1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2022 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
\r
4 * This file is part of Project 16.
\r
6 * Project 16 is free software; you can redistribute it and/or modify
\r
7 * it under the terms of the GNU General Public License as published by
\r
8 * the Free Software Foundation; either version 3 of the License, or
\r
9 * (at your option) any later version.
\r
11 * Project 16 is distributed in the hope that it will be useful,
\r
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
14 * GNU General Public License for more details.
\r
16 * You should have received a copy of the GNU General Public License
\r
17 * along with this program. If not, see <http://www.gnu.org/licenses/>, or
\r
18 * write to the Free Software Foundation, Inc., 51 Franklin Street,
\r
19 * Fifth Floor, Boston, MA 02110-1301 USA.
\r
23 #include "src/lib/16_dbg.h"
\r
27 boolean dbg_debugmm=0;
\r
30 boolean dbg_debugpm=0;
\r
33 boolean dbg_debugca=0;
\r
35 #ifdef __DEBUG_InputMgr__
\r
36 boolean dbg_testkeyin=0,dbg_testcontrolnoisy=0,dbg_nointest=0,dbg_joymousedelta=0;
\r
38 #ifdef __DEBUG_MAP__
\r
39 boolean dbg_maptext=0;
\r
43 boolean dbg_pagenorendermap=0,dbg_pagedelayrendermap=0;
\r
45 #ifdef __DEBUG_SPRI__
\r
46 boolean dbg_delayanimation=0;
\r
60 void ShapeTest_(global_game_variables_t *gvar)
\r
62 extern word NumDigi;
\r
63 extern word _seg *DigiList;
\r
64 static char buf[10];
\r
69 // dword l; word k,x;
\r
71 PageListStruct far *page;
\r
73 // CenterWindow(20,16);
\r
74 // VW_UpdateScreen();
\r
75 for (i = 0,done = false;!done;)
\r
77 // US_ClearWindow();
\r
80 page = &(gvar->pm.PMPages[i]);
\r
81 // US_Print(" Page #");
\r
82 // US_PrintUnsigned(i);
\r
83 printf(" Page #%u", i);
\r
84 //++ if (i < (gvar->pm.fi.PMSpriteStart))
\r
85 // US_Print(" (Wall)");
\r
86 //++ printf(" (Wall)");
\r
87 /* else if (i < (gvar->pm.fi.PMSoundStart))
\r
88 // US_Print(" (Sprite)");
\r
89 printf(" (Sprite)");
\r
90 else if (i == (gvar->pm.fi.ChunksInFile - 1))
\r
91 // US_Print(" (Sound Info)");
\r
92 printf(" (Sound Info)");
\r
94 // US_Print(" (Sound)");
\r
95 printf(" (Sound)");*/
\r
97 // US_Print("\n XMS: ");
\r
99 if (page->xmsPage != -1)
\r
100 // US_PrintUnsigned(page->xmsPage);
\r
101 printf("%u", page->xmsPage);
\r
106 // US_Print("\n Main: ");
\r
107 if (page->mainPage != -1)
\r
108 // US_PrintUnsigned(page->mainPage);
\r
109 printf("\n Main: %u", page->mainPage);
\r
110 else if (page->emsPage != -1)
\r
112 // US_Print("EMS ");
\r
113 // US_PrintUnsigned(page->emsPage);
\r
114 printf("EMS %u", page->emsPage);
\r
120 // US_Print("\n Last hit: ");
\r
121 // US_PrintUnsigned(page->lastHit);
\r
122 printf("\n Last hit: %u", page->lastHit);
\r
124 // US_Print("\n Address: ");
\r
125 printf("\n Address: ");
\r
126 addr = PM_GetPageAddress(i, gvar);
\r
127 sprintf(buf,"0x%04x",(word)addr);
\r
133 /* if (i < PMSpriteStart)
\r
138 bufferofs += 32*SCREENWIDTH;
\r
141 postsource = ((long)((unsigned)addr))<<16;
\r
142 for (x=0;x<64;x++,postx++,postsource+=64)
\r
144 wallheight[postx] = 256;
\r
147 bufferofs -= 32*SCREENWIDTH;
\r
149 else if (i < PMSoundStart)
\r
154 bufferofs += 32*SCREENWIDTH;
\r
155 SimpleScaleShape (160, i-PMSpriteStart, 64);
\r
156 bufferofs -= 32*SCREENWIDTH;
\r
158 else if (i == ChunksInFile - 1)
\r
160 US_Print("\n\n Number of sounds: ");
\r
161 US_PrintUnsigned(NumDigi);
\r
162 for (l = j = k = 0;j < NumDigi;j++)
\r
164 l += DigiList[(j * 2) + 1];
\r
165 k += (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize;
\r
167 US_Print("\n Total bytes: ");
\r
168 US_PrintUnsigned(l);
\r
169 US_Print("\n Total pages: ");
\r
170 US_PrintUnsigned(k);
\r
174 byte far *dp = (byte far *)MK_FP(addr,0);
\r
175 for (j = 0;j < NumDigi;j++)
\r
177 k = (DigiList[(j * 2) + 1] + (PMPageSize - 1)) / PMPageSize;
\r
180 (i >= PMSoundStart + DigiList[j * 2])
\r
181 && (i < PMSoundStart + DigiList[j * 2] + k)
\r
188 US_Print("\n Sound #");
\r
189 US_PrintUnsigned(j);
\r
190 US_Print("\n Segment #");
\r
191 US_PrintUnsigned(i - PMSoundStart - DigiList[j * 2]);
\r
193 for (j = 0;j < page->length;j += 32)
\r
196 int v2 = (unsigned)v;
\r
200 VWB_Vlin(WindowY + WindowH - 32 + v2,
\r
201 WindowY + WindowH - 32,
\r
202 WindowX + 8 + (j / 32),BLACK);
\r
204 VWB_Vlin(WindowY + WindowH - 32,
\r
205 WindowY + WindowH - 32 + v2,
\r
206 WindowX + 8 + (j / 32),BLACK);
\r
209 printf("\naddr ok\n");
\r
212 // VW_UpdateScreen();
\r
214 while (!(scan = gvar->in.inst->LastScan))
\r
225 case sc_RightArrow:
\r
226 if (++i >= (gvar->pm.fi.ChunksInFile))
\r
229 case sc_W: // Walls
\r
232 case sc_S: // Sprites
\r
233 // i = (gvar->pm.fi.PMSpriteStart);
\r
235 case sc_D: // Digitized
\r
236 // i = (gvar->pm.fi.PMSoundStart);
\r
238 case sc_I: // Digitized info
\r
239 i = (gvar->pm.fi.ChunksInFile - 1);
\r
241 case sc_L: // Load all pages
\r
242 for (j = 0;j < (gvar->pm.fi.ChunksInFile);j++)
\r
243 PM_GetPage(j, gvar);
\r
246 // if (sound != -1)
\r
247 // SD_PlayDigitized(sound);
\r
253 PM_GetPage(i, gvar);
\r
257 //SD_StopDigitized();
\r
262 #ifdef __DEBUG_VL__
\r
264 //===========================================================================
\r
274 //#define SHOWPALVARIMODQUAD ((spv.i)%QUADWH)
\r
275 #define SHOWPALVARIMOD ((spv.i)%TILEWH)
\r
276 #define SHOWPALVARIDIV ((spv.i)/TILEWH)
\r
277 #define SHOWPALVARIMODIFCOND if((!SHOWPALVARIMOD) && spv.i)
\r
278 #define SHOWPALVARIDIVIFCOND if((!SHOWPALVARIDIV) && spv.i)
\r
279 //<PAL_SIZE/3 && spv.i)
\r
280 #define SHOWPALVARPALSIZELIMIT 255
\r
282 spv_t ShowPalVarSync (spv_t *spv)
\r
287 // if(result.paly<result.palq+TILEWH*8) result.paly+=result.mult;
\r
288 // if(result.palx<result.palq+TILEWH*12) result.palx+=result.mult;
\r
289 // modexClearRegion(&gvar->video.page[0], result.palx+TILEWH, result.paly+TILEWH, result.mult, result.mult, result.i);
\r
301 void ShowPalVal (global_game_variables_t *gvar)
\r
306 word ccolor = 3, xpos = gvar->video.page[0].dx, ypos = gvar->video.page[0].dy;
\r
309 spv.palq=(spv.mult)*TILEWH;
\r
312 // IN_UserInput(1, gvar);
\r
313 modexpdump(0, gvar);
\r
315 for (spv.oi = 1,done = false;!done;)
\r
317 SHOWPALVARIMODIFCOND
\r
319 if(err) printf("SHOWPALVARIMODIFCOND\n");
\r
320 if(spv.i==SHOWPALVARPALSIZELIMIT) spv.paly=(TILEWH*8)+spv.mult*SHOWPALVARIDIV;
\r
321 spv.palx=(TILEWH*12);
\r
322 }else spv.palx=(TILEWH*12)+spv.mult*SHOWPALVARIMOD;
\r
323 if(spv.i<SHOWPALVARPALSIZELIMIT) SHOWPALVARIDIVIFCOND
\r
325 if(err) printf("SHOWPALVARIDIVIFCOND\n");
\r
326 spv.paly=(TILEWH*8);
\r
327 }else spv.paly=(TILEWH*8)+spv.mult*SHOWPALVARIDIV;
\r
329 if((spv.palx<TILEWH*12 || spv.paly<TILEWH*8) && spv.i) err=true;
\r
331 if(err){ printf("ERR "); printf("%ux%u %u\n", spv.palx, spv.paly, spv.i); }
\r
335 modexpdump(0, gvar);
\r
336 modexClearRegion(&gvar->video.page[0], spv.palx+TILEWH, spv.paly+TILEWH, spv.mult, spv.mult, 5);
\r
337 modexClearRegion(&gvar->video.page[0], spv.palx+TILEWH+1, spv.paly+TILEWH+1, spv.mult-2, spv.mult-2, spv.i);
\r
341 #define SHOWPALVARPRINT modexprint(&(gvar->video.page[0]), xpos, ypos, 1, 1, ccolor, 8, gvar->video.VL_Started, global_temp_status_text); ypos+=8;
\r
342 sprintf(global_temp_status_text, "%03u", spv.i); SHOWPALVARPRINT
\r
343 sprintf(global_temp_status_text, "r %03u", gvar->video.palette[(spv.i*3)+0]/*>>2*/); SHOWPALVARPRINT
\r
344 sprintf(global_temp_status_text, "g %03u", gvar->video.palette[(spv.i*3)+1]/*>>2*/); SHOWPALVARPRINT
\r
345 sprintf(global_temp_status_text, "b %03u", gvar->video.palette[(spv.i*3)+2]/*>>2*/); SHOWPALVARPRINT
\r
346 xpos = gvar->video.page[0].dx; ypos = gvar->video.page[0].dy;
\r
348 while (!(scan = gvar->in.inst->LastScan))
\r
361 spv.palx=gvar->video.page[0].sw-spv.mult;
\r
362 spv.paly=gvar->video.page[0].sh-spv.mult;
\r
363 spv.i = SHOWPALVARPALSIZELIMIT;
\r
366 case sc_RightArrow:
\r
367 if (spv.i < SHOWPALVARPALSIZELIMIT)
\r
373 spv.palx=TILEWH*12;
\r
385 spv.palx=gvar->video.page[0].sw-spv.mult;
\r
386 spv.paly=gvar->video.page[0].sh-spv.mult;
\r
387 spv.i = SHOWPALVARPALSIZELIMIT;
\r
391 if (spv.i < SHOWPALVARPALSIZELIMIT)
\r
397 spv.palx=TILEWH*12;
\r
402 case sc_W: // Walls
\r
410 // IN_UserInput(1, gvar);
\r