⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wl_inter.c

📁 Wolf 3D official source code.
💻 C
📖 第 1 页 / 共 3 页
字号:
	VWB_DrawPic(0,16,L_GUYPIC);

#ifndef SPEAR
	if (mapon<8)
#else
	if (mapon != 4 &&
		mapon != 9 &&
		mapon != 15 &&
		mapon < 17)
#endif
	{
#ifndef JAPAN
	 #ifdef SPANISH
	 Write(14,2,"piso\ncompletado");
	 #else
	 Write(14,2,"floor\ncompleted");
	 #endif

	 Write(14,7,STR_BONUS"     0");
	 Write(16,10,STR_TIME);
	 Write(16,12,STR_PAR);

	 #ifdef SPANISH
	 Write(11,14,    STR_RAT2KILL);
	 Write(11,16,  STR_RAT2SECRET);
	 Write(11,18,STR_RAT2TREASURE);
	 #else
	 Write(9,14,    STR_RAT2KILL);
	 Write(5,16,  STR_RAT2SECRET);
	 Write(1,18,STR_RAT2TREASURE);
	 #endif

	 Write(26,2,itoa(gamestate.mapon+1,tempstr,10));
#endif

	 #ifdef SPANISH
	 Write(30,12,parTimes[gamestate.episode*10+mapon].timestr);
	 #else
	 Write(26,12,parTimes[gamestate.episode*10+mapon].timestr);
	 #endif

	 //
	 // PRINT TIME
	 //
	 sec=gamestate.TimeCount/70;

	 if (sec > 99*60)		// 99 minutes max
	   sec = 99*60;

	 if (gamestate.TimeCount<parTimes[gamestate.episode*10+mapon].time*4200)
		timeleft=(parTimes[gamestate.episode*10+mapon].time*4200)/70-sec;

	 min=sec/60;
	 sec%=60;

	 #ifdef SPANISH
	 i=30*8;
	 #else
	 i=26*8;
	 #endif
	 VWB_DrawPic(i,10*8,L_NUM0PIC+(min/10));
	 i+=2*8;
	 VWB_DrawPic(i,10*8,L_NUM0PIC+(min%10));
	 i+=2*8;
	 Write(i/8,10,":");
	 i+=1*8;
	 VWB_DrawPic(i,10*8,L_NUM0PIC+(sec/10));
	 i+=2*8;
	 VWB_DrawPic(i,10*8,L_NUM0PIC+(sec%10));

	 VW_UpdateScreen ();
	 VW_FadeIn ();


	 //
	 // FIGURE RATIOS OUT BEFOREHAND
	 //
	 kr = sr = tr = 0;
	 if (gamestate.killtotal)
		kr=(gamestate.killcount*100)/gamestate.killtotal;
	 if (gamestate.secrettotal)
		sr=(gamestate.secretcount*100)/gamestate.secrettotal;
	 if (gamestate.treasuretotal)
		tr=(gamestate.treasurecount*100)/gamestate.treasuretotal;


	 //
	 // PRINT TIME BONUS
	 //
	 bonus=timeleft*PAR_AMOUNT;
	 if (bonus)
	 {
	  for (i=0;i<=timeleft;i++)
	  {
	   ltoa((long)i*PAR_AMOUNT,tempstr,10);
	   x=36-strlen(tempstr)*2;
	   Write(x,7,tempstr);
	   if (!(i%(PAR_AMOUNT/10)))
		 SD_PlaySound(ENDBONUS1SND);
	   VW_UpdateScreen();
	   while(SD_SoundPlaying())
		 BJ_Breathe();
	   if (IN_CheckAck())
		 goto done;
	  }

	  VW_UpdateScreen();
	  SD_PlaySound(ENDBONUS2SND);
	  while(SD_SoundPlaying())
		BJ_Breathe();
	 }


	 #ifdef SPANISH
	 #define RATIOXX		33
	 #else
	 #define RATIOXX		37
	 #endif
	 //
	 // KILL RATIO
	 //
	 ratio=kr;
	 for (i=0;i<=ratio;i++)
	 {
	  itoa(i,tempstr,10);
	  x=RATIOXX-strlen(tempstr)*2;
	  Write(x,14,tempstr);
	  if (!(i%10))
		SD_PlaySound(ENDBONUS1SND);
	  VW_UpdateScreen ();
	  while(SD_SoundPlaying())
		BJ_Breathe();

	  if (IN_CheckAck())
		goto done;
	 }
	 if (ratio==100)
	 {
	   VW_WaitVBL(VBLWAIT);
	   SD_StopSound();
	   bonus+=PERCENT100AMT;
	   ltoa(bonus,tempstr,10);
	   x=(RATIOXX-1)-strlen(tempstr)*2;
	   Write(x,7,tempstr);
	   VW_UpdateScreen();
	   SD_PlaySound(PERCENT100SND);
	 }
	 else
	 if (!ratio)
	 {
	   VW_WaitVBL(VBLWAIT);
	   SD_StopSound();
	   SD_PlaySound(NOBONUSSND);
	 }
	 else
	 SD_PlaySound(ENDBONUS2SND);

	 VW_UpdateScreen();
	 while(SD_SoundPlaying())
	   BJ_Breathe();


	 //
	 // SECRET RATIO
	 //
	 ratio=sr;
	 for (i=0;i<=ratio;i++)
	 {
	  itoa(i,tempstr,10);
	  x=RATIOXX-strlen(tempstr)*2;
	  Write(x,16,tempstr);
	  if (!(i%10))
		SD_PlaySound(ENDBONUS1SND);
	  VW_UpdateScreen ();
	  while(SD_SoundPlaying())
		BJ_Breathe();
	  BJ_Breathe();

	  if (IN_CheckAck())
		goto done;
	 }
	 if (ratio==100)
	 {
	   VW_WaitVBL(VBLWAIT);
	   SD_StopSound();
	   bonus+=PERCENT100AMT;
	   ltoa(bonus,tempstr,10);
	   x=(RATIOXX-1)-strlen(tempstr)*2;
	   Write(x,7,tempstr);
	   VW_UpdateScreen();
	   SD_PlaySound(PERCENT100SND);
	 }
	 else
	 if (!ratio)
	 {
	   VW_WaitVBL(VBLWAIT);
	   SD_StopSound();
	   SD_PlaySound(NOBONUSSND);
	 }
	 else
	   SD_PlaySound(ENDBONUS2SND);
	 VW_UpdateScreen();
	 while(SD_SoundPlaying())
	   BJ_Breathe();


	 //
	 // TREASURE RATIO
	 //
	 ratio=tr;
	 for (i=0;i<=ratio;i++)
	 {
	  itoa(i,tempstr,10);
	  x=RATIOXX-strlen(tempstr)*2;
	  Write(x,18,tempstr);
	  if (!(i%10))
		SD_PlaySound(ENDBONUS1SND);
	  VW_UpdateScreen ();
	  while(SD_SoundPlaying())
		BJ_Breathe();
	  if (IN_CheckAck())
		goto done;
	 }
	 if (ratio==100)
	 {
	   VW_WaitVBL(VBLWAIT);
	   SD_StopSound();
	   bonus+=PERCENT100AMT;
	   ltoa(bonus,tempstr,10);
	   x=(RATIOXX-1)-strlen(tempstr)*2;
	   Write(x,7,tempstr);
	   VW_UpdateScreen();
	   SD_PlaySound(PERCENT100SND);
	 }
	 else
	 if (!ratio)
	 {
	   VW_WaitVBL(VBLWAIT);
	   SD_StopSound();
	   SD_PlaySound(NOBONUSSND);
	 }
	 else
	 SD_PlaySound(ENDBONUS2SND);
	 VW_UpdateScreen();
	 while(SD_SoundPlaying())
	   BJ_Breathe();


	 //
	 // JUMP STRAIGHT HERE IF KEY PRESSED
	 //
	 done:

	 itoa(kr,tempstr,10);
	 x=RATIOXX-strlen(tempstr)*2;
	 Write(x,14,tempstr);

	 itoa(sr,tempstr,10);
	 x=RATIOXX-strlen(tempstr)*2;
	 Write(x,16,tempstr);

	 itoa(tr,tempstr,10);
	 x=RATIOXX-strlen(tempstr)*2;
	 Write(x,18,tempstr);

	 bonus=(long)timeleft*PAR_AMOUNT+
		   (PERCENT100AMT*(kr==100))+
		   (PERCENT100AMT*(sr==100))+
		   (PERCENT100AMT*(tr==100));

	 GivePoints(bonus);
	 ltoa(bonus,tempstr,10);
	 x=36-strlen(tempstr)*2;
	 Write(x,7,tempstr);

	 //
	 // SAVE RATIO INFORMATION FOR ENDGAME
	 //
	 LevelRatios[mapon].kill=kr;
	 LevelRatios[mapon].secret=sr;
	 LevelRatios[mapon].treasure=tr;
	 LevelRatios[mapon].time=min*60+sec;
	}
	else
	{
#ifdef SPEAR
#ifndef SPEARDEMO
	  switch(mapon)
	  {
	   case 4: Write(14,4," trans\n"
						  " grosse\n"
						  STR_DEFEATED); break;
	   case 9: Write(14,4,"barnacle\n"
						  "wilhelm\n"
						  STR_DEFEATED); break;
	   case 15: Write(14,4,"ubermutant\n"
						   STR_DEFEATED); break;
	   case 17: Write(14,4," death\n"
						   " knight\n"
						   STR_DEFEATED); break;
	   case 18: Write(13,4,"secret tunnel\n"
						   "    area\n"
						   "  completed!"); break;
	   case 19: Write(13,4,"secret castle\n"
						   "    area\n"
						   "  completed!"); break;
	  }
#endif
#else
	  Write(14,4,"secret floor\n completed!");
#endif

	  Write(10,16,"15000 bonus!");

	  VW_UpdateScreen();
	  VW_FadeIn();

	  GivePoints(15000);
	}


	DrawScore();
	VW_UpdateScreen();

	TimeCount=0;
	IN_StartAck();
	while(!IN_CheckAck())
	  BJ_Breathe();

