summaryrefslogtreecommitdiff
path: root/apps/plugins/doom
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/doom')
-rw-r--r--apps/plugins/doom/f_wipe.c10
-rw-r--r--apps/plugins/doom/i_video.c16
-rw-r--r--apps/plugins/doom/r_draw.c4
-rw-r--r--apps/plugins/doom/st_stuff.c4
-rw-r--r--apps/plugins/doom/v_video.c32
-rw-r--r--apps/plugins/doom/v_video.h8
6 files changed, 39 insertions, 35 deletions
diff --git a/apps/plugins/doom/f_wipe.c b/apps/plugins/doom/f_wipe.c
index a6251f295e..f51224f5ce 100644
--- a/apps/plugins/doom/f_wipe.c
+++ b/apps/plugins/doom/f_wipe.c
@@ -140,7 +140,7 @@ static int wipe_doMelt(int width, int height, int ticks)
140 return done; 140 return done;
141} 141}
142 142
143// CPhipps - modified to allocate and deallocate screens[2 to 3] as needed, saving memory 143// CPhipps - modified to allocate and deallocate d_screens[2 to 3] as needed, saving memory
144 144
145static int wipe_exitMelt(int width, int height, int ticks) 145static int wipe_exitMelt(int width, int height, int ticks)
146{ 146{
@@ -152,20 +152,20 @@ static int wipe_exitMelt(int width, int height, int ticks)
152 free(wipe_scr_end); 152 free(wipe_scr_end);
153 // Paranoia 153 // Paranoia
154 y = NULL; 154 y = NULL;
155 wipe_scr_start = wipe_scr_end = screens[SRC_SCR] = screens[DEST_SCR] = NULL; 155 wipe_scr_start = wipe_scr_end = d_screens[SRC_SCR] = d_screens[DEST_SCR] = NULL;
156 return 0; 156 return 0;
157} 157}
158 158
159int wipe_StartScreen(int x, int y, int width, int height) 159int wipe_StartScreen(int x, int y, int width, int height)
160{ 160{
161 wipe_scr_start = screens[SRC_SCR] = malloc(SCREENWIDTH * SCREENHEIGHT); 161 wipe_scr_start = d_screens[SRC_SCR] = malloc(SCREENWIDTH * SCREENHEIGHT);
162 V_CopyRect(x, y, 0, width, height, x, y, SRC_SCR, VPT_NONE ); // Copy start screen to buffer 162 V_CopyRect(x, y, 0, width, height, x, y, SRC_SCR, VPT_NONE ); // Copy start screen to buffer
163 return 0; 163 return 0;
164} 164}
165 165
166int wipe_EndScreen(int x, int y, int width, int height) 166int wipe_EndScreen(int x, int y, int width, int height)
167{ 167{
168 wipe_scr_end = screens[DEST_SCR] = malloc(SCREENWIDTH * SCREENHEIGHT); 168 wipe_scr_end = d_screens[DEST_SCR] = malloc(SCREENWIDTH * SCREENHEIGHT);
169 V_CopyRect(x, y, 0, width, height, x, y, DEST_SCR, VPT_NONE); // Copy end screen to buffer 169 V_CopyRect(x, y, 0, width, height, x, y, DEST_SCR, VPT_NONE); // Copy end screen to buffer
170 V_CopyRect(x, y, SRC_SCR, width, height, x, y, 0 , VPT_NONE); // restore start screen 170 V_CopyRect(x, y, SRC_SCR, width, height, x, y, 0 , VPT_NONE); // restore start screen
171 return 0; 171 return 0;
@@ -180,7 +180,7 @@ int wipe_ScreenWipe(int x, int y, int width, int height, int ticks)
180 if (!go) // initial stuff 180 if (!go) // initial stuff
181 { 181 {
182 go = 1; 182 go = 1;
183 wipe_scr = screens[0]; 183 wipe_scr = d_screens[0];
184 wipe_initMelt(width, height, ticks); 184 wipe_initMelt(width, height, ticks);
185 } 185 }
186 V_MarkRect(0, 0, width, height); // do a piece of wipe-in 186 V_MarkRect(0, 0, width, height); // do a piece of wipe-in
diff --git a/apps/plugins/doom/i_video.c b/apps/plugins/doom/i_video.c
index 6adb9491a4..ea6389deab 100644
--- a/apps/plugins/doom/i_video.c
+++ b/apps/plugins/doom/i_video.c
@@ -16,7 +16,11 @@
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * $Log$ 18 * $Log$
19 * Revision 1.4 2006/04/02 20:45:24 kkurbjun 19 * Revision 1.5 2006/04/03 08:51:08 bger
20 * Patch #4864 by Jonathan Gordon: text editor plugin, with some changes by me.
21 * Also correct a var clash between the rockbox's gui api and doom plugin
22 *
23 * Revision 1.4 2006-04-02 20:45:24 kkurbjun
20 * Properly ifdef H300 video code, fix commented line handling rockbox volume 24 * Properly ifdef H300 video code, fix commented line handling rockbox volume
21 * 25 *
22 * Revision 1.3 2006-04-02 01:52:44 kkurbjun 26 * Revision 1.3 2006-04-02 01:52:44 kkurbjun
@@ -336,7 +340,7 @@ void I_FinishUpdate (void)
336 *(volatile unsigned short *) 0xf0000002 = 0; // value 340 *(volatile unsigned short *) 0xf0000002 = 0; // value
337 *(volatile unsigned short *) 0xf0000000 = 0x22; // GRAM 341 *(volatile unsigned short *) 0xf0000000 = 0x22; // GRAM
338 342
339 unsigned char *screenptr=screens[0]; 343 unsigned char *screenptr=d_screens[0];
340 int wcnt=0, hcnt=0; 344 int wcnt=0, hcnt=0;
341 345
342 while(hcnt<LCD_HEIGHT) 346 while(hcnt<LCD_HEIGHT)
@@ -358,7 +362,7 @@ void I_FinishUpdate (void)
358 { 362 {
359 for (x = 0; x < LCD_WIDTH; x++) 363 for (x = 0; x < LCD_WIDTH; x++)
360 { 364 {
361 paletteIndex = screens[0][y*SCREENWIDTH + x]; 365 paletteIndex = d_screens[0][y*SCREENWIDTH + x];
362 rb->lcd_framebuffer[y * LCD_WIDTH + x] = palette[paletteIndex]; 366 rb->lcd_framebuffer[y * LCD_WIDTH + x] = palette[paletteIndex];
363 } 367 }
364 } 368 }
@@ -371,7 +375,7 @@ void I_FinishUpdate (void)
371// 375//
372void I_ReadScreen (byte* scr) 376void I_ReadScreen (byte* scr)
373{ 377{
374 memcpy (scr, screens[0], SCREENWIDTH*SCREENHEIGHT); 378 memcpy (scr, d_screens[0], SCREENWIDTH*SCREENHEIGHT);
375} 379}
376 380
377// 381//
@@ -399,9 +403,9 @@ void I_InitGraphics(void)
399 403
400#if defined(CPU_COLDFIRE) && !defined(SIMULATOR) 404#if defined(CPU_COLDFIRE) && !defined(SIMULATOR)
401 coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE); 405 coldfire_set_macsr(EMAC_FRACTIONAL | EMAC_SATURATE);
402 screens[0] = fastscreen; 406 d_screens[0] = fastscreen;
403#else 407#else
404 // Don't know if this will fit in other IRAMs 408 // Don't know if this will fit in other IRAMs
405 screens[0] = malloc (SCREENWIDTH * SCREENHEIGHT * sizeof(unsigned char)); 409 d_screens[0] = malloc (SCREENWIDTH * SCREENHEIGHT * sizeof(unsigned char));
406#endif 410#endif
407} 411}
diff --git a/apps/plugins/doom/r_draw.c b/apps/plugins/doom/r_draw.c
index b6d84f0dff..a6bc21e420 100644
--- a/apps/plugins/doom/r_draw.c
+++ b/apps/plugins/doom/r_draw.c
@@ -573,7 +573,7 @@ void R_InitBuffer(int width, int height)
573 573
574 viewwindowy = width==SCREENWIDTH ? 0 : (SCREENHEIGHT-(ST_SCALED_HEIGHT-1)-height)>>1; 574 viewwindowy = width==SCREENWIDTH ? 0 : (SCREENHEIGHT-(ST_SCALED_HEIGHT-1)-height)>>1;
575 575
576 topleft = screens[0] + viewwindowy*SCREENWIDTH + viewwindowx; 576 topleft = d_screens[0] + viewwindowy*SCREENWIDTH + viewwindowx;
577 577
578 // Preclaculate all row offsets. 578 // Preclaculate all row offsets.
579 // CPhipps - merge viewwindowx into here 579 // CPhipps - merge viewwindowx into here
@@ -627,7 +627,7 @@ void R_FillBackScreen (void)
627 627
628void R_VideoErase(unsigned ofs, int count) 628void R_VideoErase(unsigned ofs, int count)
629{ 629{
630 memcpy(screens[0]+ofs, screens[1]+ofs, count); // LFB copy. 630 memcpy(d_screens[0]+ofs, d_screens[1]+ofs, count); // LFB copy.
631} 631}
632 632
633// 633//
diff --git a/apps/plugins/doom/st_stuff.c b/apps/plugins/doom/st_stuff.c
index 5d9244d951..feae89a802 100644
--- a/apps/plugins/doom/st_stuff.c
+++ b/apps/plugins/doom/st_stuff.c
@@ -1148,6 +1148,6 @@ void ST_Init(void)
1148 veryfirsttime = 0; 1148 veryfirsttime = 0;
1149 ST_loadData(); 1149 ST_loadData();
1150 // proff 08/18/98: Changed for high-res 1150 // proff 08/18/98: Changed for high-res
1151 screens[4] = Z_Malloc(SCREENWIDTH*(ST_SCALED_HEIGHT+1), PU_STATIC, 0); 1151 d_screens[4] = Z_Malloc(SCREENWIDTH*(ST_SCALED_HEIGHT+1), PU_STATIC, 0);
1152 // screens[4] = Z_Malloc(ST_WIDTH*ST_HEIGHT, PU_STATIC, 0); 1152 // d_screens[4] = Z_Malloc(ST_WIDTH*ST_HEIGHT, PU_STATIC, 0);
1153} 1153}
diff --git a/apps/plugins/doom/v_video.c b/apps/plugins/doom/v_video.c
index 75ccc3ffda..ca90c4b293 100644
--- a/apps/plugins/doom/v_video.c
+++ b/apps/plugins/doom/v_video.c
@@ -44,7 +44,7 @@
44#include "m_swap.h" 44#include "m_swap.h"
45#include "rockmacros.h" 45#include "rockmacros.h"
46// Each screen is [SCREENWIDTH*SCREENHEIGHT]; 46// Each screen is [SCREENWIDTH*SCREENHEIGHT];
47byte *screens[6] IBSS_ATTR; 47byte *d_screens[6] IBSS_ATTR;
48int dirtybox[4]; 48int dirtybox[4];
49 49
50/* jff 4/24/98 initialize this at runtime */ 50/* jff 4/24/98 initialize this at runtime */
@@ -239,8 +239,8 @@ void V_CopyRect(int srcx, int srcy, int srcscrn, int width,
239 239
240 V_MarkRect (destx, desty, width, height); 240 V_MarkRect (destx, desty, width, height);
241 241
242 src = screens[srcscrn]+SCREENWIDTH*srcy+srcx; 242 src = d_screens[srcscrn]+SCREENWIDTH*srcy+srcx;
243 dest = screens[destscrn]+SCREENWIDTH*desty+destx; 243 dest = d_screens[destscrn]+SCREENWIDTH*desty+destx;
244 244
245 for ( ; height>0 ; height--) 245 for ( ; height>0 ; height--)
246 { 246 {
@@ -294,7 +294,7 @@ void V_DrawBlock(int x, int y, int scrn, int width, int height,
294 if (!scrn) 294 if (!scrn)
295 V_MarkRect (x, y, width, height); 295 V_MarkRect (x, y, width, height);
296 296
297 dest = screens[scrn] + y*SCREENWIDTH+x; 297 dest = d_screens[scrn] + y*SCREENWIDTH+x;
298 // x & y no longer needed 298 // x & y no longer needed
299 299
300 while (height--) { 300 while (height--) {
@@ -308,7 +308,7 @@ void V_DrawBlock(int x, int y, int scrn, int width, int height,
308 } else { 308 } else {
309 V_MarkRect (x, y, width, height); 309 V_MarkRect (x, y, width, height);
310 310
311 dest = screens[scrn] + y*SCREENWIDTH+x; 311 dest = d_screens[scrn] + y*SCREENWIDTH+x;
312 312
313 while (height--) { 313 while (height--) {
314 memcpy (dest, src, width); 314 memcpy (dest, src, width);
@@ -369,7 +369,7 @@ void V_GetBlock(int x, int y, int scrn, int width, int height, byte *dest)
369 I_Error ("V_GetBlock: Bad arguments"); 369 I_Error ("V_GetBlock: Bad arguments");
370#endif 370#endif
371 371
372 src = screens[scrn] + y*SCREENWIDTH+x; 372 src = d_screens[scrn] + y*SCREENWIDTH+x;
373 373
374 while (height--) 374 while (height--)
375 { 375 {
@@ -394,13 +394,13 @@ void V_Init (void)
394#define PREALLOCED_SCREENS 2 394#define PREALLOCED_SCREENS 2
395 395
396 // CPhipps - no point in "stick these in low dos memory on PCs" anymore 396 // CPhipps - no point in "stick these in low dos memory on PCs" anymore
397 // Allocate the screens individually, so I_InitGraphics can release screens[0] 397 // Allocate the screens individually, so I_InitGraphics can release d_screens[0]
398 // if e.g. it wants a MitSHM buffer instead 398 // if e.g. it wants a MitSHM buffer instead
399 399
400 for (i=0 ; i<PREALLOCED_SCREENS ; i++) 400 for (i=0 ; i<PREALLOCED_SCREENS ; i++)
401 screens[i] = calloc(SCREENWIDTH*SCREENHEIGHT, 1); 401 d_screens[i] = calloc(SCREENWIDTH*SCREENHEIGHT, 1);
402 for (; i<4; i++) // Clear the rest (paranoia) 402 for (; i<4; i++) // Clear the rest (paranoia)
403 screens[i] = NULL; 403 d_screens[i] = NULL;
404} 404}
405 405
406// 406//
@@ -448,7 +448,7 @@ void V_DrawMemPatch(int x, int y, int scrn, const patch_t *patch,
448 if (!(flags & VPT_STRETCH)) { 448 if (!(flags & VPT_STRETCH)) {
449 unsigned int col; 449 unsigned int col;
450 const column_t *column; 450 const column_t *column;
451 byte *desttop = screens[scrn]+y*SCREENWIDTH+x; 451 byte *desttop = d_screens[scrn]+y*SCREENWIDTH+x;
452 unsigned int w = SHORT(patch->width); 452 unsigned int w = SHORT(patch->width);
453 453
454 if (!scrn) 454 if (!scrn)
@@ -544,7 +544,7 @@ void V_DrawMemPatch(int x, int y, int scrn, const patch_t *patch,
544 V_MarkRect ( stretchx, stretchy, (SHORT( patch->width ) * DX ) >> 16, 544 V_MarkRect ( stretchx, stretchy, (SHORT( patch->width ) * DX ) >> 16,
545 (SHORT( patch->height) * DY ) >> 16 ); 545 (SHORT( patch->height) * DY ) >> 16 );
546 546
547 desttop = screens[scrn] + stretchy * SCREENWIDTH + stretchx; 547 desttop = d_screens[scrn] + stretchy * SCREENWIDTH + stretchx;
548 548
549 for ( col = 0; col <= w; x++, col+=DXI, desttop++ ) { 549 for ( col = 0; col <= w; x++, col+=DXI, desttop++ ) {
550 const column_t *column; 550 const column_t *column;
@@ -640,11 +640,11 @@ byte *V_PatchToBlock(const char* name, int cm,
640 enum patch_translation_e flags, 640 enum patch_translation_e flags,
641 unsigned short* width, unsigned short* height) 641 unsigned short* width, unsigned short* height)
642{ 642{
643 byte *oldscr = screens[1]; 643 byte *oldscr = d_screens[1];
644 byte *block; 644 byte *block;
645 const patch_t *patch; 645 const patch_t *patch;
646 646
647 screens[1] = calloc(SCREENWIDTH*SCREENHEIGHT, 1); 647 d_screens[1] = calloc(SCREENWIDTH*SCREENHEIGHT, 1);
648 648
649 patch = W_CacheLumpName(name); 649 patch = W_CacheLumpName(name);
650 V_DrawMemPatch(SHORT(patch->leftoffset), SHORT(patch->topoffset), 650 V_DrawMemPatch(SHORT(patch->leftoffset), SHORT(patch->topoffset),
@@ -662,8 +662,8 @@ byte *V_PatchToBlock(const char* name, int cm,
662 V_GetBlock(0, 0, 1, *width, *height, 662 V_GetBlock(0, 0, 1, *width, *height,
663 block = malloc((long)(*width) * (*height))); 663 block = malloc((long)(*width) * (*height)));
664 664
665 free(screens[1]); 665 free(d_screens[1]);
666 screens[1] = oldscr; 666 d_screens[1] = oldscr;
667 return block; 667 return block;
668} 668}
669#endif /* GL_DOOM */ 669#endif /* GL_DOOM */
@@ -691,7 +691,7 @@ void V_SetPalette(int pal)
691#ifndef GL_DOOM 691#ifndef GL_DOOM
692void V_FillRect(int scrn, int x, int y, int width, int height, byte colour) 692void V_FillRect(int scrn, int x, int y, int width, int height, byte colour)
693{ 693{
694 byte* dest = screens[scrn] + x + y*SCREENWIDTH; 694 byte* dest = d_screens[scrn] + x + y*SCREENWIDTH;
695 while (height--) { 695 while (height--) {
696 memset(dest, colour, width); 696 memset(dest, colour, width);
697 dest += SCREENWIDTH; 697 dest += SCREENWIDTH;
diff --git a/apps/plugins/doom/v_video.h b/apps/plugins/doom/v_video.h
index c9926e8997..c4b8927109 100644
--- a/apps/plugins/doom/v_video.h
+++ b/apps/plugins/doom/v_video.h
@@ -72,7 +72,7 @@ typedef enum
72 72
73#define CR_DEFAULT CR_RED /* default value for out of range colors */ 73#define CR_DEFAULT CR_RED /* default value for out of range colors */
74 74
75extern byte *screens[6]; 75extern byte *d_screens[6];
76extern int dirtybox[4]; 76extern int dirtybox[4];
77extern const byte gammatable[5][256]; 77extern const byte gammatable[5][256];
78extern int usegamma; 78extern int usegamma;
@@ -173,11 +173,11 @@ void V_SetPalette(int pal);
173// CPhipps - function to plot a pixel 173// CPhipps - function to plot a pixel
174 174
175#ifndef GL_DOOM 175#ifndef GL_DOOM
176#define V_PlotPixel(s,x,y,c) screens[s][x+SCREENWIDTH*y]=c 176#define V_PlotPixel(s,x,y,c) d_screens[s][x+SCREENWIDTH*y]=c
177#endif 177#endif
178 178
179#define V_AllocScreen(scrn) screens[scrn] = malloc(SCREENWIDTH*SCREENHEIGHT) 179#define V_AllocScreen(scrn) d_screens[scrn] = malloc(SCREENWIDTH*SCREENHEIGHT)
180#define V_FreeScreen(scrn) free(screens[scrn]); screens[scrn] = NULL 180#define V_FreeScreen(scrn) free(d_screens[scrn]); d_screens[scrn] = NULL
181 181
182#ifdef GL_DOOM 182#ifdef GL_DOOM
183#include "gl_struct.h" 183#include "gl_struct.h"