1 #include "src/lib/16_dbg.h"
\r
5 boolean dbg_debugmm=0;
\r
8 boolean dbg_debugpm=0;
\r
11 boolean dbg_debugca=0;
\r
13 #ifdef __DEBUG_InputMgr__
\r
14 boolean dbg_testkeyin=0,dbg_testcontrolnoisy=0,dbg_nointest=0;
\r
16 #ifdef __DEBUG_MAP__
\r
17 boolean dbg_maptext=0;
\r
21 boolean dbg_pagenorendermap=0,dbg_pagedelayrendermap=0;
\r
23 #ifdef __DEBUG_SPRI__
\r
24 boolean dbg_delayanimation=0;
\r
38 void ShapeTest_(global_game_variables_t *gvar)
\r
40 extern word NumDigi;
\r
41 extern word _seg *DigiList;
\r
42 static char buf[10];
\r
47 // dword l; word k,x;
\r
49 PageListStruct far *page;
\r
51 // CenterWindow(20,16);
\r
52 // VW_UpdateScreen();
\r
53 for (i = 0,done = false;!done;)
\r
55 // US_ClearWindow();
\r
58 page = &(gvar->pm.PMPages[i]);
\r
59 // US_Print(" Page #");
\r
60 // US_PrintUnsigned(i);
\r
61 printf(" Page #%u", i);
\r
62 //++ if (i < (gvar->pm.fi.PMSpriteStart))
\r
63 // US_Print(" (Wall)");
\r
64 //++ printf(" (Wall)");
\r
65 /* else if (i < (gvar->pm.fi.PMSoundStart))
\r
66 // US_Print(" (Sprite)");
\r
67 printf(" (Sprite)");
\r
68 else if (i == (gvar->pm.fi.ChunksInFile - 1))
\r
69 // US_Print(" (Sound Info)");
\r
70 printf(" (Sound Info)");
\r
72 // US_Print(" (Sound)");
\r
73 printf(" (Sound)");*/
\r
75 // US_Print("\n XMS: ");
\r
77 if (page->xmsPage != -1)
\r
78 // US_PrintUnsigned(page->xmsPage);
\r
79 printf("%u", page->xmsPage);
\r
84 // US_Print("\n Main: ");
\r
85 if (page->mainPage != -1)
\r
86 // US_PrintUnsigned(page->mainPage);
\r
87 printf("\n Main: %u", page->mainPage);
\r
88 else if (page->emsPage != -1)
\r
90 // US_Print("EMS ");
\r
91 // US_PrintUnsigned(page->emsPage);
\r
92 printf("EMS %u", page->emsPage);
\r
98 // US_Print("\n Last hit: ");
\r
99 // US_PrintUnsigned(page->lastHit);
\r
100 printf("\n Last hit: %u", page->lastHit);
\r
102 // US_Print("\n Address: ");
\r
103 printf("\n Address: ");
\r
104 addr = PM_GetPageAddress(i, gvar);
\r
105 sprintf(buf,"0x%04x",(word)addr);
\r
111 /* if (i < PMSpriteStart)
\r
116 bufferofs += 32*SCREENWIDTH;
\r
119 postsource = ((long)((unsigned)addr))<<16;
\r
120 for (x=0;x<64;x++,postx++,postsource+=64)
\r
122 wallheight[postx] = 256;
\r
125 bufferofs -= 32*SCREENWIDTH;
\r
127 else if (i < PMSoundStart)
\r
132 bufferofs += 32*SCREENWIDTH;
\r
133 SimpleScaleShape (160, i-PMSpriteStart, 64);
\r
134 bufferofs -= 32*SCREENWIDTH;
\r
136 else if (i == ChunksInFile - 1)
\r
138 US_Print("\n\n Number of sounds: ");
\r
139 US_PrintUnsigned(NumDigi);
\r
140 for (l = j = k = 0;j < NumDigi;j++)
\r
142 l += DigiList[(j * 2) + 1];
\r
143 k += (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize;
\r
145 US_Print("\n Total bytes: ");
\r
146 US_PrintUnsigned(l);
\r
147 US_Print("\n Total pages: ");
\r
148 US_PrintUnsigned(k);
\r
152 byte far *dp = (byte far *)MK_FP(addr,0);
\r
153 for (j = 0;j < NumDigi;j++)
\r
155 k = (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize;
\r
158 (i >= PMSoundStart + DigiList[j * 2])
\r
159 && (i < PMSoundStart + DigiList[j * 2] + k)
\r
166 US_Print("\n Sound #");
\r
167 US_PrintUnsigned(j);
\r
168 US_Print("\n Segment #");
\r
169 US_PrintUnsigned(i - PMSoundStart - DigiList[j * 2]);
\r
171 for (j = 0;j < page->length;j += 32)
\r
174 int v2 = (unsigned)v;
\r
178 VWB_Vlin(WindowY + WindowH - 32 + v2,
\r
179 WindowY + WindowH - 32,
\r
180 WindowX + 8 + (j / 32),BLACK);
\r
182 VWB_Vlin(WindowY + WindowH - 32,
\r
183 WindowY + WindowH - 32 + v2,
\r
184 WindowX + 8 + (j / 32),BLACK);
\r
187 printf("\naddr ok\n");
\r
190 // VW_UpdateScreen();
\r
192 while (!(scan = gvar->in.inst->LastScan))
\r
203 case sc_RightArrow:
\r
204 if (++i >= (gvar->pm.fi.ChunksInFile))
\r
207 case sc_W: // Walls
\r
210 case sc_S: // Sprites
\r
211 // i = (gvar->pm.fi.PMSpriteStart);
\r
213 case sc_D: // Digitized
\r
214 // i = (gvar->pm.fi.PMSoundStart);
\r
216 case sc_I: // Digitized info
\r
217 i = (gvar->pm.fi.ChunksInFile - 1);
\r
219 case sc_L: // Load all pages
\r
220 for (j = 0;j < (gvar->pm.fi.ChunksInFile);j++)
\r
221 PM_GetPage(j, gvar);
\r
224 // if (sound != -1)
\r
225 // SD_PlayDigitized(sound);
\r
231 PM_GetPage(i, gvar);
\r
235 //SD_StopDigitized();
\r
240 #ifdef __DEBUG_VL__
\r
242 //===========================================================================
\r
252 //#define SHOWPALVARIMODQUAD ((spv.i)%QUADWH)
\r
253 #define SHOWPALVARIMOD ((spv.i)%TILEWH)
\r
254 #define SHOWPALVARIDIV ((spv.i)/TILEWH)
\r
255 #define SHOWPALVARIMODCOND (!SHOWPALVARIMOD)
\r
256 #define SHOWPALVARIDIVCOND (!SHOWPALVARIDIV)
\r
257 #define SHOWPALVARIMODIFCOND if(SHOWPALVARIMODCOND && spv.i)
\r
258 #define SHOWPALVARIDIVIFCOND if(SHOWPALVARIDIVCOND && spv.i)
\r
259 //<PAL_SIZE/3 && spv.i)
\r
260 #define SHOWPALVARPALSIZELIMIT 255
\r
262 spv_t ShowPalVarSync (spv_t *spv)
\r
267 // if(result.paly<result.palq+TILEWH*8) result.paly+=result.mult;
\r
268 // if(result.palx<result.palq+TILEWH*12) result.palx+=result.mult;
\r
269 // modexClearRegion(&gvar->video.page[0], result.palx+TILEWH, result.paly+TILEWH, result.mult, result.mult, result.i);
\r
281 void ShowPalVal (global_game_variables_t *gvar)
\r
286 word ccolor = 3, xpos = gvar->video.page[0].dx, ypos = gvar->video.page[0].dy;
\r
289 spv.palq=(spv.mult)*TILEWH;
\r
292 // IN_UserInput(1, gvar);
\r
293 modexpdump(&gvar->video.page[0]);
\r
295 for (spv.oi = 1,done = false;!done;)
\r
297 SHOWPALVARIMODIFCOND
\r
299 if(err) printf("SHOWPALVARIMODIFCOND\n");
\r
300 if(spv.i==SHOWPALVARPALSIZELIMIT) spv.paly=(TILEWH*8)+spv.mult*SHOWPALVARIDIV;
\r
301 spv.palx=(TILEWH*12);
\r
302 }else spv.palx=(TILEWH*12)+spv.mult*SHOWPALVARIMOD;
\r
303 if(spv.i<SHOWPALVARPALSIZELIMIT) SHOWPALVARIDIVIFCOND
\r
305 if(err) printf("SHOWPALVARIDIVIFCOND\n");
\r
306 spv.paly=(TILEWH*8);
\r
307 }else spv.paly=(TILEWH*8)+spv.mult*SHOWPALVARIDIV;
\r
309 if((spv.palx<TILEWH*12 || spv.paly<TILEWH*8) && spv.i) err=true;
\r
311 if(err){ printf("ERR "); printf("%ux%u %u\n", spv.palx, spv.paly, spv.i); }
\r
315 modexpdump(&gvar->video.page[0]);
\r
316 modexClearRegion(&gvar->video.page[0], spv.palx+TILEWH, spv.paly+TILEWH, spv.mult, spv.mult, 5);
\r
317 modexClearRegion(&gvar->video.page[0], spv.palx+TILEWH+1, spv.paly+TILEWH+1, spv.mult-2, spv.mult-2, spv.i);
\r
321 #define SHOWPALVARPRINT modexprint(&(gvar->video.page[0]), xpos, ypos, 1, 0, ccolor, 8, gvar->video.VL_Started, global_temp_status_text); ypos+=8;
\r
322 sprintf(global_temp_status_text, "%03u", spv.i); SHOWPALVARPRINT
\r
323 sprintf(global_temp_status_text, "r %03u", gvar->video.palette[(spv.i*3)+0]/*>>2*/); SHOWPALVARPRINT
\r
324 sprintf(global_temp_status_text, "g %03u", gvar->video.palette[(spv.i*3)+1]/*>>2*/); SHOWPALVARPRINT
\r
325 sprintf(global_temp_status_text, "b %03u", gvar->video.palette[(spv.i*3)+2]/*>>2*/); SHOWPALVARPRINT
\r
326 xpos = gvar->video.page[0].dx; ypos = gvar->video.page[0].dy;
\r
328 while (!(scan = gvar->in.inst->LastScan))
\r
341 spv.palx=gvar->video.page[0].sw-spv.mult;
\r
342 spv.paly=gvar->video.page[0].sh-spv.mult;
\r
343 spv.i = SHOWPALVARPALSIZELIMIT;
\r
346 case sc_RightArrow:
\r
347 if (spv.i < SHOWPALVARPALSIZELIMIT)
\r
353 spv.palx=TILEWH*12;
\r
365 spv.palx=gvar->video.page[0].sw-spv.mult;
\r
366 spv.paly=gvar->video.page[0].sh-spv.mult;
\r
367 spv.i = SHOWPALVARPALSIZELIMIT;
\r
371 if (spv.i < SHOWPALVARPALSIZELIMIT)
\r
377 spv.palx=TILEWH*12;
\r
382 case sc_W: // Walls
\r
390 IN_UserInput(1, gvar);
\r