//
// done
//
#ifdef SPEARDEMO
	if (gamestate.mapon == 1)
	{
		SD_PlaySound (BONUS1UPSND);

		CA_CacheGrChunk (STARTFONT+1);
		Message ("This concludes your demo\n"
				 "of Spear of Destiny! Now,\n"
				 "go to your local software\n"
				 "store and buy it!");
		UNCACHEGRCHUNK (STARTFONT+1);

		IN_ClearKeysDown();
		IN_Ack();
	}
#endif

#ifdef JAPDEMO
	if (gamestate.mapon == 3)
	{
		SD_PlaySound (BONUS1UPSND);

		CA_CacheGrChunk (STARTFONT+1);
		Message ("This concludes your demo\n"
				 "of Wolfenstein 3-D! Now,\n"
				 "go to your local software\n"
				 "store and buy it!");
		UNCACHEGRCHUNK (STARTFONT+1);

		IN_ClearKeysDown();
		IN_Ack();
	}
#endif

	#ifndef SPEAR
	if (Keyboard[sc_P] && MS_CheckParm("goobers"))
		PicturePause();
	#endif

	VW_FadeOut ();
	temp = bufferofs;
	for (i=0;i<3;i++)
	{
		bufferofs = screenloc[i];
		DrawPlayBorder ();
	}
	bufferofs = temp;

	UnCacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END);
}



