id0_boolean_t ChooseGameLevel() { id0_char_t choices[] = {sc_Escape,sc_E,sc_N,sc_H,0},ch; CenterWindow(20,10); US_Print("\n Choose difficulty level:\n"); US_Print(" (E)asy\n"); US_Print(" (N)ormal\n"); US_Print(" (H)ard\n"); US_Print("\n (ESC)ape aborts\n"); // VW_UpdateScreen(); if ((ch=GetKeyChoice(choices)) == sc_Escape) { while (Keyboard[sc_Escape]); LastScan = 0; return(false); } if (ch == sc_E) restartgame = gd_Easy; else if (ch == sc_N) restartgame = gd_Normal; else restartgame = gd_Hard; return(true); }
void StatusWindow (void) { id0_word_t x; // DEBUG - make this look better US_CenterWindow(22,7); US_CPrint("Status Window"); WindowX += 8; WindowW -= 8; WindowY += 20; WindowH -= 20; PrintX = WindowX; PrintY = WindowY; VWB_DrawTile8(PrintX,PrintY,26); VWB_DrawTile8(PrintX + 8,PrintY,27); PrintX += 24; US_PrintUnsigned(gamestate.lives); US_Print("\n"); VWB_DrawTile8(PrintX,PrintY,32); VWB_DrawTile8(PrintX + 8,PrintY,33); VWB_DrawTile8(PrintX,PrintY + 8,34); VWB_DrawTile8(PrintX + 8,PrintY + 8,35); PrintX += 24; US_PrintUnsigned(gamestate.boobusbombs); US_Print("\n"); WindowX += 50; WindowW -= 50; PrintX = WindowX; PrintY = WindowY; fontcolor = F_FIRSTCOLOR; US_Print("Next "); fontcolor = F_BLACK; x = PrintX; VWB_DrawTile8(PrintX,PrintY,26); VWB_DrawTile8(PrintX + 8,PrintY,27); PrintX += 24; US_PrintUnsigned(gamestate.nextextra); US_Print("\n"); PrintX = x; VWB_DrawTile8(PrintX,PrintY,24); VWB_DrawTile8(PrintX + 8,PrintY,25); PrintX += 24; US_PrintUnsigned(gamestate.keys); US_Print("\n"); // DEBUG - add flower powers (#36) VW_UpdateScreen(); IN_Ack(); }
/////////////////////////////////////////////////////////////////////////// // // US_PrintSigned() - Prints a signed long // /////////////////////////////////////////////////////////////////////////// void US_PrintSigned(long n) { char buffer[32]; US_Print(ltoa(n,buffer,10)); }
/////////////////////////////////////////////////////////////////////////// // // US_PrintUnsigned() - Prints an unsigned long // /////////////////////////////////////////////////////////////////////////// void US_PrintUnsigned(longword n) { char buffer[32]; US_Print(ultoa(n,buffer,10)); }
/////////////////////////////////////////////////////////////////////////// // // US_PrintSigned() - Prints a signed long // /////////////////////////////////////////////////////////////////////////// void US_PrintSigned(int32_t n) { char buffer[32]; //slPrint(ltoa(n,buffer,10),slLocate(2,12)); US_Print(ltoa(n,buffer,10)); }
void FinishDemoRecord (void) { long length,level; demorecord = false; length = demoptr - (char far *)demobuffer; demoptr = ((char far *)demobuffer)+1; *(unsigned far *)demoptr = length; CenterWindow(24,3); PrintY+=6; US_Print(" Demo number (0-9):"); VW_UpdateScreen(); if (US_LineInput (px,py,str,NULL,true,2,0)) { level = atoi (str); if (level>=0 && level<=9) { demoname[4] = '0'+level; CA_WriteFile (demoname,(void far *)demobuffer,length); } } MM_FreePtr (&demobuffer); }
/////////////////////////////////////////////////////////////////////////// // // US_PrintUnsigned() - Prints an unsigned long // /////////////////////////////////////////////////////////////////////////// void US_PrintUnsigned(longword n) { char buffer[32]; sprintf(buffer, "%lu", n); US_Print(buffer); }
/////////////////////////////////////////////////////////////////////////// // // US_PrintSigned() - Prints a signed long // /////////////////////////////////////////////////////////////////////////// void US_PrintSigned(int32_t n) { char buffer[32]; US_Print(ltoa(n,buffer,10)); }
void US_PrintF(const char *str, ...) { char buf[256]; va_list args; va_start(args, str); vsprintf(buf, str, args); va_end(args); US_Print(buf); }
void US_Printf(const char *formatStr, ...) { char strbuf[256]; va_list vlist; va_start(vlist, formatStr); int len = vsnprintf(strbuf, sizeof(strbuf), formatStr, vlist); va_end(vlist); if(len <= -1 || len >= sizeof(strbuf)) strbuf[sizeof(strbuf) - 1] = 0; US_Print(strbuf); }
void DebugMemory (void) { VW_FixRefreshBuffer (); US_CenterWindow (16,7); US_CPrint ("Memory Usage"); US_CPrint ("------------"); US_Print ("Total :"); US_PrintUnsigned (mminfo.mainmem/1024); US_Print ("k\nFree :"); US_PrintUnsigned (MM_UnusedMemory()/1024); US_Print ("k\nWith purge:"); US_PrintUnsigned (MM_TotalFree()/1024); US_Print ("k\n"); VW_UpdateScreen(); IN_Ack (); #if GRMODE == EGAGR MM_ShowMemory (); #endif }
void CountObjects() { int i, total, count, active, inactive, doors; objtype *obj; CenterWindow (16,7); active = inactive = count = doors = 0; US_Print ("Total statics :"); total = laststatobj-&statobjlist[0]; US_PrintUnsigned (total); US_Print ("\nIn use statics:"); for (i=0;i<total;i++) if (statobjlist[i].shapenum != -1) count++; else doors++; //debug US_PrintUnsigned (count); US_Print ("\nDoors :"); US_PrintUnsigned (doornum); for (obj=player->next;obj;obj=obj->next) { if (obj->active) active++; else inactive++; } US_Print ("\nTotal actors :"); US_PrintUnsigned (active+inactive); US_Print ("\nActive actors :"); US_PrintUnsigned (active); VW_UpdateScreen(); IN_Ack(); }
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 (); }
void DebugMemory (void) { //id0_int_t i; //id0_char_t scratch[80],str[10]; //id0_long_t mem; //spritetype id0_seg *block; VW_FixRefreshBuffer (); CenterWindow (16,7); #if 0 CA_OpenDebug (); for (i=0;i<NUMCHUNKS;i++) { if (grsegs[i]) { strcpy (scratch,"Chunk:"); itoa (i,str,10); strcat (scratch,str); strcat (scratch,"\n"); write (debughandle,scratch,strlen(scratch)); } } CA_CloseDebug (); #endif US_CPrint ("Memory Usage"); US_CPrint ("------------"); US_Print ("Total :"); US_PrintUnsigned (mminfo.mainmem/1024); US_Print ("k\nFree :"); US_PrintUnsigned (MM_UnusedMemory()/1024); US_Print ("k\nWith purge:"); US_PrintUnsigned (MM_TotalFree()/1024); US_Print ("k\n"); VW_UpdateScreen(); IN_Ack (); }
/////////////////////////////////////////////////////////////////////////// // // US_Printxy() // void US_Printxy(word x, word y, char *text) { word orgx, orgy; orgx = PrintX; orgy = PrintY; // PrintX = WindowX+x; // PrintY = WindowY+y; PrintX = x; PrintY = y; US_Print(text); PrintX = orgx; PrintY = orgy; }
void SetSoundLoc(fixed gx,fixed gy) { fixed xt; fixef yt; int x=0; int y=0; // // translate point to view centered coordinates // gx -= viewx; gy -= viewy; // // calculate newx // xt = FixedByFrac(gx,viewcos); yt = FixedByFrac(gy,viewsin); x = (xt - yt) >> TILESHIFT; // // calculate newy // xt = FixedByFrac(gx,viewsin); yt = FixedByFrac(gy,viewcos); y = (yt + xt) >> TILESHIFT; if (y >= ATABLEMAX) y = ATABLEMAX - 1; else if (y <= -ATABLEMAX) y = -ATABLEMAX; if (x < 0) x = -x; if (x >= ATABLEMAX) x = ATABLEMAX - 1; leftchannel = lefttable[x][y + ATABLEMAX]; rightchannel = righttable[x][y + ATABLEMAX]; #if 0 CenterWindow(8,1); US_PrintSigned(leftchannel); US_Print(","); US_PrintSigned(rightchannel); VW_UpdateScreen(); #endif }
void CountObjects (void) { int i,total,count,active,inactive,doors; objtype *obj; CenterWindow (17,7); active = inactive = count = doors = 0; US_Print ("Total statics :"); total = (int)(laststatobj-&statobjlist[0]); US_PrintUnsigned (total); char str[60]; sprintf(str,"\nlaststatobj=%.8X",(int32_t)(uintptr_t)laststatobj); US_Print(str); US_Print ("\nIn use statics:"); for (i=0;i<total;i++) { if (statobjlist[i].shapenum != -1) count++; else doors++; //debug } US_PrintUnsigned (count); US_Print ("\nDoors :"); US_PrintUnsigned (doornum); for (obj=player->next;obj;obj=obj->next) { if (obj->active) active++; else inactive++; } US_Print ("\nTotal actors :"); US_PrintUnsigned (active+inactive); US_Print ("\nActive actors :"); US_PrintUnsigned (active); VW_UpdateScreen(); IN_Ack (); }
void Victory (void) { #ifndef SPEARDEMO long sec; int i,min,kr,sr,tr,x; char tempstr[8]; #define RATIOX 6 #define RATIOY 14 #define TIMEX 14 #define TIMEY 8 #ifdef SPEAR StartCPMusic (XTHEEND_MUS); CA_CacheGrChunk(BJCOLLAPSE1PIC); CA_CacheGrChunk(BJCOLLAPSE2PIC); CA_CacheGrChunk(BJCOLLAPSE3PIC); CA_CacheGrChunk(BJCOLLAPSE4PIC); VWB_Bar(0,0,320,200,VIEWCOLOR); VWB_DrawPic (124,44,BJCOLLAPSE1PIC); VW_UpdateScreen (); VW_FadeIn (); VW_WaitVBL(2*70); VWB_DrawPic (124,44,BJCOLLAPSE2PIC); VW_UpdateScreen (); VW_WaitVBL(105); VWB_DrawPic (124,44,BJCOLLAPSE3PIC); VW_UpdateScreen (); VW_WaitVBL(105); VWB_DrawPic (124,44,BJCOLLAPSE4PIC); VW_UpdateScreen (); VW_WaitVBL(3*70); UNCACHEGRCHUNK(BJCOLLAPSE1PIC); UNCACHEGRCHUNK(BJCOLLAPSE2PIC); UNCACHEGRCHUNK(BJCOLLAPSE3PIC); UNCACHEGRCHUNK(BJCOLLAPSE4PIC); VL_FadeOut (0,255,0,17,17,5); #endif StartCPMusic (URAHERO_MUS); ClearSplitVWB (); CacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END); CA_CacheGrChunk(STARTFONT); #ifndef SPEAR CA_CacheGrChunk(C_TIMECODEPIC); #endif VWB_Bar (0,0,320,200-STATUSLINES,127); #ifdef JAPAN #ifndef JAPDEMO CA_CacheGrChunk(C_ENDRATIOSPIC); VWB_DrawPic(0,0,C_ENDRATIOSPIC); UNCACHEGRCHUNK(C_ENDRATIOSPIC); #endif #else Write(18,2,STR_YOUWIN); Write(TIMEX,TIMEY-2,STR_TOTALTIME); Write(12,RATIOY-2,"averages"); #ifdef SPANISH Write(RATIOX+2, RATIOY, STR_RATKILL); Write(RATIOX+2, RATIOY+2, STR_RATSECRET); Write(RATIOX+2, RATIOY+4,STR_RATTREASURE); #else Write(RATIOX+8,RATIOY, STR_RATKILL); Write(RATIOX+4,RATIOY+2, STR_RATSECRET); Write(RATIOX, RATIOY+4,STR_RATTREASURE); #endif #endif #ifndef JAPDEMO VWB_DrawPic (8,4,L_BJWINSPIC); #endif #ifndef SPEAR for (kr = sr = tr = sec = i = 0;i < 8;i++) #else for (kr = sr = tr = sec = i = 0;i < 20;i++) #endif { sec += LevelRatios[i].time; kr += LevelRatios[i].kill; sr += LevelRatios[i].secret; tr += LevelRatios[i].treasure; } #ifndef SPEAR kr /= 8; sr /= 8; tr /= 8; #else kr /= 14; sr /= 14; tr /= 14; #endif min = sec/60; sec %= 60; if (min > 99) min = sec = 99; i = TIMEX*8+1; VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(min/10)); i += 2*8; VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(min%10)); i += 2*8; Write(i/8,TIMEY,":"); i += 1*8; VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(sec/10)); i += 2*8; VWB_DrawPic(i,TIMEY*8,L_NUM0PIC+(sec%10)); VW_UpdateScreen (); itoa(kr,tempstr,10); x=RATIOX+24-strlen(tempstr)*2; Write(x,RATIOY,tempstr); itoa(sr,tempstr,10); x=RATIOX+24-strlen(tempstr)*2; Write(x,RATIOY+2,tempstr); itoa(tr,tempstr,10); x=RATIOX+24-strlen(tempstr)*2; Write(x,RATIOY+4,tempstr); #ifndef SPANISH #ifndef UPLOAD #ifndef SPEAR // // TOTAL TIME VERIFICATION CODE // if (gamestate.difficulty>=gd_medium) { VWB_DrawPic (30*8,TIMEY*8,C_TIMECODEPIC); fontnumber = 0; fontcolor = READHCOLOR; PrintX = 30*8-3; PrintY = TIMEY*8+8; PrintX+=4; tempstr[0] = (((min/10)^(min%10))^0xa)+'A'; tempstr[1] = (((sec/10)^(sec%10))^0xa)+'A'; tempstr[2] = (tempstr[0]^tempstr[1])+'A'; tempstr[3] = 0; US_Print(tempstr); } #endif #endif #endif fontnumber = 1; VW_UpdateScreen (); VW_FadeIn (); IN_Ack(); #ifndef SPEAR if (Keyboard[sc_P] && MS_CheckParm("goobers")) PicturePause(); #endif VW_FadeOut (); #ifndef SPEAR UNCACHEGRCHUNK(C_TIMECODEPIC); #endif UnCacheLump(LEVELEND_LUMP_START,LEVELEND_LUMP_END); #ifndef SPEAR EndText(); #else EndSpear(); #endif #endif // SPEARDEMO }
int DebugKeys() { boolean esc; int level; if (IN_KeyDown(sc_C)) // C = count objects { CountObjects(); return 1; } if (IN_KeyDown(sc_E)) // E = quit level { playstate = ex_completed; // gamestate.mapon++; } if (IN_KeyDown(sc_F)) // F = facing spot { CenterWindow (14,4); US_Print ("X:"); US_PrintUnsigned (player->x); US_Print ("\nY:"); US_PrintUnsigned (player->y); US_Print ("\nA:"); US_PrintUnsigned (player->angle); VW_UpdateScreen(); IN_Ack(); return 1; } if (IN_KeyDown(sc_G)) // G = god mode { CenterWindow (12,2); if (godmode) US_PrintCentered ("God mode OFF"); else US_PrintCentered ("God mode ON"); VW_UpdateScreen(); IN_Ack(); godmode ^= 1; return 1; } if (IN_KeyDown(sc_H)) // H = hurt self { IN_ClearKeysDown (); TakeDamage (16,NULL); } else if (IN_KeyDown(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 (IN_KeyDown(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 (IN_KeyDown(sc_P)) // P = pause with no screen disruptioon { PicturePause (); return 1; } else if (IN_KeyDown(sc_Q)) // Q = fast quit Quit(NULL); else if (IN_KeyDown(sc_S)) // S = slow motion { singlestep^=1; CenterWindow (18,3); if (singlestep) US_PrintCentered ("Slow motion ON"); else US_PrintCentered ("Slow motion OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } else if (IN_KeyDown(sc_T)) // T = shape test { ShapeTest(); return 1; } else if (IN_KeyDown(sc_W)) // W = warp to level { CenterWindow(26,3); PrintY+=6; #ifndef SPEAR US_Print(" Warp to which level(1-10):"); #elif defined(SPEARDEMO) US_Print(" Warp to which level(1-2):"); #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) #elif defined(SPEARDEMO) if (level>0 && level<2) #else if (level>0 && level<22) #endif { gamestate.mapon = level-1; playstate = ex_warped; } } return 1; } DrawPlayBorder(); return 0; }
/* ================ = = ShapeTest = ================ */ void ShapeTest (void) { //TODO #if NOTYET extern word NumDigi; extern word *DigiList; extern int postx; extern int postwidth; extern byte *postsource; static char buf[10]; boolean done; ScanCode scan; int i,j,k,x; longword l; byte *addr; soundnames sound; // PageListStruct far *page; CenterWindow(20,16); VW_UpdateScreen(); for (i = 0,done = false; !done;) { US_ClearWindow(); sound = (soundnames) -1; // page = &PMPages[i]; US_Print(" Page #"); US_PrintUnsigned(i); if (i < PMSpriteStart) US_Print(" (Wall)"); else if (i < PMSoundStart) US_Print(" (Sprite)"); else if (i == ChunksInFile - 1) US_Print(" (Sound Info)"); else US_Print(" (Sound)"); /* US_Print("\n XMS: "); if (page->xmsPage != -1) US_PrintUnsigned(page->xmsPage); else US_Print("No"); US_Print("\n Main: "); if (page->mainPage != -1) US_PrintUnsigned(page->mainPage); else if (page->emsPage != -1) { US_Print("EMS "); US_PrintUnsigned(page->emsPage); } else US_Print("No"); US_Print("\n Last hit: "); US_PrintUnsigned(page->lastHit);*/ US_Print("\n Address: "); addr = (byte *) PM_GetPage(i); sprintf(buf,"0x%08X",(int32_t) addr); US_Print(buf); if (addr) { if (i < PMSpriteStart) { // // draw the wall // vbuf += 32*SCREENWIDTH; postx = 128; postwidth = 1; postsource = addr; for (x=0;x<64;x++,postx++,postsource+=64) { wallheight[postx] = 256; ScalePost (); } vbuf -= 32*SCREENWIDTH; } else if (i < PMSoundStart) { // // draw the sprite // vbuf += 32*SCREENWIDTH; SimpleScaleShape (160, i-PMSpriteStart, 64); vbuf -= 32*SCREENWIDTH; } else if (i == ChunksInFile - 1) { US_Print("\n\n Number of sounds: "); US_PrintUnsigned(NumDigi); for (l = j = k = 0;j < NumDigi;j++) { l += DigiList[(j * 2) + 1]; k += (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize; } US_Print("\n Total bytes: "); US_PrintUnsigned(l); US_Print("\n Total pages: "); US_PrintUnsigned(k); } else { byte *dp = addr; for (j = 0;j < NumDigi;j++) { k = (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize; if ((i >= PMSoundStart + DigiList[j * 2]) && (i < PMSoundStart + DigiList[j * 2] + k)) break; } if (j < NumDigi) { sound = (soundnames) j; US_Print("\n Sound #"); US_PrintUnsigned(j); US_Print("\n Segment #"); US_PrintUnsigned(i - PMSoundStart - DigiList[j * 2]); } for (j = 0;j < PageLengths[i];j += 32) { byte v = dp[j]; int v2 = (unsigned)v; v2 -= 128; v2 /= 4; if (v2 < 0) VWB_Vlin(WindowY + WindowH - 32 + v2, WindowY + WindowH - 32, WindowX + 8 + (j / 32),BLACK); else VWB_Vlin(WindowY + WindowH - 32, WindowY + WindowH - 32 + v2, WindowX + 8 + (j / 32),BLACK); } } } VW_UpdateScreen(); IN_Ack(); scan = LastScan; IN_ClearKey(scan); switch (scan) { case sc_LeftArrow: if (i) i--; break; case sc_RightArrow: if (++i >= ChunksInFile) i--; break; case sc_W: // Walls i = 0; break; case sc_S: // Sprites i = PMSpriteStart; break; case sc_D: // Digitized i = PMSoundStart; break; case sc_I: // Digitized info i = ChunksInFile - 1; break; /* case sc_L: // Load all pages for (j = 0;j < ChunksInFile;j++) PM_GetPage(j); break;*/ case sc_P: if (sound != -1) SD_PlayDigitized(sound,8,8); break; case sc_Escape: done = true; break; /* case sc_Enter: PM_GetPage(i); break;*/ } } SD_StopDigitized(); #endif }
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; }
void PrintHelp(void) { id0_char_t oldfontcolor = fontcolor; PrintY = 1; WindowX = 135; WindowW = 640; VW_FadeOut(); bufferofs = displayofs = screenloc[0]; VW_Bar(0,0,320,200,0); Display640(); VW_Bar(0, 0, 640, 200, 7); fontcolor = (7 ^ 1); US_Print ("\n\n SUMMARY OF GAME CONTROLS\n\n"); fontcolor = (7 ^ 4); US_Print (" ACTION\n\n"); US_Print ("Arrow keys, joystick, or mouse\n"); US_Print ("TAB or V while turning\n"); US_Print ("ALT or Button 2 while turning\n"); US_Print ("CTRL or Button 1\n"); US_Print ("Z\n"); US_Print ("X or Enter\n"); US_Print ("F1\n"); US_Print ("F2\n"); US_Print ("F3\n"); US_Print ("F4\n"); US_Print ("F5\n"); US_Print ("ESC\n\n"); fontcolor = (7 ^ 0); #ifndef CATALOG US_Print (" (See complete Instructions for more info)\n"); #endif US_Print ("\n copyright (c) 1992-93 Softdisk Publishing\n"); fontcolor = (7 ^ 8); PrintX = 400; PrintY = 37; WindowX = 400; US_Print (" REACTION\n\n"); US_Print ("Move and turn\n"); US_Print ("Turn quickly (Quick Turn)\n"); US_Print ("Move sideways\n"); US_Print ("Shoot a Missile\n"); US_Print ("Shoot a Zapper\n"); US_Print ("Shoot an Xterminator\n"); US_Print ("Help (this screen)\n"); US_Print ("Sound control\n"); US_Print ("Save game position\n"); US_Print ("Restore a saved game\n"); US_Print ("Joystick control\n"); US_Print ("System options\n\n\n"); VW_UpdateScreen(); VW_FadeIn(); VW_ColorBorder(8 | 56); IN_Ack(); Display320(); fontcolor = oldfontcolor; }
void CheckKeys (void) { //extern id0_boolean_t autofire; if (screenfaded) // don't do anything with a faded screen return; #if 0 // // pause key wierdness can't be checked as a scan code // if (Paused) { CenterWindow (8,3); US_PrintCentered ("PAUSED"); VW_UpdateScreen (); // SD_MusicOff(); IN_Ack(); // SD_MusicOn(); Paused = false; // (REFKEEN) Minor difference from vanilla Catacomb if (MousePresent) BE_ST_GetEmuAccuMouseMotion(NULL, NULL); // Clear accumulated mouse movement //if (MousePresent) Mouse(MDelta); // Clear accumulated mouse movement } else if (Keyboard[sc_Enter]) // P = pause with no screen disruptioon { // SD_MusicOff(); DisplaySMsg("PAUSED",NULL); IN_Ack(); // SD_MusicOn(); // (REFKEEN) Minor difference from vanilla Catacomb if (MousePresent) BE_ST_GetEmuAccuMouseMotion(NULL, NULL); // Clear accumulated mouse movement //if (MousePresent) Mouse(MDelta); // Clear accumulated mouse movement } else if (Keyboard[sc_S]) { id0_char_t *Text[] = {{"Slow Mode ON"},{"Slow Mode OFF"}}; SlowMode ^= 1; extravbls = SlowMode << 3; CenterWindow (8,3); US_PrintCentered (Text[SlowMode]); VW_UpdateScreen (); // SD_MusicOff(); IN_Ack(); // SD_MusicOn(); // (REFKEEN) Minor difference from vanilla Catacomb if (MousePresent) BE_ST_GetEmuAccuMouseMotion(NULL, NULL); // Clear accumulated mouse movement //if (MousePresent) Mouse(MDelta); // Clear accumulated mouse movement } #endif // F2 - SOUND OPTIONS // if (Keyboard[sc_F2]) { id0_int_t height=7; id0_boolean_t ChoiceMade = false; if (AdLibPresent) height++; VW_FixRefreshBuffer(); CenterWindow(22,height); US_Print( "\n 1 ) NO SOUND \n"); US_Print( " 2 ) PC AUDIO \n"); if (AdLibPresent) US_Print(" 3 ) ADLIB AUDIO\n"); US_Print( "\n ESC) EXIT "); VW_UpdateScreen(); // REFKEEN - Alternative controllers support extern BE_ST_ControllerMapping g_ingame_altcontrol_mapping_soundoptions; g_ingame_altcontrol_mapping_soundoptions.buttons[BE_ST_CTRL_BUT_X].mapClass = AdLibPresent ? BE_ST_CTRL_MAP_KEYSCANCODE : BE_ST_CTRL_MAP_NONE; // A bit of patching BE_ST_AltControlScheme_Push(); BE_ST_AltControlScheme_PrepareControllerMapping(&g_ingame_altcontrol_mapping_soundoptions); // Switch audio device ON/OFF & load sounds if there // was a change in the device. do { if (Keyboard[1]) // ESC - Exit ChoiceMade = true; else if (Keyboard[2]) // 1 - No Sound { SD_SetSoundMode(sdm_Off); ChoiceMade = true; } else if (Keyboard[3]) // 2 - PC Audio { SD_SetSoundMode(sdm_PC); // if (oldsoundmode != sdm_PC) CA_LoadAllSounds(); ChoiceMade = true; } else if ((Keyboard[4]) && AdLibPresent) // 3 - AdLib Audio { SD_SetSoundMode(sdm_AdLib); // if (oldsoundmode != sdm_AdLib) CA_LoadAllSounds(); ChoiceMade = true; } BE_ST_ShortSleep(); } while (!ChoiceMade); // REFKEEN - Alternative controllers support BE_ST_AltControlScheme_Pop(); tics = realtics = 1; IN_ClearKeysDown(); } // F5 - CALIBRATE JOYSTICK // if (Keyboard[sc_F5]) { CalibrateJoystick(0); tics = realtics = 1; IN_ClearKeysDown(); } deadloop:; // ESCAPE - quits game // if ((Keyboard[sc_Escape]) || (Flags & FL_DEAD)) { id0_char_t ch; DisplaySMsg("Options", NULL); status_flag = S_NONE; if (Flags & FL_DEAD) { id0_char_t choices[] = {sc_Escape,sc_R,sc_N,sc_Q,0}; ch = DisplayMsg("Restore New Quit",choices); } else { id0_char_t choices[] = {sc_Escape,sc_S,sc_R,sc_N,sc_Q,0}; ch = DisplayMsg("Save Restore New Quit",choices); } DrawText(true); switch (ch) { case sc_S: if (!(Flags & FL_DEAD)) Keyboard[sc_F3] = true; break; case sc_R: Keyboard[sc_F4] = true; break; case sc_N: DisplaySMsg("Starting anew", NULL); VW_WaitVBL(60); playstate = ex_resetgame; Flags &= ~FL_DEAD; break; case sc_Q: // REFKEEN - Alternative controllers support { extern BE_ST_ControllerMapping g_ingame_altcontrol_mapping_inackback; BE_ST_AltControlScheme_Push(); BE_ST_AltControlScheme_PrepareControllerMapping(&g_ingame_altcontrol_mapping_inackback); // REFKEEN - We don't pop this since we quit... } DisplaySMsg("FARE THEE WELL!", NULL); VW_WaitVBL(120); if (!Flags & FL_QUICK) VW_FadeOut(); NormalScreen(); FreeUpMemory(); Quit(NULL); break; } tics = realtics = 1; } // F1 - DISPLAY HELP // if (Keyboard[sc_F1]) { PrintHelp(); #ifdef TEXT_PRESENTER extern PresenterInfo MainHelpText; VW_FadeOut(); FreeUpMemory(); if (!LoadPresenterScript("HELP.TXT",&MainHelpText)) { VW_FadeIn(); CenterWindow(30,5); US_CPrint("\nError loading HELP file.\n"); US_CPrint("Press any key."); IN_Ack(); VW_FadeOut(); } else { VW_SetSplitScreen(200); bufferofs = displayofs = screenloc[0]; VW_Bar(0,0,320,200,0); Display640(); Presenter(&MainHelpText); Display320(); } FreePresenterScript(&MainHelpText); #endif VW_SetSplitScreen(120); VW_SetScreen(screenloc[0],0); screenpage = 0; CacheScaleds(); bufferofs = 0; RedrawStatusWindow(); ThreeDRefresh(); VW_FadeIn(); Keyboard[sc_F1] = false; tics = realtics = 1; IN_ClearKeysDown(); } // F3 - SAVE GAME // if ((Keyboard[sc_F3]) && (!(Flags & FL_DEAD))) { PreFullDisplay(); GE_SaveGame(); PostFullDisplay(true); tics = realtics = 1; IN_ClearKeysDown(); } // F4 - LOAD GAME // if (Keyboard[sc_F4]) { PreFullDisplay(); if (GE_LoadGame()) { loadedgame = true; playstate = ex_loadedgame; Flags &= ~FL_DEAD; lasttext = -1; PostFullDisplay(false); } else if (playstate == ex_victorious) { PostFullDisplay(false); Victory(false); IN_Ack(); // gamestate.mapon++; } else PostFullDisplay(true); Keyboard[sc_F5] = false; tics = realtics = 1; IN_ClearKeysDown(); } if (Flags & FL_DEAD) goto deadloop; // // F10-? debug keys // if (Keyboard[sc_BackSpace]) { DebugKeys(); // (REFKEEN) Minor difference from vanilla Catacomb if (MousePresent) BE_ST_GetEmuAccuMouseMotion(NULL, NULL); // Clear accumulated mouse movement //if (MousePresent) Mouse(MDelta); // Clear accumulated mouse movement lasttimecount = SD_GetTimeCount(); } }
/* ================ = = DebugKeys = ================ */ id0_int_t DebugKeys (void) { id0_boolean_t esc; id0_int_t level; #if FRILLS if (Keyboard[0x12] && ingame) // DEBUG: end + 'E' to quit level { if (tedlevel) TEDDeath(); playstate = levelcomplete; } #endif if (Keyboard[0x22] && ingame) // G = god mode { VW_FixRefreshBuffer (); US_CenterWindow (12,2); if (godmode) US_PrintCentered ("God mode OFF"); else US_PrintCentered ("God mode ON"); VW_UpdateScreen(); IN_Ack(); godmode ^= 1; return 1; } else if (Keyboard[0x17]) // I = item cheat { VW_FixRefreshBuffer (); US_CenterWindow (12,3); US_PrintCentered ("Free items!"); gamestate.boobusbombs=99; gamestate.flowerpowers=99; gamestate.keys=99; VW_UpdateScreen(); IN_Ack (); return 1; } else if (Keyboard[0x24]) // J = jump cheat { jumpcheat^=1; VW_FixRefreshBuffer (); US_CenterWindow (18,3); if (jumpcheat) US_PrintCentered ("Jump cheat ON"); else US_PrintCentered ("Jump cheat OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } #if FRILLS else if (Keyboard[0x32]) // M = memory info { DebugMemory(); return 1; } #endif else if (Keyboard[0x19]) // P = pause with no screen disruptioon { IN_Ack(); } else if (Keyboard[0x1f] && ingame) // S = slow motion { singlestep^=1; VW_FixRefreshBuffer (); US_CenterWindow (18,3); if (singlestep) US_PrintCentered ("Slow motion ON"); else US_PrintCentered ("Slow motion OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } #if FRILLS else if (Keyboard[0x14]) // T = sprite test { TestSprites(); return 1; } #endif else if (Keyboard[0x11] && ingame) // W = warp to level { VW_FixRefreshBuffer (); US_CenterWindow(26,3); PrintY+=6; US_Print(" Warp to which level(0-16):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=16) { gamestate.mapon = level; playstate = warptolevel; } } return 1; } return 0; }
void TestSprites(void) { id0_int_t hx,hy,sprite,oldsprite,bottomy,topx,shift; spritetabletype id0_far *spr; spritetype id0_seg *block; id0_unsigned_t mem,scan; VW_FixRefreshBuffer (); US_CenterWindow (30,17); US_CPrint ("Sprite Test"); US_CPrint ("-----------"); hy=PrintY; hx=(PrintX+56)&(~7); topx = hx+TEXTWIDTH; US_Print ("Chunk:\nWidth:\nHeight:\nOrgx:\nOrgy:\nXl:\nYl:\nXh:\nYh:\n" "Shifts:\nMem:\n"); bottomy = PrintY; sprite = STARTSPRITES; shift = 0; do { if (sprite>=STARTTILE8) sprite = STARTTILE8-1; else if (sprite<STARTSPRITES) sprite = STARTSPRITES; spr = &spritetable[sprite-STARTSPRITES]; block = (spritetype id0_seg *)grsegs[sprite]; VWB_Bar (hx,hy,TEXTWIDTH,bottomy-hy,WHITE); PrintX=hx; PrintY=hy; US_PrintUnsigned (sprite);US_Print ("\n");PrintX=hx; US_PrintUnsigned (spr->width);US_Print ("\n");PrintX=hx; US_PrintUnsigned (spr->height);US_Print ("\n");PrintX=hx; US_PrintSigned (spr->orgx);US_Print ("\n");PrintX=hx; US_PrintSigned (spr->orgy);US_Print ("\n");PrintX=hx; US_PrintSigned (spr->xl);US_Print ("\n");PrintX=hx; US_PrintSigned (spr->yl);US_Print ("\n");PrintX=hx; US_PrintSigned (spr->xh);US_Print ("\n");PrintX=hx; US_PrintSigned (spr->yh);US_Print ("\n");PrintX=hx; US_PrintSigned (spr->shifts);US_Print ("\n");PrintX=hx; if (!block) { US_Print ("-----"); } else { mem = block->sourceoffset[3]+5*block->planesize[3]; mem = (mem+15)&(~15); // round to paragraphs US_PrintUnsigned (mem); } oldsprite = sprite; do { // // draw the current shift, then wait for key // VWB_Bar(topx,hy,DISPWIDTH,bottomy-hy,WHITE); if (block) { PrintX = topx; PrintY = hy; US_Print ("Shift:"); US_PrintUnsigned (shift); US_Print ("\n"); VWB_DrawSprite (topx+16+shift*2,PrintY,sprite); } VW_UpdateScreen(); scan = IN_WaitForKey (); switch (scan) { case sc_UpArrow: sprite++; break; case sc_DownArrow: sprite--; break; case sc_LeftArrow: if (--shift == -1) shift = 3; break; case sc_RightArrow: if (++shift == 4) shift = 0; break; case sc_Escape: return; } } while (sprite == oldsprite); } while (1); }
void WLUser::US_PrintSigned(qint32 n) { char buffer[32]; US_Print(ltoa(n,buffer,10)); }
//------------------------------------------------------------------------- // DisplayIntroText() //------------------------------------------------------------------------- void DisplayIntroText() { #ifdef TEXT_PRESENTER PresenterInfo pi; const id0_char_t *toptext = "You stand before the gate leading into the Towne " "of Morbidity.... " "^XX"; // REFKEEN - Fix compiler warning ("" instead of "), although this isn't actually compiled const id0_char_t *bottomtext = "Enter now boldly to defeat the evil Nemesis " "deep inside the catacombs." "" "^XX"; #endif id0_char_t oldfontcolor=fontcolor; fontcolor = 14; #ifdef TEXT_PRESENTER pi.xl = 0; pi.yl = 0; pi.xh = 319; pi.yh = 1; pi.bgcolor = 0; pi.script[0] = (id0_char_t id0_far *)toptext; Presenter(&pi); pi.yl = 160; pi.yh = 161; pi.script[0] = (id0_char_t id0_far *)bottomtext; Presenter(&pi); #else PrintY = 1; PrintX = 0; WindowX = 0; WindowW = 320; US_Print (" A chilling wind greets you at the entrance\n"); US_Print (" to the Sanctuary of the Dead.\n"); PrintY = 180; fontcolor = 9; US_Print (" Shall you proceed as\n"); fontcolor = 14; US_Print (" N"); fontcolor = 9; US_Print ("ovice or"); fontcolor = 14; US_Print (" W"); fontcolor = 9; US_Print ("arrior ?"); #endif fontcolor = oldfontcolor; }
id0_int_t DebugKeys (void) { id0_boolean_t esc; id0_int_t level,i; #if 0 if (Keyboard[sc_A]) { id0_char_t levelstr[50]; id0_unsigned_t org_tile,org_mapon,msgnum; id0_boolean_t newmsg=true,newlevel=false; VW_FixRefreshBuffer (); CenterWindow (16,3); US_Print("\n"); US_CPrint("Message Test"); VW_UpdateScreen(); org_mapon = mapon; msgnum = (org_tile = *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex))-NAMESTART; while (1) { // Get outta' here // if (Keyboard[sc_Escape]) { while (Keyboard[sc_Escape]) { BE_ST_ShortSleep(); } break; } // Move to previous message // if (Keyboard[sc_UpArrow]) { if (msgnum) { msgnum--; newmsg = true; } } // Move to next message // if (Keyboard[sc_DownArrow]) { if (msgnum < 24) { msgnum++; newmsg = true; } } // Move to previous level // if (Keyboard[sc_LeftArrow]) { if (mapon) { MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3); mapon--; newlevel = true; } } // Move to next level // if (Keyboard[sc_RightArrow]) { if (mapon < LASTMAP-2) { MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3); mapon++; newlevel = true; } } // Load new level text // if (newlevel) { CA_CacheGrChunk(LEVEL1TEXT+mapon); ScanText(); newmsg = true; newlevel=false; } // Display new message text // if (newmsg) { *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) = msgnum+NAMESTART; DrawText(true); strcpy(levelstr,"Level: "); itoa(mapon,levelstr+strlen(levelstr),10); strcat(levelstr," Msg: "); itoa(msgnum,levelstr+strlen(levelstr),10); DisplaySMsg(levelstr,NULL); newmsg = false; if (Keyboard[sc_UpArrow] || Keyboard[sc_DownArrow] || Keyboard[sc_LeftArrow] || Keyboard[sc_RightArrow]) VW_WaitVBL(6); } BE_ST_ShortSleep(); } // Restore game // MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3); mapon = org_mapon; CA_CacheGrChunk(LEVEL1TEXT+mapon); ScanText(); *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) = org_tile; DrawText(true); status_flag = 0; } #endif if (Keyboard[sc_T]) { VW_FixRefreshBuffer (); CenterWindow (16,4); US_Print("Tics :"); US_PrintUnsigned (tics); US_Print("\nReal Tics :"); US_PrintUnsigned(realtics); VW_UpdateScreen(); IN_Ack (); } if (Keyboard[sc_V]) { displayofs = bufferofs = screenloc[screenpage]; CenterWindow (20,5); US_CPrint(refkeen_compat_gelib_c4_debug_str_with_gamename); //US_CPrint("\n"GAMENAME); US_CPrint(VERSION); US_CPrint(REVISION); VW_UpdateScreen(); IN_Ack (); } if (Keyboard[sc_Q]) // Q = Insta-Quit! Quit("Insta-Quit!"); if (Keyboard[sc_Z]) // Z = freeze Time { if (FreezeTime) FreezeTime = 1; // Allow refresh to dec to zero.. else StopTime(); IN_Ack(); return 1; } // if (Keyboard[sc_E]) // FaceDoor((player->x>>16l)+1,(player->y>>16l)); // FaceAngle(90); #if 0 if (Keyboard[sc_B]) // B = border color { CenterWindow(24,3); PrintY+=6; US_Print(" Border color (0-15):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=15) VW_ColorBorder (level); } return 1; } #endif #if 0 if (Keyboard[sc_C]) // C = count objects { CountObjects(); return 1; } if (Keyboard[sc_D]) // D = start / end demo record { if (DemoMode == demo_Off) StartDemoRecord (); else if (DemoMode == demo_Record) { EndDemoRecord (); playstate = ex_completed; } return 1; } #endif #if 0 if (Keyboard[sc_E]) // E = quit level { if (tedlevel) TEDDeath(); playstate = ex_warped; gamestate.mapon++; } #endif #if 0 if (Keyboard[sc_F]) // F = facing spot { CenterWindow (12,4); US_Print ("X:"); US_PrintUnsigned (player->x); US_Print ("Y:"); US_PrintUnsigned (player->y); US_Print ("A:"); US_PrintUnsigned (player->angle); VW_UpdateScreen(); IN_Ack(); return 1; } #endif if (Keyboard[sc_G]) // G = god mode { CenterWindow (12,2); if (godmode) US_PrintCentered ("God mode OFF"); else US_PrintCentered ("God mode ON"); VW_UpdateScreen(); IN_Ack(); godmode ^= 1; return 1; } #if 0 if (Keyboard[sc_H]) // H = hurt self { TakeDamage (5); } #endif if (Keyboard[sc_I]) // I = item cheat { extern id0_boolean_t redraw_gems; CenterWindow (12,3); US_PrintCentered ("Free items!"); VW_UpdateScreen(); for (i=0;i<4;i++) { GiveBolt (); GiveNuke (); GivePotion (); // if (!gamestate.keys[i]) GiveKey (i); gamestate.gems[i] = GEM_DELAY_TIME; } gamestate.gems[4] = GEM_DELAY_TIME; redraw_gems = true; for (i=0;i<8;i++) GiveScroll (i,false); IN_Ack (); return 1; } if (Keyboard[sc_M]) // M = memory info { DebugMemory(); return 1; } #if DEBUG_OVERHEAD if (Keyboard[sc_O]) // O = overhead { ViewMap(); return 1; } #endif #if 0 if (Keyboard[sc_P]) // P = pause with no screen disruptioon { PicturePause (); return 1; } #endif #if 0 if (Keyboard[sc_S]) // S = slow motion { singlestep^=1; CenterWindow (18,3); if (singlestep) US_PrintCentered ("Slow motion ON"); else US_PrintCentered ("Slow motion OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } #endif #if 0 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,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=8) extravbls = level; } return 1; } #endif if (Keyboard[sc_W]) // W = warp to level { CenterWindow(26,3); PrintY+=6; US_Print(" Warp to which level(0-18):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=LASTMAP-1) { gamestate.mapon = level; playstate = ex_warped; lasttext = -1; } } return 1; } #if 0 if (Keyboard[sc_X]) // X = item cheat { CenterWindow (12,3); US_PrintCentered ("Extra stuff!"); VW_UpdateScreen(); for (i=0;i<4;i++) { GiveBolt (); GiveNuke (); GivePotion (); } IN_Ack (); return 1; } #endif if (LastScan >= sc_1 && LastScan <= sc_8) // free scrolls { GiveScroll (LastScan-sc_1,false); IN_ClearKeysDown (); } return 0; }
void WLUser::US_PrintUnsigned(quint32 n) { char buffer[32]; sprintf(buffer, "%lu", (long unsigned int)n); US_Print(buffer); }
int DebugKeys (void) { boolean esc; int level,i; #if DEBUG_KEYS_AVAILABLE if (Keyboard[sc_R]) { CenterWindow (12,2); if (autofire) US_PrintCentered ("Rapid-Fire OFF"); else US_PrintCentered ("Rapid-Fire ON"); VW_UpdateScreen(); IN_Ack(); autofire ^= 1; return 1; } #endif #if DEBUG_KEYS_AVAILABLE if (Keyboard[sc_A]) { char levelstr[50]; unsigned org_tile,org_mapon,msgnum; boolean newmsg=true,newlevel=false; VW_FixRefreshBuffer (); CenterWindow (16,3); US_Print("\n"); US_CPrint("Message Test"); VW_UpdateScreen(); org_mapon = mapon; msgnum = (org_tile = *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex))-NAMESTART; while (1) { // Get outta' here // if (Keyboard[sc_Escape]) { while (Keyboard[sc_Escape]); break; } // Move to previous message // if (Keyboard[sc_UpArrow]) { if (msgnum) { msgnum--; newmsg = true; } } // Move to next message // if (Keyboard[sc_DownArrow]) { if (msgnum < 24) { msgnum++; newmsg = true; } } // Move to previous level // if (Keyboard[sc_LeftArrow]) { if (mapon) { MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3); mapon--; newlevel = true; } } // Move to next level // if (Keyboard[sc_RightArrow]) { if (mapon < LASTMAP-1) { MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3); mapon++; newlevel = true; } } // Load new level text // if (newlevel) { CA_CacheGrChunk(LEVEL1TEXT+mapon); ScanText(); newmsg = true; newlevel=false; } // Display new message text // if (newmsg) { *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) = msgnum+NAMESTART; DrawText(true); strcpy(levelstr,"Level: "); itoa(mapon,levelstr+strlen(levelstr),10); strcat(levelstr," Msg: "); itoa(msgnum,levelstr+strlen(levelstr),10); DisplaySMsg(levelstr,NULL); newmsg = false; if (Keyboard[sc_UpArrow] || Keyboard[sc_DownArrow] || Keyboard[sc_LeftArrow] || Keyboard[sc_RightArrow]) VW_WaitVBL(6); } } // Restore game // MM_SetPurge(&grsegs[LEVEL1TEXT+mapon],3); mapon = org_mapon; CA_CacheGrChunk(LEVEL1TEXT+mapon); ScanText(); *(mapsegs[0]+farmapylookup[player->tiley]+player->tilex) = org_tile; DrawText(true); status_flag = 0; } if (Keyboard[sc_V]) { displayofs = bufferofs = screenloc[screenpage]; CenterWindow (16,4); US_CPrint("\n"GAMENAME); US_CPrint(VERSION); US_CPrint(REVISION); VW_UpdateScreen(); IN_Ack (); } #endif if (Keyboard[sc_Q]) // Q = Insta-Quit! Quit("Insta-Quit!"); #if 0 if (Keyboard[sc_Z]) // Z = freeze Time { if (FreezeTime) FreezeTime = 1; // Allow refresh to dec to zero.. else StopTime(); IN_Ack(); return 1; } #endif // if (Keyboard[sc_E]) // FaceDoor((player->x>>16l)+1,(player->y>>16l)); // FaceAngle(90); #if 0 if (Keyboard[sc_B]) // B = border color { CenterWindow(24,3); PrintY+=6; US_Print(" Border color (0-15):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=15) VW_ColorBorder (level); } return 1; } #endif #if 1//DEBUG_KEYS_AVAILABLE if (Keyboard[sc_O]) { extern unsigned objectcount,latchmemavail; unsigned unused,total; CenterWindow (30,13); US_Print ("Objects: "); US_PrintUnsigned (objectcount); US_Print("\n\nTics: "); US_PrintUnsigned (tics); US_Print(" Real Tics: "); US_PrintUnsigned(realtics); US_Print ("\n\n Total Available: "); US_PrintUnsigned (mminfo.mainmem/1024); US_Print ("k\n Mem In Use: "); unused=MM_UnusedMemory()/1024; US_PrintUnsigned (unused); US_Print ("k\n Mem After Purge: "); total=MM_TotalFree()/1024; US_PrintUnsigned (total); US_Print ("k ("); US_PrintUnsigned (total-unused); US_Print (")\n\nLatch Mem Free: "); US_PrintUnsigned (latchmemavail); US_Print ("\n"); VW_UpdateScreen(); IN_Ack(); } if (colordelay<1) { if (Keyboard[26]) { extern unsigned *groundcolor,debug_gnd; groundcolor = &debug_gnd; debug_gnd += 0x0101; if (debug_gnd == 0x1010) debug_gnd = 0; colordelay = 10; } if (Keyboard[27]) { extern unsigned *skycolor,debug_sky; skycolor = &debug_sky; debug_sky += 0x0101; if (debug_sky == 0x1010) debug_sky = 0; colordelay = 10; } } else colordelay -= realtics; #endif #if 0 if (Keyboard[sc_C]) // C = count objects { CountObjects(); return 1; } if (Keyboard[sc_D]) // D = start / end demo record { if (DemoMode == demo_Off) StartDemoRecord (); else if (DemoMode == demo_Record) { EndDemoRecord (); playstate = ex_completed; } return 1; } #endif #if 0 if (Keyboard[sc_E]) // E = quit level { if (tedlevel) TEDDeath(); playstate = ex_warped; gamestate.mapon++; } #endif #if 0 if (Keyboard[sc_F]) // F = facing spot { CenterWindow (12,4); US_Print ("X:"); US_PrintUnsigned (player->x); US_Print ("Y:"); US_PrintUnsigned (player->y); US_Print ("A:"); US_PrintUnsigned (player->angle); VW_UpdateScreen(); IN_Ack(); return 1; } #endif if (Keyboard[sc_G]) // G = god mode { CenterWindow (12,2); if (godmode) US_PrintCentered ("God mode OFF"); else US_PrintCentered ("God mode ON"); VW_UpdateScreen(); IN_Ack(); godmode ^= 1; return 1; } #if 0 if (Keyboard[sc_H]) // H = hurt self { TakeDamage (5); } #endif if (Keyboard[sc_I]) // I = item cheat { extern boolean redraw_gems; CenterWindow (12,3); US_PrintCentered ("Free items!"); VW_UpdateScreen(); for (i=0;i<4;i++) { GiveBolt (); GiveNuke (); GivePotion (); // if (!gamestate.keys[i]) GiveKey (i); gamestate.gems[i] = GEM_DELAY_TIME; } gamestate.gems[4] = GEM_DELAY_TIME; redraw_gems = true; ///////// for (i=0;i<8;i++) ///////// GiveScroll (i,false); IN_Ack (); return 1; } #if DEBUG_OVERHEAD if (Keyboard[sc_Z]) // O is used elsewhere... { ViewMap(); return 1; } #endif #if 0 if (Keyboard[sc_P]) // P = pause with no screen disruptioon { PicturePause (); return 1; } #endif #if 0 if (Keyboard[sc_S]) // S = slow motion { singlestep^=1; CenterWindow (18,3); if (singlestep) US_PrintCentered ("Slow motion ON"); else US_PrintCentered ("Slow motion OFF"); VW_UpdateScreen(); IN_Ack (); return 1; } #endif #if 0 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,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=8) extravbls = level; } return 1; } #endif if (Keyboard[sc_W]) // W = warp to level { CenterWindow(26,3); PrintY+=6; US_Print(" Warp to which level(0-17):"); VW_UpdateScreen(); esc = !US_LineInput (px,py,str,NULL,true,2,0); if (!esc) { level = atoi (str); if (level>=0 && level<=LASTMAP-1) { gamestate.mapon = level; playstate = ex_warped; lasttext = -1; } } return 1; } #if 0 if (Keyboard[sc_X]) // X = item cheat { CenterWindow (12,3); US_PrintCentered ("Extra stuff!"); VW_UpdateScreen(); for (i=0;i<4;i++) { GiveBolt (); GiveNuke (); GivePotion (); } IN_Ack (); return 1; } #endif //////// if (LastScan >= sc_1 && LastScan <= sc_8) // free scrolls //////// { //////// GiveScroll (LastScan-sc_1,false); //////// IN_ClearKeysDown (); //////// } return 0; }