Made joy_flush also resetting button state; Improved glReticle; Implemented Fallback resolution if SDL may fail; Code cleanup

This commit is contained in:
zicodxx 2008-04-19 19:11:32 +00:00
parent 53ed00581b
commit 9bcea627d1
24 changed files with 319 additions and 612 deletions

View file

@ -1,5 +1,9 @@
D2X-Rebirth Changelog
20080419
--------
include/ogl_init.h, include/gr.h, include/strutil.h, include/internal.h, main/network.c, main/inferno.c, main/menu.c, main/movie.c, main/playsave.c, main/state.c, main/newdemo.c, main/gamecntl.c, d2x-rebirth.xcodeproj/project.pbxproj, misc/strutil.c, SConstruct, arch/ogl/ogl.c, arch/ogl/gr.c, arch/sdl/joy.c, arch/sdl/gr.c, arch/carbon/conf.h, libmve/mve_main.c, libmve/mveplay.c: Made joy_flush also resetting button state; Improved glReticle; Implemented Fallback resolution if SDL may fail; Code cleanup
20080413
--------
include/args.h, main/newmenu.c, main/collide.h, main/network.c, main/multi.c, main/multi.h, main/inferno.c, main/menu.c, main/menu.h, main/playsave.c, main/playsave.h, main/object.c, main/hud.c, main/weapon.c, main/newdemo.c, main/config.c, main/config.h, main/gamerend.c, main/gameseq.c, main/escort.c, main/escort.h, main/endlevel.c, main/powerup.c, main/powerup.h, main/automap.c, main/game.c, main/gauges.c, main/game.h, main/kconfig.c, main/gauges.h, main/kconfig.h, main/gamecntl.c, misc/args.c, d2x.ini, arch/ogl/ogl.c, arch/ogl/gr.c, arch/sdl/joy.c: Added structure for values saved in PLR/PLX files; Added most common command-line options to options menu

View file

@ -265,7 +265,6 @@ arch_macosx_sources = [
arch_ogl_sources = [
'arch/ogl/gr.c',
'arch/ogl/ogl.c',
'arch/ogl/sdlgl.c'
]
# for sdl

View file

@ -80,9 +80,6 @@
/* Define for a "release" build */
/* #undef RELEASE */
/* Define if you have the SDL_image library */
/* #undef SDL_IMAGE */
/* Define this to be the shared game directory root */
#define SHAREPATH ""

View file

@ -28,7 +28,7 @@
#endif
#include <errno.h>
#include <SDL/SDL.h>
#include "hudmsg.h"
#include "game.h"
#include "text.h"
@ -49,6 +49,7 @@
#include "console.h"
#include "config.h"
#include "playsave.h"
#include "vers_id.h"
#if defined(__APPLE__) && defined(__MACH__)
#include <OpenGL/glu.h>
@ -59,19 +60,61 @@
int gr_installed = 0;
int gl_initialized=0;
int ogl_fullscreen;
static int curx=-1,cury=-1,curfull=0;
int gr_check_fullscreen(void){
void ogl_swap_buffers_internal(void)
{
SDL_GL_SwapBuffers();
}
int ogl_init_window(int x, int y)
{
if (gl_initialized){
if (x==curx && y==cury && curfull==ogl_fullscreen)
return 0;
#ifdef __LINUX__ // Windows, at least, seems to need to reload every time.
if (ogl_fullscreen || curfull)
#endif
ogl_smash_texture_list_internal();//if we are or were fullscreen, changing vid mode will invalidate current textures
}
SDL_WM_SetCaption(DESCENT_VERSION, "Descent II");
if (!SDL_SetVideoMode(x, y, GameArg.DbgGlBpp, SDL_OPENGL | (ogl_fullscreen ? SDL_FULLSCREEN : 0)))
{
Error("Could not set %dx%dx%d opengl video mode: %s\n", x, y, GameArg.DbgGlBpp, SDL_GetError());
}
SDL_ShowCursor(0);
curx=x;cury=y;curfull=ogl_fullscreen;
gl_initialized=1;
return 0;
}
int gr_check_fullscreen(void)
{
return ogl_fullscreen;
}
void gr_do_fullscreen(int f){
void gr_do_fullscreen(int f)
{
ogl_fullscreen=f;
if (gl_initialized){
ogl_do_fullscreen_internal();
if (gl_initialized)
{
if (!SDL_VideoModeOK(curx, cury, GameArg.DbgGlBpp, SDL_OPENGL | (ogl_fullscreen?SDL_FULLSCREEN:0)))
{
con_printf(CON_URGENT,"Cannot set %ix%i. Fallback to 640x480\n",curx,cury);
curx=640;
cury=480;
Game_screen_mode=SM(curx,cury);
}
ogl_init_window(curx,cury);
}
}
int gr_toggle_fullscreen(void){
int gr_toggle_fullscreen(void)
{
gr_do_fullscreen(!ogl_fullscreen);
gr_remap_color_fonts();
gr_remap_mono_fonts();
@ -93,7 +136,8 @@ int gr_toggle_fullscreen(void){
extern void ogl_init_pixel_buffers(int w, int h);
extern void ogl_close_pixel_buffers(void);
void ogl_init_state(void){
void ogl_init_state(void)
{
/* select clearing (background) color */
glClearColor(0.0, 0.0, 0.0, 0.0);
@ -135,52 +179,45 @@ void ogl_get_verinfo(void)
#endif
//add driver specific hacks here. whee.
if ((stricmp(gl_renderer,"Mesa NVIDIA RIVA 1.0\n")==0 || stricmp(gl_renderer,"Mesa NVIDIA RIVA 1.2\n")==0) && stricmp(gl_version,"1.2 Mesa 3.0")==0){
if ((stricmp(gl_renderer,"Mesa NVIDIA RIVA 1.0\n")==0 || stricmp(gl_renderer,"Mesa NVIDIA RIVA 1.2\n")==0) && stricmp(gl_version,"1.2 Mesa 3.0")==0)
{
GameArg.DbgGlIntensity4Ok=0;//ignores alpha, always black background instead of transparent.
GameArg.DbgGlReadPixelsOk=0;//either just returns all black, or kills the X server entirely
GameArg.DbgGlGetTexLevelParamOk=0;//returns random data..
}
if (stricmp(gl_vendor,"Matrox Graphics Inc.")==0){
if (stricmp(gl_vendor,"Matrox Graphics Inc.")==0)
{
//displays garbage. reported by
// redomen@crcwnet.com (render="Matrox G400" version="1.1.3 5.52.015")
// orulz (Matrox G200)
GameArg.DbgGlIntensity4Ok=0;
}
#ifdef macintosh
if (stricmp(gl_renderer,"3dfx Voodoo 3")==0){ // strangely, includes Voodoo 2
if (stricmp(gl_renderer,"3dfx Voodoo 3")==0) // strangely, includes Voodoo 2
GameArg.DbgGlGetTexLevelParamOk=0; // Always returns 0
}
#endif
con_printf(CON_VERBOSE, "gl_intensity4:%i gl_luminance4_alpha4:%i gl_rgba2:%i gl_readpixels:%i gl_gettexlevelparam:%i\n", GameArg.DbgGlIntensity4Ok, GameArg.DbgGlLuminance4Alpha4Ok, GameArg.DbgGlRGBA2Ok, GameArg.DbgGlReadPixelsOk, GameArg.DbgGlGetTexLevelParamOk);
}
int gr_check_mode(u_int32_t mode)
{
int w, h;
w = SM_W(mode);
h = SM_H(mode);
return ogl_check_mode(w, h); // platform specific code
}
int gr_set_mode(u_int32_t mode)
{
unsigned int w, h;
char *gr_bm_data;
#ifdef NOGRAPH
return 0;
#endif
if (mode<=0)
return 0;
w=SM_W(mode);
h=SM_H(mode);
if (!SDL_VideoModeOK(w, h, GameArg.DbgGlBpp, SDL_OPENGL | (ogl_fullscreen?SDL_FULLSCREEN:0)))
{
con_printf(CON_URGENT,"Cannot set %ix%i. Fallback to 640x480\n",w,h);
w=640;
h=480;
Game_screen_mode=mode=SM(w,h);
}
gr_bm_data=(char *)grd_curscreen->sc_canvas.cv_bitmap.bm_data;//since we use realloc, we want to keep this pointer around.
memset( grd_curscreen, 0, sizeof(grs_screen));
@ -198,11 +235,8 @@ int gr_set_mode(u_int32_t mode)
gr_set_current_canvas(NULL);
ogl_init_window(w,h);//platform specific code
ogl_get_verinfo();
OGL_VIEWPORT(0,0,w,h);
ogl_init_state();
gamefont_choose_game_font(w,h);
gr_remap_color_fonts();
@ -212,10 +246,12 @@ int gr_set_mode(u_int32_t mode)
}
#define GLstrcmptestr(a,b) if (stricmp(a,#b)==0 || stricmp(a,"GL_" #b)==0)return GL_ ## b;
int ogl_atotexfilti(char *a,int min){
int ogl_atotexfilti(char *a,int min)
{
GLstrcmptestr(a,NEAREST);
GLstrcmptestr(a,LINEAR);
if (min){//mipmaps are valid only for the min filter
if (min)
{//mipmaps are valid only for the min filter
GLstrcmptestr(a,NEAREST_MIPMAP_NEAREST);
GLstrcmptestr(a,NEAREST_MIPMAP_LINEAR);
GLstrcmptestr(a,LINEAR_MIPMAP_NEAREST);
@ -224,8 +260,10 @@ int ogl_atotexfilti(char *a,int min){
Error("unknown/invalid texture filter %s\n",a);
}
int ogl_testneedmipmaps(int i){
switch (i){
int ogl_testneedmipmaps(int i)
{
switch (i)
{
case GL_NEAREST:
case GL_LINEAR:
return 0;
@ -245,7 +283,8 @@ int ogl_rt_loaded=0;
int ogl_init_load_library(void)
{
int retcode=0;
if (!ogl_rt_loaded){
if (!ogl_rt_loaded)
{
retcode = OpenGL_LoadLibrary(true);
if(retcode)
{
@ -253,7 +292,9 @@ int ogl_init_load_library(void)
{
Error("Opengl: Functions not imported\n");
}
}else{
}
else
{
Error("Opengl: error loading %s\n", OglLibPath);
}
ogl_rt_loaded=1;
@ -295,7 +336,13 @@ int gr_init(int mode)
GL_needmipmaps=ogl_testneedmipmaps(OglTexMinFilt);
ogl_init();//platform specific initialization
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,0);
SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE,0);
SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE,0);
SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE,0);
SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE,0);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
ogl_init_texture_list_internal();
@ -305,9 +352,7 @@ int gr_init(int mode)
// Set the mode.
if ((retcode=gr_set_mode(mode)))
{
return retcode;
}
grd_curscreen->sc_canvas.cv_color = 0;
grd_curscreen->sc_canvas.cv_drawmode = 0;
@ -329,8 +374,14 @@ void gr_close()
{
ogl_brightness_r = ogl_brightness_g = ogl_brightness_b = 0;
ogl_close();//platform specific code
if (grd_curscreen){
if (gl_initialized)
{
ogl_smash_texture_list_internal();
SDL_ShowCursor(1);
}
if (grd_curscreen)
{
if (grd_curscreen->sc_canvas.cv_bitmap.bm_data)
d_free(grd_curscreen->sc_canvas.cv_bitmap.bm_data);
d_free(grd_curscreen);
@ -341,8 +392,10 @@ void gr_close()
OpenGL_LoadLibrary(false);
#endif
}
extern int r_upixelc;
void ogl_upixelc(int x, int y, int c){
void ogl_upixelc(int x, int y, int c)
{
r_upixelc++;
OGL_DISABLE(TEXTURE_2D);
glPointSize(grd_curscreen->sc_w/320);
@ -352,7 +405,8 @@ void ogl_upixelc(int x, int y, int c){
glEnd();
}
void ogl_urect(int left,int top,int right,int bot){
void ogl_urect(int left,int top,int right,int bot)
{
GLfloat xo,yo,xf,yf;
int c=COLOR;
@ -374,7 +428,8 @@ void ogl_urect(int left,int top,int right,int bot){
glEnd();
}
void ogl_ulinec(int left,int top,int right,int bot,int c){
void ogl_ulinec(int left,int top,int right,int bot,int c)
{
GLfloat xo,yo,xf,yf;
xo = (left + grd_curcanv->cv_bitmap.bm_x + 0.5) / (float)last_width;
@ -394,14 +449,17 @@ void ogl_ulinec(int left,int top,int right,int bot,int c){
GLfloat last_r=0, last_g=0, last_b=0;
int do_pal_step=0;
void ogl_do_palfx(void){
void ogl_do_palfx(void)
{
OGL_DISABLE(TEXTURE_2D);
if (do_pal_step){
if (do_pal_step)
{
glEnable(GL_BLEND);
glBlendFunc(GL_ONE,GL_ONE);
glColor3f(last_r,last_g,last_b);
}else
}
else
return;
glBegin(GL_QUADS);
@ -450,9 +508,11 @@ void gr_palette_load( ubyte *pal )
{
int i;
for (i=0; i<768; i++ ) {
for (i=0; i<768; i++ )
{
gr_current_pal[i] = pal[i];
if (gr_current_pal[i] > 63) gr_current_pal[i] = 63;
if (gr_current_pal[i] > 63)
gr_current_pal[i] = 63;
}
gr_palette_step_up(0, 0, 0); // make ogl_setbrightness_internal get run so that menus get brightened too.
@ -462,22 +522,26 @@ void gr_palette_load( ubyte *pal )
void gr_palette_read(ubyte * pal)
{
int i;
for (i=0; i<768; i++ ) {
for (i=0; i<768; i++ )
{
pal[i]=gr_current_pal[i];
if (pal[i] > 63) pal[i] = 63;
if (pal[i] > 63)
pal[i] = 63;
}
}
#define GL_BGR_EXT 0x80E0
typedef struct {
typedef struct
{
unsigned char TGAheader[12];
unsigned char header[6];
} TGA_header;
//writes out an uncompressed RGB .tga file
//if we got really spiffy, we could optionally link in libpng or something, and use that.
void write_bmp(char *savename,int w,int h,unsigned char *buf){
void write_bmp(char *savename,int w,int h,unsigned char *buf)
{
PHYSFS_file* TGAFile;
TGA_header TGA;
GLbyte HeightH,HeightL,WidthH,WidthL;
@ -537,8 +601,6 @@ void save_screen_shot(int automap_flag)
do
{
if (savenum == 9999)
savenum = 0;
sprintf(savename, "%sscrn%04d.tga",SCRNS_DIR, savenum++);
} while (PHYSFS_exists(savename));
@ -549,6 +611,7 @@ void save_screen_shot(int automap_flag)
if (!automap_flag && PlayerCfg.OglPRShot && Function_mode == FMODE_GAME)
{
gr_set_current_canvas(NULL);
render_frame(0,0);
gr_set_curfont(MEDIUM2_FONT);
gr_printf(SWIDTH-FSPACX(92),SHEIGHT-LINE_SPACING,"DXX-Rebirth\n");

View file

@ -501,7 +501,8 @@ int circle_list_init(int nsides,int type,int mode) {
float bright_g[4]={ 32.0/256, 255.0/256, 32.0/256, 1.0};
float dark_g[4]={ 32.0/256, 138.0/256, 32.0/256, 0.6};
void ogl_draw_reticle(int cross,int primary,int secondary){
void ogl_draw_reticle(int cross,int primary,int secondary)
{
float scale=(float)grd_curscreen->sc_h/(float)grd_curscreen->sc_h;
glPushMatrix();
@ -510,7 +511,8 @@ void ogl_draw_reticle(int cross,int primary,int secondary){
glLineWidth(SWIDTH/320);
OGL_DISABLE(TEXTURE_2D);
glDisable(GL_CULL_FACE);
if (!cross_lh[cross]){
if (!cross_lh[cross])
{
cross_lh[cross]=glGenLists(1);
glNewList(cross_lh[cross], GL_COMPILE_AND_EXECUTE);
glBegin(GL_LINES);
@ -522,14 +524,12 @@ void ogl_draw_reticle(int cross,int primary,int secondary){
else
glColor4fv(dark_g);
glVertex2f(-2.0,0.0);
//cross bottom left
glColor4fv(dark_g);
glVertex2f(-3.0,-4.0);
if (cross)
glColor4fv(bright_g);
glVertex2f(-2.0,-3.0);
//cross top right
glColor4fv(dark_g);
glVertex2f(4.0,2.0);
@ -538,20 +538,20 @@ void ogl_draw_reticle(int cross,int primary,int secondary){
else
glColor4fv(dark_g);
glVertex2f(2.0,0.0);
//cross bottom right
glColor4fv(dark_g);
glVertex2f(3.0,-4.0);
if (cross)
glColor3fv(bright_g);
glVertex2f(2.0,-3.0);
glEnd();
glEndList();
}else
}
else
glCallList(cross_lh[cross]);
if (!primary_lh[primary]){
if (!primary_lh[primary])
{
primary_lh[primary]=glGenLists(1);
glNewList(primary_lh[primary], GL_COMPILE_AND_EXECUTE);
//left primary bar
@ -563,12 +563,22 @@ void ogl_draw_reticle(int cross,int primary,int secondary){
glVertex3f( -5.5f, -5.0f, 0.0f);
glVertex3f( -6.5f, -7.5f, 0.0f);
glColor4fv(dark_g);
glVertex3f(-15.0f, -9.5f, 0.0f);
glVertex3f(-15.0f, -8.5f, 0.0f);
glVertex3f( -10.0f, -8.7f, 0.0f);
glVertex3f( -10.0f, -7.0f, 0.0f);
glEnd();
glBegin(GL_POLYGON);
glColor4fv(dark_g);
glVertex3f( -10.0f, -8.7f, 0.0f);
glVertex3f( -10.0f, -7.0f, 0.0f);
if (primary!=2)
glColor4fv(dark_g);
else
glColor4fv(bright_g);
glVertex3f( -15.0f, -8.5f, 0.0f);
glVertex3f( -15.0f, -9.5f, 0.0f);
glEnd();
//right primary bar
glBegin(GL_POLYGON);
if (primary==0)
glColor4fv(dark_g);
else
@ -576,14 +586,28 @@ void ogl_draw_reticle(int cross,int primary,int secondary){
glVertex3f( 5.5f, -5.0f, 0.0f);
glVertex3f( 6.5f, -7.5f, 0.0f);
glColor4fv(dark_g);
glVertex3f(15.0f, -9.5f, 0.0f);
glVertex3f(15.0f, -8.5f, 0.0f);
glVertex3f( 10.0f, -8.7f, 0.0f);
glVertex3f( 10.0f, -7.0f, 0.0f);
glEnd();
glBegin(GL_POLYGON);
glColor4fv(dark_g);
glVertex3f( 10.0f, -8.7f, 0.0f);
glVertex3f( 10.0f, -7.0f, 0.0f);
if (primary!=2)
glColor4fv(dark_g);
else
glColor4fv(bright_g);
glVertex3f( 15.0f, -8.5f, 0.0f);
glVertex3f( 15.0f, -9.5f, 0.0f);
glEnd();
glEndList();
}else
}
else
glCallList(primary_lh[primary]);
if (!secondary_lh[secondary]){
if (!secondary_lh[secondary])
{
secondary_lh[secondary]=glGenLists(1);
glNewList(secondary_lh[secondary], GL_COMPILE_AND_EXECUTE);
if (secondary<=2){
@ -599,7 +623,9 @@ void ogl_draw_reticle(int cross,int primary,int secondary){
else
glColor4fv(bright_g);
ogl_drawcircle2(16,GL_LINE_LOOP,2.0,10.0,2.0,-2.0);
}else{
}
else
{
//bottom/middle secondary
if (secondary!=4)
glColor4fv(dark_g);
@ -608,7 +634,8 @@ void ogl_draw_reticle(int cross,int primary,int secondary){
ogl_drawcircle2(16,GL_LINE_LOOP,2.0,0.0,2.0,-8.0);
}
glEndList();
}else
}
else
glCallList(secondary_lh[secondary]);
glPopMatrix();
@ -1040,9 +1067,11 @@ void ogl_filltexbuf(unsigned char *data, GLubyte *texp, int truewidth, int width
Error("Texture is too big: %ix%i", width, height);
i=0;
for (y=0;y<theight;y++){
for (y=0;y<theight;y++)
{
i=dxo+truewidth*(y+dyo);
for (x=0;x<twidth;x++){
for (x=0;x<twidth;x++)
{
if (x<width && y<height)
{
if (data_format)
@ -1068,22 +1097,22 @@ void ogl_filltexbuf(unsigned char *data, GLubyte *texp, int truewidth, int width
{
switch (type)
{
case GL_LUMINANCE_ALPHA:
(*(texp++)) = 255;
(*(texp++)) = 0;
break;
case GL_RGBA:
(*(texp++)) = 255;
(*(texp++)) = 255;
(*(texp++)) = 255;
(*(texp++)) = 0; // transparent pixel
break;
case GL_COLOR_INDEX:
(*(texp++)) = c;
break;
default:
Error("ogl_filltexbuf unhandled super-transparent texformat\n");
break;
case GL_LUMINANCE_ALPHA:
(*(texp++)) = 255;
(*(texp++)) = 0;
break;
case GL_RGBA:
(*(texp++)) = 255;
(*(texp++)) = 255;
(*(texp++)) = 255;
(*(texp++)) = 0; // transparent pixel
break;
case GL_COLOR_INDEX:
(*(texp++)) = c;
break;
default:
Error("ogl_filltexbuf unhandled super-transparent texformat\n");
break;
}
}
else if (((c == 255 && (bm_flags & BM_FLAG_TRANSPARENT)) || c == 256) ||
@ -1120,8 +1149,11 @@ void ogl_filltexbuf(unsigned char *data, GLubyte *texp, int truewidth, int width
Error("ogl_filltexbuf unknown texformat\n");
break;
}
}else{
switch (type){
}
else
{
switch (type)
{
case GL_LUMINANCE://these could prolly be done to make the intensity based upon the intensity of the resulting color, but its not needed for anything (yet?) so no point. :)
(*(texp++))=255;
break;

View file

@ -1,85 +0,0 @@
/*
*
* Graphics functions for SDL-GL.
*
*/
#ifdef HAVE_CONFIG_H
#include <conf.h>
#endif
#include <SDL/SDL.h>
#include "internal.h"
#include "vers_id.h"
#include "error.h"
#include "u_mem.h"
#include "args.h"
#include "config.h"
static int curx=-1,cury=-1,curfull=0;
void ogl_do_fullscreen_internal(void)
{
ogl_init_window(curx,cury);
}
void ogl_swap_buffers_internal(void)
{
SDL_GL_SwapBuffers();
}
int ogl_check_mode(int x, int y)
{
return !SDL_VideoModeOK(x, y, GameArg.DbgGlBpp, SDL_OPENGL | (ogl_fullscreen?SDL_FULLSCREEN:0));
}
int ogl_init_window(int x, int y)
{
if (gl_initialized){
if (x==curx && y==cury && curfull==ogl_fullscreen)
return 0;
#ifdef __LINUX__ // Windows, at least, seems to need to reload every time.
if (ogl_fullscreen || curfull)
#endif
ogl_smash_texture_list_internal();//if we are or were fullscreen, changing vid mode will invalidate current textures
}
SDL_WM_SetCaption(DESCENT_VERSION, "Descent II");
if (!SDL_SetVideoMode(x, y, GameArg.DbgGlBpp, SDL_OPENGL | (ogl_fullscreen ? SDL_FULLSCREEN : 0)))
{
Error("Could not set %dx%dx%d opengl video mode: %s\n", x, y, GameArg.DbgGlBpp, SDL_GetError());
}
SDL_ShowCursor(0);
curx=x;cury=y;curfull=ogl_fullscreen;
gl_initialized=1;
return 0;
}
void ogl_destroy_window(void)
{
if (gl_initialized)
{
ogl_smash_texture_list_internal();
SDL_ShowCursor(1);
}
return;
}
void ogl_init(void)
{
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE,0);
SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE,0);
SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE,0);
SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE,0);
SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE,0);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
}
void ogl_close(void)
{
ogl_destroy_window();
}

View file

@ -1,9 +1,7 @@
/* $Id: gr.c,v 1.1.1.1 2006/03/17 19:53:38 zicodxx Exp $ */
/*
*
* SDL video functions.
*
*
*/
#ifdef HAVE_CONFIG_H
@ -15,99 +13,23 @@
#include <limits.h>
#include <math.h>
#include <SDL/SDL.h>
#ifdef SDL_IMAGE
#include <SDL_image.h>
#endif
#include "gr.h"
#include "grdef.h"
#include "palette.h"
#include "u_mem.h"
#include "error.h"
#include "menu.h"
#include "vers_id.h"
#include "args.h"
#include "gamefont.h"
#include "args.h"
#include "config.h"
#ifdef _WIN32_WCE // should really be checking for "Pocket PC" somehow
# define LANDSCAPE
#endif
int sdl_video_flags = SDL_SWSURFACE | SDL_HWPALETTE | SDL_DOUBLEBUF;
//end addition -MM
SDL_Surface *screen;
#ifdef LANDSCAPE
static SDL_Surface *real_screen, *screen2;
#endif
int gr_installed = 0;
#ifdef LANDSCAPE
/* Create a new rotated surface for drawing */
SDL_Surface *CreateRotatedSurface(SDL_Surface *s)
{
#if 0
return(SDL_CreateRGBSurface(s->flags, s->h, s->w,
s->format->BitsPerPixel,
s->format->Rmask,
s->format->Gmask,
s->format->Bmask,
s->format->Amask));
#else
return(SDL_CreateRGBSurface(s->flags, s->h, s->w, 8, 0, 0, 0, 0));
#endif
}
/* Used to copy the rotated scratch surface to the screen */
void BlitRotatedSurface(SDL_Surface *from, SDL_Surface *to)
{
int bpp = from->format->BytesPerPixel;
int w=from->w, h=from->h, pitch=to->pitch;
int i,j;
Uint8 *pfrom, *pto, *to0;
SDL_LockSurface(from);
SDL_LockSurface(to);
pfrom=(Uint8 *)from->pixels;
to0=(Uint8 *) to->pixels+pitch*(w-1);
for (i=0; i<h; i++)
{
to0+=bpp;
pto=to0;
for (j=0; j<w; j++)
{
if (bpp==1) *pto=*pfrom;
else if (bpp==2) *(Uint16 *)pto=*(Uint16 *)pfrom;
else if (bpp==4) *(Uint32 *)pto=*(Uint32 *)pfrom;
else if (bpp==3)
{
pto[0]=pfrom[0];
pto[1]=pfrom[1];
pto[2]=pfrom[2];
}
pfrom+=bpp;
pto-=pitch;
}
}
SDL_UnlockSurface(from);
SDL_UnlockSurface(to);
}
#endif
void gr_flip()
{
#ifdef LANDSCAPE
screen2 = SDL_DisplayFormat(screen);
BlitRotatedSurface(screen2, real_screen);
//SDL_SetColors(real_screen, screen->format->palette->colors, 0, 256);
SDL_UpdateRect(real_screen, 0, 0, 0, 0);
SDL_FreeSurface(screen2);
#else
SDL_Flip(screen);
#endif
}
// Set the buffer to draw to. 0 is front, 1 is back
@ -117,66 +39,38 @@ void gr_set_draw_buffer(int buf)
buf = buf;
}
int gr_check_mode(u_int32_t mode)
{
int w, h;
w = SM_W(mode);
h = SM_H(mode);
return !SDL_VideoModeOK(w, h, 8, sdl_video_flags);
}
int gr_set_mode(u_int32_t mode)
{
unsigned int w, h;
#ifdef NOGRAPH
return 0;
#endif
if (mode<=0)
return 0;
w=SM_W(mode);
h=SM_H(mode);
//added on 11/06/98 by Matt Mueller to set the title bar. (moved from below)
//sekmu: might wanna copy this litte blurb to one of the text files or something
//we want to set it here so that X window manager "Style" type commands work
//for example, in fvwm2 or fvwm95:
//Style "D1X*" NoTitle, NoHandles, BorderWidth 0
//if you can't use -fullscreen like me (crashes X), this is a big help in
//getting the window centered correctly (if you use SmartPlacement)
screen=NULL;
SDL_WM_SetCaption(DESCENT_VERSION, "Descent II");
//end addition -MM
#ifdef SDL_IMAGE
if(SDL_VideoModeOK(w,h,8,sdl_video_flags))
{
#include "descent.xpm"
SDL_WM_SetIcon(IMG_ReadXPMFromArray(pixmap), NULL);
screen=SDL_SetVideoMode(w, h, 8, sdl_video_flags);
}
else
{
con_printf(CON_URGENT,"Cannot set %ix%i. Fallback to 640x480\n",w,h);
w=640;
h=480;
Game_screen_mode=mode=SM(w,h);
screen=SDL_SetVideoMode(w, h, 8, sdl_video_flags);
}
#endif
//edited 10/05/98 by Matt Mueller - make fullscreen mode optional
// changed by adb on 980913: added SDL_HWPALETTE (should be option?)
// changed by someone on 980923 to add SDL_FULLSCREEN
if (screen == NULL)
{
Error("Could not set %dx%dx8 video mode\n",w,h);
exit(1);
}
#ifdef LANDSCAPE
real_screen = SDL_SetVideoMode(h, w, 0, sdl_video_flags);
screen = CreateRotatedSurface(real_screen);
#else
screen = SDL_SetVideoMode(w, h, 8, sdl_video_flags);
#endif
// end changes by someone
// end changes by adb
//end edit -MM
if (screen == NULL) {
Error("Could not set %dx%dx8 video mode\n",w,h);
exit(1);
}
memset( grd_curscreen, 0, sizeof(grs_screen));
grd_curscreen->sc_mode = mode;
grd_curscreen->sc_w = w;
@ -190,15 +84,8 @@ int gr_set_mode(u_int32_t mode)
grd_curscreen->sc_canvas.cv_bitmap.bm_type = BM_LINEAR;
grd_curscreen->sc_canvas.cv_bitmap.bm_data = (unsigned char *)screen->pixels;
gr_set_current_canvas(NULL);
//gr_enable_default_palette_loading();
//added on 9/30/98 by Matt Mueller to hide the mouse if its over the game window
SDL_ShowCursor(0);
//end addition -MM
//--moved up--added on 9/30/98 by Matt Mueller to set the title bar. Woohoo!
//--moved up-- SDL_WM_SetCaption(DESCENT_VERSION " " D1X_DATE, NULL);
//--moved up--end addition -MM
gamefont_choose_game_font(w,h);
gr_palette_load(gr_palette);
gr_remap_color_fonts();
@ -207,11 +94,13 @@ int gr_set_mode(u_int32_t mode)
return 0;
}
int gr_check_fullscreen(void){
int gr_check_fullscreen(void)
{
return (sdl_video_flags & SDL_FULLSCREEN)?1:0;
}
int gr_toggle_fullscreen(void){
int gr_toggle_fullscreen(void)
{
gr_remap_color_fonts();
gr_remap_mono_fonts();
sdl_video_flags^=SDL_FULLSCREEN;
@ -222,6 +111,7 @@ int gr_toggle_fullscreen(void){
int gr_init(int mode)
{
int retcode;
// Only do this function once!
if (gr_installed==1)
return -1;
@ -230,23 +120,19 @@ int gr_init(int mode)
{
Error("SDL library video initialisation failed: %s.",SDL_GetError());
}
MALLOC( grd_curscreen,grs_screen,1 );
memset( grd_curscreen, 0, sizeof(grs_screen));
if (!GameCfg.WindowMode && !GameArg.SysWindow)
sdl_video_flags|=SDL_FULLSCREEN;
sdl_video_flags|=SDL_FULLSCREEN;
//added 05/19/99 Matt Mueller - make HW surface optional
if (GameArg.DbgSdlHWSurface)
sdl_video_flags|=SDL_HWSURFACE;
//end addition -MM
sdl_video_flags|=SDL_HWSURFACE;
// Set the mode.
if ((retcode=gr_set_mode(mode)))
{
return retcode;
}
grd_curscreen->sc_canvas.cv_color = 0;
grd_curscreen->sc_canvas.cv_drawmode = 0;
@ -256,9 +142,7 @@ int gr_init(int mode)
gr_set_current_canvas( &grd_curscreen->sc_canvas );
gr_installed = 1;
// added on 980913 by adb to add cleanup
atexit(gr_close);
// end changes by adb
return 0;
}
@ -269,121 +153,125 @@ void gr_close()
{
gr_installed = 0;
d_free(grd_curscreen);
SDL_ShowCursor(1);
}
}
// Palette functions follow.
static int last_r=0, last_g=0, last_b=0;
void gr_palette_step_up( int r, int g, int b )
{
int i;
ubyte *p = gr_palette;
int temp;
int i;
ubyte *p = gr_palette;
int temp;
SDL_Palette *palette;
SDL_Color colors[256];
if ( (r==last_r) && (g==last_g) && (b==last_b) )
return;
SDL_Palette *palette;
SDL_Color colors[256];
last_r = r;
last_g = g;
last_b = b;
if ( (r==last_r) && (g==last_g) && (b==last_b) ) return;
palette = screen->format->palette;
last_r = r;
last_g = g;
last_b = b;
if (palette == NULL)
return; // Display is not palettised
palette = screen->format->palette;
for (i=0; i<256; i++)
{
temp = (int)(*p++) + r + gr_palette_gamma;
if (palette == NULL) {
return; // Display is not palettised
}
if (temp<0)
temp=0;
else if (temp>63)
temp=63;
for (i=0; i<256; i++) {
temp = (int)(*p++) + r + gr_palette_gamma;
if (temp<0) temp=0;
else if (temp>63) temp=63;
colors[i].r = temp * 4;
temp = (int)(*p++) + g + gr_palette_gamma;
if (temp<0) temp=0;
else if (temp>63) temp=63;
colors[i].g = temp * 4;
temp = (int)(*p++) + b + gr_palette_gamma;
if (temp<0) temp=0;
else if (temp>63) temp=63;
colors[i].b = temp * 4;
}
colors[i].r = temp * 4;
temp = (int)(*p++) + g + gr_palette_gamma;
SDL_SetColors(screen, colors, 0, 256);
if (temp<0)
temp=0;
else if (temp>63)
temp=63;
colors[i].g = temp * 4;
temp = (int)(*p++) + b + gr_palette_gamma;
if (temp<0)
temp=0;
else if (temp>63)
temp=63;
colors[i].b = temp * 4;
}
SDL_SetColors(screen, colors, 0, 256);
}
//added on 980913 by adb to fix palette problems
// need a min without side effects...
#undef min
static inline int min(int x, int y) { return x < y ? x : y; }
//end changes by adb
void gr_palette_load( ubyte *pal )
{
int i, j;
SDL_Palette *palette;
SDL_Color colors[256];
ubyte gamma[64];
int i, j;
SDL_Palette *palette;
SDL_Color colors[256];
ubyte gamma[64];
if (memcmp(pal,gr_current_pal,768))
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
if (memcmp(pal,gr_current_pal,768))
SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
for (i=0; i<768; i++ ) {
gr_current_pal[i] = pal[i];
if (gr_current_pal[i] > 63) gr_current_pal[i] = 63;
}
for (i=0; i<768; i++ )
{
gr_current_pal[i] = pal[i];
if (gr_current_pal[i] > 63)
gr_current_pal[i] = 63;
}
if (screen == NULL)
return;
if (screen == NULL) {
return;
}
palette = screen->format->palette;
if (palette == NULL) {
return; // Display is not palettised
}
for (i=0;i<64;i++)
gamma[i] = (int)((pow(((double)(14)/(double)(32)), 1.0)*i) + 0.5);
for (i = 0, j = 0; j < 256; j++) {
int c;
c = gr_find_closest_color(gamma[gr_palette[j*3]],gamma[gr_palette[j*3+1]],gamma[gr_palette[j*3+2]]);
gr_fade_table[14*256+j] = c;
//changed on 980913 by adb to fix palette problems
colors[j].r = (min(gr_current_pal[i++] + gr_palette_gamma, 63)) * 4;
colors[j].g = (min(gr_current_pal[i++] + gr_palette_gamma, 63)) * 4;
colors[j].b = (min(gr_current_pal[i++] + gr_palette_gamma, 63)) * 4;
//end changes by adb
}
SDL_SetColors(screen, colors, 0, 256);
// SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 0, 0, 0));
init_computed_colors();
palette = screen->format->palette;
if (palette == NULL)
return; // Display is not palettised
for (i=0;i<64;i++)
gamma[i] = (int)((pow(((double)(14)/(double)(32)), 1.0)*i) + 0.5);
for (i = 0, j = 0; j < 256; j++)
{
int c;
c = gr_find_closest_color(gamma[gr_palette[j*3]],gamma[gr_palette[j*3+1]],gamma[gr_palette[j*3+2]]);
gr_fade_table[14*256+j] = c;
colors[j].r = (min(gr_current_pal[i++] + gr_palette_gamma, 63)) * 4;
colors[j].g = (min(gr_current_pal[i++] + gr_palette_gamma, 63)) * 4;
colors[j].b = (min(gr_current_pal[i++] + gr_palette_gamma, 63)) * 4;
}
SDL_SetColors(screen, colors, 0, 256);
init_computed_colors();
gr_remap_color_fonts();
gr_remap_mono_fonts();
}
void gr_palette_read(ubyte * pal)
{
SDL_Palette *palette;
int i, j;
SDL_Palette *palette;
int i, j;
palette = screen->format->palette;
if (palette == NULL)
return; // Display is not palettised
palette = screen->format->palette;
if (palette == NULL) {
return; // Display is not palettised
}
for (i = 0, j=0; i < 256; i++) {
pal[j++] = palette->colors[i].r / 4;
pal[j++] = palette->colors[i].g / 4;
pal[j++] = palette->colors[i].b / 4;
}
for (i = 0, j=0; i < 256; i++)
{
pal[j++] = palette->colors[i].r / 4;
pal[j++] = palette->colors[i].g / 4;
pal[j++] = palette->colors[i].b / 4;
}
}

View file

@ -333,6 +333,7 @@ void joy_flush()
for (i = 0; i < Joystick.n_buttons; i++) {
Joystick.buttons[i].time_went_down = 0;
Joystick.buttons[i].num_downs = 0;
Joystick.buttons[i].state = SDL_RELEASED;
}
}

View file

@ -256,7 +256,6 @@
676AC2C20668A939007173EB /* timer.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B441DD06687A0200DF26D8 /* timer.c */; };
676AC2C30668A939007173EB /* gr.c in Sources */ = {isa = PBXBuildFile; fileRef = 676AC04E0668A814007173EB /* gr.c */; };
676AC2C40668A939007173EB /* ogl.c in Sources */ = {isa = PBXBuildFile; fileRef = 676AC0510668A814007173EB /* ogl.c */; };
676AC2C50668A939007173EB /* sdlgl.c in Sources */ = {isa = PBXBuildFile; fileRef = 676AC0520668A814007173EB /* sdlgl.c */; };
676AC2C70668A939007173EB /* iff.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B4420006687A9E00DF26D8 /* iff.c */; };
676AC2C80668A939007173EB /* decoder16.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B4421006687AD900DF26D8 /* decoder16.c */; };
676AC2C90668A939007173EB /* decoder8.c in Sources */ = {isa = PBXBuildFile; fileRef = 67B4421106687AD900DF26D8 /* decoder8.c */; };
@ -413,7 +412,6 @@
676032F9066B39CE008A67A3 /* kmatrix.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = kmatrix.c; sourceTree = "<group>"; };
676AC04E0668A814007173EB /* gr.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = gr.c; sourceTree = "<group>"; };
676AC0510668A814007173EB /* ogl.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = ogl.c; sourceTree = "<group>"; };
676AC0520668A814007173EB /* sdlgl.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = sdlgl.c; sourceTree = "<group>"; };
676AC0E10668A86F007173EB /* ogl_init.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = ogl_init.h; sourceTree = "<group>"; };
676AC26F0668A939007173EB /* d2x.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = d2x.app; sourceTree = BUILT_PRODUCTS_DIR; };
676AC31D0668A939007173EB /* d2xgl.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = d2xgl.app; sourceTree = BUILT_PRODUCTS_DIR; };
@ -933,7 +931,6 @@
children = (
676AC04E0668A814007173EB /* gr.c */,
676AC0510668A814007173EB /* ogl.c */,
676AC0520668A814007173EB /* sdlgl.c */,
);
name = ogl;
path = arch/ogl;
@ -1880,7 +1877,6 @@
676AC2B70668A939007173EB /* setup.c in Sources */,
676AC2C30668A939007173EB /* gr.c in Sources */,
676AC2C40668A939007173EB /* ogl.c in Sources */,
676AC2C50668A939007173EB /* sdlgl.c in Sources */,
676AC2BA0668A939007173EB /* digi.c in Sources */,
676AC2BB0668A939007173EB /* event.c in Sources */,
676AC2BD0668A939007173EB /* joy.c in Sources */,

View file

@ -165,7 +165,6 @@ int gr_init(int mode);
// the video mode changes.
int gr_init_screen(int mode, int w, int h, int x, int y, int rowsize, ubyte *data);
int gr_check_mode(u_int32_t mode);
int gr_set_mode(u_int32_t mode);
extern void gr_pal_setblock( int start, int number, unsigned char * pal );

View file

@ -17,7 +17,6 @@ void ogl_vivify_texture_list_internal(void);
extern int ogl_brightness_ok;
extern int ogl_brightness_r, ogl_brightness_g, ogl_brightness_b;
extern int ogl_fullscreen;
void ogl_do_fullscreen_internal(void);
extern int GL_TEXTURE_2D_enabled;
#define OGL_ENABLE2(a,f) {if (a ## _enabled!=1) {f;a ## _enabled=1;}}

View file

@ -70,12 +70,7 @@ extern float OglTexMinFilt;
extern int active_texture_unit;
void ogl_setActiveTexture(int t);
int ogl_check_mode(int x, int y); // check if mode is valid
int ogl_init_window(int x, int y);//create a window/switch modes/etc
void ogl_destroy_window(void);//destroy window/etc
void ogl_init(void);//one time initialization
void ogl_close(void);//one time shutdown
#define OGL_FLAG_MIPMAP (1 << 0)
#define OGL_FLAG_NOCOLOR (1 << 1)

View file

@ -1,4 +1,3 @@
/* $Id: strutil.h,v 1.1.1.1 2006/03/17 20:01:28 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -24,13 +23,6 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
# define strnicmp(a,b,c) strncasecmp(a,b,c)
#endif
#ifdef _WIN32_WCE
# define stricmp _stricmp
# define strnicmp _strnicmp
# define strlwr _strlwr
# define strrev _strrev
#endif
#ifndef _WIN32
#ifndef __DJGPP__
void strupr( char *s1 );
@ -46,7 +38,7 @@ void removeext(const char *filename, char *out);
//give a filename a new extension, doesn't work with paths.
extern void change_filename_extension( char *dest, char *src, char *new_ext );
#if !defined(__MSDOS__) && !(defined(_WIN32) && !defined(_WIN32_WCE))
#if !(defined(_WIN32))
void _splitpath(char *name, char *drive, char *path, char *base, char *ext);
#endif

View file

@ -9,18 +9,11 @@
# include <windows.h>
#endif
#ifdef _WIN32_WCE // should really be checking for "Pocket PC" somehow
# define LANDSCAPE
#endif
#include <SDL/SDL.h>
#include "libmve.h"
static SDL_Surface *g_screen;
#ifdef LANDSCAPE
static SDL_Surface *real_screen;
#endif
static unsigned char g_palette[768];
static int g_truecolor;
@ -47,57 +40,6 @@ int main(int c, char **v)
return doPlay(v[1]);
}
#ifdef LANDSCAPE
/* Create a new rotated surface for drawing */
SDL_Surface *CreateRotatedSurface(SDL_Surface *s)
{
return(SDL_CreateRGBSurface(s->flags, s->h, s->w,
s->format->BitsPerPixel,
s->format->Rmask,
s->format->Gmask,
s->format->Bmask,
s->format->Amask));
}
/* Used to copy the rotated scratch surface to the screen */
void BlitRotatedSurface(SDL_Surface *from, SDL_Surface *to)
{
int bpp = from->format->BytesPerPixel;
int w=from->w, h=from->h, pitch=to->pitch;
int i,j;
Uint8 *pfrom, *pto, *to0;
SDL_LockSurface(from);
SDL_LockSurface(to);
pfrom=(Uint8 *)from->pixels;
to0=(Uint8 *) to->pixels+pitch*(w-1);
for (i=0; i<h; i++)
{
to0+=bpp;
pto=to0;
for (j=0; j<w; j++)
{
if (bpp==1) *pto=*pfrom;
else if (bpp==2) *(Uint16 *)pto=*(Uint16 *)pfrom;
else if (bpp==4) *(Uint32 *)pto=*(Uint32 *)pfrom;
else if (bpp==3)
{
pto[0]=pfrom[0];
pto[1]=pfrom[1];
pto[2]=pfrom[2];
}
pfrom+=bpp;
pto-=pitch;
}
}
SDL_UnlockSurface(from);
SDL_UnlockSurface(to);
}
#endif
static unsigned int fileRead(void *handle, void *buf, unsigned int count)
{
unsigned numread;
@ -144,18 +86,12 @@ static void showFrame(unsigned char *buf, unsigned int bufw, unsigned int bufh,
destRect.h = h;
SDL_BlitSurface(sprite, &srcRect, g_screen, &destRect);
#ifdef LANDSCAPE
BlitRotatedSurface(g_screen, real_screen);
if ( (real_screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF )
SDL_Flip(real_screen);
else
SDL_UpdateRect(real_screen, 0, 0, 0, 0);
#else
if ( (g_screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF )
SDL_Flip(g_screen);
else
SDL_UpdateRects(g_screen, 1, &destRect);
#endif
SDL_FreeSurface(sprite);
}
@ -230,16 +166,9 @@ static int doPlay(const char *filename)
MVE_getVideoSpec(&vSpec);
#ifndef _WIN32_WCE // doesn't like to change bpp?
bpp = vSpec.truecolor?16:8;
#endif
#ifdef LANDSCAPE
real_screen = SDL_SetVideoMode(vSpec.screenHeight, vSpec.screenWidth, bpp, SDL_FULLSCREEN);
g_screen = CreateRotatedSurface(real_screen);
#else
g_screen = SDL_SetVideoMode(vSpec.screenWidth, vSpec.screenHeight, bpp, SDL_ANYFORMAT);
#endif
g_truecolor = vSpec.truecolor;

View file

@ -3,9 +3,6 @@
#include <conf.h>
#endif
#ifndef __MSDOS__
#define AUDIO
#endif
//#define DEBUG
#include <string.h>
@ -111,15 +108,13 @@ static int end_movie_handler(unsigned char major, unsigned char minor, unsigned
* timer handlers
*************************/
#if !defined(HAVE_STRUCT_TIMEVAL) || !HAVE_STRUCT_TIMEVAL // ifdef _WIN32_WCE
#if !_WIN32 // ZICO - we don`t want timeval in win32
#if !defined(HAVE_STRUCT_TIMEVAL) || !HAVE_STRUCT_TIMEVAL
struct timeval
{
long tv_sec;
long tv_usec;
};
#endif
#endif
/*
* timer variables

View file

@ -961,15 +961,6 @@ int HandleSystemKey(int key)
Function_mode = FMODE_MENU;
break;
// case KEY_SHIFTED + KEY_ESC: //quick exit
// #ifdef EDITOR
// if (! SafetyCheck()) break;
// close_editor_screen();
// #endif
// Game_aborted=1;
// Function_mode=FMODE_EXIT;
// break;
// fleshed these out because F1 and F2 aren't sequenctial keycodes on mac -- MWA
MAC(case KEY_COMMAND+KEY_SHIFTED+KEY_1:)
@ -984,18 +975,6 @@ int HandleSystemKey(int key)
switch (key) {
#if 0
case KEY_SHIFTED + KEY_ESC: //quick exit
#ifdef EDITOR
if (! SafetyCheck()) break;
close_editor_screen();
#endif
Game_aborted=1;
Function_mode=FMODE_EXIT;
break;
#endif
MAC( case KEY_COMMAND+KEY_P: )
case KEY_PAUSE:
do_game_pause(); break;
@ -2349,38 +2328,12 @@ void ReadControls()
game_flush_inputs();
} else {
int i;
//if (key_down_count(KEY_BACKSP))
// Int3();
//if (key_down_count(KEY_PRINT_SCREEN))
// save_screen_shot(0);
#ifndef MACINTOSH
for (i = 0; i < 4; i++)
// the following "if" added by WraithX, 4/17/00
if (isJoyRotationKey(i) != 1)
{
if (joy_get_button_down_cnt(i) > 0)
Death_sequence_aborted = 1;
}// end "if" added by WraithX
#else
if (joy_get_any_button_down_cnt() > 0)
Death_sequence_aborted = 1;
#endif
for (i = 0; i < 3; i++)
// the following "if" added by WraithX, 4/17/00
if (isMouseRotationKey(i) != 1)
{
if (mouse_button_down_count(i) > 0)
Death_sequence_aborted = 1;
}// end "if" added by WraithX
for (i=0; i < JOY_MAX_BUTTONS; i++ )
if (joy_get_button_down_cnt(i) > 0) Death_sequence_aborted = 1;
//for (i = 0; i < 256; i++)
// // the following "if" added by WraithX, 4/17/00
// if (isKeyboardRotationKey(i) != 1)
// {
// if (!key_isfunc(i) && !key_ismod(i) && key_down_count(i) > 0)
// Death_sequence_aborted = 1;
// }// end "if" added by WraithX
for (i = 0; i < MOUSE_MAX_BUTTONS; i++)
if (mouse_button_down_count(i) > 0) Death_sequence_aborted = 1;
if (Death_sequence_aborted)
game_flush_inputs();

View file

@ -360,14 +360,6 @@ int main(int argc, char *argv[])
Lighting_on = 1;
#ifdef EDITOR
if (gr_check_mode(SM(800, 600)) != 0)
{
con_printf(CON_NORMAL, "The editor will not be available, press any key to start game...\n" );
Function_mode = FMODE_MENU;
}
#endif
con_printf (CON_VERBOSE, "%s", TXT_VERBOSE_1);
ReadConfigFile();

View file

@ -488,7 +488,6 @@ void change_res()
u_int32_t screen_mode = 0, aspect_mode = 0;
int screen_width = 0;
int screen_height = 0;
SDL_Rect **sdlmode = SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
m[mc].type = NM_TYPE_RADIO; m[mc].text = "320x200"; m[mc].value = (Game_screen_mode == SM(320,200)); m[mc].group = 0; modes[mc] = SM(320,200); mc++;
m[mc].type = NM_TYPE_RADIO; m[mc].text = "640x480"; m[mc].value = (Game_screen_mode == SM(640,480)); m[mc].group = 0; modes[mc] = SM(640,480); mc++;
@ -554,11 +553,6 @@ void change_res()
if (Game_screen_mode == screen_mode)
return;
if (screen_width > sdlmode[0]->w || screen_height > sdlmode[0]->h) {
if (!nm_messagebox( TXT_WARNING, 2, "NO", "YES", "Could not verify selected\nscreen resolution.\nThe game may crash.\nDo you really want to proceed?" ))
return;
}
if (screen_width < 320 || screen_height < 200) {
nm_messagebox( TXT_WARNING, 1, "OK", "Entered resolution is too small.\nReverting ..." );
return;

View file

@ -1,4 +1,3 @@
/* $Id: movie.c,v 1.1.1.1 2006/03/17 19:55:55 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -22,17 +21,11 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <conf.h>
#endif
#ifdef RCS
static char rcsid[] = "$Id: movie.c,v 1.1.1.1 2006/03/17 19:55:55 zicodxx Exp $";
#endif
#include <string.h>
#ifndef macintosh
# ifndef _WIN32_WCE
# include <sys/types.h>
# include <sys/stat.h>
# include <fcntl.h>
# endif
# include <sys/types.h>
# include <sys/stat.h>
# include <fcntl.h>
# ifndef _MSC_VER
# include <unistd.h>
# endif

View file

@ -313,7 +313,7 @@ network_init(void)
network_flush();
Netgame.PacketsPerSec=10;
Netgame.ShortPackets=1;
Netgame.ShortPackets=0;
}
int

View file

@ -27,9 +27,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <stdio.h>
#include <stdarg.h>
#include <string.h> // for memset
#ifndef _WIN32_WCE
#include <errno.h>
#endif
#include <ctype.h> /* for isdigit */
#include <limits.h>
#ifdef __unix__
@ -3003,11 +3001,7 @@ void newdemo_start_recording()
Newdemo_state = ND_STATE_RECORDING;
outfile = PHYSFSX_openWriteBuffered(DEMO_FILENAME);
#if !defined(MACINTOSH) && !defined(_WIN32_WCE)
if (outfile == NULL && errno == ENOENT) { //dir doesn't exist?
#else
if (outfile == NULL) { //dir doesn't exist and no errno on mac!
#endif
PHYSFS_mkdir(DEMO_DIR); //try making directory
outfile = PHYSFSX_openWriteBuffered(DEMO_FILENAME);
}

View file

@ -26,9 +26,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#if !defined(_MSC_VER) && !defined(macintosh)
#include <unistd.h>
#endif
#ifndef _WIN32_WCE
#include <errno.h>
#endif
#if !(defined(__APPLE__) && defined(__MACH__))
#include <physfs.h>

View file

@ -28,9 +28,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#if !defined(_MSC_VER) && !defined(macintosh)
#include <unistd.h>
#endif
#ifndef _WIN32_WCE
#include <errno.h>
#endif
#ifdef OGL
# ifdef _MSC_VER
# include <windows.h>

View file

@ -1,4 +1,3 @@
/* $Id: strutil.c,v 1.1.1.1 2006/03/17 19:58:51 zicodxx Exp $ */
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
@ -152,7 +151,7 @@ void change_filename_extension( char *dest, char *src, char *ext )
strcpy(p+1,ext);
}
#if !defined(__MSDOS__) && !(defined(_WIN32) && !defined(_WIN32_WCE))
#if !(defined(_WIN32))
void _splitpath(char *name, char *drive, char *path, char *base, char *ext)
{
char *s, *p;
@ -204,21 +203,3 @@ void _splitpath(char *name, char *drive, char *path, char *base, char *ext)
strcpy(ext, p);
}
#endif
#if 0
void main()
{
char drive[10], path[50], name[16], ext[5];
drive[0] = path[0] = name[0] = ext[0] = '\0';
_splitpath("f:\\tmp\\x.out", drive, path, name, ext);
drive[0] = path[0] = name[0] = ext[0] = '\0';
_splitpath("tmp\\x.out", drive, path, name, ext);
drive[0] = path[0] = name[0] = ext[0] = '\0';
_splitpath("f:\\tmp\\a.out", NULL, NULL, name, NULL);
drive[0] = path[0] = name[0] = ext[0] = '\0';
_splitpath("tmp\\*.dem", drive, path, NULL, NULL);
drive[0] = path[0] = name[0] = ext[0] = '\0';
_splitpath(".\\tmp\\*.dem", drive, path, NULL, NULL);
}
#endif