//==========================================================================


/*
=================
=
= PreloadGraphics
=
= Fill the cache up
=
=================
*/

boolean PreloadUpdate(unsigned current, unsigned total)
{
	unsigned w = WindowW - 10;


	VWB_Bar(WindowX + 5,WindowY + WindowH - 3,w,2,BLACK);
	w = ((long)w * current) / total;
	if (w)
	{
	 VWB_Bar(WindowX + 5,WindowY + WindowH - 3,w,2,0x37); //SECONDCOLOR);
	 VWB_Bar(WindowX + 5,WindowY + WindowH - 3,w-1,1,0x32);

	}
	VW_UpdateScreen();
//	if (LastScan == sc_Escape)
//	{
//		IN_ClearKeysDown();
//		return(true);
//	}
//	else
		return(false);
}

void PreloadGraphics(void)
{
	DrawLevel ();
	ClearSplitVWB ();			// set up for double buffering in split screen

	VWB_Bar (0,0,320,200-STATUSLINES,127);

	LatchDrawPic (20-14,80-3*8,GETPSYCHEDPIC);

	WindowX = 160-14*8;
	WindowY = 80-3*8;
	WindowW = 28*8;
	WindowH = 48;
	VW_UpdateScreen();
	VW_FadeIn ();

	PM_Preload (PreloadUpdate);
	IN_UserInput (70);
	VW_FadeOut ();

	DrawPlayBorder ();
	VW_UpdateScreen ();
}


