void PlayDemo (int demonumber) { int length; #ifdef DEMOSEXTERN // debug: load chunk #ifndef SPEARDEMO int dems[4]={T_DEMO0,T_DEMO1,T_DEMO2,T_DEMO3}; #else int dems[1]={T_DEMO0}; #endif CA_CacheGrChunk(dems[demonumber]); demoptr = grsegs[dems[demonumber]]; MM_SetLock (&grsegs[dems[demonumber]],true); #else demoname[4] = '0'+demonumber; CA_LoadFile (demoname,&demobuffer); MM_SetLock (&demobuffer,true); demoptr = (char far *)demobuffer; #endif NewGame (1,0); gamestate.mapon = *demoptr++; gamestate.difficulty = gd_hard; length = *((unsigned far *)demoptr)++; demoptr++; lastdemoptr = demoptr-4+length; VW_FadeOut (); SETFONTCOLOR(0,15); DrawPlayScreen (); VW_FadeIn (); startgame = false; demoplayback = true; SetupGameLevel (); StartMusic (); PM_CheckMainMem (); fizzlein = true; PlayLoop (); #ifdef DEMOSEXTERN UNCACHEGRCHUNK(dems[demonumber]); #else MM_FreePtr (&demobuffer); #endif demoplayback = false; StopMusic (); VW_FadeOut (); ClearMemory (); }
void RecordDemo (void) { int level,esc; CenterWindow(26,3); PrintY+=6; CA_CacheGrChunk(STARTFONT); fontnumber=0; US_Print(" Demo which level(1-10):"); VW_UpdateScreen(); VW_FadeIn (); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (esc) return; level = atoi (str); level--; SETFONTCOLOR(0,15); VW_FadeOut (); #ifndef SPEAR NewGame (gd_hard,level/10); gamestate.mapon = level%10; #else NewGame (gd_hard,0); gamestate.mapon = level; #endif StartDemoRecord (level); DrawPlayScreen (); VW_FadeIn (); startgame = false; demorecord = true; SetupGameLevel (); StartMusic (); PM_CheckMainMem (); fizzlein = true; PlayLoop (); demoplayback = false; StopMusic (); VW_FadeOut (); ClearMemory (); FinishDemoRecord (); }
id0_boolean_t LoadTheGame(BE_FILE_T file) { id0_unsigned_t i,x,y; objtype /**obj,*/*prev,*next,*followed; id0_unsigned_t compressed,expanded; id0_unsigned_t id0_far *map,tile; memptr bigbuffer; // (REFKEEN) Reading fields one-by-one in a cross-platform manner if (!LoadGameState(file, &gamestate)) //if (!CA_FarRead(file,(void id0_far *)&gamestate,sizeof(gamestate))) return(false); SetupGameLevel (); // load in and cache the base old level expanded = mapwidth * mapheight * 2; MM_GetPtr (&bigbuffer,expanded); for (i = 0;i < 3;i+=2) // Read planes 0 and 2 { if (BE_Cross_readInt16LE(file, &compressed) != 2) //if (!CA_FarRead(file,(id0_byte_t id0_far *)&compressed,sizeof(compressed)) ) { MM_FreePtr (&bigbuffer); return(false); } if (BE_Cross_readInt16LEBuffer(file, bigbuffer, compressed) != compressed) //if (!CA_FarRead(file,(id0_byte_t id0_far *)bigbuffer,compressed) ) { MM_FreePtr (&bigbuffer); return(false); } CA_RLEWexpand ((id0_unsigned_t id0_huge *)bigbuffer, (id0_unsigned_t id0_huge *)mapsegs[i],expanded,RLETAG); } MM_FreePtr (&bigbuffer); // // copy the wall data to a data segment array again, to handle doors and // bomb walls that are allready opened // memset (tilemap,0,sizeof(tilemap)); memset (actorat,0,sizeof(actorat)); map = mapsegs[0]; for (y=0;y<mapheight;y++) for (x=0;x<mapwidth;x++) { tile = *map++; if (tile<NUMFLOORS) { tilemap[x][y] = tile; if (tile>0) actorat[x][y] = tile; //(id0_unsigned_t)actorat[x][y] = tile; } } // Read the object list back in - assumes at least one object in list InitObjList (); newobj = player; while (true) { prev = newobj->prev; next = newobj->next; // (REFKEEN) Reading fields one-by-one in a cross-platform manner if (!LoadObject(file, newobj)) //if (!CA_FarRead(file,(void id0_far *)newobj,sizeof(objtype))) return(false); followed = newobj->next; newobj->prev = prev; newobj->next = next; actorat[newobj->tilex][newobj->tiley] = COMPAT_OBJ_CONVERT_OBJ_PTR_TO_DOS_PTR(newobj); // drop a new marker //actorat[newobj->tilex][newobj->tiley] = newobj; // drop a new marker if (followed) GetNewObj (false); else break; } return(true); }
// REFKEEN - Rename different versions of DemoLoop for multi-ver support void DemoLoop_Old (void) { const id0_char_t *s; //id0_word_t move; //id0_longword_t lasttime; WindowRec mywin; #if FRILLS // // check for launch from ted // if (tedlevel) { NewGame(); gamestate.mapon = tedlevelnum; GameLoop(); TEDDeath(); } #endif // // demo loop // // REFKEEN - Alternative controllers support BE_ST_AltControlScheme_Push(); BE_ST_AltControlScheme_PrepareControllerMapping(&g_ingame_altcontrol_mapping_demoloop); US_SetLoadSaveHooks(LoadGame,SaveGame,ResetGame); restartgame = gd_Continue; while (true) { // Load the Title map gamestate.mapon = 20; // title map number loadedgame = false; SetupGameLevel(true); while (!restartgame && !loadedgame) { VW_InitDoubleBuffer(); IN_ClearKeysDown(); while (true) { // Display the Title map RF_NewPosition((5 * TILEGLOBAL) + (TILEGLOBAL / 2), (TILEGLOBAL * 2) + (TILEGLOBAL / 2) + (TILEGLOBAL / 4)); RF_ForceRefresh(); RF_Refresh(); RF_Refresh(); if (Wait(TickBase * 2)) break; mywin.x = (16 * 13) + 4; mywin.y = 0; mywin.w = 16 * 7; mywin.h = 200; mywin.px = mywin.x + 0; mywin.py = mywin.y + 10; s = "Game\n" "John Carmack\n" "\n" "Utilities\n" "John Romero\n" "\n" "Interface/Sound\n" "Jason Blochowiak\n" "\n" "Creative Director\n" "Tom Hall\n" "\n" "Art\n" "Adrian Carmack\n"; if (ShowText((9 * TILEGLOBAL) - (PIXGLOBAL * 2),&mywin,s)) break; mywin.x = 4; mywin.y = 0; mywin.w = 16 * 7; mywin.h = 200; mywin.px = mywin.x + 0; mywin.py = mywin.y + 10; if (refkeen_current_gamever == BE_GAMEVER_KDREAMSC105) s = "\n" "\"Keen Dreams\"\n" "Copyright 1991-93\n" "Softdisk, Inc.\n" "\n" "\n" "\n" "\n" "Commander Keen\n" "Copyright 1990-91\n" "Id Software, Inc.\n" "\n" "Press F1 for Help\n" "SPACE to Start\n"; else s = "Gamer's Edge\n" "\"Keen Dreams\"\n" "Copyright 1991\n" "Softdisk, Inc.\n" "\n" "Subscriptions\n" "1-800-831-2694\n" "\n" "Commander Keen\n" "Copyright 1990-91\n" "Id Software, Inc.\n" "\n" "Press F1 for Help\n" "SPACE to Start\n"; if (ShowText((2 * TILEGLOBAL) + (PIXGLOBAL * 2),&mywin,s)) break; if (MoveTitleTo((5 * TILEGLOBAL) + (TILEGLOBAL / 2))) break; if (Wait(TickBase * 3)) break; VWB_Bar(0,0,320,200,FIRSTCOLOR); US_DisplayHighScores(-1); if (IN_UserInput(TickBase * 8,false)) break; } US_ControlPanel (); } if (!loadedgame) NewGame(); GameLoop(); } // REFKEEN - Alternative controllers support BE_ST_AltControlScheme_Pop(); }
id0_boolean_t LoadGame(BE_FILE_T file) { id0_word_t i/*,j,size*/; //objtype *o; //id0_int_t orgx,orgy; objtype *prev,*next,*followed; id0_unsigned_t compressed,expanded; memptr bigbuffer; // (REFKEEN) Reading fields one-by-one in a cross-platform manner if (!LoadGameState(file, &gamestate)) //if (!CA_FarRead(file,(void id0_far *)&gamestate,sizeof(gamestate))) return(false); // drop down a cache level and mark everything, so when the option screen // is exited it will be cached ca_levelbit >>= 1; ca_levelnum--; SetupGameLevel (false); // load in and cache the base old level titleptr[ca_levelnum] = levelnames[mapon]; ca_levelbit <<= 1; ca_levelnum ++; expanded = mapwidth * mapheight * 2; MM_GetPtr (&bigbuffer,expanded); for (i = 0;i < 3;i++) // Read all three planes of the map { if (BE_Cross_readInt16LE(file, &compressed) != 2) //if (!CA_FarRead(file,(id0_byte_t id0_far *)&compressed,sizeof(compressed)) ) { MM_FreePtr (&bigbuffer); return(false); } if (BE_Cross_readInt16LEBuffer(file, bigbuffer, compressed) != compressed) //if (!CA_FarRead(file,(id0_byte_t id0_far *)bigbuffer,compressed) ) { MM_FreePtr (&bigbuffer); return(false); } CA_RLEWexpand ((id0_unsigned_t id0_huge *)bigbuffer, (id0_unsigned_t id0_huge *)mapsegs[i],compressed,RLETAG); } MM_FreePtr (&bigbuffer); // Read the object list back in - assumes at least one object in list InitObjArray (); newobj = player; prev = newobj->prev; next = newobj->next; // (REFKEEN) Reading fields one-by-one in a cross-platform manner if (!LoadObject(file, newobj)) //if (!CA_FarRead(file,(void id0_far *)newobj,sizeof(objtype))) return(false); newobj->prev = prev; newobj->next = next; newobj->needtoreact = true; newobj->sprite = NULL; newobj = scoreobj; while (true) { prev = newobj->prev; next = newobj->next; // And again if (!LoadObject(file, newobj)) //if (!CA_FarRead(file,(void id0_far *)newobj,sizeof(objtype))) return(false); followed = newobj->next; newobj->prev = prev; newobj->next = next; newobj->needtoreact = true; newobj->sprite = NULL; if (followed) GetNewObj (false); else break; } scoreobj->temp1 = scoreobj->temp2 = -1; // force score to be updated scoreobj->temp3 = -1; // and flower power scoreobj->temp4 = -1; // and lives #if 0 *((id0_long_t *)&(scoreobj->temp1)) = -1; // force score to be updated scoreobj->temp3 = -1; // and flower power scoreobj->temp4 = -1; // and lives #endif return(true); }
/* =================== = = GameLoop = =================== This function controls the flow between states of the game. It loads previous saved games, setup levels states, controls the flow between levels, including when player loses or when completes the game, and checks if the result of the current game is a highscore. The "real" game loop (player actions in like moving, killing, etc.) is in the PlayLoop function. */ void GameLoop (void) { int i,xl,yl,xh,yh; char num[20]; boolean died; #ifdef MYPROFILE /* clock_t type variables may register times, start and and times could be used to measure the speed of the graphics system. Speed is measured in fps- frames per second. */ clock_t start,end; #endif restartgame: ClearMemory (); SETFONTCOLOR(0,15); DrawPlayScreen (); died = false; restart: do { if (!loadedgame) gamestate.score = gamestate.oldscore; DrawScore(); startgame = false; if (loadedgame) loadedgame = false; else SetupGameLevel (); #ifdef SPEAR if (gamestate.mapon == 20) // give them the key allways { gamestate.keys |= 1; DrawKeys (); } #endif ingame = true; StartMusic (); PM_CheckMainMem (); if (!died) PreloadGraphics (); else died = false; fizzlein = true; DrawLevel (); startplayloop: PlayLoop (); #ifdef SPEAR if (spearflag) { SD_StopSound(); SD_PlaySound(GETSPEARSND); if (DigiMode != sds_Off) { long lasttimecount = TimeCount; while(TimeCount < lasttimecount+150) //while(DigiPlaying!=false) SD_Poll(); } else SD_WaitSoundDone(); ClearMemory (); gamestate.oldscore = gamestate.score; gamestate.mapon = 20; SetupGameLevel (); StartMusic (); PM_CheckMainMem (); player->x = spearx; player->y = speary; player->angle = spearangle; spearflag = false; Thrust (0,0); goto startplayloop; } #endif StopMusic (); ingame = false; if (demorecord && playstate != ex_warped) FinishDemoRecord (); if (startgame || loadedgame) goto restartgame; switch (playstate) { case ex_completed: case ex_secretlevel: gamestate.keys = 0; DrawKeys (); VW_FadeOut (); ClearMemory (); LevelCompleted (); // do the intermission #ifdef SPEARDEMO if (gamestate.mapon == 1) { died = true; // don't "get psyched!" VW_FadeOut (); ClearMemory (); CheckHighScore (gamestate.score,gamestate.mapon+1); #pragma warn -sus #ifndef JAPAN _fstrcpy(MainMenu[viewscores].string,STR_VS); #endif MainMenu[viewscores].routine = CP_ViewScores; #pragma warn +sus return; } #endif #ifdef JAPDEMO if (gamestate.mapon == 3) { died = true; // don't "get psyched!" VW_FadeOut (); ClearMemory (); CheckHighScore (gamestate.score,gamestate.mapon+1); #pragma warn -sus #ifndef JAPAN _fstrcpy(MainMenu[viewscores].string,STR_VS); #endif MainMenu[viewscores].routine = CP_ViewScores; #pragma warn +sus return; } #endif gamestate.oldscore = gamestate.score; #ifndef SPEAR // // COMING BACK FROM SECRET LEVEL // if (gamestate.mapon == 9) gamestate.mapon = ElevatorBackTo[gamestate.episode]; // back from secret else // // GOING TO SECRET LEVEL // if (playstate == ex_secretlevel) gamestate.mapon = 9; #else #define FROMSECRET1 3 #define FROMSECRET2 11 // // GOING TO SECRET LEVEL // if (playstate == ex_secretlevel) switch(gamestate.mapon) { case FROMSECRET1: gamestate.mapon = 18; break; case FROMSECRET2: gamestate.mapon = 19; break; } else // // COMING BACK FROM SECRET LEVEL // if (gamestate.mapon == 18 || gamestate.mapon == 19) switch(gamestate.mapon) { case 18: gamestate.mapon = FROMSECRET1+1; break; case 19: gamestate.mapon = FROMSECRET2+1; break; } #endif else // // GOING TO NEXT LEVEL // gamestate.mapon++; break; case ex_died: Died (); died = true; // don't "get psyched!" if (gamestate.lives > -1) break; // more lives left VW_FadeOut (); ClearMemory (); CheckHighScore (gamestate.score,gamestate.mapon+1); #pragma warn -sus #ifndef JAPAN _fstrcpy(MainMenu[viewscores].string,STR_VS); #endif MainMenu[viewscores].routine = CP_ViewScores; #pragma warn +sus return; case ex_victorious: #ifndef SPEAR VW_FadeOut (); #else VL_FadeOut (0,255,0,17,17,300); #endif ClearMemory (); Victory (); ClearMemory (); CheckHighScore (gamestate.score,gamestate.mapon+1); #pragma warn -sus #ifndef JAPAN _fstrcpy(MainMenu[viewscores].string,STR_VS); #endif MainMenu[viewscores].routine = CP_ViewScores; #pragma warn +sus return; default: ClearMemory (); break; } } while (1); }
boolean LoadTheGame(FILE *file,int x,int y) { int32_t oldchecksum; objtype nullobj; statobj_t nullstat; int actnum=0, i, j; int32_t checksum = 0; DiskFlopAnim(x,y); fread (&gamestate,sizeof(gamestate),1,file); checksum = DoChecksum((byte *)&gamestate,sizeof(gamestate),checksum); DiskFlopAnim(x,y); fread (&LevelRatios[0],sizeof(LRstruct)*LRpack,1,file); checksum = DoChecksum((byte *)&LevelRatios[0],sizeof(LRstruct)*LRpack,checksum); DiskFlopAnim(x,y); SetupGameLevel (); DiskFlopAnim(x,y); fread (tilemap,sizeof(tilemap),1,file); checksum = DoChecksum((byte *)tilemap,sizeof(tilemap),checksum); DiskFlopAnim(x,y); for(i=0; i<MAPSIZE; i++) { for(j=0; j<MAPSIZE; j++) { fread (&actnum,sizeof(word),1,file); checksum = DoChecksum((byte *) &actnum,sizeof(word),checksum); if(actnum&0x8000) actorat[i][j]=objlist+(actnum&0x7fff); else actorat[i][j]=(objtype *)(uintptr_t) actnum; } } fread (areaconnect,sizeof(areaconnect),1,file); fread (areabyplayer,sizeof(areabyplayer),1,file); InitActorList (); DiskFlopAnim(x,y); fread (player,sizeof(*player),1,file); player->state=(statetype *) ((uintptr_t)player->state+(uintptr_t)&s_player); /* Load all actors ? */ while (1) { DiskFlopAnim(x,y); fread (&nullobj,sizeof(nullobj),1,file); if (nullobj.active == ac_badobject) break; GetNewActor (); nullobj.state=(statetype *) ((uintptr_t)nullobj.state+(uintptr_t)&s_grdstand); /* don't copy over the links */ memcpy (newobj,&nullobj,sizeof(nullobj)-8); } DiskFlopAnim(x,y); word laststatobjnum; fread (&laststatobjnum,sizeof(laststatobjnum),1,file); laststatobj=statobjlist+laststatobjnum; checksum = DoChecksum((byte *)&laststatobjnum,sizeof(laststatobjnum),checksum); DiskFlopAnim(x,y); for(i=0; i<MAXSTATS; i++) { fread(&nullstat,sizeof(nullstat),1,file); checksum = DoChecksum((byte *)&nullstat,sizeof(nullstat),checksum); nullstat.visspot=(byte *) ((uintptr_t)nullstat.visspot+(uintptr_t)spotvis); memcpy(statobjlist+i,&nullstat,sizeof(nullstat)); } DiskFlopAnim(x,y); fread (doorposition,sizeof(doorposition),1,file); checksum = DoChecksum((byte *)doorposition,sizeof(doorposition),checksum); DiskFlopAnim(x,y); fread (doorobjlist,sizeof(doorobjlist),1,file); checksum = DoChecksum((byte *)doorobjlist,sizeof(doorobjlist),checksum); DiskFlopAnim(x,y); fread (&pwallstate,sizeof(pwallstate),1,file); checksum = DoChecksum((byte *)&pwallstate,sizeof(pwallstate),checksum); fread (&pwalltile,sizeof(pwalltile),1,file); checksum = DoChecksum((byte *)&pwalltile,sizeof(pwalltile),checksum); fread (&pwallx,sizeof(pwallx),1,file); checksum = DoChecksum((byte *)&pwallx,sizeof(pwallx),checksum); fread (&pwally,sizeof(pwally),1,file); checksum = DoChecksum((byte *)&pwally,sizeof(pwally),checksum); fread (&pwalldir,sizeof(pwalldir),1,file); checksum = DoChecksum((byte *)&pwalldir,sizeof(pwalldir),checksum); fread (&pwallpos,sizeof(pwallpos),1,file); checksum = DoChecksum((byte *)&pwallpos,sizeof(pwallpos),checksum); /* assign valid floorcodes under moved pushwalls */ if (gamestate.secretcount) { word *map, *obj; word tile, sprite; map = mapsegs[0]; obj = mapsegs[1]; for (y=0; y<mapheight; y++) for (x=0; x<mapwidth; x++) { tile = *map++; sprite = *obj++; if (sprite == PUSHABLETILE && !tilemap[x][y] && (tile < AREATILE || tile >= (AREATILE+NUMMAPS))) { if (*map >= AREATILE) tile = *map; if (*(map-1-mapwidth) >= AREATILE) tile = *(map-1-mapwidth); if (*(map-1+mapwidth) >= AREATILE) tile = *(map-1+mapwidth); if ( *(map-2) >= AREATILE) tile = *(map-2); *(map-1) = tile; *(obj-1) = 0; } } } /* set player->areanumber to the floortile you're standing on */ Thrust(0,0); fread (&oldchecksum,sizeof(oldchecksum),1,file); fread (&lastgamemusicoffset,sizeof(lastgamemusicoffset),1,file); if(lastgamemusicoffset<0) lastgamemusicoffset=0; if (oldchecksum != checksum) { Message(STR_SAVECHT1"\n" STR_SAVECHT2"\n" STR_SAVECHT3"\n" STR_SAVECHT4); IN_ClearKeysDown(); IN_Ack(); gamestate.oldscore = gamestate.score = 0; gamestate.lives = 1; gamestate.weapon = gamestate.chosenweapon = gamestate.bestweapon = wp_pistol; gamestate.ammo = 8; } return true; }
id0_boolean_t LoadTheGame(BE_FILE_T file) { id0_unsigned_t i,x,y; objtype /**obj,*/*prev,*next,*followed; id0_unsigned_t compressed,expanded; id0_unsigned_t id0_far *map,tile; memptr bigbuffer; screenpage = 0; FreeUpMemory(); playstate = ex_loadedgame; // load the sky and ground colors // REFKEEN - But not before converting from original 16-bit pointers (reusing i variable) if (BE_Cross_readInt16LE(file, &i) != 2) //if (!CA_FarRead(file,(void id0_far *)&skycolor,sizeof(skycolor))) return(false); skycolor = GetSkyGndColorPtrFromDOSPointer(i); if (BE_Cross_readInt16LE(file, &i) != 2) //if (!CA_FarRead(file,(void id0_far *)&groundcolor,sizeof(groundcolor))) return(false); groundcolor = GetSkyGndColorPtrFromDOSPointer(i); if (BE_Cross_readInt16LE(file, &FreezeTime) != 2) //if (!CA_FarRead(file,(void id0_far *)&FreezeTime,sizeof(FreezeTime))) return(false); // (REFKEEN) Reading fields one-by-one in a cross-platform manner if (!LoadGameState(file, &gamestate)) //if (!CA_FarRead(file,(void id0_far *)&gamestate,sizeof(gamestate))) return(false); if (BE_Cross_read_boolean_From16LE(file, &EASYMODEON) != 2) //if (!CA_FarRead(file,(void id0_far *)&EASYMODEON,sizeof(EASYMODEON))) return(false); SetupGameLevel (); // load in and cache the base old level // (REFKEEN) DIFFERENCE FROM VANILLA CATACOMB ADVENTURES: // Don't do this check, we've already opened the file anyway // and this can lead to unexpected behaviors! #if 0 if (!FindRewritableFile(Filename,"SAVE GAME",-1)) Quit("Error: Can't find saved game file!"); #endif expanded = mapwidth * mapheight * 2; MM_GetPtr (&bigbuffer,expanded); for (i = 0;i < 3;i+=2) // Read planes 0 and 2 { if (BE_Cross_readInt16LE(file, &compressed) != 2) //if (!CA_FarRead(file,(id0_byte_t id0_far *)&compressed,sizeof(compressed)) ) { MM_FreePtr (&bigbuffer); return(false); } if (BE_Cross_readInt16LEBuffer(file, bigbuffer, compressed) != compressed) //if (!CA_FarRead(file,(id0_byte_t id0_far *)bigbuffer,compressed) ) { MM_FreePtr (&bigbuffer); return(false); } CA_RLEWexpand ((id0_unsigned_t id0_huge *)bigbuffer, (id0_unsigned_t id0_huge *)mapsegs[i],expanded,RLETAG); } MM_FreePtr (&bigbuffer); // // copy the wall data to a data segment array again, to handle doors and // bomb walls that are allready opened // memset (tilemap,0,sizeof(tilemap)); memset (actorat,0,sizeof(actorat)); map = mapsegs[0]; for (y=0;y<mapheight;y++) for (x=0;x<mapwidth;x++) { tile = *map++; if (tile<NUMFLOORS) { if (tile != INVISIBLEWALL) tilemap[x][y] = tile; if (tile>0) actorat[x][y] = tile; //(id0_unsigned_t)actorat[x][y] = tile; } } // Read the object list back in - assumes at least one object in list InitObjList (); newobj = player; while (true) { prev = newobj->prev; next = newobj->next; // (REFKEEN) Reading fields one-by-one in a cross-platform manner if (!LoadObject(file, newobj)) //if (!CA_FarRead(file,(void id0_far *)newobj,sizeof(objtype))) return(false); followed = newobj->next; newobj->prev = prev; newobj->next = next; actorat[newobj->tilex][newobj->tiley] = COMPAT_OBJ_CONVERT_OBJ_PTR_TO_DOS_PTR(newobj); // drop a new marker //actorat[newobj->tilex][newobj->tiley] = newobj; // drop a new marker if (followed) GetNewObj (false); else break; } return(true); }
static bool ShowImage(IntermissionAction *image, bool drawonly) { if(!image->Music.IsEmpty()) StartCPMusic(image->Music); if(!image->Palette.IsEmpty()) { if(image->Palette.CompareNoCase("$GamePalette") == 0) VL_ReadPalette(gameinfo.GamePalette); else VL_ReadPalette(image->Palette); } static FTextureID background; static bool tileBackground = false; static IntermissionAction::BackgroundType type = IntermissionAction::NORMAL; // High Scores and such need special handling if(image->Type != IntermissionAction::UNSET) { type = image->Type; } if(type == IntermissionAction::NORMAL && image->Background.isValid()) { background = image->Background; tileBackground = image->BackgroundTile; } intermissionMapLoaded = false; switch(type) { default: if(!tileBackground) CA_CacheScreen(TexMan(background)); else VWB_DrawFill(TexMan(background), 0, 0, screenWidth, screenHeight); break; case IntermissionAction::HIGHSCORES: DrawHighScores(); break; case IntermissionAction::TITLEPAGE: background = TexMan.CheckForTexture(gameinfo.TitlePage, FTexture::TEX_Any); if(!gameinfo.TitlePalette.IsEmpty()) VL_ReadPalette(gameinfo.TitlePalette); CA_CacheScreen(TexMan(background)); break; case IntermissionAction::LOADMAP: if(image->MapName.IsNotEmpty()) { strncpy(gamestate.mapname, image->MapName, 8); StartTravel(); SetupGameLevel(); FinishTravel(); // Drop weapon players[0].SetPSprite(NULL, player_t::ps_weapon); PreloadGraphics(true); gamestate.victoryflag = true; } intermissionMapLoaded = true; ThreeDRefresh(); ClearStatusbar(); break; } for(unsigned int i = 0;i < image->Draw.Size();++i) { VWB_DrawGraphic(TexMan(image->Draw[i].Image), image->Draw[i].X, image->Draw[i].Y); } if(!drawonly) { VW_UpdateScreen(); return WaitIntermission(image->Time); } return false; }