Added mode that allows window resizing [amit]; also minor reformat of spacing

This commit is contained in:
hpsolo
2001-06-03 21:50:33 +00:00
parent b2b2b8a71a
commit e9bb66e7bd
5 changed files with 166 additions and 332 deletions

View File

@@ -612,6 +612,7 @@ db '; 8 = 768x672 OGL WIN 9 = 896x784 OGL WIN',13,10
db '; 10 = 1024x896 OGL WIN 11 = 800x600 OGL FULL',13,10 db '; 10 = 1024x896 OGL WIN 11 = 800x600 OGL FULL',13,10
db '; 12 = 1024x768 OGL FULL 13 = 640x480 OGL WIN',13,10 db '; 12 = 1024x768 OGL FULL 13 = 640x480 OGL WIN',13,10
db '; 14 = 800x600 OGL WIN 15 = 1024x768 OGL WIN',13,10 db '; 14 = 800x600 OGL WIN 15 = 1024x768 OGL WIN',13,10
db '; 16 = VARIABLE OGL WIN',13,10
%endif %endif
db '',13,10 db '',13,10
db 'VideoMode = %U',13,10 db 'VideoMode = %U',13,10

View File

@@ -15,10 +15,12 @@ typedef enum
{ FALSE = 0, TRUE = !FALSE } { FALSE = 0, TRUE = !FALSE }
BOOL; BOOL;
// SDL VIDEO VARIOABLES // VIDEO VARIABLES
static SDL_Surface *surface; extern unsigned char cvidmode;
static int SurfaceX, SurfaceY; extern SDL_Surface *surface;
static int SurfaceLocking = 0; extern int SurfaceX, SurfaceY;
extern int SurfaceLocking;
extern DWORD BitDepth;
// OPENGL VARIABLES // OPENGL VARIABLES
static unsigned short *glvidbuffer = 0; static unsigned short *glvidbuffer = 0;
@@ -39,6 +41,7 @@ int gl_start(int width, int height, int req_depth, int FullScreen)
GLubyte scanbuffer[256]; GLubyte scanbuffer[256];
int i; int i;
flags |= (cvidmode == 16 ? SDL_RESIZABLE : 0);
flags |= (FullScreen ? SDL_FULLSCREEN : 0); flags |= (FullScreen ? SDL_FULLSCREEN : 0);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
@@ -142,10 +145,8 @@ static void gl_drawspan(int hires, int start, int end)
{ {
if (!gltexture512) if (!gltexture512)
{ {
unsigned short *vbuf1 = unsigned short *vbuf1 = &((unsigned short *) vidbuffer)[16];
&((unsigned short *) vidbuffer)[16]; unsigned short *vbuf2 = &((unsigned short *) vidbuffer)[75036 * 2 + 16];
unsigned short *vbuf2 =
&((unsigned short *) vidbuffer)[75036 * 2 + 16];
unsigned short *vbuf = &glvidbuffer[0]; unsigned short *vbuf = &glvidbuffer[0];
for (j = 0; j < 224; j++) for (j = 0; j < 224; j++)

View File

@@ -970,7 +970,7 @@ SECTION .data
; Total Number of Video Modes ; Total Number of Video Modes
%ifdef __OPENGL__ %ifdef __OPENGL__
NEWSYM NumVideoModes, dd 16 NEWSYM NumVideoModes, dd 17
%else %else
NEWSYM NumVideoModes, dd 4 NEWSYM NumVideoModes, dd 4
%endif %endif
@@ -995,29 +995,30 @@ db '1024x768 OGL FULL',0 ;12
db '640x480 OGL WIN ',0 ;13 db '640x480 OGL WIN ',0 ;13
db '800x600 OGL WIN ',0 ;14 db '800x600 OGL WIN ',0 ;14
db '1024x768 OGL WIN ',0 ;15 db '1024x768 OGL WIN ',0 ;15
db 'VARIABLE OGL WIN ',0 ;16
%endif %endif
; Video Mode Feature Availability (1 = Available, 0 = Not Available) ; Video Mode Feature Availability (1 = Available, 0 = Not Available)
; Left side starts with Video Mode 0 ; Left side starts with Video Mode 0
; vid mode column = 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5 ; vid mode column = 0,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6
NEWSYM GUI16VID, db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ; 16-bit mode NEWSYM GUI16VID, db 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 ; 16-bit mode
NEWSYM GUINGVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; New Graphics Mode Available NEWSYM GUINGVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; New Graphics Mode Available
NEWSYM GUISLVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Scanlines NEWSYM GUISLVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Scanlines
NEWSYM GUIINVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Interpolation NEWSYM GUIINVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Interpolation
NEWSYM GUII2VID, db 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0 ; Interpolation(w) NEWSYM GUII2VID, db 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Interpolation(w)
NEWSYM GUIEAVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Eagle NEWSYM GUIEAVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Eagle
NEWSYM GUIIEVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (Interp | Eagle) NEWSYM GUIIEVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; (Interp | Eagle)
NEWSYM GUIFSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Full Screen NEWSYM GUIFSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Full Screen
NEWSYM GUISSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Small Screen NEWSYM GUISSVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Small Screen
NEWSYM GUITBVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Triple Buffering NEWSYM GUITBVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Triple Buffering
NEWSYM GUIHSVID, db 0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1 ; Half/Quarter Scanlines NEWSYM GUIHSVID, db 0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1 ; Half/Quarter Scanlines
NEWSYM GUI2xVID, db 0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1 ; 2xSaI/Super Eagle Engines NEWSYM GUI2xVID, db 0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1 ; 2xSaI/Super Eagle Engines
NEWSYM GUIM7VID, db 0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1 ; ?Mode 7 video thing? NEWSYM GUIM7VID, db 0,0,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1 ; ?Mode 7 video thing?
NEWSYM GUIWFVID, db 0,1,0,1,0,0,1,0,0,0,0,1,1,0,0,0 ; If Windows Full Screen NEWSYM GUIWFVID, db 0,1,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0 ; If Windows Full Screen
NEWSYM GUIDSIZE, db 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0 NEWSYM GUIDSIZE, db 0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0
NEWSYM GUIRATIO, db 0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0 NEWSYM GUIRATIO, db 0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0
NEWSYM GUIBIFIL, db 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1 ; binlinear = 1, nearest = 0 NEWSYM GUIBIFIL, db 0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1 ; binlinear = 1, nearest = 0
NEWSYM GUITBWVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Triple Buffering (Win) NEWSYM GUITBWVID, db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 ; Triple Buffering (Win)
SECTION .text SECTION .text

View File

@@ -10,6 +10,10 @@
#include "sw_draw.h" #include "sw_draw.h"
#include "gl_draw.h" #include "gl_draw.h"
#ifdef __OPENGL__
#include <GL/gl.h>
#endif
#define BYTE unsigned char #define BYTE unsigned char
#define WORD unsigned short #define WORD unsigned short
#define DWORD unsigned long #define DWORD unsigned long
@@ -33,6 +37,11 @@ DWORD PrevSoundQuality;
extern BYTE StereoSound; extern BYTE StereoSound;
extern DWORD SoundQuality; extern DWORD SoundQuality;
// SDL VIDEO VARIABLES
SDL_Surface *surface;
int SurfaceLocking = 0;
int SurfaceX, SurfaceY;
// VIDEO VARIABLES // VIDEO VARIABLES
static DWORD WindowWidth = 256; static DWORD WindowWidth = 256;
static DWORD WindowHeight = 224; static DWORD WindowHeight = 224;
@@ -44,7 +53,7 @@ DWORD BitDepth = 0; // Do NOT change this for ANY reason
// JOYSTICK AND KEYBOARD INPUT // JOYSTICK AND KEYBOARD INPUT
SDL_Joystick *JoystickInput[4]; SDL_Joystick *JoystickInput[4];
DWORD CurrentJoy = 0; //DWORD CurrentJoy = 0;
unsigned char keyboardhit = 0; unsigned char keyboardhit = 0;
int shiftptr = 0; int shiftptr = 0;
DWORD numlockptr; DWORD numlockptr;
@@ -86,9 +95,8 @@ static _int64 zsnes_GetTicks()
struct timeval tv; struct timeval tv;
gettimeofday(&tv, NULL); gettimeofday(&tv, NULL);
return (tv.tv_sec - start_time.tv_sec) * 1000000L + (tv.tv_usec - return (tv.tv_sec - start_time.tv_sec) * 1000000L +
start_time. (tv.tv_usec - start_time.tv_usec);
tv_usec);
} }
void drawscreenwin(void); void drawscreenwin(void);
@@ -100,7 +108,7 @@ int Main_Proc(void)
{ {
int j; int j;
SDL_Event event; SDL_Event event;
Uint8 JoyButton; //Uint8 JoyButton;
while (SDL_PollEvent(&event)) while (SDL_PollEvent(&event))
{ {
@@ -116,11 +124,8 @@ int Main_Proc(void)
numlockptr = 0; numlockptr = 0;
if (event.key.keysym.scancode - 8 >= 0) if (event.key.keysym.scancode - 8 >= 0)
{ {
if (pressed if (pressed[event.key.keysym.scancode - 8] != 2)
[event.key.keysym.scancode - 8] != pressed[event.key.keysym.scancode - 8] = 1;
2)
pressed[event.key.keysym.
scancode - 8] = 1;
ProcessKeyBuf(event.key.keysym.sym); ProcessKeyBuf(event.key.keysym.sym);
} }
break; break;
@@ -130,21 +135,16 @@ int Main_Proc(void)
event.key.keysym.sym == SDLK_RSHIFT) event.key.keysym.sym == SDLK_RSHIFT)
shiftptr = 0; shiftptr = 0;
if (event.key.keysym.scancode - 8 >= 0) if (event.key.keysym.scancode - 8 >= 0)
pressed[event.key.keysym.scancode - 8] = pressed[event.key.keysym.scancode - 8] = 0;
0;
break; break;
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
MouseX = event.motion.x; MouseX = event.motion.x;
MouseY = event.motion.y; MouseY = event.motion.y;
if (MouseX < MouseMinX) if (MouseX < MouseMinX) MouseX = MouseMinX;
MouseX = MouseMinX; if (MouseX > MouseMaxX) MouseX = MouseMaxX;
if (MouseX > MouseMaxX) if (MouseY < MouseMinY) MouseY = MouseMinY;
MouseX = MouseMaxX; if (MouseY > MouseMaxY) MouseY = MouseMaxY;
if (MouseY < MouseMinY)
MouseY = MouseMinY;
if (MouseY > MouseMaxY)
MouseY = MouseMaxY;
break; break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
@@ -165,9 +165,7 @@ int Main_Proc(void)
ProcessKeyBuf(SDLK_RETURN); ProcessKeyBuf(SDLK_RETURN);
// Yes, this is intentional - DDOI // Yes, this is intentional - DDOI
default: default:
MouseButton = MouseButton = MouseButton | event.button.button;
MouseButton | event.
button.button;
break; break;
} }
@@ -185,50 +183,34 @@ int Main_Proc(void)
really general here, but this may break the format of 'pressed' really general here, but this may break the format of 'pressed'
*/ */
case SDL_JOYBALLMOTION: case SDL_JOYBALLMOTION:
CurrentJoy = event.jball.which; //CurrentJoy = event.jball.which;
if (event.jball.ball == 0) if (event.jball.ball == 0)
{ {
if (event.jball.xrel < -100) if (event.jball.xrel < -100)
{ {
pressed[0x100 + pressed[0x100 + event.jball.which * 32 + 6] = 0;
CurrentJoy * 32 + 6] = pressed[0x100 + event.jball.which * 32 + 7] = 1;
0;
pressed[0x100 +
CurrentJoy * 32 + 7] =
1;
} }
if (event.jball.xrel > 100) if (event.jball.xrel > 100)
{ {
pressed[0x100 + pressed[0x100 + event.jball.which * 32 + 6] = 1;
CurrentJoy * 32 + 6] = pressed[0x100 + event.jball.which * 32 + 7] = 0;
1;
pressed[0x100 +
CurrentJoy * 32 + 7] =
0;
} }
if (event.jball.yrel < -100) if (event.jball.yrel < -100)
{ {
pressed[0x100 + pressed[0x100 + event.jball.which * 32 + 8] = 0;
CurrentJoy * 32 + 8] = pressed[0x100 + event.jball.which * 32 + 9] = 1;
0;
pressed[0x100 +
CurrentJoy * 32 + 9] =
1;
} }
if (event.jball.yrel > 100) if (event.jball.yrel > 100)
{ {
pressed[0x100 + pressed[0x100 + event.jball.which * 32 + 8] = 1;
CurrentJoy * 32 + 8] = pressed[0x100 + event.jball.which * 32 + 9] = 0;
1;
pressed[0x100 +
CurrentJoy * 32 + 9] =
0;
} }
} }
break; break;
case SDL_JOYAXISMOTION: case SDL_JOYAXISMOTION:
CurrentJoy = event.jaxis.which; //CurrentJoy = event.jaxis.which;
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
{ {
if (event.jaxis.axis == j) if (event.jaxis.axis == j)
@@ -236,57 +218,59 @@ int Main_Proc(void)
if (event.jaxis.value < -16384) if (event.jaxis.value < -16384)
{ {
pressed[0x100 + pressed[0x100 +
CurrentJoy * event.jaxis.which * 32 + 2 * j + 1] = 1;
32 + 2 * j +
1] = 1;
pressed[0x100 + pressed[0x100 +
CurrentJoy * event.jaxis.which * 32 + 2 * j + 0] = 0;
32 + 2 * j +
0] = 0;
} }
else if (event.jaxis.value > else if (event.jaxis.value > 16384)
16384)
{ {
pressed[0x100 + pressed[0x100 +
CurrentJoy * event.jaxis.which * 32 + 2 * j + 0] = 1;
32 + 2 * j +
0] = 1;
pressed[0x100 + pressed[0x100 +
CurrentJoy * event.jaxis.which * 32 + 2 * j + 1] = 0;
32 + 2 * j +
1] = 0;
} }
else else
{ {
pressed[0x100 + pressed[0x100 +
CurrentJoy * event.jaxis.which * 32 + 2 * j + 0] = 0;
32 + 2 * j +
0] = 0;
pressed[0x100 + pressed[0x100 +
CurrentJoy * event.jaxis.which * 32 + 2 * j + 1] = 0;
32 + 2 * j +
1] = 0;
} }
} }
} }
break; break;
case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONDOWN:
CurrentJoy = event.jbutton.which; //CurrentJoy = event.jbutton.which;
JoyButton = event.jbutton.button; //JoyButton = event.jbutton.button;
pressed[0x100 + CurrentJoy * 32 + 16 + pressed[0x100 + event.jbutton.which * 32 + 16 +
JoyButton] = 1; event.jbutton.button] = 1;
break; break;
case SDL_JOYBUTTONUP: case SDL_JOYBUTTONUP:
CurrentJoy = event.jbutton.which; //CurrentJoy = event.jbutton.which;
JoyButton = event.jbutton.button; //JoyButton = event.jbutton.button;
pressed[0x100 + CurrentJoy * 32 + 16 + pressed[0x100 + event.jbutton.which * 32 + 16 +
JoyButton] = 0; event.jbutton.button] = 0;
break; break;
case SDL_QUIT: case SDL_QUIT:
LinuxExit(); LinuxExit();
break; break;
#ifdef __OPENGL__
case SDL_VIDEORESIZE:
if(cvidmode != 16) {
surface = SDL_SetVideoMode(WindowWidth, WindowHeight,
BitDepth, surface->flags & ~SDL_RESIZABLE);
break;
}
WindowWidth = SurfaceX = event.resize.w;
WindowHeight = SurfaceY = event.resize.h;
surface = SDL_SetVideoMode(WindowWidth,
WindowHeight, BitDepth, surface->flags);
glViewport(0,0, WindowWidth, WindowHeight);
glFlush();
break;
#endif
default: default:
break; break;
} }
@@ -324,42 +308,21 @@ void ProcessKeyBuf(int scancode)
{ {
switch (scancode) switch (scancode)
{ {
case '1': case '1': vkeyval = '!'; break;
vkeyval = '!'; case '2': vkeyval = '@'; break;
break; case '3': vkeyval = '#'; break;
case '2': case '4': vkeyval = '$'; break;
vkeyval = '@'; case '5': vkeyval = '%'; break;
break; case '6': vkeyval = '^'; break;
case '3': case '7': vkeyval = '&'; break;
vkeyval = '#'; case '8': vkeyval = '*'; break;
break; case '9': vkeyval = '('; break;
case '4': case '0': vkeyval = ')'; break;
vkeyval = '$';
break;
case '5':
vkeyval = '%';
break;
case '6':
vkeyval = '^';
break;
case '7':
vkeyval = '&';
break;
case '8':
vkeyval = '*';
break;
case '9':
vkeyval = '(';
break;
case '0':
vkeyval = ')';
break;
} }
} }
} }
if ((scancode >= SDLK_KP0) && (scancode <= SDLK_KP9)) if ((scancode >= SDLK_KP0) && (scancode <= SDLK_KP9))
{ {
if (numlockptr) if (numlockptr)
{ {
accept = true; accept = true;
@@ -370,42 +333,15 @@ void ProcessKeyBuf(int scancode)
switch (scancode) switch (scancode)
{ {
case SDLK_KP9: case SDLK_KP9: vkeyval = 256 + 73; accept = true; break;
vkeyval = 256 + 73; case SDLK_KP8: vkeyval = 256 + 72; accept = true; break;
accept = true; case SDLK_KP7: vkeyval = 256 + 71; accept = true; break;
break; case SDLK_KP6: vkeyval = 256 + 77; accept = true; break;
case SDLK_KP8: case SDLK_KP5: vkeyval = 256 + 76; accept = true; break;
vkeyval = 256 + 72; case SDLK_KP4: vkeyval = 256 + 75; accept = true; break;
accept = true; case SDLK_KP3: vkeyval = 256 + 81; accept = true; break;
break; case SDLK_KP2: vkeyval = 256 + 80; accept = true; break;
case SDLK_KP7: case SDLK_KP1: vkeyval = 256 + 79; accept = true; break;
vkeyval = 256 + 71;
accept = true;
break;
case SDLK_KP6:
vkeyval = 256 + 77;
accept = true;
break;
case SDLK_KP5:
vkeyval = 256 + 76;
accept = true;
break;
case SDLK_KP4:
vkeyval = 256 + 75;
accept = true;
break;
case SDLK_KP3:
vkeyval = 256 + 81;
accept = true;
break;
case SDLK_KP2:
vkeyval = 256 + 80;
accept = true;
break;
case SDLK_KP1:
vkeyval = 256 + 79;
accept = true;
break;
} }
} // end no-numlock } // end no-numlock
} // end testing of keypad } // end testing of keypad
@@ -413,153 +349,54 @@ void ProcessKeyBuf(int scancode)
{ {
switch (scancode) switch (scancode)
{ {
case SDLK_MINUS: case SDLK_MINUS: vkeyval = '-'; accept = true; break;
vkeyval = '-'; case SDLK_EQUALS: vkeyval = '='; accept = true; break;
accept = true; case SDLK_LEFTBRACKET: vkeyval = '['; accept = true; break;
break; case SDLK_RIGHTBRACKET: vkeyval = ']'; accept = true; break;
case SDLK_EQUALS: case SDLK_SEMICOLON: vkeyval = ';'; accept = true; break;
vkeyval = '=';
accept = true;
break;
case SDLK_LEFTBRACKET:
vkeyval = '[';
accept = true;
break;
case SDLK_RIGHTBRACKET:
vkeyval = ']';
accept = true;
break;
case SDLK_SEMICOLON:
vkeyval = ';';
accept = true;
break;
// ??? - DDOI // ??? - DDOI
//case 222: vkeyval=39; accept = true; break; //case 222: vkeyval=39; accept = true; break;
//case 220: vkeyval=92; accept = true; break; //case 220: vkeyval=92; accept = true; break;
case SDLK_COMMA: case SDLK_COMMA: vkeyval = ','; accept = true; break;
vkeyval = ','; case SDLK_PERIOD: vkeyval = '.'; accept = true; break;
accept = true; case SDLK_SLASH: vkeyval = '/'; accept = true; break;
break; case SDLK_QUOTE: vkeyval = '`'; accept = true; break;
case SDLK_PERIOD:
vkeyval = '.';
accept = true;
break;
case SDLK_SLASH:
vkeyval = '/';
accept = true;
break;
case SDLK_QUOTE:
vkeyval = '`';
accept = true;
break;
} }
} }
else else
{ {
switch (scancode) switch (scancode)
{ {
case SDLK_MINUS: case SDLK_MINUS: vkeyval = '_'; accept = true; break;
vkeyval = '_'; case SDLK_EQUALS: vkeyval = '+'; accept = true; break;
accept = true; case SDLK_LEFTBRACKET: vkeyval = '{'; accept = true; break;
break; case SDLK_RIGHTBRACKET: vkeyval = '}'; accept = true; break;
case SDLK_EQUALS: case SDLK_SEMICOLON: vkeyval = ':'; accept = true; break;
vkeyval = '+'; case SDLK_QUOTE: vkeyval = '"'; accept = true; break;
accept = true; case SDLK_COMMA: vkeyval = '<'; accept = true; break;
break; case SDLK_PERIOD: vkeyval = '>'; accept = true; break;
case SDLK_LEFTBRACKET: case SDLK_SLASH: vkeyval = '?'; accept = true; break;
vkeyval = '{'; case SDLK_BACKQUOTE: vkeyval = '~'; accept = true; break;
accept = true; case SDLK_BACKSLASH: vkeyval = '|'; accept = true; break;
break;
case SDLK_RIGHTBRACKET:
vkeyval = '}';
accept = true;
break;
case SDLK_SEMICOLON:
vkeyval = ':';
accept = true;
break;
case SDLK_QUOTE:
vkeyval = '"';
accept = true;
break;
case SDLK_COMMA:
vkeyval = '<';
accept = true;
break;
case SDLK_PERIOD:
vkeyval = '>';
accept = true;
break;
case SDLK_SLASH:
vkeyval = '?';
accept = true;
break;
case SDLK_BACKQUOTE:
vkeyval = '~';
accept = true;
break;
case SDLK_BACKSLASH:
vkeyval = '|';
accept = true;
break;
} }
} }
// TODO Figure out what the rest these are supposed to be - DDOI // TODO Figure out what the rest these are supposed to be - DDOI
switch (scancode) switch (scancode)
{ {
case SDLK_PAGEUP: case SDLK_PAGEUP: vkeyval = 256 + 73; accept = true; break;
vkeyval = 256 + 73; case SDLK_UP: vkeyval = 256 + 72; accept = true; break;
accept = true; case SDLK_HOME: vkeyval = 256 + 71; accept = true; break;
break; case SDLK_RIGHT: vkeyval = 256 + 77; accept = true; break;
case SDLK_UP:
vkeyval = 256 + 72;
accept = true;
break;
case SDLK_HOME:
vkeyval = 256 + 71;
accept = true;
break;
case SDLK_RIGHT:
vkeyval = 256 + 77;
accept = true;
break;
//case 12: vkeyval = 256+76; accept = true; break; //case 12: vkeyval = 256+76; accept = true; break;
case SDLK_LEFT: case SDLK_LEFT: vkeyval = 256 + 75; accept = true; break;
vkeyval = 256 + 75; case SDLK_PAGEDOWN: vkeyval = 256 + 81; accept = true; break;
accept = true; case SDLK_DOWN: vkeyval = 256 + 80; accept = true; break;
break; case SDLK_END: vkeyval = 256 + 79; accept = true; break;
case SDLK_PAGEDOWN: case SDLK_KP_PLUS: vkeyval = '+'; accept = true; break;
vkeyval = 256 + 81; case SDLK_KP_MINUS: vkeyval = '-'; accept = true; break;
accept = true; case SDLK_KP_MULTIPLY: vkeyval = '*'; accept = true; break;
break; case SDLK_KP_DIVIDE: vkeyval = '/'; accept = true; break;
case SDLK_DOWN: case SDLK_KP_PERIOD: vkeyval = '.'; accept = true; break;
vkeyval = 256 + 80;
accept = true;
break;
case SDLK_END:
vkeyval = 256 + 79;
accept = true;
break;
case SDLK_KP_PLUS:
vkeyval = '+';
accept = true;
break;
case SDLK_KP_MINUS:
vkeyval = '-';
accept = true;
break;
case SDLK_KP_MULTIPLY:
vkeyval = '*';
accept = true;
break;
case SDLK_KP_DIVIDE:
vkeyval = '/';
accept = true;
break;
case SDLK_KP_PERIOD:
vkeyval = '.';
accept = true;
break;
} }
if (accept) if (accept)
@@ -666,7 +503,8 @@ int startgame(void)
if (!sdl_inited) if (!sdl_inited)
{ {
if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0) if (SDL_Init(SDL_INIT_AUDIO | SDL_INIT_TIMER |
SDL_INIT_VIDEO | SDL_INIT_JOYSTICK) < 0)
{ {
fprintf(stderr, "Could not initialize SDL!\n"); fprintf(stderr, "Could not initialize SDL!\n");
return FALSE; return FALSE;
@@ -677,29 +515,22 @@ int startgame(void)
BitDepth = (UseOpenGL ? 16 : 0); BitDepth = (UseOpenGL ? 16 : 0);
if (sdl_inited == 1) if (sdl_inited == 1) sw_end();
sw_end();
#ifdef __OPENGL__ #ifdef __OPENGL__
else if (sdl_inited == 2) else if (sdl_inited == 2) gl_end();
gl_end();
if (UseOpenGL) if (UseOpenGL)
{ {
status = gl_start(WindowWidth, WindowHeight, BitDepth, status = gl_start(WindowWidth, WindowHeight, BitDepth, FullScreen);
FullScreen);
} }
else else
#endif #endif
{ {
status = sw_start(WindowWidth, WindowHeight, BitDepth, status = sw_start(WindowWidth, WindowHeight, BitDepth, FullScreen);
FullScreen);
} }
if (!status) if (!status) return FALSE;
return FALSE;
sdl_inited = UseOpenGL + 1; sdl_inited = UseOpenGL + 1;
return TRUE; return TRUE;
} }
@@ -806,7 +637,7 @@ void initwinvideo(void)
UseOpenGL = 1; UseOpenGL = 1;
#else #else
if (cvidmode > 3) if (cvidmode > 3)
cvidmode = 0; cvidmode = 2; // set it to the default 512x448 W
#endif #endif
switch (cvidmode) switch (cvidmode)
@@ -822,12 +653,13 @@ void initwinvideo(void)
break; break;
case 2: case 2:
case 5: case 5:
case 13:
WindowWidth = 512; WindowWidth = 512;
WindowHeight = 448; WindowHeight = 448;
break; break;
case 3: case 3:
case 6: case 6:
case 13: case 16:
WindowWidth = 640; WindowWidth = 640;
WindowHeight = 480; WindowHeight = 480;
break; break;

View File

@@ -10,13 +10,14 @@
typedef enum { FALSE = 0, TRUE = !FALSE } BOOL; typedef enum { FALSE = 0, TRUE = !FALSE } BOOL;
extern void LinuxExit(); // VIDEO VARIABLES
extern unsigned char cvidmode;
extern SDL_Surface *surface;
extern int SurfaceX, SurfaceY;
extern int SurfaceLocking;
extern DWORD BitDepth;
// SDL VIDEO VARIOABLES extern void LinuxExit();
static SDL_Surface *surface;
static int SurfaceLocking = 0;
static int SurfaceX, SurfaceY;
static DWORD BitDepth = 0; // Do NOT change this for ANY reason
extern unsigned int vidbuffer; extern unsigned int vidbuffer;
extern DWORD converta; extern DWORD converta;
@@ -31,9 +32,7 @@ BOOL sw_start(int width, int height, int req_depth, int FullScreen)
p = BitConv32Ptr; p = BitConv32Ptr;
for(i=0; i<65536; i++) { for(i=0; i<65536; i++) {
color32 = ((i&0xF800)<<8)+ color32 = ((i&0xF800)<<8) + ((i&0x07E0)<<5) + ((i&0x001F)<<3)+0xFF000000;
((i&0x07E0)<<5)+
((i&0x001F)<<3)+0xFF000000;
(*(unsigned int *)(p)) = color32; (*(unsigned int *)(p)) = color32;
p += 4; p += 4;
} }