//==========================================================================

/*
==================
=
= DrawHighScores
=
==================
*/

void	DrawHighScores(void)
{
	char		buffer[16],*str,buffer1[5];
	byte		temp,temp1,temp2,temp3;
	word		i,j,
				w,h,
				x,y;
	HighScore	*s;


	MM_SortMem ();

#ifndef SPEAR
//	CA_CacheGrChunk (C_CODEPIC);
	CA_CacheGrChunk (HIGHSCORESPIC);
	CA_CacheGrChunk (STARTFONT);
	CA_CacheGrChunk (C_LEVELPIC);
	CA_CacheGrChunk (C_SCOREPIC);
	CA_CacheGrChunk (C_NAMEPIC);

	ClearMScreen();
	DrawStripes(10);

	VWB_DrawPic(48,0,HIGHSCORESPIC);
	UNCACHEGRCHUNK (HIGHSCORESPIC);

	VWB_DrawPic(4*8,68,C_NAMEPIC);
	VWB_DrawPic(20*8,68,C_LEVELPIC);
	VWB_DrawPic(28*8,68,C_SCOREPIC);
#ifndef UPLOAD
//	VWB_DrawPic(35*8,68,C_CODEPIC);
#endif
	fontnumber=0;

#else
	CacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);
	ClearMScreen();
	DrawStripes(10);
	UnCacheLump (BACKDROP_LUMP_START,BACKDROP_LUMP_END);

	CacheLump (HIGHSCORES_LUMP_START,HIGHSCORES_LUMP_END);
	CA_CacheGrChunk (STARTFONT+1);
	VWB_DrawPic (0,0,HIGHSCORESPIC);

	fontnumber = 1;
#endif


#ifndef SPEAR
	SETFONTCOLOR(15,0x29);
#else
	SETFONTCOLOR(HIGHLIGHT,0x29);
#endif

	for (i = 0,s = Scores;i < MaxScores;i++,s++)
	{
		PrintY = 76 + (16 * i);

		//
		// name
		//
#ifndef SPEAR
		PrintX = 4*8;
#else
		PrintX = 16;
#endif
		US_Print(s->name);

		//
		// level
		//
		ultoa(s->completed,buffer,10);
#ifndef SPEAR
		for (str = buffer;*str;str++)
			*str = *str + (129 - '0');	// Used fixed-width numbers (129...)
		USL_MeasureString(buffer,&w,&h);
		PrintX = (22 * 8)-w;
#else
		USL_MeasureString(buffer,&w,&h);
		PrintX = 194 - w;
#endif

#ifndef UPLOAD
#ifndef SPEAR
		PrintX -= 6;
		itoa(s->episode+1,buffer1,10);
		US_Print("E");
		US_Print(buffer1);
		US_Print("/L");
#endif
#endif

#ifdef SPEAR
		if (s->completed == 21)
			VWB_DrawPic (PrintX+8,PrintY-1,C_WONSPEARPIC);
		else
#endif
		US_Print(buffer);

		//
		// score
		//
		ultoa(s->score,buffer,10);
#ifndef SPEAR
		for (str = buffer;*str;str++)
			*str = *str + (129 - '0');	// Used fixed-width numbers (129...)
		USL_MeasureString(buffer,&w,&h);
		PrintX = (34 * 8) - 8 - w;
#else
		USL_MeasureString(buffer,&w,&h);
		PrintX = 292 - w;
#endif
		US_Print(buffer);

		#if 0
#ifndef UPLOAD
#ifndef SPEAR

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -