Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. // WL_DEBUG.C
  2.  
  3. #ifdef _WIN32
  4.         #include <io.h>
  5. #else
  6.         #include <unistd.h>
  7. #endif
  8.  
  9. #include "wl_def.h"
  10. #pragma hdrstop
  11.  
  12. #ifdef USE_CLOUDSKY
  13. #include "wl_cloudsky.h"
  14. #endif
  15.  
  16. /*
  17. =============================================================================
  18.  
  19.                                                  LOCAL CONSTANTS
  20.  
  21. =============================================================================
  22. */
  23.  
  24. #define VIEWTILEX       (viewwidth/16)
  25. #define VIEWTILEY       (viewheight/16)
  26.  
  27. /*
  28. =============================================================================
  29.  
  30.                                                  GLOBAL VARIABLES
  31.  
  32. =============================================================================
  33. */
  34.  
  35. #ifdef DEBUGKEYS
  36.  
  37. int DebugKeys (void);
  38.  
  39.  
  40. // from WL_DRAW.C
  41.  
  42. void ScalePost();
  43. void SimpleScaleShape (int xcenter, int shapenum, unsigned height);
  44.  
  45. /*
  46. =============================================================================
  47.  
  48.                                                  LOCAL VARIABLES
  49.  
  50. =============================================================================
  51. */
  52.  
  53. int     maporgx;
  54. int     maporgy;
  55. enum {mapview,tilemapview,actoratview,visview}  viewtype;
  56.  
  57. void ViewMap (void);
  58.  
  59. //===========================================================================
  60.  
  61. /*
  62. ==================
  63. =
  64. = CountObjects
  65. =
  66. ==================
  67. */
  68.  
  69. void CountObjects (void)
  70. {
  71.     int     i,total,count,active,inactive,doors;
  72.     objtype *obj;
  73.  
  74.     CenterWindow (17,7);
  75.     active = inactive = count = doors = 0;
  76.  
  77.     US_Print ("Total statics :");
  78.     total = (int)(laststatobj-&statobjlist[0]);
  79.     US_PrintUnsigned (total);
  80.  
  81.     char str[60];
  82.     sprintf(str,"\nlaststatobj=%.8X",(int32_t)(uintptr_t)laststatobj);
  83.     US_Print(str);
  84.  
  85.     US_Print ("\nIn use statics:");
  86.     for (i=0;i<total;i++)
  87.     {
  88.         if (statobjlist[i].shapenum != -1)
  89.             count++;
  90.         else
  91.             doors++;        //debug
  92.     }
  93.     US_PrintUnsigned (count);
  94.  
  95.     US_Print ("\nDoors         :");
  96.     US_PrintUnsigned (doornum);
  97.  
  98.     for (obj=player->next;obj;obj=obj->next)
  99.     {
  100.         if (obj->active)
  101.             active++;
  102.         else
  103.             inactive++;
  104.     }
  105.  
  106.     US_Print ("\nTotal actors  :");
  107.     US_PrintUnsigned (active+inactive);
  108.  
  109.     US_Print ("\nActive actors :");
  110.     US_PrintUnsigned (active);
  111.  
  112.     VW_UpdateScreen();
  113.     IN_Ack ();
  114. }
  115.  
  116.  
  117. //===========================================================================
  118.  
  119. /*
  120. ===================
  121. =
  122. = PictureGrabber
  123. =
  124. ===================
  125. */
  126. void PictureGrabber (void)
  127. {
  128.     static char fname[] = "WSHOT000.BMP";
  129.  
  130.     for(int i = 0; i < 1000; i++)
  131.     {
  132.         fname[7] = i % 10 + '0';
  133.         fname[6] = (i / 10) % 10 + '0';
  134.         fname[5] = i / 100 + '0';
  135.         int file = open(fname, O_RDONLY | O_BINARY);
  136.         if(file == -1) break;       // file does not exist, so use that filename
  137.         close(file);
  138.     }
  139.  
  140.     // overwrites WSHOT999.BMP if all wshot files exist
  141.  
  142.     SDL_SaveBMP(curSurface, fname);
  143.  
  144.     CenterWindow (18,2);
  145.     US_PrintCentered ("Screenshot taken");
  146.     VW_UpdateScreen();
  147.     IN_Ack();
  148. }
  149.  
  150.  
  151. //===========================================================================
  152.  
  153. /*
  154. ===================
  155. =
  156. = BasicOverhead
  157. =
  158. ===================
  159. */
  160.  
  161. void BasicOverhead (void)
  162. {
  163.     int x, y, z, offx, offy;
  164.  
  165.     z = 128/MAPSIZE; // zoom scale
  166.     offx = 320/2;
  167.     offy = (160-MAPSIZE*z)/2;
  168.  
  169. #ifdef MAPBORDER
  170.     int temp = viewsize;
  171.     NewViewSize(16);
  172.     DrawPlayBorder();
  173. #endif
  174.  
  175.     // right side (raw)
  176.  
  177.     for(x=0;x<MAPSIZE;x++)
  178.         for(y=0;y<MAPSIZE;y++)
  179.             VWB_Bar(x*z+offx, y*z+offy,z,z,(unsigned)(uintptr_t)actorat[x][y]);
  180.  
  181.     // left side (filtered)
  182.  
  183.     uintptr_t tile;
  184.     int color;
  185.     offx -= 128;
  186.  
  187.     for(x=0;x<MAPSIZE;x++)
  188.     {
  189.         for(y=0;y<MAPSIZE;y++)
  190.         {
  191.             tile = (uintptr_t)actorat[x][y];
  192.             if (ISPOINTER(tile) && ((objtype *)tile)->flags&FL_SHOOTABLE) color = 72;  // enemy
  193.             else if (!tile || ISPOINTER(tile))
  194.             {
  195.                 if (spotvis[x][y]) color = 111;  // visable
  196.                 else color = 0;  // nothing
  197.             }
  198.             else if (MAPSPOT(x,y,1) == PUSHABLETILE) color = 171;  // pushwall
  199.             else if (tile == 64) color = 158; // solid obj
  200.             else if (tile < 128) color = 154;  // walls
  201.             else if (tile < 256) color = 146;  // doors
  202.  
  203.             VWB_Bar(x*z+offx, y*z+offy,z,z,color);
  204.         }
  205.     }
  206.  
  207.     VWB_Bar(player->tilex*z+offx,player->tiley*z+offy,z,z,15); // player
  208.  
  209.     // resize the border to match
  210.  
  211.     VW_UpdateScreen();
  212.     IN_Ack();
  213.  
  214. #ifdef MAPBORDER
  215.     NewViewSize(temp);
  216.     DrawPlayBorder();
  217. #endif
  218. }
  219.  
  220.  
  221. //===========================================================================
  222.  
  223. /*
  224. ================
  225. =
  226. = ShapeTest
  227. =
  228. ================
  229. */
  230.  
  231. void ShapeTest (void)
  232. {
  233.     //TODO
  234. #if NOTYET
  235.     extern  word    NumDigi;
  236.     extern  word    *DigiList;
  237.     extern  int     postx;
  238.     extern  int     postwidth;
  239.     extern  byte    *postsource;
  240.     static  char    buf[10];
  241.  
  242.     boolean         done;
  243.     ScanCode        scan;
  244.     int             i,j,k,x;
  245.     longword        l;
  246.     byte            *addr;
  247.     soundnames      sound;
  248.     //      PageListStruct  far *page;
  249.  
  250.     CenterWindow(20,16);
  251.     VW_UpdateScreen();
  252.     for (i = 0,done = false; !done;)
  253.     {
  254.         US_ClearWindow();
  255.         sound = (soundnames) -1;
  256.  
  257.         //              page = &PMPages[i];
  258.         US_Print(" Page #");
  259.         US_PrintUnsigned(i);
  260.         if (i < PMSpriteStart)
  261.             US_Print(" (Wall)");
  262.         else if (i < PMSoundStart)
  263.             US_Print(" (Sprite)");
  264.         else if (i == ChunksInFile - 1)
  265.             US_Print(" (Sound Info)");
  266.         else
  267.             US_Print(" (Sound)");
  268.  
  269.         /*              US_Print("\n XMS: ");
  270.         if (page->xmsPage != -1)
  271.         US_PrintUnsigned(page->xmsPage);
  272.         else
  273.         US_Print("No");
  274.  
  275.         US_Print("\n Main: ");
  276.         if (page->mainPage != -1)
  277.         US_PrintUnsigned(page->mainPage);
  278.         else if (page->emsPage != -1)
  279.         {
  280.         US_Print("EMS ");
  281.         US_PrintUnsigned(page->emsPage);
  282.         }
  283.         else
  284.         US_Print("No");
  285.  
  286.         US_Print("\n Last hit: ");
  287.         US_PrintUnsigned(page->lastHit);*/
  288.  
  289.         US_Print("\n Address: ");
  290.         addr = (byte *) PM_GetPage(i);
  291.         sprintf(buf,"0x%08X",(int32_t) addr);
  292.         US_Print(buf);
  293.  
  294.         if (addr)
  295.         {
  296.             if (i < PMSpriteStart)
  297.             {
  298.                 //
  299.                 // draw the wall
  300.                 //
  301.                 vbuf += 32*SCREENWIDTH;
  302.                 postx = 128;
  303.                 postwidth = 1;
  304.                 postsource = addr;
  305.                 for (x=0;x<64;x++,postx++,postsource+=64)
  306.                 {
  307.                     wallheight[postx] = 256;
  308.                     ScalePost ();
  309.                 }
  310.                 vbuf -= 32*SCREENWIDTH;
  311.             }
  312.             else if (i < PMSoundStart)
  313.             {
  314.                 //
  315.                 // draw the sprite
  316.                 //
  317.                 vbuf += 32*SCREENWIDTH;
  318.                 SimpleScaleShape (160, i-PMSpriteStart, 64);
  319.                 vbuf -= 32*SCREENWIDTH;
  320.             }
  321.             else if (i == ChunksInFile - 1)
  322.             {
  323.                 US_Print("\n\n Number of sounds: ");
  324.                 US_PrintUnsigned(NumDigi);
  325.                 for (l = j = k = 0;j < NumDigi;j++)
  326.                 {
  327.                     l += DigiList[(j * 2) + 1];
  328.                     k += (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize;
  329.                 }
  330.                 US_Print("\n Total bytes: ");
  331.                 US_PrintUnsigned(l);
  332.                 US_Print("\n Total pages: ");
  333.                 US_PrintUnsigned(k);
  334.             }
  335.             else
  336.             {
  337.                 byte *dp = addr;
  338.                 for (j = 0;j < NumDigi;j++)
  339.                 {
  340.                     k = (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize;
  341.                     if ((i >= PMSoundStart + DigiList[j * 2])
  342.                             && (i < PMSoundStart + DigiList[j * 2] + k))
  343.                         break;
  344.                 }
  345.                 if (j < NumDigi)
  346.                 {
  347.                     sound = (soundnames) j;
  348.                     US_Print("\n Sound #");
  349.                     US_PrintUnsigned(j);
  350.                     US_Print("\n Segment #");
  351.                     US_PrintUnsigned(i - PMSoundStart - DigiList[j * 2]);
  352.                 }
  353.                 for (j = 0;j < PageLengths[i];j += 32)
  354.                 {
  355.                     byte v = dp[j];
  356.                     int v2 = (unsigned)v;
  357.                     v2 -= 128;
  358.                     v2 /= 4;
  359.                     if (v2 < 0)
  360.                         VWB_Vlin(WindowY + WindowH - 32 + v2,
  361.                         WindowY + WindowH - 32,
  362.                         WindowX + 8 + (j / 32),BLACK);
  363.                     else
  364.                         VWB_Vlin(WindowY + WindowH - 32,
  365.                         WindowY + WindowH - 32 + v2,
  366.                         WindowX + 8 + (j / 32),BLACK);
  367.                 }
  368.             }
  369.         }
  370.  
  371.         VW_UpdateScreen();
  372.  
  373.         IN_Ack();
  374.         scan = LastScan;
  375.  
  376.         IN_ClearKey(scan);
  377.         switch (scan)
  378.         {
  379.             case sc_LeftArrow:
  380.                 if (i)
  381.                     i--;
  382.                 break;
  383.             case sc_RightArrow:
  384.                 if (++i >= ChunksInFile)
  385.                     i--;
  386.                 break;
  387.             case sc_W:      // Walls
  388.                 i = 0;
  389.                 break;
  390.             case sc_S:      // Sprites
  391.                 i = PMSpriteStart;
  392.                 break;
  393.             case sc_D:      // Digitized
  394.                 i = PMSoundStart;
  395.                 break;
  396.             case sc_I:      // Digitized info
  397.                 i = ChunksInFile - 1;
  398.                 break;
  399. /*            case sc_L:      // Load all pages
  400.                 for (j = 0;j < ChunksInFile;j++)
  401.                     PM_GetPage(j);
  402.                 break;*/
  403.             case sc_P:
  404.                 if (sound != -1)
  405.                     SD_PlayDigitized(sound,8,8);
  406.                 break;
  407.             case sc_Escape:
  408.                 done = true;
  409.                 break;
  410. /*            case sc_Enter:
  411.                 PM_GetPage(i);
  412.                 break;*/
  413.         }
  414.     }
  415.     SD_StopDigitized();
  416. #endif
  417. }
  418.  
  419.  
  420. //===========================================================================
  421.  
  422.  
  423. /*
  424. ================
  425. =
  426. = DebugKeys
  427. =
  428. ================
  429. */
  430.  
  431. int DebugKeys (void)
  432. {
  433.     boolean esc;
  434.     int level;
  435.  
  436.     if (Keyboard[sc_B])             // B = border color
  437.     {
  438.         CenterWindow(20,3);
  439.         PrintY+=6;
  440.         US_Print(" Border color (0-56): ");
  441.         VW_UpdateScreen();
  442.         esc = !US_LineInput (px,py,str,NULL,true,2,0);
  443.         if (!esc)
  444.         {
  445.             level = atoi (str);
  446.             if (level>=0 && level<=99)
  447.             {
  448.                 if (level<30) level += 31;
  449.                 else
  450.                 {
  451.                     if (level > 56) level=31;
  452.                     else level -= 26;
  453.                 }
  454.  
  455.                 bordercol=level*4+3;
  456.  
  457.                 if (bordercol == VIEWCOLOR)
  458.                     DrawStatusBorder(bordercol);
  459.  
  460.                 DrawPlayBorder();
  461.  
  462.                 return 0;
  463.             }
  464.         }
  465.         return 1;
  466.     }
  467.     if (Keyboard[sc_C])             // C = count objects
  468.     {
  469.         CountObjects();
  470.         return 1;
  471.     }
  472.     if (Keyboard[sc_D])             // D = Darkone's FPS counter
  473.     {
  474.         CenterWindow (22,2);
  475.         if (fpscounter)
  476.             US_PrintCentered ("Darkone's FPS Counter OFF");
  477.         else
  478.             US_PrintCentered ("Darkone's FPS Counter ON");
  479.         VW_UpdateScreen();
  480.         IN_Ack();
  481.         fpscounter ^= 1;
  482.         return 1;
  483.     }
  484.     if (Keyboard[sc_E])             // E = quit level
  485.         playstate = ex_completed;
  486.  
  487.     if (Keyboard[sc_F])             // F = facing spot
  488.     {
  489.         char str[60];
  490.         CenterWindow (14,6);
  491.         US_Print ("x:");     US_PrintUnsigned (player->x);
  492.         US_Print (" (");     US_PrintUnsigned (player->x%65536);
  493.         US_Print (")\ny:");  US_PrintUnsigned (player->y);
  494.         US_Print (" (");     US_PrintUnsigned (player->y%65536);
  495.         US_Print (")\nA:");  US_PrintUnsigned (player->angle);
  496.         US_Print (" X:");    US_PrintUnsigned (player->tilex);
  497.         US_Print (" Y:");    US_PrintUnsigned (player->tiley);
  498.         US_Print ("\n1:");   US_PrintUnsigned (tilemap[player->tilex][player->tiley]);
  499.         sprintf(str," 2:%.8X",(unsigned)(uintptr_t)actorat[player->tilex][player->tiley]); US_Print(str);
  500.         US_Print ("\nf 1:"); US_PrintUnsigned (player->areanumber);
  501.         US_Print (" 2:");    US_PrintUnsigned (MAPSPOT(player->tilex,player->tiley,1));
  502.         US_Print (" 3:");
  503.         if ((unsigned)(uintptr_t)actorat[player->tilex][player->tiley] < 256)
  504.             US_PrintUnsigned (spotvis[player->tilex][player->tiley]);
  505.         else
  506.             US_PrintUnsigned (actorat[player->tilex][player->tiley]->flags);
  507.         VW_UpdateScreen();
  508.         IN_Ack();
  509.         return 1;
  510.     }
  511.  
  512.     if (Keyboard[sc_G])             // G = god mode
  513.     {
  514.         CenterWindow (12,2);
  515.         if (godmode == 0)
  516.             US_PrintCentered ("God mode ON");
  517.         else if (godmode == 1)
  518.             US_PrintCentered ("God (no flash)");
  519.         else if (godmode == 2)
  520.             US_PrintCentered ("God mode OFF");
  521.  
  522.         VW_UpdateScreen();
  523.         IN_Ack();
  524.         if (godmode != 2)
  525.             godmode++;
  526.         else
  527.             godmode = 0;
  528.         return 1;
  529.     }
  530.     if (Keyboard[sc_H])             // H = hurt self
  531.     {
  532.         IN_ClearKeysDown ();
  533.         TakeDamage (16,NULL);
  534.     }
  535.     else if (Keyboard[sc_I])        // I = item cheat
  536.     {
  537.         CenterWindow (12,3);
  538.         US_PrintCentered ("Free items!");
  539.         VW_UpdateScreen();
  540.         GivePoints (100000);
  541.         HealSelf (99);
  542.         if (gamestate.bestweapon<wp_chaingun)
  543.             GiveWeapon (gamestate.bestweapon+1);
  544.         gamestate.ammo += 50;
  545.         if (gamestate.ammo > 99)
  546.             gamestate.ammo = 99;
  547.         DrawAmmo ();
  548.         IN_Ack ();
  549.         return 1;
  550.     }
  551.     else if (Keyboard[sc_K])        // K = give keys
  552.     {
  553.         CenterWindow(16,3);
  554.         PrintY+=6;
  555.         US_Print("  Give Key (1-4): ");
  556.         VW_UpdateScreen();
  557.         esc = !US_LineInput (px,py,str,NULL,true,1,0);
  558.         if (!esc)
  559.         {
  560.             level = atoi (str);
  561.             if (level>0 && level<5)
  562.                 GiveKey(level-1);
  563.         }
  564.         return 1;
  565.     }
  566.     else if (Keyboard[sc_L])        // L = level ratios
  567.     {
  568.         byte x,start,end=LRpack;
  569.  
  570.         if (end == 8)   // wolf3d
  571.         {
  572.             CenterWindow(17,10);
  573.             start = 0;
  574.         }
  575.         else            // sod
  576.         {
  577.             CenterWindow(17,12);
  578.             start = 0; end = 10;
  579.         }
  580. again:
  581.         for(x=start;x<end;x++)
  582.         {
  583.             US_PrintUnsigned(x+1);
  584.             US_Print(" ");
  585.             US_PrintUnsigned(LevelRatios[x].time/60);
  586.             US_Print(":");
  587.             if (LevelRatios[x].time%60 < 10)
  588.                 US_Print("0");
  589.             US_PrintUnsigned(LevelRatios[x].time%60);
  590.             US_Print(" ");
  591.             US_PrintUnsigned(LevelRatios[x].kill);
  592.             US_Print("% ");
  593.             US_PrintUnsigned(LevelRatios[x].secret);
  594.             US_Print("% ");
  595.             US_PrintUnsigned(LevelRatios[x].treasure);
  596.             US_Print("%\n");
  597.         }
  598.         VW_UpdateScreen();
  599.         IN_Ack();
  600.         if (end == 10 && gamestate.mapon > 9)
  601.         {
  602.             start = 10; end = 20;
  603.             CenterWindow(17,12);
  604.             goto again;
  605.         }
  606.  
  607.         return 1;
  608.     }
  609.     else if (Keyboard[sc_N])        // N = no clip
  610.     {
  611.         noclip^=1;
  612.         CenterWindow (18,3);
  613.         if (noclip)
  614.             US_PrintCentered ("No clipping ON");
  615.         else
  616.             US_PrintCentered ("No clipping OFF");
  617.         VW_UpdateScreen();
  618.         IN_Ack ();
  619.         return 1;
  620.     }
  621.     else if (Keyboard[sc_O])        // O = basic overhead
  622.     {
  623.         BasicOverhead();
  624.         return 1;
  625.     }
  626.     else if(Keyboard[sc_P])         // P = Ripper's picture grabber
  627.     {
  628.         PictureGrabber();
  629.         return 1;
  630.     }
  631.     else if (Keyboard[sc_Q])        // Q = fast quit
  632.         Quit (NULL);
  633.     else if (Keyboard[sc_S])        // S = slow motion
  634.     {
  635.         CenterWindow(30,3);
  636.         PrintY+=6;
  637.         US_Print(" Slow Motion steps (default 14): ");
  638.         VW_UpdateScreen();
  639.         esc = !US_LineInput (px,py,str,NULL,true,2,0);
  640.         if (!esc)
  641.         {
  642.             level = atoi (str);
  643.             if (level>=0 && level<=50)
  644.                 singlestep = level;
  645.         }
  646.         return 1;
  647.     }
  648.     else if (Keyboard[sc_T])        // T = shape test
  649.     {
  650.         ShapeTest ();
  651.         return 1;
  652.     }
  653.     else if (Keyboard[sc_V])        // V = extra VBLs
  654.     {
  655.         CenterWindow(30,3);
  656.         PrintY+=6;
  657.         US_Print("  Add how many extra VBLs(0-8): ");
  658.         VW_UpdateScreen();
  659.         esc = !US_LineInput (px,py,str,NULL,true,1,0);
  660.         if (!esc)
  661.         {
  662.             level = atoi (str);
  663.             if (level>=0 && level<=8)
  664.                 extravbls = level;
  665.         }
  666.         return 1;
  667.     }
  668.     else if (Keyboard[sc_W])        // W = warp to level
  669.     {
  670.         CenterWindow(26,3);
  671.         PrintY+=6;
  672. #ifndef SPEAR
  673.         US_Print("  Warp to which level(1-10): ");
  674. #else
  675.         US_Print("  Warp to which level(1-21): ");
  676. #endif
  677.         VW_UpdateScreen();
  678.         esc = !US_LineInput (px,py,str,NULL,true,2,0);
  679.         if (!esc)
  680.         {
  681.             level = atoi (str);
  682. #ifndef SPEAR
  683.             if (level>0 && level<11)
  684. #else
  685.             if (level>0 && level<22)
  686. #endif
  687.             {
  688.                 gamestate.mapon = level-1;
  689.                 playstate = ex_warped;
  690.             }
  691.         }
  692.         return 1;
  693.     }
  694.     else if (Keyboard[sc_X])        // X = item cheat
  695.     {
  696.         CenterWindow (12,3);
  697.         US_PrintCentered ("Extra stuff!");
  698.         VW_UpdateScreen();
  699.         // DEBUG: put stuff here
  700.         IN_Ack ();
  701.         return 1;
  702.     }
  703. #ifdef USE_CLOUDSKY
  704.     else if(Keyboard[sc_Z])
  705.     {
  706.         char defstr[15];
  707.  
  708.         CenterWindow(34,4);
  709.         PrintY+=6;
  710.         US_Print("  Recalculate sky with seek: ");
  711.         int seekpx = px, seekpy = py;
  712.         US_PrintUnsigned(curSky->seed);
  713.         US_Print("\n  Use color map (0-");
  714.         US_PrintUnsigned(numColorMaps - 1);
  715.         US_Print("): ");
  716.         int mappx = px, mappy = py;
  717.         US_PrintUnsigned(curSky->colorMapIndex);
  718.         VW_UpdateScreen();
  719.  
  720.         sprintf(defstr, "%u", curSky->seed);
  721.         esc = !US_LineInput(seekpx, seekpy, str, defstr, true, 10, 0);
  722.         if(esc) return 0;
  723.         curSky->seed = (uint32_t) atoi(str);
  724.  
  725.         sprintf(defstr, "%u", curSky->colorMapIndex);
  726.         esc = !US_LineInput(mappx, mappy, str, defstr, true, 10, 0);
  727.         if(esc) return 0;
  728.         uint32_t newInd = (uint32_t) atoi(str);
  729.         if(newInd < (uint32_t) numColorMaps)
  730.         {
  731.             curSky->colorMapIndex = newInd;
  732.             InitSky();
  733.         }
  734.         else
  735.         {
  736.             CenterWindow (18,3);
  737.             US_PrintCentered ("Illegal color map!");
  738.             VW_UpdateScreen();
  739.             IN_Ack ();
  740.         }
  741.     }
  742. #endif
  743.  
  744.     return 0;
  745. }
  746.  
  747.  
  748. #if 0
  749. /*
  750. ===================
  751. =
  752. = OverheadRefresh
  753. =
  754. ===================
  755. */
  756.  
  757. void OverheadRefresh (void)
  758. {
  759.     unsigned        x,y,endx,endy,sx,sy;
  760.     unsigned        tile;
  761.  
  762.  
  763.     endx = maporgx+VIEWTILEX;
  764.     endy = maporgy+VIEWTILEY;
  765.  
  766.     for (y=maporgy;y<endy;y++)
  767.     {
  768.         for (x=maporgx;x<endx;x++)
  769.         {
  770.             sx = (x-maporgx)*16;
  771.             sy = (y-maporgy)*16;
  772.  
  773.             switch (viewtype)
  774.             {
  775. #if 0
  776.                 case mapview:
  777.                     tile = *(mapsegs[0]+farmapylookup[y]+x);
  778.                     break;
  779.  
  780.                 case tilemapview:
  781.                     tile = tilemap[x][y];
  782.                     break;
  783.  
  784.                 case visview:
  785.                     tile = spotvis[x][y];
  786.                     break;
  787. #endif
  788.                 case actoratview:
  789.                     tile = (unsigned)actorat[x][y];
  790.                     break;
  791.             }
  792.  
  793.             if (tile<MAXWALLTILES)
  794.                 LatchDrawTile(sx,sy,tile);
  795.             else
  796.             {
  797.                 LatchDrawChar(sx,sy,NUMBERCHARS+((tile&0xf000)>>12));
  798.                 LatchDrawChar(sx+8,sy,NUMBERCHARS+((tile&0x0f00)>>8));
  799.                 LatchDrawChar(sx,sy+8,NUMBERCHARS+((tile&0x00f0)>>4));
  800.                 LatchDrawChar(sx+8,sy+8,NUMBERCHARS+(tile&0x000f));
  801.             }
  802.         }
  803.     }
  804. }
  805. #endif
  806.  
  807. #if 0
  808. /*
  809. ===================
  810. =
  811. = ViewMap
  812. =
  813. ===================
  814. */
  815.  
  816. void ViewMap (void)
  817. {
  818.     boolean         button0held;
  819.  
  820.     viewtype = actoratview;
  821.     //      button0held = false;
  822.  
  823.  
  824.     maporgx = player->tilex - VIEWTILEX/2;
  825.     if (maporgx<0)
  826.         maporgx = 0;
  827.     if (maporgx>MAPSIZE-VIEWTILEX)
  828.         maporgx=MAPSIZE-VIEWTILEX;
  829.     maporgy = player->tiley - VIEWTILEY/2;
  830.     if (maporgy<0)
  831.         maporgy = 0;
  832.     if (maporgy>MAPSIZE-VIEWTILEY)
  833.         maporgy=MAPSIZE-VIEWTILEY;
  834.  
  835.     do
  836.     {
  837.         //
  838.         // let user pan around
  839.         //
  840.         PollControls ();
  841.         if (controlx < 0 && maporgx>0)
  842.             maporgx--;
  843.         if (controlx > 0 && maporgx<mapwidth-VIEWTILEX)
  844.             maporgx++;
  845.         if (controly < 0 && maporgy>0)
  846.             maporgy--;
  847.         if (controly > 0 && maporgy<mapheight-VIEWTILEY)
  848.             maporgy++;
  849.  
  850. #if 0
  851.         if (c.button0 && !button0held)
  852.         {
  853.             button0held = true;
  854.             viewtype++;
  855.             if (viewtype>visview)
  856.                 viewtype = mapview;
  857.         }
  858.         if (!c.button0)
  859.             button0held = false;
  860. #endif
  861.  
  862.         OverheadRefresh ();
  863.  
  864.     } while (!Keyboard[sc_Escape]);
  865.  
  866.     IN_ClearKeysDown ();
  867. }
  868. #endif
  869. #endif
  870.