DOOM: Changed SCREENWIDTH/SCREENHEIGHT to be variables

Performance impact to be verified but I don't think there will be any.
This commit is contained in:
Alex Duchesne 2024-04-11 16:06:38 -04:00
parent 698bd7b97f
commit a2be526347
5 changed files with 19 additions and 13 deletions

View File

@ -1,4 +1,4 @@
Alex Duchesne <alex@netvps.ca>
Alex Duchesne (ducalex)
- Author and maintainer
Pelle7 / Go-Emu

View File

@ -41,4 +41,5 @@
// Location for any defines turned variables.
// None.
int SCREENWIDTH = 320;
int SCREENHEIGHT = 240;

View File

@ -40,15 +40,6 @@
#include "config.h"
#endif
#ifdef RETRO_GO
#include <rg_system.h>
#define SCREENWIDTH (RG_SCREEN_WIDTH - RG_SCREEN_MARGIN_LEFT - RG_SCREEN_MARGIN_RIGHT)
#define SCREENHEIGHT (RG_SCREEN_HEIGHT - RG_SCREEN_MARGIN_TOP - RG_SCREEN_MARGIN_BOTTOM)
#else
#define SCREENWIDTH 320
#define SCREENHEIGHT 240
#endif
// This must come first, since it redefines malloc(), free(), etc. -- killough:
#include "z_zone.h"
@ -85,8 +76,14 @@ typedef enum {
// when multiple screen sizes are supported
// proff 08/17/98: Changed for high-res
#define MAX_SCREENWIDTH SCREENWIDTH
#define MAX_SCREENHEIGHT SCREENHEIGHT
#define MAX_SCREENWIDTH 320
#define MAX_SCREENHEIGHT 240
// SCREENWIDTH and SCREENHEIGHT define the visible size
// #define SCREENWIDTH 320
// #define SCREENHEIGHT 240
extern int SCREENWIDTH;
extern int SCREENHEIGHT;
// The maximum number of players, multiplayer/networking.
#define MAXPLAYERS 4

View File

@ -37,6 +37,10 @@
#include "config.h"
#endif
#ifdef RETRO_GO
#include <rg_system.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

View File

@ -532,6 +532,10 @@ void app_main()
app = rg_system_init(AUDIO_SAMPLE_RATE, &handlers, options);
app->tickRate = TICRATE;
const rg_display_t *display = rg_display_get_info();
SCREENWIDTH = RG_MIN(display->screen.width, MAX_SCREENWIDTH);
SCREENHEIGHT = RG_MIN(display->screen.height, MAX_SCREENHEIGHT);
update = rg_surface_create(SCREENWIDTH, SCREENHEIGHT, RG_PIXEL_PAL565_BE, MEM_FAST);
const char *save = RG_BASE_PATH_SAVES "/doom";