Skip to content
This repository has been archived by the owner on Dec 19, 2022. It is now read-only.

Commit

Permalink
Change bufferlength from int to unsigned int to maximize chaos.
Browse files Browse the repository at this point in the history
Actually make automatic screen aspect ratio work.
Finish up 1366 resolution bitblt padding so that actually works.
  • Loading branch information
hobgoblin committed Oct 26, 2013
1 parent 9c9238c commit 63fc18a
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 49 deletions.
4 changes: 2 additions & 2 deletions common.h
Expand Up @@ -33,8 +33,8 @@ typedef struct sizebuf_s
qboolean allowoverflow; // if false, do a Sys_Error
qboolean overflowed; // set to true if the buffer size failed
byte *data;
int maxsize;
int cursize;
unsigned int maxsize; //qb: allow 65535 max
unsigned int cursize;
} sizebuf_t;

void SZ_Alloc (sizebuf_t *buf, int startsize);
Expand Down
10 changes: 5 additions & 5 deletions host.c
Expand Up @@ -324,7 +324,7 @@ void WriteHelp(FILE *f)

GetVersionEx(&osvi);

fprintf (f, ">>>>> hardware information: \n");
fprintf (f, ">>>>> system information: \n");

// Copy the hardware information to the SYSTEM_INFO structure.
GetSystemInfo(&siSysInfo);
Expand All @@ -334,7 +334,7 @@ void WriteHelp(FILE *f)
case 1:
case 2:
case 3:
strcpy(os_name, "Windows 3.x, NT 3.x, or earlier. (really???)");
strcpy(os_name, "Windows 3.x, NT 3.x, or earlier. (really?)");
break;

case 4:
Expand Down Expand Up @@ -400,11 +400,11 @@ void WriteHelp(FILE *f)
fprintf(f, " Page size: %u\n", siSysInfo.dwPageSize);
fprintf(f, " Processor type: %u\n\n", siSysInfo.dwProcessorType);
#endif
fprintf (f, ">>>>> graphics information: \n");
fprintf (f, ">>>>> graphics: \n");
fprintf (f, " video mode: %s\n", vid_mode.string);
fprintf (f, " resolution: %i x %i \n", vid.width, vid.height);
fprintf (f, " resolution: %i x %i \n\n", vid.width, vid.height);

fprintf (f, ">>>>> cvars that have been changed from super8 defaults: \n\n");
fprintf (f, ">>>>> cvars that are different from super8 defaults: \n");
for (var = cvar_vars ; var ; var = var->next)
{
Cmd_TokenizeString(var->string);
Expand Down
4 changes: 2 additions & 2 deletions net.h
Expand Up @@ -29,7 +29,7 @@ struct qsockaddr

#define NET_NAMELEN 64

#define NET_MAXMESSAGE 32767 //qb: 65535 per qsb, was 8192
#define NET_MAXMESSAGE 65535 //qb: 65535 per qsb, was 8192
#define NET_HEADERSIZE (2 * sizeof(unsigned int))
#define NET_DATAGRAMSIZE (MAX_DATAGRAM + NET_HEADERSIZE)

Expand Down Expand Up @@ -136,7 +136,7 @@ typedef struct qsocket_s
unsigned int ackSequence;
unsigned int sendSequence;
unsigned int unreliableSendSequence;
int sendMessageLength;
unsigned int sendMessageLength;
byte sendMessage [NET_MAXMESSAGE];

unsigned int receiveSequence;
Expand Down
2 changes: 1 addition & 1 deletion net_loop.c
Expand Up @@ -151,7 +151,7 @@ int Loop_GetMessage (qsocket_t *sock)
int Loop_SendMessage (qsocket_t *sock, sizebuf_t *data)
{
byte *buffer;
int *bufferLength;
unsigned int *bufferLength;

if (!sock->driverdata)
return -1;
Expand Down
4 changes: 0 additions & 4 deletions qbismSuper8.cbp
Expand Up @@ -17,7 +17,6 @@
<Option compiler="mingw32" />
<Option parameters=" -heapsize 64000 -map start" />
<Compiler>
<Add option="-pg" />
<Add option="-g" />
<Add option="-DWIN32" />
<Add option="-D_WINDOWS" />
Expand All @@ -30,9 +29,6 @@
<ResourceCompiler>
<Add directory="./dxsdk/sdk/inc" />
</ResourceCompiler>
<Linker>
<Add option="-pg -lgmon" />
</Linker>
</Target>
<Target title="Release Win32">
<Option output="../../quake/qbismS8" prefix_auto="1" extension_auto="1" />
Expand Down
6 changes: 3 additions & 3 deletions quakedef.h
Expand Up @@ -88,9 +88,9 @@ void as3ReadFileSharedObject(const char* filename);

#define ON_EPSILON 0.1 // point on plane side epsilon

#define MAX_MSGLEN 32767 //qb: 32767 Super8 max, 65535 per qsb - was 8000 // max length of a reliable message
#define MAX_DATAGRAM 32767 //max for wifi, 32767 Super8 max - was 1024 // max length of unreliable message
#define DATAGRAM_MTU 1400 //qb: johnfitz -- if client is nonlocal
#define MAX_MSGLEN 65535 //qb: 65535 Super8 max, 65535 per qsb - was 8000 // max length of a reliable message
#define MAX_DATAGRAM 65535 //qb: 65535 Super8 max - was 1024 // max length of unreliable message
#define DATAGRAM_MTU 1400 //qb: max for multiplayer, assumes wifi. johnfitz -- if client is nonlocal

//
// per-level limits
Expand Down
4 changes: 2 additions & 2 deletions r_local.h
Expand Up @@ -252,7 +252,7 @@ void R_PushDlights (struct mnode_s *headnode); //qb: moved from render.h

extern int r_amodels_drawn;
extern edge_t *auxedges;
extern int r_numallocatededges;
extern unsigned int r_numallocatededges;
extern edge_t *r_edges, *edge_p, *edge_max;

extern edge_t *newedges[MAXHEIGHT];
Expand Down Expand Up @@ -282,7 +282,7 @@ extern float r_time1;
extern float dp_time1, dp_time2, db_time1, db_time2, rw_time1, rw_time2;
extern float se_time1, se_time2, de_time1, de_time2, dv_time1, dv_time2;
extern int r_frustum_indexes[4*6];
extern int r_maxsurfsseen, r_maxedgesseen, r_cnumsurfs;
extern unsigned int r_maxsurfsseen, r_maxedgesseen, r_cnumsurfs;
extern qboolean r_surfsonstack;
extern cshift_t cshift_water;
extern qboolean r_dowarpold, r_viewchanged;
Expand Down
18 changes: 8 additions & 10 deletions r_main.c
Expand Up @@ -33,7 +33,7 @@ void *colormap;
//vec3_t viewlightvec; // Manoel Kasimier - changed alias models lighting - removed
//alight_t r_viewlighting = {128, 192, viewlightvec}; // Manoel Kasimier - changed alias models lighting - removed
float r_time1;
int r_numallocatededges;
unsigned int r_numallocatededges;
//qb: remove qboolean r_drawpolys;
//qb: remove qboolean r_drawculledpolys;
//qb: remove qboolean r_worldpolysbacktofront;
Expand All @@ -50,7 +50,7 @@ btofpoly_t *pbtofpolys;
mvertex_t *r_pcurrentvertbase;

int c_surf;
int r_maxsurfsseen, r_maxedgesseen, r_cnumsurfs;
unsigned int r_maxsurfsseen, r_maxedgesseen, r_cnumsurfs;
qboolean r_surfsonstack;
int r_clipflags;

Expand Down Expand Up @@ -167,10 +167,10 @@ cvar_t r_clcolorweight= {"r_clcolorweight", "0.5", "r_clcolorweight[0.0 - 1.0] I
cvar_t r_fog = {"r_fog", "1", "r_fog[0/1] Toggle rendering of fog.", true}; //qb: draw fog?

cvar_t r_reportsurfout = {"r_reportsurfout", "0", "r_reportsurfout[0/1] Toggle report of surfaces dropped because > r_maxsurfs."};
cvar_t r_maxsurfs = {"r_maxsurfs", "0", "r_maxsurfs[value] Sets the maximum number of surfaces. Setting take effect on map restart."};
cvar_t r_maxsurfs = {"r_maxsurfs", "63000", "r_maxsurfs[value] Sets the maximum number of surfaces. Setting take effect on map restart."};
cvar_t r_numsurfs = {"r_numsurfs", "0", "r_numsurfs[0/1] Toggles display of number of surfaces in current view."};
cvar_t r_reportedgeout = {"r_reportedgeout", "0", "r_reportedgeout[0/1] Toggle report of edges dropped because > r_maxedges."};
cvar_t r_maxedges = {"r_maxedges", "0", "r_maxedges[value] Sets the maximum number of edges. Setting take effect on map restart."};
cvar_t r_maxedges = {"r_maxedges", "63000", "r_maxedges[value] Sets the maximum number of edges. Setting take effect on map restart."};
cvar_t r_numedges = {"r_numedges", "0", "r_numedges[0/1] Toggles display of number of surfaces in current view."};

//cvar_t r_letterbox = {"r_letterbox","0"}; // Manoel Kasimier - r_letterbox
Expand Down Expand Up @@ -363,9 +363,6 @@ void R_Init (void)
Cvar_RegisterVariable(&thread_flip);
Cvar_RegisterVariable(&thread_fog);

Cvar_SetValue ("r_maxedges", (float) 100000); //NUMSTACKEDGES //qb: was 60000
Cvar_SetValue ("r_maxsurfs", (float) 100000); //NUMSTACKSURFACES //qb: was 60000

view_clipplanes[0].leftedge = true;
view_clipplanes[1].rightedge = true;
view_clipplanes[1].leftedge = view_clipplanes[2].leftedge =
Expand Down Expand Up @@ -931,14 +928,15 @@ void R_ViewChanged (vrect_t *pvrect, int lineadj)
if(r_fisheye.value)
{
pixelAspect = (float)r_refdef.vrect.height/(float)r_refdef.vrect.width;
screenAspect = r_refdef.vrect.width*pixelAspect /r_refdef.vrect.height;
screenAspect = (float)(r_refdef.vrect.width*pixelAspect) /(float)r_refdef.vrect.height;
}
else
{
pixelAspect = 1/vid_nativeaspect; //qb Lavent correction
pixelAspect = vid_nativeaspect/((float)(r_refdef.vrect.width) /(float)(r_refdef.vrect.height)); //qb Lavent correction
if(vid_windowed_mode.value)
screenAspect = 1;
else screenAspect = r_refdef.vrect.width*pixelAspect /r_refdef.vrect.height;
else
screenAspect = ((float)r_refdef.vrect.width)*pixelAspect /(float)r_refdef.vrect.height;
}
xOrigin = r_refdef.xOrigin;
yOrigin = r_refdef.yOrigin;
Expand Down
2 changes: 1 addition & 1 deletion r_shared.h
Expand Up @@ -70,7 +70,7 @@ extern entity_t *currententity;
#define MINEDGES NUMSTACKEDGES
#define NUMSTACKSURFACES 8192 //qb: 8192 per qsb - was 800
#define MINSURFACES NUMSTACKSURFACES
#define MAXSPANS 8000 //qb: was 3000.
#define MAXSPANS 8192 //qb: was 3000.

typedef struct espan_s
{
Expand Down
38 changes: 19 additions & 19 deletions s_win32/vid_win.c
Expand Up @@ -328,7 +328,7 @@ cvar_t vid_ddraw = {"vid_ddraw", "0", "vid_ddraw[0/1] Toggle use direct draw.",
// compatibility
qboolean DDActive;

#define MAX_MODE_LIST 18 //qb: this many will fit on menu, I think
#define MAX_MODE_LIST 24 //qb: this many will fit on menu, I think
#define VID_ROW_SIZE 3
#define VID_WINDOWED_MODES 3 //qb

Expand Down Expand Up @@ -718,8 +718,8 @@ void VID_GetDisplayModes (void)

if ((devmode.dmPelsWidth <= MAXWIDTH) &&
(devmode.dmPelsHeight <= MAXHEIGHT) &&
(devmode.dmPelsWidth >= 640) && //qb: was 640
(devmode.dmPelsHeight >= 360) && //qb: was 480
(devmode.dmPelsWidth >= min_vid_width) && //qb: was 640
(devmode.dmPelsHeight >= min_vid_height) && //qb: was 480
(nummodes < MAX_MODE_LIST))
{
devmode.dmFields = DM_BITSPERPEL |
Expand Down Expand Up @@ -757,7 +757,7 @@ void VID_GetDisplayModes (void)
if (modelist[nummodes].width > highestres)
{
highestres = modelist[nummodes].width;
vid_nativeaspect = modelist[nummodes].width/modelist[nummodes].height;
vid_nativeaspect = ((float) modelist[nummodes].width)/ (float)modelist[nummodes].height;
}
nummodes++;
}
Expand Down Expand Up @@ -806,7 +806,7 @@ qboolean VID_SetWindowedMode (int modenum)
if (vid_usingddraw)
DIBWidth = modelist[modenum].width;
else
DIBWidth = (modelist[modenum].width>>2)<<2; //qb: power of two
DIBWidth = ((int)modelist[modenum].width/4)* 4; //qb: dib only handles multiples of 4. Otherwise, pad it. 1366 res for example.
DIBHeight = modelist[modenum].height;
WindowStyle = WS_OVERLAPPED | WS_BORDER | WS_CAPTION | WS_SYSMENU |
WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_CLIPSIBLINGS |
Expand Down Expand Up @@ -913,7 +913,7 @@ qboolean VID_SetFullDIBMode (int modenum)
WindowRect.right = modelist[modenum].width;
WindowRect.bottom = modelist[modenum].height;

DIBWidth = modelist[modenum].width;
DIBWidth = ((int)modelist[modenum].width /4) *4; //qb: multiple of 4
DIBHeight = modelist[modenum].height;

WindowStyle = WS_POPUP | WS_SYSMENU | WS_CLIPSIBLINGS | WS_CLIPCHILDREN;
Expand Down Expand Up @@ -1710,12 +1710,12 @@ void FlipScreen (vrect_t *rects)
BitBlt
(
hdcGDI,
rects->x+ (rects->width %4) >>1,
rects->x+(rects->width %4) /2,
rects->y,
rects->x + (rects->width >>2)<<2,
rects->x + (rects->width /4)*4,
rects->y + rects->height,
hdcDIBSection,
rects->x + (rects->width %4) >>1,
rects->x+(rects->width %4) /2,
rects->y,
SRCCOPY
);
Expand Down Expand Up @@ -2230,7 +2230,7 @@ typedef struct
int width;
} modedesc_t;

#define MAX_COLUMN_SIZE 5
#define MAX_COLUMN_SIZE 7 //qb: was 5
#define MODE_AREA_HEIGHT (MAX_COLUMN_SIZE + 6)
#define MAX_MODEDESCS (MAX_COLUMN_SIZE*3)

Expand Down Expand Up @@ -2331,7 +2331,7 @@ void VID_MenuDraw (void)

M_Print (7 * 8, 36, "Windowed Modes custom:");
column = 16;
row = 36 + 2 * 8;
row = 36 + 1 * 8; //qb: save a row, was 1 * 8

for (i = 0; i < 3; i++)
{
Expand All @@ -2345,9 +2345,9 @@ void VID_MenuDraw (void)

if (vid_wmodes > 3)
{
M_Print (12 * 8, 36 + 4 * 8, "Fullscreen Modes");
M_Print (12 * 8, 36 + 3 * 8, "Fullscreen Modes");
column = 16;
row = 36 + 6 * 8;
row = 36 + 4 * 8; //qb: was 6 * 8, save a couple rows for more modes.

for (i = 3; i < vid_wmodes; i++)
{
Expand Down Expand Up @@ -2379,31 +2379,31 @@ void VID_MenuDraw (void)
{
M_Print (9 * 8, 36 + MODE_AREA_HEIGHT * 8 + 8,
"Press Enter to set mode");
M_Print (6 * 8, 36 + MODE_AREA_HEIGHT * 8 + 8 * 3,
M_Print (6 * 8, 36 + MODE_AREA_HEIGHT * 8 + 8 * 2,
"T to test mode for 5 seconds");
ptr = VID_GetModeDescription2 (vid_modenum);

if (ptr)
{
sprintf (temp, "D to set default: %s", ptr);
M_Print (2 * 8, 36 + MODE_AREA_HEIGHT * 8 + 8 * 5, temp);
M_Print (2 * 8, 36 + MODE_AREA_HEIGHT * 8 + 8 * 4, temp);
}

ptr = VID_GetModeDescription2 ((int) vid_default_mode_win.value);

if (ptr)
{
sprintf (temp, "Current default: %s", ptr);
M_Print (3 * 8, 36 + MODE_AREA_HEIGHT * 8 + 8 * 6, temp);
M_Print (3 * 8, 36 + MODE_AREA_HEIGHT * 8 + 8 * 5, temp);
}

M_Print (15 * 8, 36 + MODE_AREA_HEIGHT * 8 + 8 * 8,
M_Print (15 * 8, 36 + MODE_AREA_HEIGHT * 8 + 8 * 7,
"Esc to exit");
row = 36 + 2 * 8 + (vid_line / VID_ROW_SIZE) * 8;
row = 36 + 1 * 8 + (vid_line / VID_ROW_SIZE) * 8; //qb: was 36 + 2 * 8, more rows.
column = 8 + (vid_line % VID_ROW_SIZE) * 13 * 8;

if (vid_line >= 3)
row += 3 * 8;
row += 2 * 8; //qb: was 3 * 8; more rows

M_DrawCharacter (column, row, 12 + ((int) (realtime * 4) & 1), false);
}
Expand Down

0 comments on commit 63fc18a

Please sign in to comment.