void SpawnInertStatic (int x, int y, int z, int mtype) {statobj_t * temp; if (!firstemptystat) {temp = (statobj_t*)Z_LevelMalloc(sizeof(statobj_t),PU_LEVELSTRUCT,NULL); //SoftError("\nMalloc-ing actor"); //if (insetupgame) // SoftError("in setup"); } else {temp = lastemptystat; //SoftError("\nfree actor available"); RemoveFromFreeStaticList(lastemptystat); } if (temp) { memset(temp,0,sizeof(*temp)); temp->shapenum = stats[mtype].picnum; temp->whichstat = statcount ++; temp->tilex = x>>16; temp->tiley = y>>16; temp->x = x; temp->y = y; temp->areanumber = MAPSPOT(temp->tilex,temp->tiley,0)-AREATILE; temp->linked_to = -1; if ((temp->areanumber<=0) || (temp->areanumber>NUMAREAS)) { int tilex=temp->tilex; int tiley=temp->tiley; FindEmptyTile(&tilex,&tiley); temp->areanumber = MAPSPOT(tilex,tiley,0)-AREATILE; } temp->z=z; temp->visspot = &spotvis[temp->tilex][temp->tiley]; temp->which = SPRITE; temp->ticcount = stats[mtype].tictime; temp->hitpoints = stats[mtype].hitpoints; temp->itemnumber = stats[mtype].type; temp->flags = (stats[mtype].flags|FL_ABP|FL_NONMARK); if (fog) {temp->shapenum++; temp->flags &= ~FL_TRANSLUCENT; } temp->ammo = stats[mtype].ammo; temp->numanims = stats[mtype].numanims; AddStatic(temp); MakeStatActive(temp); } else
void BasicOverhead (void) { int x, y, z, offx, offy; z = 128/MAPSIZE; // zoom scale offx = 320/2; offy = (160-MAPSIZE*z)/2; #ifdef MAPBORDER int temp = viewsize; NewViewSize(16); DrawPlayBorder(); #endif // right side (raw) for(x=0;x<MAPSIZE;x++) for(y=0;y<MAPSIZE;y++) VWB_Bar(x*z+offx, y*z+offy,z,z,(unsigned)(uintptr_t)actorat[x][y]); // left side (filtered) uintptr_t tile; int color; offx -= 128; for(x=0;x<MAPSIZE;x++) { for(y=0;y<MAPSIZE;y++) { tile = (uintptr_t)actorat[x][y]; if (ISPOINTER(tile) && ((objtype *)tile)->flags&FL_SHOOTABLE) color = 72; // enemy else if (!tile || ISPOINTER(tile)) { if (spotvis[x][y]) color = 111; // visable else color = 0; // nothing } else if (MAPSPOT(x,y,1) == PUSHABLETILE) color = 171; // pushwall else if (tile == 64) color = 158; // solid obj else if (tile < 128) color = 154; // walls else if (tile < 256) color = 146; // doors VWB_Bar(x*z+offx, y*z+offy,z,z,color); } } VWB_Bar(player->tilex*z+offx,player->tiley*z+offy,z,z,15); // player // resize the border to match VW_UpdateScreen(); IN_Ack(); #ifdef MAPBORDER NewViewSize(temp); DrawPlayBorder(); #endif }
void TurnOnLight(int i,int j) { LightsInArea[MAPSPOT(i,j,0)-AREATILE]++; if (lightsource==0) return; if ((!(tilemap[i+1][j])) && (!(tilemap[i-1][j]))) { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0x135789ab); SetLight(i-1,j,0xba987351); SetLight(i,j+1,0xcdeffedc); SetLight(i,j-1,0xcdeffedc); SetLight(i-1,j-1,0xba987351); SetLight(i+1,j+1,0xba987351); SetLight(i+1,j-1,0x135789ab); SetLight(i-1,j+1,0x135789ab); } else if ((!(tilemap[i][j+1])) && (!(tilemap[i][j-1]))) { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0xcdeffedc); SetLight(i-1,j,0xcdeffedc); SetLight(i,j+1,0x135789ab); SetLight(i,j-1,0xba987531); SetLight(i-1,j-1,0x135789ab); SetLight(i+1,j-1,0xba987531); SetLight(i+1,j+1,0x135789ab); SetLight(i-1,j+1,0xba987531); } // | //__| else if ((tilemap[i][j+1]) && (tilemap[i+1][j])) { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0xcdeffedc); SetLight(i-1,j,0xcdeffedc); SetLight(i,j+1,0xcdeffedc); SetLight(i,j-1,0xcdeffedc); SetLight(i-1,j-1,0xba987351); SetLight(i+1,j-1,0xba987351); SetLight(i+1,j+1,0xba987351); SetLight(i-1,j+1,0x135789ab); } //| //|_ else if ((tilemap[i][j+1]) && (tilemap[i-1][j])) { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0xcdeffedc); SetLight(i-1,j,0xcdeffedc); SetLight(i,j+1,0xcdeffedc); SetLight(i,j-1,0xcdeffedc); SetLight(i-1,j-1,0x135789ab); SetLight(i+1,j-1,0xba987531); SetLight(i+1,j+1,0xba987531); SetLight(i-1,j+1,0xba987531); } //_ // | else if ((tilemap[i][j-1]) && (tilemap[i+1][j])) { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0xcdeffedc); SetLight(i-1,j,0xcdeffedc); SetLight(i,j+1,0xcdeffedc); SetLight(i,j-1,0xcdeffedc); SetLight(i-1,j-1,0xba987531); SetLight(i+1,j-1,0x135789ab); SetLight(i+1,j+1,0x135789ab); SetLight(i-1,j+1,0xba987531); } //__ //| else if ((tilemap[i][j-1]) && (tilemap[i-1][j])) { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0xcdeffedc); SetLight(i-1,j,0xcdeffedc); SetLight(i,j+1,0xcdeffedc); SetLight(i,j-1,0xcdeffedc); SetLight(i-1,j-1,0x135789ab); SetLight(i+1,j-1,0x135789ab); SetLight(i+1,j+1,0xba987531); SetLight(i-1,j+1,0xba987531); } else if (tilemap[i][j]) { SetLight(i,j,0x58bffb85); } else { SetLight(i,j,0xcdeffedc); SetLight(i+1,j,0xba987654); SetLight(i-1,j,0x456789ab); SetLight(i,j+1,0xba987654); SetLight(i,j-1,0x456789ab); SetLight(i-1,j+1,0x33322211); SetLight(i+1,j+1,0x33322211); SetLight(i+1,j-1,0x11222333); SetLight(i-1,j-1,0x11222333); } }
void TurnOffLight(int tilex,int tiley) { DoLights(tilex,tiley); LightsInArea[MAPSPOT(tilex,tiley,0)-AREATILE]--; }
void SpawnStatic (int tilex, int tiley, int mtype, int zoffset) {statobj_t * temp; boolean onetimer; #if (SHAREWARE == 1) switch(mtype) { case stat_rlight: case stat_glight: case stat_ylight: case stat_chandelier: mtype = stat_blight; break; case stat_garb1: case stat_garb2: case stat_garb3: case stat_shit: mtype = stat_metalshards; break; case stat_lamp: mtype = stat_altbrazier2; break; } #endif if ( BATTLEMODE ) { if ( !gamestate.BattleOptions.SpawnWeapons ) { if ( stats[ mtype ].flags & FL_WEAPON ) { return; } } if (mtype == stat_pit) return; // Change lifeitems and extra lives to health switch( mtype ) { case stat_lifeitem1 : case stat_lifeitem2 : mtype = stat_monkcrystal1; break; case stat_lifeitem3 : case stat_lifeitem4 : case stat_oneup : case stat_threeup : mtype = stat_monkcrystal2; break; } switch( mtype ) { case stat_monkmeal : case stat_priestporridge : case stat_monkcrystal1 : case stat_monkcrystal2 : case stat_healingbasin : if ( ( gamestate.Product != ROTT_SHAREWARE ) && ( gamestate.BattleOptions.SpawnMines ) && ( !IsPlatform( tilex, tiley ) && ( ( zoffset & 0xff00 ) != 0xb000 ) ) && ( zoffset == -1 ) ) { mtype = stat_mine; } else if ( !gamestate.BattleOptions.SpawnHealth ) { return; } break; } } if (!firstemptystat) {temp = (statobj_t*)Z_LevelMalloc(sizeof(statobj_t),PU_LEVELSTRUCT,NULL); //SoftError("\nMalloc-ing actor"); //if (insetupgame) // SoftError("in setup"); } else {temp = lastemptystat; //SoftError("\nfree actor available"); RemoveFromFreeStaticList(lastemptystat); } // Standard pole hack if ((zoffset>=14) && (zoffset<=17)) zoffset=-1; if (temp) { memset(temp,0,sizeof(*temp)); temp->shapenum = stats[mtype].picnum; temp->whichstat = statcount ++; temp->tilex = tilex; temp->tiley = tiley; temp->x = ((long)tilex << TILESHIFT) + 0x8000; temp->y = ((long)tiley << TILESHIFT) + 0x8000; temp->areanumber = MAPSPOT(tilex,tiley,0)-AREATILE; temp->linked_to = -1; if ((temp->areanumber<=0) || (temp->areanumber>NUMAREAS)) Error ("Sprite at x=%d y=%d type=%d has an illegal areanumber\n",tilex,tiley,mtype); if ( mtype == stat_mine ) { temp->z = nominalheight; } else if (zoffset!=-1) { if ((zoffset&0xff00)==0xb000) Set_NewZ_to_MapValue(&(temp->z),zoffset,"static",tilex,tiley); else if (IsPlatform(tilex,tiley)) temp->z = PlatformHeight(tilex,tiley); else if (zoffset==11) temp->z=-65; else if (zoffset==12) temp->z=-66; else temp->z = nominalheight; // Error ("You didn't specify a valid height over the sprite at tilex=%ld tiley=%ld\n",tilex,tiley); } else if (mtype>stat_chandelier) temp->z = nominalheight; temp->visspot = &spotvis[tilex][tiley]; temp->which = SPRITE; temp->ticcount = stats[mtype].tictime; temp->hitpoints = stats[mtype].hitpoints; temp->itemnumber = stats[mtype].type; temp->flags = stats[mtype].flags; temp->ammo = stats[mtype].ammo; temp->numanims = stats[mtype].numanims; if (temp->flags & FL_BONUS) switch (stats[mtype].type) {case stat_lifeitem1: case stat_lifeitem2: case stat_lifeitem3: case stat_lifeitem4: gamestate.treasuretotal++; break; default: ; } AddStatic(temp); onetimer = ((mtype == stat_rubble) || (mtype == stat_woodfrag) || (mtype == stat_metalfrag) || (mtype == stat_missmoke) ); if (DoPanicMapping()) { if (temp->numanims && (!onetimer)) { temp->flags &= ~FL_ACTIVE; temp->numanims = 0; GameRandomNumber("SpawnStatic",mtype); } } else { if (temp->numanims) { if (!onetimer) temp->count = (int)(((int)GameRandomNumber("SpawnStatic",mtype) % stats[mtype].numanims) + 1); else temp->count = 0; } else if (temp->itemnumber == stat_standardpole) { if (MAPSPOT(temp->tilex,temp->tiley,2)) temp->count = 2*(MAPSPOT(temp->tilex,temp->tiley,2)-14); else temp->count = 0; } if ((temp->itemnumber == stat_knifestatue) || (temp->itemnumber == stat_emptystatue) || (temp->itemnumber == stat_standardpole)) temp->flags|=FL_ROTATING; } if (mtype != stat_missmoke) sprites[tilex][tiley] = temp; else temp->flags |= FL_NONMARK; //================ check special junk ==================================// if (temp->itemnumber == stat_dariantouch) {_2Dpoint *tdptr; tdptr = &(MISCVARS->ETOUCH[MISCVARS->nexttouch]); tdptr->x = tilex; tdptr->y = tiley; sprites[tilex][tiley]->linked_to = MISCVARS->nexttouch; MISCVARS->nexttouch ++; } else if ((temp->itemnumber >= stat_touch1) && (temp->itemnumber <= stat_touch4)) {touchindices[tilex][tiley] = lasttouch + 1; SD_PreCacheSoundGroup(SD_TOUCHPLATESND,SD_BADTOUCHSND); lasttouch ++; } //=====================================================================// //bna added // BaseMarkerZ used to adjust height in s_basemarker1 // in SpawnNewObj(i,j,&s_basemarker1,inertobj); BaseMarkerZ=temp->z;//bna++ BaseMarkerZ = spawnz; PreCacheStaticFrames(temp); PreCacheStaticSounds(temp->itemnumber); if (temp->flags & FL_WEAPON) MISCVARS->NUMWEAPONS ++; } else Error("Z_LevelMalloc failed in SpawnStatic!"); }
int DebugKeys (void) { boolean esc; int level; if (Keyboard[sc_B]) // B = border color { CenterWindow(20,3); PrintY+=6; US_Print(" Border color (0-56): "); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=99) { if (level<30) level += 31; else { if (level > 56) level=31; else level -= 26; } bordercol=level*4+3; if (bordercol == VIEWCOLOR) DrawStatusBorder(bordercol); DrawPlayBorder(); return 0; } } return 1; } if (Keyboard[sc_C]) // C = count objects { CountObjects(); return 1; } if (Keyboard[sc_D]) // D = Darkone's FPS counter { CenterWindow (22,2); if (fpscounter) US_PrintCentered ("Darkone's FPS Counter OFF"); else US_PrintCentered ("Darkone's FPS Counter ON"); VW_UpdateScreen(); IN_Ack(); fpscounter ^= 1; /* if (!fpscounter) DrawPlayScreen(); */ return 1; } if (Keyboard[sc_E]) // E = quit level { if (param_tedlevel != -1) Quit (NULL); playstate = ex_completed; } if (Keyboard[sc_F]) // F = facing spot { char str[60]; CenterWindow (14,6); US_Print ("x:"); US_PrintUnsigned (player->x); US_Print (" ("); US_PrintUnsigned (player->x%65536); US_Print (")\ny:"); US_PrintUnsigned (player->y); US_Print (" ("); US_PrintUnsigned (player->y%65536); US_Print (")\nA:"); US_PrintUnsigned (player->angle); US_Print (" X:"); US_PrintUnsigned (player->tilex); US_Print (" Y:"); US_PrintUnsigned (player->tiley); US_Print ("\n1:"); US_PrintUnsigned (tilemap[player->tilex][player->tiley]); sprintf(str," 2:%.8X",(unsigned)(uintptr_t)actorat[player->tilex][player->tiley]); US_Print(str); US_Print ("\nf 1:"); US_PrintUnsigned (player->areanumber); US_Print (" 2:"); US_PrintUnsigned (MAPSPOT(player->tilex,player->tiley,1)); US_Print (" 3:"); if ((unsigned)(uintptr_t)actorat[player->tilex][player->tiley] < 256) US_PrintUnsigned (spotvis[player->tilex][player->tiley]); else US_PrintUnsigned (actorat[player->tilex][player->tiley]->flags); VW_UpdateScreen(); IN_Ack(); return 1; } if (Keyboard[sc_G]) // G = god mode { CenterWindow (12,2); if (godmode == 0) US_PrintCentered ("God mode ON"); else if (godmode == 1) US_PrintCentered ("God (no flash)"); else if (godmode == 2) US_PrintCentered ("God mode OFF"); VW_UpdateScreen(); IN_Ack(); if (godmode != 2) godmode++; else godmode = 0; return 1; } if (Keyboard[sc_H]) // H = hurt self { IN_ClearKeysDown (); TakeDamage (16,NULL); } else if (Keyboard[sc_I]) // I = item cheat { CenterWindow (12,3); US_PrintCentered ("Free items!"); VW_UpdateScreen(); GivePoints (100000); HealSelf (99); if (gamestate.bestweapon<wp_chaingun) GiveWeapon (gamestate.bestweapon+1); gamestate.ammo += 50; if (gamestate.ammo > 99) gamestate.ammo = 99; DrawAmmo (); IN_Ack (); return 1; } else if (Keyboard[sc_K]) // K = give keys { CenterWindow(16,3); PrintY+=6; US_Print(" Give Key (1-4): "); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,1,0); if (!esc) { level = atoi (str); if (level>0 && level<5) GiveKey(level-1); } return 1; } else if (Keyboard[sc_L]) // L = level ratios { byte x,start,end=LRpack; if (end == 8) // wolf3d { CenterWindow(17,10); start = 0; } else // sod { CenterWindow(17,12); start = 0; end = 10; } again: for(x=start;x<end;x++) { US_PrintUnsigned(x+1); US_Print(" "); US_PrintUnsigned(LevelRatios[x].time/60); US_Print(":"); if (LevelRatios[x].time%60 < 10) US_Print("0"); US_PrintUnsigned(LevelRatios[x].time%60); US_Print(" "); US_PrintUnsigned(LevelRatios[x].kill); US_Print("% "); US_PrintUnsigned(LevelRatios[x].secret); US_Print("% "); US_PrintUnsigned(LevelRatios[x].treasure); US_Print("%\n"); } VW_UpdateScreen(); IN_Ack(); if (end == 10 && gamestate.mapon > 9) { start = 10; end = 20; CenterWindow(17,12); goto again; } return 1; } else if (Keyboard[sc_N]) // N = no clip { noclip^=1; CenterWindow (18,3); if (noclip) US_PrintCentered ("No clipping ON"); else US_PrintCentered ("No clipping OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } else if (Keyboard[sc_O]) // O = basic overhead { BasicOverhead(); return 1; } /*else if(Keyboard[sc_P]) // P = Ripper's picture grabber { PictureGrabber(); return 1; } */ else if (Keyboard[sc_Q]) // Q = fast quit Quit (NULL); else if (Keyboard[sc_S]) // S = slow motion { CenterWindow(30,3); PrintY+=6; US_Print(" Slow Motion steps (default 14): "); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=50) singlestep = level; } return 1; } else if (Keyboard[sc_T]) // T = shape test { ShapeTest (); return 1; } else if (Keyboard[sc_V]) // V = extra VBLs { CenterWindow(30,3); PrintY+=6; US_Print(" Add how many extra VBLs(0-8): "); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,1,0); if (!esc) { level = atoi (str); if (level>=0 && level<=8) extravbls = level; } return 1; } else if (Keyboard[sc_W]) // W = warp to level { CenterWindow(26,3); PrintY+=6; #ifndef SPEAR US_Print(" Warp to which level(1-10): "); #else US_Print(" Warp to which level(1-21): "); #endif VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); #ifndef SPEAR if (level>0 && level<11) #else if (level>0 && level<22) #endif { gamestate.mapon = level-1; playstate = ex_warped; } } return 1; } else if (Keyboard[sc_X]) // X = item cheat { CenterWindow (12,3); US_PrintCentered ("Extra stuff!"); VW_UpdateScreen(); // DEBUG: put stuff here IN_Ack (); return 1; } #ifdef USE_CLOUDSKY else if(Keyboard[sc_Z]) { char defstr[15]; CenterWindow(34,4); PrintY+=6; US_Print(" Recalculate sky with seek: "); int seekpx = px, seekpy = py; US_PrintUnsigned(curSky->seed); US_Print("\n Use color map (0-"); US_PrintUnsigned(numColorMaps - 1); US_Print("): "); int mappx = px, mappy = py; US_PrintUnsigned(curSky->colorMapIndex); VW_UpdateScreen(); sprintf(defstr, "%u", curSky->seed); esc = !US_LineInput(seekpx, seekpy, str, defstr, true, 10, 0); if(esc) return 0; curSky->seed = (uint32_t) atoi(str); sprintf(defstr, "%u", curSky->colorMapIndex); esc = !US_LineInput(mappx, mappy, str, defstr, true, 10, 0); if(esc) return 0; uint32_t newInd = (uint32_t) atoi(str); if(newInd < (uint32_t) numColorMaps) { curSky->colorMapIndex = newInd; InitSky(); } else { CenterWindow (18,3); US_PrintCentered ("Illegal color map!"); VW_UpdateScreen(); IN_Ack (); } } #endif return 0; }