// // P_InitSwitchList // Only called at game initialization. // void P_InitSwitchList(void) { int i; int index; int episode; episode = 1; if(isregistered) episode = 2; // villsa [STRIFE] unused /*else if ( gamemode == commercial ) episode = 3;*/ for(index = 0, i = 0; i < MAXSWITCHES; i++) { if(!alphSwitchList[i].episode) { numswitches = index/2; switchlist[index] = -1; break; } if (alphSwitchList[i].episode <= episode) { switchlist[index++] = R_TextureNumForName(DEH_String(alphSwitchList[i].name1)); switchlist[index++] = R_TextureNumForName(DEH_String(alphSwitchList[i].name2)); } } }
void P_LoadSideDefs(int lump) { byte *data; int i; mapsidedef_t *msd; side_t *sd; numsides = W_LumpLength(lump) / sizeof(mapsidedef_t); sides = Z_Malloc(numsides * sizeof(side_t), PU_LEVEL, 0); memset(sides, 0, numsides * sizeof(side_t)); data = W_CacheLumpNum(lump, PU_STATIC); msd = (mapsidedef_t *) data; sd = sides; for (i = 0; i < numsides; i++, msd++, sd++) { sd->textureoffset = SHORT(msd->textureoffset) << FRACBITS; sd->rowoffset = SHORT(msd->rowoffset) << FRACBITS; sd->toptexture = R_TextureNumForName(msd->toptexture); sd->bottomtexture = R_TextureNumForName(msd->bottomtexture); sd->midtexture = R_TextureNumForName(msd->midtexture); sd->sector = §ors[SHORT(msd->sector)]; } W_ReleaseLumpNum(lump); }
// // P_InitSwitchList // Only called at game initialization. // void P_InitSwitchList(void) { int i, slindex, episode; // Note that this is called "episode" here but it's actually something // quite different. As we progress from Shareware->Registered->Doom II // we support more switch textures. if (isregistered) { episode = 2; } else { episode = 1; } slindex = 0; for (i = 0; i < arrlen(alphSwitchList); i++) { if (alphSwitchList[i].episode <= episode) { switchlist[slindex++] = R_TextureNumForName(DEH_String(alphSwitchList[i].name1)); switchlist[slindex++] = R_TextureNumForName(DEH_String(alphSwitchList[i].name2)); } } numswitches = slindex / 2; switchlist[slindex] = -1; }
void P_InitSwitchList(void) { int i; int index; int episode; episode = 1; if (!shareware) episode = 2; for (index = 0,i = 0;i < MAXSWITCHES;i++) { if (!alphSwitchList[i].episode) { numswitches = index/2; switchlist[index] = -1; break; } if (alphSwitchList[i].episode <= episode) { switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name1); switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name2); } } }
void P_LoadSideDefs (int lump) { byte *data; int i; mapsidedef_t *msd; side_t *sd; numsides = W_LumpLength (lump) / sizeof(mapsidedef_t); sides = Z_Malloc (numsides*sizeof(side_t),PU_LEVEL,0); memset (sides, 0, numsides*sizeof(side_t)); data = W_CacheLumpNum (lump,PU_STATIC); msd = (mapsidedef_t *)data; sd = sides; // Make sure primary lumps are used for texture searching W_UsePrimary(); for(i = 0; i < numsides; i++, msd++, sd++) { sd->textureoffset = SHORT(msd->textureoffset)<<FRACBITS; sd->rowoffset = SHORT(msd->rowoffset)<<FRACBITS; sd->toptexture = R_TextureNumForName(msd->toptexture); sd->bottomtexture = R_TextureNumForName(msd->bottomtexture); sd->midtexture = R_TextureNumForName(msd->midtexture); sd->sector = §ors[SHORT(msd->sector)]; } if(DevMaps) { W_UseAuxiliary(); } Z_Free(data); }
void P_LoadSideDefs(int lump) { byte *data; int i; mapsidedef_t *msd; side_t *sd; for(i = 0; i < numtextures; i++) textures[i].usecount = 0; numsides = W_LumpLength(lump) / sizeof(mapsidedef_t); sides = Z_Malloc(numsides * sizeof(side_t), PU_LEVEL, 0); D_memset(sides, 0, numsides * sizeof(side_t)); data = I_TempBuffer(); W_ReadLump(lump, data); msd = (mapsidedef_t *)data; sd = sides; for(i = 0; i < numsides; i++, msd++, sd++) { sd->textureoffset = LITTLESHORT(msd->textureoffset) << FRACBITS; sd->rowoffset = LITTLESHORT(msd->rowoffset) << FRACBITS; sd->toptexture = R_TextureNumForName(msd->toptexture); sd->bottomtexture = R_TextureNumForName(msd->bottomtexture); sd->midtexture = R_TextureNumForName(msd->midtexture); sd->sector = §ors[LITTLESHORT(msd->sector)]; textures[sd->toptexture].usecount++; textures[sd->bottomtexture].usecount++; textures[sd->midtexture].usecount++; } }
void G_DoLoadLevel (void) { int i; for (i=0 ; i<MAXPLAYERS ; i++) { if (playeringame[i] && players[i].playerstate == PST_DEAD) players[i].playerstate = PST_REBORN; players[i].frags = 0; } /* */ /* set the sky map for the episode */ /* */ if (gamemap < 9) skytexture = R_TextureNumForName ("SKY1"); else if (gamemap < 18) skytexture = R_TextureNumForName ("SKY2"); else skytexture = R_TextureNumForName ("SKY3"); skytexturep = &textures[skytexture]; P_SetupLevel (gamemap, gameskill); displayplayer = consoleplayer; /* view the guy you are playing */ gameaction = ga_nothing; /* S_StartSong(1, 0); */ /* Added CEF */ Z_CheckHeap (mainzone); /* DEBUG */ }
// // P_InitSwitchList() // // Only called at game initialization in order to list the set of switches // and buttons known to the engine. This enables their texture to change // when activated, and in the case of buttons, change back after a timeout. // // This routine modified to read its data from a predefined lump or // PWAD lump called SWITCHES rather than a static table in this module to // allow wad designers to insert or modify switches. // // Lump format is an array of byte packed switchlist_t structures, terminated // by a structure with episode == -0. The lump can be generated from a // text source file using SWANTBLS.EXE, distributed with the BOOM utils. // The standard list of switches and animations is contained in the example // source text file DEFSWANI.DAT also in the BOOM util distribution. // // Rewritten by Lee Killough to remove limit 2/8/98 // void P_InitSwitchList(void) { int i, index = 0; int episode = (gamemode == registered || gamemode==retail) ? 2 : gamemode == commercial ? 3 : 1; switchlist_t *alphSwitchList; //jff 3/23/98 pointer to switch table //jff 3/23/98 read the switch table from a predefined lump alphSwitchList = (switchlist_t *)W_CacheLumpName("SWITCHES",PU_STATIC); for (i=0;;i++) { if (index+1 >= max_numswitches) switchlist = realloc(switchlist, sizeof *switchlist * (max_numswitches = max_numswitches ? max_numswitches*2 : 8)); if (SHORT(alphSwitchList[i].episode) <= episode) //jff 5/11/98 endianess { if (!SHORT(alphSwitchList[i].episode)) break; switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name1); switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name2); } } numswitches = index/2; switchlist[index] = -1; Z_ChangeTag(alphSwitchList,PU_CACHE); //jff 3/23/98 allow table to be freed }
// // P_InitSwitchList() // // Only called at game initialization in order to list the set of switches // and buttons known to the engine. This enables their texture to change // when activated, and in the case of buttons, change back after a timeout. // // This routine modified to read its data from a predefined lump or // PWAD lump called SWITCHES rather than a static table in this module to // allow wad designers to insert or modify switches. // // Lump format is an array of byte packed switchlist_t structures, terminated // by a structure with episode == -0. The lump can be generated from a // text source file using SWANTBLS.EXE, distributed with the BOOM utils. // The standard list of switches and animations is contained in the example // source text file DEFSWANI.DAT also in the BOOM util distribution. // // Rewritten by Lee Killough to remove limit 2/8/98 // void P_InitSwitchList(void) { int i, index = 0; int episode = (gamemode == registered || gamemode==retail) ? 2 : gamemode == commercial ? 3 : 1; const switchlist_t *alphSwitchList; //jff 3/23/98 pointer to switch table int lump = W_GetNumForName("SWITCHES"); // cph - new wad lump handling //jff 3/23/98 read the switch table from a predefined lump alphSwitchList = (const switchlist_t *)W_CacheLumpNum(lump); for (i=0;;i++) { if (index+1 >= max_numswitches) switchlist = realloc(switchlist, sizeof *switchlist * (max_numswitches = max_numswitches ? max_numswitches*2 : 8)); if (SHORT(alphSwitchList[i].episode) <= episode) //jff 5/11/98 endianess { if (!SHORT(alphSwitchList[i].episode)) break; switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name1); switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name2); } } numswitches = index/2; switchlist[index] = -1; W_UnlockLumpNum(lump); }
static int CmdSetLineTexture(void) { line_t *line; int lineTag; int side; int position; int texture; int searcher; texture = R_TextureNumForName(ACStrings[Pop()]); position = Pop(); side = Pop(); lineTag = Pop(); searcher = -1; while ((line = P_FindLine(lineTag, &searcher)) != NULL) { if (position == TEXTURE_MIDDLE) { sides[line->sidenum[side]].midtexture = texture; } else if (position == TEXTURE_BOTTOM) { sides[line->sidenum[side]].bottomtexture = texture; } else { // TEXTURE_TOP sides[line->sidenum[side]].toptexture = texture; } } return SCRIPT_CONTINUE; }
void P_InitPicAnims (void) { int i; // Init animation lastanim = anims; for (i=0 ; animdefs[i].istexture != -1 ; i++) { char *startname, *endname; startname = DEH_String(animdefs[i].startname); endname = DEH_String(animdefs[i].endname); if (animdefs[i].istexture) { // different episode ? if (R_CheckTextureNumForName(startname) == -1) continue; lastanim->picnum = R_TextureNumForName(endname); lastanim->basepic = R_TextureNumForName(startname); } else { if (W_CheckNumForName(startname) == -1) continue; lastanim->picnum = R_FlatNumForName(endname); lastanim->basepic = R_FlatNumForName(startname); } lastanim->istexture = animdefs[i].istexture; lastanim->numpics = lastanim->picnum - lastanim->basepic + 1; if (lastanim->numpics < 2) I_Error ("P_InitPicAnims: bad cycle from %s to %s", startname, endname); lastanim->speed = animdefs[i].speed; lastanim++; } }
// // P_InitSwitchList // Only called at game initialization. // void P_InitSwitchList(void) { int i; int index; int episode; episode = 1; if ((gamemode == registered) || (gamemode == retail)) episode = 2; else if ( gamemode == commercial ) episode = 3; for (index = 0,i = 0;i < MAXSWITCHES;i++) { if (!alphSwitchList[i].episode) { numswitches = index/2; switchlist[index] = -1; break; } if (alphSwitchList[i].episode <= episode) { #if 0 // UNUSED - debug? int value; if (R_CheckTextureNumForName(alphSwitchList[i].name1) < 0) { I_Error("Can't find switch texture '%s'!", alphSwitchList[i].name1); continue; } value = R_TextureNumForName(alphSwitchList[i].name1); #endif switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name1); switchlist[index++] = R_TextureNumForName(alphSwitchList[i].name2); } } }
void P_InitPicAnims (void) { int i; // Init animation ::g->lastanim = ::g->anims; for (i=0 ; animdefs[i].istexture != (qboolean)-1 ; i++) { if (animdefs[i].istexture) { // different episode ? if (R_CheckTextureNumForName(animdefs[i].startname) == -1) continue; ::g->lastanim->picnum = R_TextureNumForName (animdefs[i].endname); ::g->lastanim->basepic = R_TextureNumForName (animdefs[i].startname); } else { if (W_CheckNumForName(animdefs[i].startname) == -1) continue; ::g->lastanim->picnum = R_FlatNumForName (animdefs[i].endname); ::g->lastanim->basepic = R_FlatNumForName (animdefs[i].startname); } ::g->lastanim->istexture = animdefs[i].istexture; ::g->lastanim->numpics = ::g->lastanim->picnum - ::g->lastanim->basepic + 1; if (::g->lastanim->numpics < 2) I_Error ("P_InitPicAnims: bad cycle from %s to %s", animdefs[i].startname, animdefs[i].endname); ::g->lastanim->speed = animdefs[i].speed; ::g->lastanim++; } }
void P_InitSwitchList(void) { int i; int idx; if (alphSwitchList == NULL) { alphSwitchList = (shareware && oldwad_10) ? alphSwitchListDemo : alphSwitchListFull; } for (idx = 0, i = 0; i < MAXSWITCHES; i++) { if (!alphSwitchList[i].soundID) { numswitches = idx/2; switchlist[idx] = -1; break; } switchlist[idx++] = R_TextureNumForName(alphSwitchList[i].name1); switchlist[idx++] = R_TextureNumForName(alphSwitchList[i].name2); } }
void P_InitPicAnims(void) { int i; lastanim = anims; for(i = 0; animdefs[i].istexture != -1; i++) { if(animdefs[i].istexture) { // Texture animation if(R_CheckTextureNumForName(animdefs[i].startname) == -1) { // Texture doesn't exist continue; } lastanim->picnum = R_TextureNumForName(animdefs[i].endname); lastanim->basepic = R_TextureNumForName(animdefs[i].startname); } else { // Flat animation if(W_CheckNumForName(animdefs[i].startname) == -1) { // Flat doesn't exist continue; } lastanim->picnum = R_FlatNumForName(animdefs[i].endname); lastanim->basepic = R_FlatNumForName(animdefs[i].startname); } lastanim->istexture = animdefs[i].istexture; lastanim->numpics = lastanim->picnum-lastanim->basepic+1; if(lastanim->numpics < 2) { I_Error("P_InitPicAnims: bad cycle from %s to %s", animdefs[i].startname, animdefs[i].endname); } lastanim->speed = animdefs[i].speed; lastanim++; } }
void P_InitSlidingDoorFrames(void) { int i; int f1; int f2; int f3; int f4; // DOOM II ONLY... if ( gamemode != commercial) return; for (i = 0;i < MAXSLIDEDOORS; i++) { if (!slideFrameNames[i].frontFrame1[0]) break; f1 = R_TextureNumForName(slideFrameNames[i].frontFrame1); f2 = R_TextureNumForName(slideFrameNames[i].frontFrame2); f3 = R_TextureNumForName(slideFrameNames[i].frontFrame3); f4 = R_TextureNumForName(slideFrameNames[i].frontFrame4); slideFrames[i].frontFrames[0] = f1; slideFrames[i].frontFrames[1] = f2; slideFrames[i].frontFrames[2] = f3; slideFrames[i].frontFrames[3] = f4; f1 = R_TextureNumForName(slideFrameNames[i].backFrame1); f2 = R_TextureNumForName(slideFrameNames[i].backFrame2); f3 = R_TextureNumForName(slideFrameNames[i].backFrame3); f4 = R_TextureNumForName(slideFrameNames[i].backFrame4); slideFrames[i].backFrames[0] = f1; slideFrames[i].backFrames[1] = f2; slideFrames[i].backFrames[2] = f3; slideFrames[i].backFrames[3] = f4; } }
// // P_InitSlidingDoorFrames // // villsa [STRIFE] resurrected // void P_InitSlidingDoorFrames(void) { int i; int f1; int f2; int f3; int f4; memset(slideFrames, 0, sizeof(slideframe_t) * MAXSLIDEDOORS); for(i = 0; i < MAXSLIDEDOORS; i++) { if(!slideFrameNames[i].frame1[0]) break; f1 = R_TextureNumForName(DEH_String(slideFrameNames[i].frame1)); f2 = R_TextureNumForName(DEH_String(slideFrameNames[i].frame2)); f3 = R_TextureNumForName(DEH_String(slideFrameNames[i].frame3)); f4 = R_TextureNumForName(DEH_String(slideFrameNames[i].frame4)); slideFrames[i].frames[0] = f1; slideFrames[i].frames[1] = f2; slideFrames[i].frames[2] = f3; slideFrames[i].frames[3] = f4; f1 = R_TextureNumForName(DEH_String(slideFrameNames[i].frame5)); f2 = R_TextureNumForName(DEH_String(slideFrameNames[i].frame6)); f3 = R_TextureNumForName(DEH_String(slideFrameNames[i].frame7)); f4 = R_TextureNumForName(DEH_String(slideFrameNames[i].frame8)); slideFrames[i].frames[4] = f1; slideFrames[i].frames[5] = f2; slideFrames[i].frames[6] = f3; slideFrames[i].frames[7] = f4; } }
void R_InitSkyMap(void) { int map = (gameepisode - 1) * 10 + gamemap; skyflatnum = R_FlatNumForName(SKYFLATNAME); skytexture = P_GetMapSky1Texture(map); if (!skytexture) { if (gamemode == commercial) { if (gamemap < 12) skytexture = R_TextureNumForName("SKY1"); else if (gamemap < 21) skytexture = R_TextureNumForName("SKY2"); else skytexture = R_TextureNumForName("SKY3"); } else { switch (gameepisode) { default: case 1: skytexture = R_TextureNumForName("SKY1"); break; case 2: skytexture = R_TextureNumForName("SKY2"); break; case 3: skytexture = R_TextureNumForName("SKY3"); break; case 4: skytexture = R_TextureNumForName("SKY4"); break; case 5: skytexture = R_TextureNumForName(R_CheckTextureNumForName("SKY5_ZD") != -1 ? "SKY5_ZD" : "SKY5"); break; } } } skyscrolldelta = P_GetMapSky1ScrollDelta(map); if ((canmouselook = ((mouselook || keyboardmouselook || mousemouselook != -1 || autotilt) && !nomouselook))) { int skyheight = textureheight[skytexture] >> FRACBITS; if (skyheight >= 128 && skyheight < 200) skytexturemid = -54 * FRACUNIT * skyheight / SKYSTRETCH_HEIGHT; else if (skyheight > 200) skytexturemid = (200 - skyheight) * FRACUNIT * skyheight / SKYSTRETCH_HEIGHT; else skytexturemid = 0; skyiscale = (fixed_t)(((uint64_t)FRACUNIT * SCREENWIDTH * 200) / ((uint64_t)viewwidth * SCREENHEIGHT)) * skyheight / SKYSTRETCH_HEIGHT; }
void P_InitFTAnims(void) { int base; boolean ignore; boolean done; int AnimDefCount = 0; int groupNumber, picBase; int type, index; SC_Open(ANIM_SCRIPT_NAME); while(SC_GetString()) { if(AnimDefCount == MAX_ANIM_DEFS) { Con_Error("P_InitFTAnims: too many AnimDefs."); } if(SC_Compare(SCI_FLAT)) { type = ANIM_FLAT; } else if(SC_Compare(SCI_TEXTURE)) { type = ANIM_TEXTURE; } else { SC_ScriptError(NULL); } SC_MustGetString(); // Name ignore = false; if(type == ANIM_FLAT) { if(W_CheckNumForName(sc_String) == -1) { ignore = true; } else { picBase = R_FlatNumForName(sc_String); groupNumber = R_CreateAnimGroup(DD_FLAT, AGF_SMOOTH | AGF_FIRST_ONLY); } } else { // Texture if(R_CheckTextureNumForName(sc_String) == -1) { ignore = true; } else { picBase = R_TextureNumForName(sc_String); groupNumber = R_CreateAnimGroup(DD_TEXTURE, AGF_SMOOTH | AGF_FIRST_ONLY); } } done = false; while(done == false) { if(SC_GetString()) { if(SC_Compare(SCI_PIC)) { SC_MustGetNumber(); if(ignore == false) { index = picBase + sc_Number - 1; } SC_MustGetString(); if(SC_Compare(SCI_TICS)) { SC_MustGetNumber(); if(ignore == false) { R_AddToAnimGroup(groupNumber, index, sc_Number, 0); } } else if(SC_Compare(SCI_RAND)) { SC_MustGetNumber(); base = sc_Number; SC_MustGetNumber(); if(ignore == false) { R_AddToAnimGroup(groupNumber, index, base, sc_Number - base); } } else { SC_ScriptError(NULL); } } else { SC_UnGet(); done = true; } } else { done = true; } } } SC_Close(); }
void P_InitSlidingDoorFrames(void) { int i; int f1, f2, f3, f4, f5, f6, f7, f8; char tname[9]; // DOOM II ONLY... if (gamemode != commercial) return; for (i = 0; i < MAXSLIDEDOORS; i++) { if (!slideFrameNames[i].frontFrame1[0]) break; // no textures for sliding doors in any IWAD... sprintf(&tname[0], "GDOOR%1dF1", i + 1); if (W_CheckNumForName(&tname[0]) == -1) continue; f1 = R_TextureNumForName(slideFrameNames[i].frontFrame1); f2 = R_TextureNumForName(slideFrameNames[i].frontFrame2); f3 = R_TextureNumForName(slideFrameNames[i].frontFrame3); f4 = R_TextureNumForName(slideFrameNames[i].frontFrame4); f5 = R_TextureNumForName(slideFrameNames[i].frontFrame5); f6 = R_TextureNumForName(slideFrameNames[i].frontFrame6); f7 = R_TextureNumForName(slideFrameNames[i].frontFrame7); f8 = R_TextureNumForName(slideFrameNames[i].frontFrame8); slideFrames[i].frontFrames[0] = f1; slideFrames[i].frontFrames[1] = f2; slideFrames[i].frontFrames[2] = f3; slideFrames[i].frontFrames[3] = f4; slideFrames[i].frontFrames[4] = f5; slideFrames[i].frontFrames[5] = f6; slideFrames[i].frontFrames[6] = f7; slideFrames[i].frontFrames[7] = f8; f1 = R_TextureNumForName(slideFrameNames[i].backFrame1); f2 = R_TextureNumForName(slideFrameNames[i].backFrame2); f3 = R_TextureNumForName(slideFrameNames[i].backFrame3); f4 = R_TextureNumForName(slideFrameNames[i].backFrame4); f5 = R_TextureNumForName(slideFrameNames[i].backFrame5); f6 = R_TextureNumForName(slideFrameNames[i].backFrame6); f7 = R_TextureNumForName(slideFrameNames[i].backFrame7); f8 = R_TextureNumForName(slideFrameNames[i].backFrame8); slideFrames[i].backFrames[0] = f1; slideFrames[i].backFrames[1] = f2; slideFrames[i].backFrames[2] = f3; slideFrames[i].backFrames[3] = f4; slideFrames[i].backFrames[4] = f5; slideFrames[i].backFrames[5] = f6; slideFrames[i].backFrames[6] = f7; slideFrames[i].backFrames[7] = f8; } }
void G_InitNew(skill_t skill, int episode, int map) { int i; int speed; static char *skyLumpNames[5] = { "SKY1", "SKY2", "SKY3", "SKY1", "SKY3" }; if (paused) { paused = false; S_ResumeSound(); } if (skill < sk_baby) skill = sk_baby; if (skill > sk_nightmare) skill = sk_nightmare; if (episode < 1) episode = 1; // Up to 9 episodes for testing if (episode > 9) episode = 9; if (map < 1) map = 1; if (map > 9) map = 9; M_ClearRandom(); if (respawnparm) { respawnmonsters = true; } else { respawnmonsters = false; } // Set monster missile speeds speed = skill == sk_nightmare; for (i = 0; MonsterMissileInfo[i].type != -1; i++) { mobjinfo[MonsterMissileInfo[i].type].speed = MonsterMissileInfo[i].speed[speed] << FRACBITS; } // Force players to be initialized upon first level load for (i = 0; i < MAXPLAYERS; i++) { players[i].playerstate = PST_REBORN; players[i].didsecret = false; } // Set up a bunch of globals usergame = true; // will be set false if a demo paused = false; demorecording = false; demoplayback = false; viewactive = true; gameepisode = episode; gamemap = map; gameskill = skill; viewactive = true; BorderNeedRefresh = true; // Set the sky map if (episode > 5) { skytexture = R_TextureNumForName(DEH_String("SKY1")); } else { skytexture = R_TextureNumForName(DEH_String(skyLumpNames[episode - 1])); } // // give one null ticcmd_t // #if 0 gametic = 0; maketic = 1; for (i = 0; i < MAXPLAYERS; i++) nettics[i] = 1; // one null event for this gametic memset(localcmds, 0, sizeof(localcmds)); memset(netcmds, 0, sizeof(netcmds)); #endif G_DoLoadLevel(); }
static void InitMapInfo(void) { int map; int mapMax; int mcmdValue; mapInfo_t *info; char songMulch[10]; mapMax = 1; // Put defaults into MapInfo[0] info = MapInfo; info->cluster = 0; info->warpTrans = 0; info->nextMap = 1; // Always go to map 1 if not specified info->cdTrack = 1; info->sky1Texture = R_TextureNumForName(DEFAULT_SKY_NAME); info->sky2Texture = info->sky1Texture; info->sky1ScrollDelta = 0; info->sky2ScrollDelta = 0; info->doubleSky = false; info->lightning = false; info->fadetable = W_GetNumForName(DEFAULT_FADE_TABLE); strcpy(info->name, UNKNOWN_MAP_NAME); // strcpy(info->songLump, DEFAULT_SONG_LUMP); SC_Open(MAPINFO_SCRIPT_NAME); while (SC_GetString()) { if (SC_Compare("MAP") == false) { SC_ScriptError(NULL); } SC_MustGetNumber(); if (sc_Number < 1 || sc_Number > 99) { // SC_ScriptError(NULL); } map = sc_Number; info = &MapInfo[map]; // Save song lump name strcpy(songMulch, info->songLump); // Copy defaults to current map definition memcpy(info, &MapInfo[0], sizeof(*info)); // Restore song lump name strcpy(info->songLump, songMulch); // The warp translation defaults to the map number info->warpTrans = map; // Map name must follow the number SC_MustGetString(); strcpy(info->name, sc_String); // Process optional tokens while (SC_GetString()) { if (SC_Compare("MAP")) { // Start next map definition SC_UnGet(); break; } mcmdValue = MapCmdIDs[SC_MustMatchString(MapCmdNames)]; switch (mcmdValue) { case MCMD_CLUSTER: SC_MustGetNumber(); info->cluster = sc_Number; break; case MCMD_WARPTRANS: SC_MustGetNumber(); info->warpTrans = sc_Number; break; case MCMD_NEXT: SC_MustGetNumber(); info->nextMap = sc_Number; break; case MCMD_CDTRACK: SC_MustGetNumber(); info->cdTrack = sc_Number; break; case MCMD_SKY1: SC_MustGetString(); info->sky1Texture = R_TextureNumForName(sc_String); SC_MustGetNumber(); info->sky1ScrollDelta = sc_Number << 8; break; case MCMD_SKY2: SC_MustGetString(); info->sky2Texture = R_TextureNumForName(sc_String); SC_MustGetNumber(); info->sky2ScrollDelta = sc_Number << 8; break; case MCMD_DOUBLESKY: info->doubleSky = true; break; case MCMD_LIGHTNING: info->lightning = true; break; case MCMD_FADETABLE: SC_MustGetString(); info->fadetable = W_GetNumForName(sc_String); break; case MCMD_CD_STARTTRACK: case MCMD_CD_END1TRACK: case MCMD_CD_END2TRACK: case MCMD_CD_END3TRACK: case MCMD_CD_INTERTRACK: case MCMD_CD_TITLETRACK: SC_MustGetNumber(); cd_NonLevelTracks[mcmdValue - MCMD_CD_STARTTRACK] = sc_Number; break; } } mapMax = map > mapMax ? map : mapMax; } SC_Close(); MapCount = mapMax; }
//========================================================================== // SV_GetArchiveTexture //========================================================================== int SV_GetArchiveTexture(int archivenum) { return R_TextureNumForName(tex_archive.table[archivenum].name); }