Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2010
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 25.36 KB | None | 0 0
  1. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/doomdef.h
  2. ===================================================================
  3. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/doomdef.h (revision 2849)
  4. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/doomdef.h (revision 2850)
  5. @@ -112,10 +112,6 @@
  6.  // allows us to avoid the overhead of dynamic allocation
  7.  // when multiple screen sizes are supported
  8.  
  9. -// proff 08/17/98: Changed for high-res
  10. -#define MAX_SCREENWIDTH  2048
  11. -#define MAX_SCREENHEIGHT 1536
  12. -
  13.  // SCREENWIDTH and SCREENHEIGHT define the visible size
  14.  extern int SCREENWIDTH;
  15.  extern int SCREENHEIGHT;
  16. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/i_video.h
  17. ===================================================================
  18. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/i_video.h (revision 2849)
  19. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/i_video.h (revision 2850)
  20. @@ -42,8 +42,7 @@
  21.  #endif
  22.  
  23.  void I_PreInitGraphics(void); /* CPhipps - do stuff immediately on start */
  24. -void I_CalculateRes(unsigned int width, unsigned int height); /* calculate resolution */
  25. -void I_SetRes(void); /* set resolution */
  26. +void I_InitScreenResolution(void); /* init resolution */
  27.  void I_SetWindowCaption(void); /* Set the window caption */
  28.  void I_SetWindowIcon(void); /* Set the application icon */
  29.  void I_InitGraphics (void);
  30. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/SDL/i_video.c
  31. ===================================================================
  32. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/SDL/i_video.c (revision 2849)
  33. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/SDL/i_video.c (revision 2850)
  34. @@ -59,6 +59,9 @@
  35.  #include "doomtype.h"
  36.  #include "v_video.h"
  37.  #include "r_draw.h"
  38. +#include "r_things.h"
  39. +#include "r_plane.h"
  40. +#include "f_wipe.h"
  41.  #include "d_main.h"
  42.  #include "d_event.h"
  43.  #include "i_joy.h"
  44. @@ -108,6 +111,8 @@
  45.  extern int     usemouse;        // config file var
  46.  static boolean mouse_enabled; // usemouse, but can be overriden by -nomouse
  47.  
  48. +int I_GetModeFromString(const char *modestr);
  49. +
  50.  /////////////////////////////////////////////////////////////////////////////////
  51.  // Keyboard handling
  52.  
  53. @@ -570,6 +575,15 @@
  54.    atexit(I_ShutdownSDL);
  55.  }
  56.  
  57. +// e6y: resolution limitation is removed
  58. +void I_InitBuffersRes(void)
  59. +{
  60. +  R_InitMeltRes();
  61. +  R_InitSpritesRes();
  62. +  R_InitBuffersRes();
  63. +  R_InitPlanesRes();
  64. +}
  65. +
  66.  // e6y
  67.  // GLBoom use this function for trying to set the closest supported resolution if the requested mode can't be set correctly.
  68.  // For example glboom.exe -geom 1025x768 -nowindow will set 1024x768.
  69. @@ -593,9 +607,6 @@
  70.        twidth = modes[i]->w;
  71.        theight = modes[i]->h;
  72.  
  73. -      if (twidth > MAX_SCREENWIDTH || theight> MAX_SCREENHEIGHT)
  74. -        continue;
  75. -      
  76.        if (twidth == *width && theight == *height)
  77.          return;
  78.  
  79. @@ -657,7 +668,7 @@
  80.  
  81.    // e6y: processing of screen_multiply
  82.    {
  83. -    int factor = ((V_GetMode() == VID_MODEGL) ? 1 : screen_multiply);
  84. +    int factor = ((V_GetMode() == VID_MODEGL) ? 1 : render_screen_multiply);
  85.      REAL_SCREENWIDTH = SCREENWIDTH * factor;
  86.      REAL_SCREENHEIGHT = SCREENHEIGHT * factor;
  87.      REAL_SCREENPITCH = SCREENPITCH * factor;
  88. @@ -665,15 +676,84 @@
  89.  }
  90.  
  91.  // CPhipps -
  92. -// I_SetRes
  93. +// I_InitScreenResolution
  94.  // Sets the screen resolution
  95.  // e6y: processing of screen_multiply
  96. -void I_SetRes(void)
  97. +void I_InitScreenResolution(void)
  98.  {
  99. -  int i;
  100. +  int i, p, w, h;
  101. +  char c;
  102. +  video_mode_t mode;
  103.  
  104. -  I_CalculateRes(SCREENWIDTH, SCREENHEIGHT);
  105. +  // Video stuff
  106. +  if ((p = M_CheckParm("-width")))
  107. +    if (myargv[p+1])
  108. +      desired_screenwidth = atoi(myargv[p+1]);
  109.  
  110. +  if ((p = M_CheckParm("-height")))
  111. +    if (myargv[p+1])
  112. +      desired_screenheight = atoi(myargv[p+1]);
  113. +
  114. +  if ((p = M_CheckParm("-fullscreen")))
  115. +      use_fullscreen = 1;
  116. +
  117. +  if ((p = M_CheckParm("-nofullscreen")))
  118. +      use_fullscreen = 0;
  119. +
  120. +  // e6y
  121. +  // New command-line options for setting a window (-window)
  122. +  // or fullscreen (-nowindow) mode temporarily which is not saved in cfg.
  123. +  // It works like "-geom" switch
  124. +  desired_fullscreen = use_fullscreen;
  125. +  if ((p = M_CheckParm("-window")))
  126. +      desired_fullscreen = 0;
  127. +
  128. +  if ((p = M_CheckParm("-nowindow")))
  129. +      desired_fullscreen = 1;
  130. +
  131. +  // e6y
  132. +  // change the screen size for the current session only
  133. +  // syntax: -geom WidthxHeight[w|f]
  134. +  // examples: -geom 320x200f, -geom 640x480w, -geom 1024x768
  135. +  w = desired_screenwidth;
  136. +  h = desired_screenheight;
  137. +
  138. +  if (!(p = M_CheckParm("-geom")))
  139. +    p = M_CheckParm("-geometry");
  140. +
  141. +  if (p && p + 1 < myargc)
  142. +  {
  143. +    int count = sscanf(myargv[p+1], "%dx%d%c", &w, &h, &c);
  144. +
  145. +    // at least width and height must be specified
  146. +    // restoring original values if not
  147. +    if (count < 2)
  148. +    {
  149. +      w = desired_screenwidth;
  150. +      h = desired_screenheight;
  151. +    }
  152. +
  153. +    if (count >= 3)
  154. +    {
  155. +      if (tolower(c) == 'w')
  156. +        desired_fullscreen = 0;
  157. +      if (tolower(c) == 'f')
  158. +        desired_fullscreen = 1;
  159. +    }
  160. +  }
  161. +
  162. +  I_CalculateRes(w, h);
  163. +
  164. +  lprintf(LO_INFO, "I_InitScreenResolution: %dx%d (%s)\n", SCREENWIDTH, SCREENHEIGHT, desired_fullscreen ? "fullscreen" : "nofullscreen");
  165. +
  166. +  mode = I_GetModeFromString(default_videomode);
  167. +  if ((i=M_CheckParm("-vidmode")) && i<myargc-1)
  168. +  {
  169. +    mode = I_GetModeFromString(myargv[i+1]);
  170. +  }
  171. +
  172. +  V_InitMode(mode);
  173. +
  174.    // set first three to standard values
  175.    for (i=0; i<3; i++) {
  176.      screens[i].width = REAL_SCREENWIDTH;
  177. @@ -690,7 +770,9 @@
  178.    screens[4].short_pitch = REAL_SCREENPITCH / V_GetModePixelDepth(VID_MODE16);
  179.    screens[4].int_pitch = REAL_SCREENPITCH / V_GetModePixelDepth(VID_MODE32);
  180.  
  181. -  lprintf(LO_INFO,"I_SetRes: Using resolution %dx%d\n", REAL_SCREENWIDTH, REAL_SCREENHEIGHT);
  182. +  I_InitBuffersRes();
  183. +
  184. +  lprintf(LO_INFO,"I_InitScreenResolution: Using resolution %dx%d\n", REAL_SCREENWIDTH, REAL_SCREENHEIGHT);
  185.  }
  186.  
  187.  //
  188. @@ -813,22 +895,10 @@
  189.  void I_UpdateVideoMode(void)
  190.  {
  191.    int init_flags;
  192. -  int i;
  193. -  video_mode_t mode;
  194.  
  195. -  lprintf(LO_INFO, "I_UpdateVideoMode: %dx%d (%s)\n", SCREENWIDTH, SCREENHEIGHT, desired_fullscreen ? "fullscreen" : "nofullscreen");
  196. -
  197. -  mode = I_GetModeFromString(default_videomode);
  198. -  if ((i=M_CheckParm("-vidmode")) && i<myargc-1) {
  199. -    mode = I_GetModeFromString(myargv[i+1]);
  200. -  }
  201. -
  202. -  V_InitMode(mode);
  203.    V_DestroyUnusedTrueColorPalettes();
  204.    V_FreeScreens();
  205.  
  206. -  I_SetRes();
  207. -
  208.    // Initialize SDL with this graphics mode
  209.    if (V_GetMode() == VID_MODEGL) {
  210.      init_flags = SDL_OPENGL;
  211. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_main.c
  212. ===================================================================
  213. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_main.c  (revision 2849)
  214. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_main.c  (revision 2850)
  215. @@ -100,7 +100,8 @@
  216.  // to the lowest viewangle that maps back to x ranges
  217.  // from clipangle to -clipangle.
  218.  
  219. -angle_t xtoviewangle[MAX_SCREENWIDTH+1];   // killough 2/8/98
  220. +// e6y: resolution limitation is removed
  221. +angle_t *xtoviewangle;   // killough 2/8/98
  222.  
  223.  // killough 3/20/98: Support dynamic colormaps, e.g. deep water
  224.  // killough 4/4/98: support dynamic number of them as well
  225. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_bsp.c
  226. ===================================================================
  227. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_bsp.c   (revision 2849)
  228. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_bsp.c   (revision 2850)
  229. @@ -69,7 +69,8 @@
  230.  // Instead of clipsegs, let's try using an array with one entry for each column,
  231.  // indicating whether it's blocked by a solid wall yet or not.
  232.  
  233. -byte solidcol[MAX_SCREENWIDTH];
  234. +// e6y: resolution limitation is removed
  235. +byte *solidcol;
  236.  
  237.  // CPhipps -
  238.  // R_ClipWallSegment
  239. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_state.h
  240. ===================================================================
  241. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_state.h (revision 2849)
  242. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_state.h (revision 2850)
  243. @@ -103,7 +103,10 @@
  244.  extern player_t         *viewplayer;
  245.  extern angle_t          clipangle;
  246.  extern int              viewangletox[FINEANGLES/2];
  247. -extern angle_t          xtoviewangle[MAX_SCREENWIDTH+1];  // killough 2/8/98
  248. +
  249. +// e6y: resolution limitation is removed
  250. +extern angle_t          *xtoviewangle;  // killough 2/8/98
  251. +
  252.  extern fixed_t          rw_distance;
  253.  extern angle_t          rw_normalangle;
  254.  
  255. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/f_wipe.c
  256. ===================================================================
  257. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/f_wipe.c  (revision 2849)
  258. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/f_wipe.c  (revision 2850)
  259. @@ -61,8 +61,17 @@
  260.  static screeninfo_t wipe_scr_end;
  261.  static screeninfo_t wipe_scr;
  262.  
  263. -static int y_lookup[MAX_SCREENWIDTH];
  264. +// e6y: resolution limitation is removed
  265. +static int *y_lookup = NULL;
  266.  
  267. +// e6y: resolution limitation is removed
  268. +void R_InitMeltRes(void)
  269. +{
  270. +  if (y_lookup) free(y_lookup);
  271. +
  272. +  y_lookup = malloc(SCREENWIDTH * sizeof(*y_lookup));
  273. +}
  274. +
  275.  static int wipe_initMelt(int ticks)
  276.  {
  277.    int i;
  278. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_bsp.h
  279. ===================================================================
  280. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_bsp.h   (revision 2849)
  281. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_bsp.h   (revision 2850)
  282. @@ -50,7 +50,8 @@
  283.  extern drawseg_t *drawsegs;
  284.  extern unsigned maxdrawsegs;
  285.  
  286. -extern byte solidcol[MAX_SCREENWIDTH];
  287. +// e6y: resolution limitation is removed
  288. +extern byte *solidcol;
  289.  
  290.  extern drawseg_t *ds_p;
  291.  
  292. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_things.c
  293. ===================================================================
  294. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_things.c    (revision 2849)
  295. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_things.c    (revision 2850)
  296. @@ -76,8 +76,9 @@
  297.  // constant arrays
  298.  //  used for psprite clipping and initializing clipping
  299.  
  300. -int negonearray[MAX_SCREENWIDTH];        // killough 2/8/98: // dropoff overflow
  301. -int screenheightarray[MAX_SCREENWIDTH];  // change to MAX_* // dropoff overflow
  302. +// e6y: resolution limitation is removed
  303. +int *negonearray;        // killough 2/8/98: // dropoff overflow
  304. +int *screenheightarray;  // change to MAX_* // dropoff overflow
  305.  
  306.  //
  307.  // INITIALIZATION FUNCTIONS
  308. @@ -93,6 +94,17 @@
  309.  static spriteframe_t sprtemp[MAX_SPRITE_FRAMES];
  310.  static int maxframe;
  311.  
  312. +void R_InitSpritesRes(void)
  313. +{
  314. +  if (xtoviewangle) free(xtoviewangle);
  315. +  if (negonearray) free(negonearray);
  316. +  if (screenheightarray) free(screenheightarray);
  317. +
  318. +  xtoviewangle = malloc((SCREENWIDTH + 1) * sizeof(*xtoviewangle));
  319. +  negonearray = malloc(SCREENWIDTH * sizeof(*negonearray));
  320. +  screenheightarray = malloc(SCREENWIDTH * sizeof(*screenheightarray));
  321. +}
  322. +
  323.  //
  324.  // R_InstallSpriteLump
  325.  // Local function for R_InitSprites.
  326. @@ -280,7 +292,7 @@
  327.  void R_InitSprites(const char * const *namelist)
  328.  {
  329.    int i;
  330. -  for (i=0; i<MAX_SCREENWIDTH; i++)    // killough 2/8/98
  331. +  for (i=0; i<SCREENWIDTH; i++)    // killough 2/8/98
  332.      negonearray[i] = -1;
  333.    R_InitSpriteDefs(namelist);
  334.  }
  335. @@ -1010,14 +1022,20 @@
  336.  static void R_DrawSprite (vissprite_t* spr)
  337.  {
  338.    drawseg_t *ds;
  339. -  int     clipbot[MAX_SCREENWIDTH]; // killough 2/8/98: // dropoff overflow
  340. -  int     cliptop[MAX_SCREENWIDTH]; // change to MAX_*  // dropoff overflow
  341. +  static int     *clipbot = NULL; // killough 2/8/98: // dropoff overflow
  342. +  static int     *cliptop = NULL; // change to MAX_*  // dropoff overflow
  343.    int     x;
  344.    int     r1;
  345.    int     r2;
  346.    fixed_t scale;
  347.    fixed_t lowscale;
  348.  
  349. +  if (!clipbot)
  350. +  {
  351. +    clipbot = malloc(SCREENWIDTH * sizeof(*clipbot));
  352. +    cliptop = malloc(SCREENWIDTH * sizeof(*cliptop));
  353. +  }
  354. +
  355.    for (x = spr->x1 ; x<=spr->x2 ; x++)
  356.      clipbot[x] = cliptop[x] = -2;
  357.  
  358. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/f_wipe.h
  359. ===================================================================
  360. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/f_wipe.h  (revision 2849)
  361. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/f_wipe.h  (revision 2850)
  362. @@ -34,6 +34,9 @@
  363.  #ifndef __F_WIPE_H__
  364.  #define __F_WIPE_H__
  365.  
  366. +// e6y: resolution limitation is removed
  367. +void R_InitMeltRes(void);
  368. +
  369.  /*
  370.   * SCREEN WIPE PACKAGE
  371.   */
  372. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_draw.c
  373. ===================================================================
  374. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_draw.c  (revision 2849)
  375. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_draw.c  (revision 2850)
  376. @@ -87,9 +87,12 @@
  377.  
  378.  static int    temp_x = 0;
  379.  static int    tempyl[4], tempyh[4];
  380. -static byte           byte_tempbuf[MAX_SCREENHEIGHT * 4];
  381. -static unsigned short short_tempbuf[MAX_SCREENHEIGHT * 4];
  382. -static unsigned int   int_tempbuf[MAX_SCREENHEIGHT * 4];
  383. +
  384. +// e6y: resolution limitation is removed
  385. +static byte           *byte_tempbuf;
  386. +static unsigned short *short_tempbuf;
  387. +static unsigned int   *int_tempbuf;
  388. +
  389.  static int    startx = 0;
  390.  static int    temptype = COL_NONE;
  391.  static int    commontop, commonbot;
  392. @@ -985,6 +988,21 @@
  393.    R_GetDrawSpanFunc(drawvars.filterfloor, drawvars.filterz)(dsvars);
  394.  }
  395.  
  396. +void R_InitBuffersRes(void)
  397. +{
  398. +  extern byte *solidcol;
  399. +
  400. +  if (solidcol) free(solidcol);
  401. +  if (byte_tempbuf) free(byte_tempbuf);
  402. +  if (short_tempbuf) free(short_tempbuf);
  403. +  if (int_tempbuf) free(int_tempbuf);
  404. +
  405. +  solidcol = malloc(SCREENWIDTH * sizeof(*solidcol));
  406. +  byte_tempbuf = malloc((SCREENHEIGHT * 4) * sizeof(*byte_tempbuf));
  407. +  short_tempbuf = malloc((SCREENHEIGHT * 4) * sizeof(*short_tempbuf));
  408. +  int_tempbuf = malloc((SCREENHEIGHT * 4) * sizeof(*int_tempbuf));
  409. +}
  410. +
  411.  //
  412.  // R_InitBuffer
  413.  // Creats lookup tables that avoid
  414. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_things.h
  415. ===================================================================
  416. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_things.h    (revision 2849)
  417. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_things.h    (revision 2850)
  418. @@ -42,8 +42,9 @@
  419.  
  420.  /* Constant arrays used for psprite clipping and initializing clipping. */
  421.  
  422. -extern int negonearray[MAX_SCREENWIDTH];       /* killough 2/8/98: */ // dropoff overflow
  423. -extern int screenheightarray[MAX_SCREENWIDTH]; /* change to MAX_*  */ // dropoff overflow
  424. +// e6y: resolution limitation is removed
  425. +extern int *negonearray;       /* killough 2/8/98: */ // dropoff overflow
  426. +extern int *screenheightarray; /* change to MAX_*  */ // dropoff overflow
  427.  
  428.  /* Vars for R_DrawMaskedColumn */
  429.  
  430. @@ -71,6 +72,7 @@
  431.  void R_SortVisSprites(void);
  432.  void R_AddSprites(subsector_t* subsec, int lightlevel);
  433.  void R_DrawPlayerSprites(void);
  434. +void R_InitSpritesRes(void);
  435.  void R_InitSprites(const char * const * namelist);
  436.  void R_ClearSprites(void);
  437.  void R_DrawMasked(void);
  438. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_draw.h
  439. ===================================================================
  440. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_draw.h  (revision 2849)
  441. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_draw.h  (revision 2850)
  442. @@ -152,6 +152,8 @@
  443.  
  444.  void R_InitBuffer(int width, int height);
  445.  
  446. +void R_InitBuffersRes(void);
  447. +
  448.  // Initialize color translation tables, for player rendering etc.
  449.  void R_InitTranslationTables(void);
  450.  
  451. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_segs.c
  452. ===================================================================
  453. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_segs.c  (revision 2849)
  454. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_segs.c  (revision 2850)
  455. @@ -214,7 +214,7 @@
  456.            int_64_t t = ((int_64_t) centeryfrac << FRACBITS) -
  457.              (int_64_t) dcvars.texturemid * spryscale;
  458.            if (t + (int_64_t) textureheight[texnum] * spryscale < 0 ||
  459. -              t > (int_64_t) MAX_SCREENHEIGHT << FRACBITS*2)
  460. +              t > (int_64_t) SCREENHEIGHT << FRACBITS*2)
  461.              continue;        // skip if the texture is out of screen's range
  462.            sprtopscreen = (long)(t >> FRACBITS);
  463.          }
  464. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_defs.h
  465. ===================================================================
  466. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_defs.h  (revision 2849)
  467. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_defs.h  (revision 2850)
  468. @@ -425,11 +425,12 @@
  469.    int picnum, lightlevel, minx, maxx;
  470.    fixed_t height;
  471.    fixed_t xoffs, yoffs;         // killough 2/28/98: Support scrolling flats
  472. -  unsigned int pad1;          // leave pads for [minx-1]/[maxx+1]
  473. -  unsigned int top[MAX_SCREENWIDTH];
  474. -  unsigned int pad2, pad3;    // killough 2/8/98, 4/25/98
  475. -  unsigned int bottom[MAX_SCREENWIDTH];
  476. -  unsigned int pad4; // dropoff overflow
  477. +  // e6y: resolution limitation is removed
  478. +  // bottom and top arrays are dynamically
  479. +  // allocated immediately after the visplane
  480. +  unsigned short *bottom;
  481. +  unsigned short pad1;          // leave pads for [minx-1]/[maxx+1]
  482. +  unsigned short top[3];
  483.  } visplane_t;
  484.  
  485.  #endif
  486. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_plane.c
  487. ===================================================================
  488. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_plane.c (revision 2849)
  489. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_plane.c (revision 2850)
  490. @@ -80,11 +80,15 @@
  491.  //  floorclip starts out SCREENHEIGHT
  492.  //  ceilingclip starts out -1
  493.  
  494. -int floorclip[MAX_SCREENWIDTH], ceilingclip[MAX_SCREENWIDTH]; // dropoff overflow
  495. +// dropoff overflow
  496. +// e6y: resolution limitation is removed
  497. +int *floorclip = NULL;
  498. +int *ceilingclip = NULL;
  499.  
  500.  // spanstart holds the start of a plane span; initialized to 0 at start
  501.  
  502. -static int spanstart[MAX_SCREENHEIGHT];                // killough 2/8/98
  503. +// e6y: resolution limitation is removed
  504. +static int *spanstart = NULL;                // killough 2/8/98
  505.  
  506.  //
  507.  // texture mapping
  508. @@ -96,14 +100,43 @@
  509.  // killough 2/8/98: make variables static
  510.  
  511.  static fixed_t basexscale, baseyscale;
  512. -static fixed_t cachedheight[MAX_SCREENHEIGHT];
  513. -static fixed_t cacheddistance[MAX_SCREENHEIGHT];
  514. -static fixed_t cachedxstep[MAX_SCREENHEIGHT];
  515. -static fixed_t cachedystep[MAX_SCREENHEIGHT];
  516. +static fixed_t *cachedheight = NULL;
  517. +static fixed_t *cacheddistance = NULL;
  518. +static fixed_t *cachedxstep = NULL;
  519. +static fixed_t *cachedystep = NULL;
  520.  static fixed_t xoffs,yoffs;    // killough 2/28/98: flat offsets
  521.  
  522. -fixed_t yslope[MAX_SCREENHEIGHT], distscale[MAX_SCREENWIDTH];
  523. +// e6y: resolution limitation is removed
  524. +fixed_t *yslope = NULL;
  525. +fixed_t *distscale = NULL;
  526.  
  527. +void R_InitPlanesRes(void)
  528. +{
  529. +  if (floorclip) free(floorclip);
  530. +  if (ceilingclip) free(ceilingclip);
  531. +  if (spanstart) free(spanstart);
  532. +
  533. +  if (cachedheight) free(cachedheight);
  534. +  if (cacheddistance) free(cacheddistance);
  535. +  if (cachedxstep) free(cachedxstep);
  536. +  if (cachedystep) free(cachedystep);
  537. +
  538. +  if (yslope) free(yslope);
  539. +  if (distscale) free(distscale);
  540. +
  541. +  floorclip = malloc(SCREENWIDTH * sizeof(*floorclip));
  542. +  ceilingclip = malloc(SCREENWIDTH * sizeof(*ceilingclip));
  543. +  spanstart = malloc(SCREENHEIGHT * sizeof(*spanstart));
  544. +
  545. +  cachedheight = malloc(SCREENHEIGHT * sizeof(*cachedheight));
  546. +  cacheddistance = malloc(SCREENHEIGHT * sizeof(*cacheddistance));
  547. +  cachedxstep = malloc(SCREENHEIGHT * sizeof(*cachedxstep));
  548. +  cachedystep = malloc(SCREENHEIGHT * sizeof(*cachedystep));
  549. +
  550. +  yslope = malloc(SCREENHEIGHT * sizeof(*yslope));
  551. +  distscale = malloc(SCREENWIDTH * sizeof(*distscale));
  552. +}
  553. +
  554.  //
  555.  // R_InitPlanes
  556.  // Only at game startup.
  557. @@ -220,7 +253,11 @@
  558.  {
  559.    visplane_t *check = freetail;
  560.    if (!check)
  561. -    check = calloc(1, sizeof *check);
  562. +  {
  563. +    // e6y: resolution limitation is removed
  564. +    check = calloc(1, sizeof(*check) + sizeof(*check->top) * (SCREENWIDTH * 2 + sizeof(*check->bottom) * 4));
  565. +    check->bottom = &check->top[SCREENWIDTH + sizeof(*check->bottom)];
  566. +  }
  567.    else
  568.      if (!(freetail = freetail->next))
  569.        freehead = &freetail;
  570. @@ -246,7 +283,7 @@
  571.        new_pl->yoffs = pl->yoffs;
  572.        new_pl->minx = start;
  573.        new_pl->maxx = stop;
  574. -      memset(new_pl->top, 0xff, sizeof new_pl->top);
  575. +      memset(new_pl->top, 0xff, sizeof(*new_pl->top) * SCREENWIDTH);
  576.        return new_pl;
  577.  }
  578.  //
  579. @@ -284,7 +321,7 @@
  580.    check->xoffs = xoffs;               // killough 2/28/98: Save offsets
  581.    check->yoffs = yoffs;
  582.  
  583. -  memset (check->top, 0xff, sizeof check->top);
  584. +  memset (check->top, 0xff, sizeof(*check->top) * SCREENWIDTH);
  585.  
  586.    return check;
  587.  }
  588. @@ -442,7 +479,7 @@
  589.  
  590.        stop = pl->maxx + 1;
  591.        planezlight = zlight[light];
  592. -      pl->top[pl->minx-1] = pl->top[stop] = 0xffffffffu; // dropoff overflow
  593. +      pl->top[pl->minx-1] = pl->top[stop] = 0xffffu; // dropoff overflow
  594.  
  595.        for (x = pl->minx ; x <= stop ; x++)
  596.           R_MakeSpans(x,pl->top[x-1],pl->bottom[x-1],
  597. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_plane.h
  598. ===================================================================
  599. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_plane.h (revision 2849)
  600. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/r_plane.h (revision 2850)
  601. @@ -46,9 +46,11 @@
  602.  /* Visplane related. */
  603.  extern int *lastopening; // dropoff overflow
  604.  
  605. -extern int floorclip[], ceilingclip[]; // dropoff overflow
  606. -extern fixed_t yslope[], distscale[];
  607. +// e6y: resolution limitation is removed
  608. +extern int *floorclip, *ceilingclip; // dropoff overflow
  609. +extern fixed_t *yslope, *distscale;
  610.  
  611. +void R_InitPlanesRes(void);
  612.  void R_InitPlanes(void);
  613.  void R_ClearPlanes(void);
  614.  void R_DrawPlanes (void);
  615. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/m_misc.c
  616. ===================================================================
  617. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/m_misc.c  (revision 2849)
  618. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/m_misc.c  (revision 2850)
  619. @@ -354,9 +354,9 @@
  620.    {"videomode",{NULL, &default_videomode},{0,"8"},UL,UL,def_str,ss_none},
  621.  #endif
  622.    /* 640x480 default resolution */
  623. -  {"screen_width",{&desired_screenwidth},{640}, 320, MAX_SCREENWIDTH,
  624. +  {"screen_width",{&desired_screenwidth},{640}, 320, UL,
  625.     def_int,ss_none},
  626. -  {"screen_height",{&desired_screenheight},{480},200,MAX_SCREENHEIGHT,
  627. +  {"screen_height",{&desired_screenheight},{480},200,UL,
  628.     def_int,ss_none},
  629.    {"use_fullscreen",{&use_fullscreen},{1},0,1, /* proff 21/05/2000 */
  630.     def_bool,ss_none},
  631. Index: D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/d_main.c
  632. ===================================================================
  633. --- D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/d_main.c  (revision 2849)
  634. +++ D:/andre/prg/doom/prboom-plus/branches/prboom-plus-24/src/d_main.c  (revision 2850)
  635. @@ -1441,70 +1441,9 @@
  636.    G_ReloadDefaults();    // killough 3/4/98: set defaults just loaded.
  637.    // jff 3/24/98 this sets startskill if it was -1
  638.  
  639. -  // Video stuff
  640. -  if ((p = M_CheckParm("-width")))
  641. -    if (myargv[p+1])
  642. -      desired_screenwidth = atoi(myargv[p+1]);
  643. +  // Calculate the screen resolution and init all buffers
  644. +  I_InitScreenResolution();
  645.  
  646. -  if ((p = M_CheckParm("-height")))
  647. -    if (myargv[p+1])
  648. -      desired_screenheight = atoi(myargv[p+1]);
  649. -
  650. -  if ((p = M_CheckParm("-fullscreen")))
  651. -      use_fullscreen = 1;
  652. -
  653. -  if ((p = M_CheckParm("-nofullscreen")))
  654. -      use_fullscreen = 0;
  655. -
  656. -  // e6y
  657. -  // New command-line options for setting a window (-window)
  658. -  // or fullscreen (-nowindow) mode temporarily which is not saved in cfg.
  659. -  // It works like "-geom" switch
  660. -  desired_fullscreen = use_fullscreen;
  661. -  if ((p = M_CheckParm("-window")))
  662. -      desired_fullscreen = 0;
  663. -
  664. -  if ((p = M_CheckParm("-nowindow")))
  665. -      desired_fullscreen = 1;
  666. -
  667. -  // e6y
  668. -  // change the screen size for the current session only
  669. -  // syntax: -geom WidthxHeight[w|f]
  670. -  // examples: -geom 320x200f, -geom 640x480w, -geom 1024x768
  671. -  {
  672. -    int w, h;
  673. -    char c;
  674. -
  675. -    w = desired_screenwidth;
  676. -    h = desired_screenheight;
  677. -
  678. -    if (!(p = M_CheckParm("-geom")))
  679. -      p = M_CheckParm("-geometry");
  680. -
  681. -    if (p && p + 1 < myargc)
  682. -    {
  683. -      int count = sscanf(myargv[p+1], "%dx%d%c", &w, &h, &c);
  684. -      
  685. -      // at least width and height must be specified
  686. -      // restoring original values if not
  687. -      if (count < 2)
  688. -      {
  689. -        w = desired_screenwidth;
  690. -        h = desired_screenheight;
  691. -      }
  692. -
  693. -      if (count >= 3)
  694. -      {
  695. -        if (tolower(c) == 'w')
  696. -          desired_fullscreen = 0;
  697. -        if (tolower(c) == 'f')
  698. -          desired_fullscreen = 1;
  699. -      }
  700. -    }
  701. -
  702. -    I_CalculateRes(w, h);
  703. -  }
  704. -
  705.  #ifdef GL_DOOM
  706.    // proff 04/05/2000: for GL-specific switches
  707.    gld_InitCommandLine();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement