svn merge -r 1800:1841 ../polymer

git-svn-id: https://svn.eduke32.com/eduke32@1842 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
plagman 2011-03-13 02:23:18 +00:00
parent 44ab4b6ca1
commit 0c2157f5eb
72 changed files with 7456 additions and 3847 deletions

View file

@ -224,7 +224,7 @@ ifeq ($(PRETTY_OUTPUT),1)
endif
$(MAKE) -C $(EROOT)/ "OBJ=../$(EOBJ)" $@
#\
SUPERBUILD=$(SUPERBUILD) POLYMOST=$(POLYMOST) DEBUGANYWAY=$(DEBUGANYWAY) KRANDDEBUG=$(KRANDDEBUG)\
DEBUGANYWAY=$(DEBUGANYWAY) KRANDDEBUG=$(KRANDDEBUG)\
USE_OPENGL=$(USE_OPENGL) BUILD32_ON_64=$(BUILD32_ON_64) PROFILER=$(PROFILER)\
NOASM=$(NOASM) NEDMALLOC=$(NEDMALLOC) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) $@
ifeq ($(PRETTY_OUTPUT),1)

View file

@ -11,14 +11,11 @@ PRETTY_OUTPUT ?= 1
DXROOT_OVERRIDE:=
# Engine options
# SUPERBUILD - enables voxels
# POLYMOST - enables Polymost renderer
# USE_OPENGL - enables OpenGL support in Polymost
# USE_OPENGL - enables basic OpenGL Polymost renderer
# POLYMER - enables fancy Polymer renderer
# NOASM - disables the use of inline assembly pragmas
# LINKED_GTK - enables compile-time linkage to GTK
#
SUPERBUILD = 1
POLYMOST = 1
POLYMER = 1
USE_OPENGL = 1
NOASM = 0
@ -27,7 +24,6 @@ BUILD32_ON_64 = 0
NEDMALLOC = 1
ifeq (0,$(USE_OPENGL))
POLYMOST = 0
POLYMER = 0
endif

View file

@ -20,8 +20,8 @@ EDITORLIB=build.lib
# the WDK allows us to link against msvcrt.dll instead of msvcrxxx.dll
# this path should match build\Makefile.msvc
WDKROOT="C:\WinDDK\7600.16385.1"
DXROOT="C:\Program Files\Microsoft DirectX SDK (February 2010)"
WDKROOT="H:\WinDDK\7600.16385.1"
DXROOT="H:\Microsoft DirectX SDK (February 2010)"
!ifdef DEBUG
# debugging options
@ -33,7 +33,7 @@ flags_cl=/O2 /GL /arch:SSE /MP /I$(WDKROOT)\inc\crt
flags_link=/RELEASE /LTCG /LIBPATH:$(WDKROOT)\lib\wxp\i386 /LIBPATH:$(WDKROOT)\lib\Crt\i386
!endif
ENGINEOPTS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DPOLYMER
ENGINEOPTS=/DUSE_OPENGL /DPOLYMER
CC=cl
AS=ml

View file

@ -46,7 +46,7 @@ else
LIBS+= $(L_SSP) -Wl,--enable-auto-import
endif
OURCFLAGS=$(BASECFLAGS) -Wno-char-subscripts -DKSFORBUILD -I$(INC) $(ARCH)
OURCFLAGS=$(BASECFLAGS) -Wno-char-subscripts -I$(INC) $(ARCH)
OURCXXFLAGS=$(BASECXXFLAGS)
ASFLAGS=$(BASEASFLAGS)

View file

@ -9,7 +9,7 @@ OBJ=obj.msc
!endif
INC=include\ #
!ifndef CFLAGS
CFLAGS=/DSUPERBUILD /DPOLYMOST /DUSE_OPENGL /DKSFORBUILD /DPOLYMER # /DNEDMALLOC
CFLAGS=/DUSE_OPENGL /DPOLYMER # /DNEDMALLOC
!endif
o=obj

View file

@ -3,13 +3,12 @@
ENGINELIB=libengine.a
EDITORLIB=libbuild.a
# SDLCONFIG = /usr/local/bin/sdl-config
SDLCONFIG = /usr/bin/sdl-config
SDLCONFIG = /usr/local/bin/sdl-configinvalid
ifeq ($(wildcard $(SDLCONFIG)),$(SDLCONFIG))
SDLROOT = /usr/local
else
SDLCONFIG = sdl-config
SDLCONFIG = /usr/bin/sdl-config
endif
SDL_FRAMEWORK = 0
@ -184,12 +183,6 @@ endif
BUILDCFLAGS+= -DRENDERTYPE$(RENDERTYPE)=1
ifneq (0,$(SUPERBUILD))
BUILDCFLAGS+= -DSUPERBUILD
endif
ifneq (0,$(POLYMOST))
BUILDCFLAGS+= -DPOLYMOST
endif
ifneq (0,$(USE_OPENGL))
BUILDCFLAGS+= -DUSE_OPENGL
endif
@ -201,11 +194,9 @@ ifneq (0,$(LINKED_GTK))
endif
ifneq (0,$(POLYMER))
ifneq (0,$(POLYMOST))
ifneq (0,$(USE_OPENGL))
BUILDCFLAGS+= -DPOLYMER
endif
endif
endif
ifneq (0,$(NEDMALLOC))

View file

@ -81,6 +81,8 @@ extern char keyasciififo[KEYFIFOSIZ], keyasciififoplc, keyasciififoend;
extern char scantoasc[128], remap[256], key_names[256][24];
extern int32_t remapinit;
extern int32_t defaultres[][2];
extern void SetKey(int32_t key, int32_t state);
// mouse

View file

@ -29,6 +29,10 @@ extern "C" {
#define MAXWALLSB ((MAXWALLS>>2)+(MAXWALLS>>3))
#define MAXSPRITES MAXSPRITESV8
// additional space beyond wall, in walltypes:
#define M32_FIXME_WALLS 512
#define M32_FIXME_SECTORS 2
#define MAXTILES 15360
#define MAXVOXELS 4096
#define MAXSTATUS 1024
@ -57,6 +61,17 @@ extern "C" {
#define PR_LIGHT_PRIO_LOW 4
#define PR_LIGHT_PRIO_LOW_GAME 5
////////// yax defs //////////
#define YAX_BIT 1024
#define YAX_CEILING 0
#define YAX_FLOOR 1
#define YAX_SECTORFLD(Sect,Fld, Cf) (*((Cf) ? (&sector[Sect].floor##Fld) : (&sector[Sect].ceiling##Fld)))
int16_t yax_getbunch(int16_t i, int16_t cf);
void yax_setbunch(int16_t i, int16_t cf, int16_t bunchnum);
#define CLIPMASK0 (((1L)<<16)+1L)
#define CLIPMASK1 (((256L)<<16)+64L)
@ -292,11 +307,10 @@ extern int32_t dommxoverlay, novoxmips;
extern float debug1, debug2;
#ifdef SUPERBUILD
extern int32_t tiletovox[MAXTILES];
extern int32_t usevoxels, voxscale[MAXVOXELS];
#endif
#ifdef POLYMOST
#ifdef USE_OPENGL
extern int32_t usemodels, usehightile;
extern int32_t rendmode;
#endif
@ -313,7 +327,7 @@ EXTERN int32_t connecthead, connectpoint2[MAXPLAYERS];
static inline int32_t getrendermode(void)
{
#ifndef POLYMOST
#ifndef USE_OPENGL
return 0;
#else
return rendmode;
@ -465,7 +479,7 @@ void setview(int32_t x1, int32_t y1, int32_t x2, int32_t y2);
void setaspect(int32_t daxrange, int32_t daaspect);
void flushperms(void);
void plotlines2d(int32_t *xx, int32_t *yy, int32_t numpoints, char col) ATTRIBUTE((nonnull(1,2)));
void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, char col) ATTRIBUTE((nonnull(1,2)));
void plotpixel(int32_t x, int32_t y, char col);
char getpixel(int32_t x, int32_t y);
@ -491,7 +505,7 @@ int32_t clipinsideboxline(int32_t x, int32_t y, int32_t x1, int32_t y1, int32_
int32_t pushmove(vec3_t *vect, int16_t *sectnum, int32_t walldist, int32_t ceildist, int32_t flordist, uint32_t cliptype) ATTRIBUTE((nonnull(1,2)));
void getzrange(const vec3_t *vect, int16_t sectnum, int32_t *ceilz, int32_t *ceilhit, int32_t *florz, int32_t *florhit, int32_t walldist, uint32_t cliptype) ATTRIBUTE((nonnull(1,3,4,5,6)));
int32_t hitscan(const vec3_t *sv, int16_t sectnum, int32_t vx, int32_t vy, int32_t vz, hitdata_t *hitinfo, uint32_t cliptype) ATTRIBUTE((nonnull(1,6)));
int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, char tagsearch) ATTRIBUTE((nonnull(6,7,8)));
int32_t neartag(int32_t xs, int32_t ys, int32_t zs, int16_t sectnum, int16_t ange, int16_t *neartagsector, int16_t *neartagwall, int16_t *neartagsprite, int32_t *neartaghitdist, int32_t neartagrange, uint8_t tagsearch) ATTRIBUTE((nonnull(6,7,8)));
int32_t cansee(int32_t x1, int32_t y1, int32_t z1, int16_t sect1, int32_t x2, int32_t y2, int32_t z2, int16_t sect2);
void updatesector(int32_t x, int32_t y, int16_t *sectnum) ATTRIBUTE((nonnull(3)));
void updatesectorexclude(int32_t x, int32_t y, int16_t *sectnum, const uint8_t *excludesectbitmap) ATTRIBUTE((nonnull(3)));
@ -573,6 +587,8 @@ int32_t changespritesect(int16_t spritenum, int16_t newsectnum);
int32_t changespritestat(int16_t spritenum, int16_t newstatnum);
int32_t setsprite(int16_t spritenum, const vec3_t *new) ATTRIBUTE((nonnull(2)));
int32_t spriteheight(int16_t i, int32_t *basez);
int32_t screencapture(const char *filename, char inverseit) ATTRIBUTE((nonnull(1)));
int32_t getclosestcol(int32_t r, int32_t g, int32_t b);
@ -601,7 +617,7 @@ void drawcircle16(int32_t x1, int32_t y1, int32_t r, int32_t eccen, char col);
int32_t setrendermode(int32_t renderer);
int32_t getrendermode(void);
#ifdef POLYMOST
#ifdef USE_OPENGL
void setrollangle(int32_t rolla);
#endif
@ -626,7 +642,7 @@ int32_t polymost_drawtilescreen(int32_t tilex, int32_t tiley, int32_t wallnum, i
void polymost_glreset(void);
void polymost_precache(int32_t dapicnum, int32_t dapalnum, int32_t datype);
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
extern int32_t glanisotropy;
extern int32_t glusetexcompr;
extern int32_t gltexfiltermode;
@ -667,7 +683,7 @@ int32_t md_loadmodel(const char *fn);
int32_t md_setmisc(int32_t modelid, float scale, int32_t shadeoff, float zadd, int32_t flags);
// int32_t md_tilehasmodel(int32_t tilenume, int32_t pal);
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
typedef struct
{
// maps build tiles to particular animation frames of a model
@ -694,7 +710,7 @@ static inline int32_t md_tilehasmodel(int32_t tilenume,int32_t pal)
int32_t md_defineframe(int32_t modelid, const char *framename, int32_t tilenume, int32_t skinnum, float smoothduration, int32_t pal);
int32_t md_defineanimation(int32_t modelid, const char *framestart, const char *frameend, int32_t fps, int32_t flags);
int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32_t skinnum, int32_t surfnum, float param, float specpower, float specfactor);
int32_t md_definehud (int32_t modelid, int32_t tilex, double xadd, double yadd, double zadd, double angadd, int32_t flags);
int32_t md_definehud (int32_t modelid, int32_t tilex, double xadd, double yadd, double zadd, double angadd, int32_t flags, int32_t fov);
int32_t md_undefinetile(int32_t tile);
int32_t md_undefinemodel(int32_t modelid);
@ -727,7 +743,7 @@ void hash_add(hashtable_t *t, const char *s, int32_t key, int32_t replace);
#ifdef POLYMER
# include "polymer.h"
#else
#ifdef POLYMOST
#ifdef USE_OPENGL
# include "polymost.h"
#endif
#endif

View file

@ -11,7 +11,7 @@
extern "C" {
#endif
#define VERSION " 2.0.0devel"
#define VERSION "2.0.0devel"
// Build keys
#define BK_MOVEFORWARD 0
@ -39,8 +39,10 @@ extern "C" {
extern int32_t qsetmode;
extern int16_t searchsector, searchwall, searchstat;
extern int16_t searchbottomwall;
extern int32_t zmode, kensplayerheight;
extern int16_t defaultspritecstat;
extern int32_t zmode, kensplayerheight, zlock;
#define DEFAULT_SPRITE_CSTAT 0
//extern int16_t defaultspritecstat;
extern int32_t temppicnum, tempcstat, templotag, temphitag, tempextra;
extern uint32_t temppal, tempvis, tempxrepeat, tempyrepeat;
@ -62,6 +64,7 @@ extern int16_t prefixtiles[16];
extern char program_origcwd[BMAX_PATH];
extern char *mapster32_fullpath;
extern char *testplay_addparam;
extern const char *g_namesFileName;
extern int32_t m32_osd_tryscript;
extern int32_t showheightindicators;
@ -83,13 +86,15 @@ extern inline int32_t getscreenvdisp(int32_t bz, int32_t zoome);
extern void setup_sideview_sincos(void);
extern void m32_setkeyfilter(int32_t on);
extern int32_t wallength(int16_t i);
extern void fixrepeats(int16_t i);
extern void fixxrepeat(int16_t i, uint32_t lenrepquot);
extern int32_t ExtInit(void);
extern int32_t ExtPreInit(int32_t argc,const char **argv);
extern void ExtUnInit(void);
extern void ExtPreCheckKeys(void);
#ifdef SUPERBUILD
extern void ExtAnalyzeSprites(void);
#endif
extern void ExtCheckKeys(void);
extern void ExtPreLoadMap(void);
extern void ExtLoadMap(const char *mapname);
@ -122,6 +127,8 @@ extern void showsectordata(int16_t sectnum, int16_t small);
extern void showwalldata(int16_t wallnum, int16_t small);
extern void showspritedata(int16_t spritenum, int16_t small);
extern void drawsmallabel(const char *text, char col, char backcol, int32_t dax, int32_t day, int32_t daz);
extern int32_t circlewall;
int32_t loadsetup(const char *fn); // from config.c
@ -149,11 +156,19 @@ extern int32_t lastpm16time;
extern char lastpm16buf[156];
void DoSpriteOrnament(int32_t i);
void getpoint(int32_t searchxe, int32_t searchye, int32_t *x, int32_t *y);
int32_t getpointhighlight(int32_t xplc, int32_t yplc, int32_t point);
void update_highlight();
void update_highlightsector();
int32_t inside_editor(const vec3_t *pos, int32_t searchx, int32_t searchy, int32_t zoom,
int32_t x, int32_t y, int16_t sectnum);
void correct_sprite_yoffset(int32_t i);
extern uint8_t hlsectorbitmap[MAXSECTORS>>3];
#ifdef _WIN32
#define DEFAULT_GAME_EXEC "eduke32.exe"
#define DEFAULT_GAME_LOCAL_EXEC "eduke32.exe"
@ -169,21 +184,6 @@ void test_map(int32_t mode);
#define POINT2(i) (wall[wall[i].point2])
#define SPRITESEC(j) (sector[sprite[j].sectnum])
static inline int32_t wallength(int16_t i)
{
int64_t dax = POINT2(i).x - wall[i].x;
int64_t day = POINT2(i).y - wall[i].y;
#if 1 //def POLYMOST
int64_t hypsq = dax*dax + day*day;
if (hypsq > (int64_t)INT_MAX)
return (int32_t)sqrt((double)hypsq);
else
return ksqrt((int32_t)hypsq);
#else
return ksqrt(dax*dax + day*day);
#endif
}
#define CLEARLINES2D(Startline, Numlines, Color) clearbuf((char *)(frameplace + ((Startline)*bytesperline)), (bytesperline*(Numlines))>>2, (Color))
#define SCRIPTHISTSIZ 32 // should be the same as OSD_HISTORYDEPTH for maximum win, should be a power of two
@ -222,4 +222,8 @@ extern int32_t scripthistend;
Itervar < endwall; \
Itervar++
#define BTAG_MAX 65535
#define BZ_MAX 8388608
#endif

View file

@ -231,9 +231,9 @@ void freeallmodels(void);
void clearskins(void);
int32_t mddraw(spritetype *tspr);
typedef struct { float xadd, yadd, zadd; int16_t angadd, flags; } hudtyp;
typedef struct { float xadd, yadd, zadd; int16_t angadd, flags, fov; } hudtyp;
EXTERN hudtyp hudmem[2][MAXTILES]; //~320KB ... ok for now ... could replace with dynamic alloc
EXTERN hudtyp hudmem[2][MAXTILES];
EXTERN int32_t mdpause;
EXTERN int32_t nummodelsalloced, nextmodelid;

View file

@ -53,6 +53,13 @@ extern int32_t pr_overridespecular;
extern float pr_specularpower;
extern float pr_specularfactor;
extern int32_t pr_highpalookups;
extern int32_t pr_overridehud;
extern float pr_hudxadd;
extern float pr_hudyadd;
extern float pr_hudzadd;
extern int32_t pr_hudangadd;
extern int32_t pr_hudfov;
extern float pr_overridemodelscale;
extern int32_t pr_ati_fboworkaround;
extern int32_t pr_ati_nodepthoffset;
#ifdef __APPLE__
@ -283,13 +290,15 @@ typedef struct s_pranimatespritesinfo {
// EXTERNAL FUNCTIONS
int32_t polymer_init(void);
void polymer_uninit(void);
void polymer_setaspect(int32_t);
void polymer_glinit(void);
void polymer_resetlights(void);
void polymer_loadboard(void);
void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t daposz, int16_t daang, int32_t dahoriz, int16_t dacursectnum);
void polymer_drawmasks(void);
void polymer_editorpick(void);
void polymer_rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade, char dapalnum, int32_t dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2);
void polymer_inb4rotatesprite(int16_t tilenum, char pal, int8_t shade);
void polymer_postrotatesprite(void);
void polymer_drawmaskwall(int32_t damaskwallcnt);
void polymer_drawsprite(int32_t snum);
void polymer_setanimatesprites(animatespritesptr animatesprites, int32_t x, int32_t y, int32_t a, int32_t smoothratio);

View file

@ -1,7 +1,7 @@
#ifndef _polymost_h_
# define _polymost_h_
#ifdef POLYMOST
#ifdef USE_OPENGL
#include "hightile.h"

View file

@ -47,6 +47,14 @@ char scantoasc[128] =
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
int32_t defaultres[][2] =
{
{1920, 1440}, {1920, 1200}, {1920, 1080}, {1600, 1200}, {1600, 900}, {1366, 768}, {1280, 1024},
{1280, 960}, {1152, 864}, {1024, 768}, {1024, 600}, {800, 600}, {640, 480}, {640, 400},
{512, 384}, {480, 360}, {400, 300}, {320, 240}, {320, 200}, {0, 0}
};
void SetKey(int32_t key, int32_t state)
{
keystatus[remap[key]] = state;
@ -141,7 +149,7 @@ int32_t flushlogwindow = 1;
static void onvideomodechange(int32_t newmode) { UNREFERENCED_PARAMETER(newmode); }
void (*baselayer_onvideomodechange)(int32_t) = onvideomodechange;
#if defined(POLYMOST)
#ifdef USE_OPENGL
static int32_t osdfunc_setrendermode(const osdfuncparm_t *parm)
{
int32_t m;
@ -312,7 +320,6 @@ int32_t baselayer_init(void)
cvar_t cvars_engine[] =
{
#ifdef SUPERBUILD
{ "r_usenewaspect","r_usenewaspect: enable/disable new screen aspect ratio determination code",(void *) &r_usenewaspect, CVAR_BOOL, 0, 1 },
{ "r_screenaspect","r_screenaspect: if using the new aspect code and in fullscreen, screen aspect ratio in the form XXYY, e.g. 1609 for 16:9",(void *) &r_screenxy, CVAR_UINT, 100, 9999 },
{ "r_novoxmips","r_novoxmips: turn off/on the use of mipmaps when rendering 8-bit voxels",(void *) &novoxmips, CVAR_BOOL, 0, 1 },
@ -321,7 +328,6 @@ int32_t baselayer_init(void)
{ "vid_gamma","vid_gamma <gamma>: adjusts gamma ramp",(void *) &vid_gamma, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 },
{ "vid_contrast","vid_contrast <gamma>: adjusts gamma ramp",(void *) &vid_contrast, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 },
{ "vid_brightness","vid_brightness <gamma>: adjusts gamma ramp",(void *) &vid_brightness, CVAR_DOUBLE|CVAR_FUNCPTR, 0, 10 },
#endif
{ "debug1","debug counter",(void *) &debug1, CVAR_FLOAT, -100000, 100000 },
{ "debug2","debug counter",(void *) &debug2, CVAR_FLOAT, -100000, 100000 },
};
@ -335,7 +341,7 @@ int32_t baselayer_init(void)
(cvars_engine[i].type & CVAR_FUNCPTR) ? osdcmd_cvar_set_baselayer : osdcmd_cvar_set);
}
#ifdef POLYMOST
#ifdef USE_OPENGL
OSD_RegisterFunction("setrendermode","setrendermode <number>: sets the engine's rendering mode.\n"
"Mode numbers are:\n"
" 0 - Classic Build software\n"

File diff suppressed because it is too large Load diff

View file

@ -59,8 +59,8 @@ extern int16_t brightness;
extern int32_t vsync;
extern char game_executable[BMAX_PATH];
extern int32_t fullscreen;
extern char option[9];
extern char keys[NUMBUILDKEYS];
extern char default_buildkeys[NUMBUILDKEYS];
static char *const keys = default_buildkeys;
extern char remap[256];
extern int32_t remapinit;
extern double msens;
@ -134,8 +134,8 @@ int32_t loadsetup(const char *fn)
if (readconfig(fp, "xdim3d", val, VL) > 0) xdimgame = Batoi(val);
if (readconfig(fp, "ydim3d", val, VL) > 0) ydimgame = Batoi(val);
// if (readconfig(fp, "samplerate", val, VL) > 0) option[7] = (Batoi(val) & 0x0f) << 4;
if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; }
if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; }
// if (readconfig(fp, "music", val, VL) > 0) { if (Batoi(val) != 0) option[2] = 1; else option[2] = 0; }
// if (readconfig(fp, "mouse", val, VL) > 0) { if (Batoi(val) != 0) option[3] = 1; else option[3] = 0; }
if (readconfig(fp, "bpp", val, VL) > 0) bppgame = Batoi(val);
if (readconfig(fp, "vsync", val, VL) > 0) vsync = Batoi(val)?1:0;
if (readconfig(fp, "editorgridextent", val, VL) > 0) editorgridextent = max(min(262144,Batoi(val)),32768);
@ -155,7 +155,7 @@ int32_t loadsetup(const char *fn)
#ifdef RENDERTYPEWIN
if (readconfig(fp, "maxrefreshfreq", val, VL) > 0) maxrefreshfreq = Batoi(val);
#endif
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (readconfig(fp, "usemodels", val, VL) > 0) usemodels = Batoi(val)?1:0;
if (readconfig(fp, "usehightile", val, VL) > 0) usehightile = Batoi(val)?1:0;
@ -187,10 +187,10 @@ int32_t loadsetup(const char *fn)
if (readconfig(fp, "gameexecutable", val, VL) > 0)
Bstrcpy(game_executable, val);
option[0] = 1; // vesa all the way...
option[1] = 1; // sound all the way...
option[4] = 0; // no multiplayer
option[5] = 0;
// option[0] = 1; // vesa all the way...
// option[1] = 1; // sound all the way...
// option[4] = 0; // no multiplayer
// option[5] = 0;
#if 1
if (readconfig(fp, "keyforward", val, VL) > 0) keys[0] = Bstrtol(val, NULL, 16);
@ -345,7 +345,7 @@ int32_t writesetup(const char *fn)
"; Startup grid size (0-8, 9 is automatic)\n"
"grid = %d\n"
"\n"
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
"; OpenGL mode options\n"
"usemodels = %d\n"
"usehightile = %d\n"
@ -393,11 +393,6 @@ int32_t writesetup(const char *fn)
"music = %d\n"
"\n"
#endif
"; Enable mouse\n"
"; 0 - No\n"
"; 1 - Yes\n"
"mouse = %d\n"
"\n"
"; Mouse sensitivity\n"
"mousesensitivity = %g\n"
"\n"
@ -511,7 +506,7 @@ int32_t writesetup(const char *fn)
glrendmode,
#endif
editorgridextent, min(max(0, default_grid), 9),
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
usemodels, usehightile,
glusetexcache, gltexfiltermode, glanisotropy,r_downsize,glusetexcompr,
#endif
@ -525,7 +520,7 @@ int32_t writesetup(const char *fn)
#if 0
option[7]>>4, option[2],
#endif
option[3], msens, unrealedlook, pk_uedaccel, quickmapcycling,
msens, unrealedlook, pk_uedaccel, quickmapcycling,
sideview_reversehrot,
revertCTRL,scrollamount,pk_turnaccel,pk_turndecel,autosave,autocorruptcheck,
showheightindicators,showambiencesounds,graphicsmode,

View file

@ -58,6 +58,7 @@ enum scripttoken_t
T_YADD,
T_ZADD,
T_ANGADD,
T_FOV,
T_FLIPPED,
T_HIDE,
T_NOBOB,
@ -105,7 +106,7 @@ static int32_t getatoken(scriptfile *sf, const tokenlist *tl, int32_t ntokens)
static int32_t lastmodelid = -1, lastvoxid = -1, modelskin = -1, lastmodelskin = -1, seenframe = 0;
extern int32_t nextvoxid;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
extern float alphahackarray[MAXTILES];
#endif
@ -305,7 +306,7 @@ static int32_t defsparser(scriptfile *script)
if (scriptfile_getsymbol(script,&tile)) break;
if (scriptfile_getdouble(script,&alpha)) break;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if ((uint32_t)tile < MAXTILES) alphahackarray[tile] = alpha;
#endif
}
@ -325,7 +326,7 @@ static int32_t defsparser(scriptfile *script)
tilenume2 = tilenume1;
tilenume1 = i;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if ((tilenume1 >= 0 && tilenume1 < MAXTILES) && (tilenume2 >= 0 && tilenume2 < MAXTILES))
{
for (i=tilenume1; i<=tilenume2; i++)
@ -467,7 +468,7 @@ static int32_t defsparser(scriptfile *script)
char *texturetokptr = script->ltextptr, *textureend, *fn = NULL, *tfn = NULL, *ftd = NULL;
int32_t tile=-1, token, i;
int32_t alphacut = 255;
int32_t xoffset = 0, yoffset = 0;
int32_t xoffset = 0, yoffset = 0, goodtogo=0;
static const tokenlist tilefromtexturetokens[] =
{
@ -526,6 +527,7 @@ static int32_t defsparser(scriptfile *script)
}
else Bfree(tfn);
pathsearchmode = i;
goodtogo = 1;
}
if ((unsigned)tile >= (unsigned)MAXTILES)
@ -535,6 +537,7 @@ static int32_t defsparser(scriptfile *script)
break;
}
if (goodtogo)
{
int32_t xsiz, ysiz, j;
int32_t *picptr = NULL;
@ -699,7 +702,7 @@ static int32_t defsparser(scriptfile *script)
if (scriptfile_getdouble(script,&scale)) break;
if (scriptfile_getnumber(script,&shadeoffs)) break;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
lastmodelid = md_loadmodel(modelfn);
if (lastmodelid < 0)
{
@ -715,7 +718,7 @@ static int32_t defsparser(scriptfile *script)
case T_DEFINEMODELFRAME:
{
char *framename;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
char happy=1;
#endif
int32_t ftilenume, ltilenume, tilex;
@ -736,7 +739,7 @@ static int32_t defsparser(scriptfile *script)
initprintf("Warning: Ignoring frame definition.\n");
break;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++)
{
switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), 0.0f,0))
@ -777,7 +780,7 @@ static int32_t defsparser(scriptfile *script)
initprintf("Warning: Ignoring animation definition.\n");
break;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
switch (md_defineanimation(lastmodelid, startframe, endframe, (int32_t)(dfps*(65536.0*.001)), flags))
{
case 0:
@ -823,7 +826,7 @@ static int32_t defsparser(scriptfile *script)
if (seenframe) { modelskin = ++lastmodelskin; }
seenframe = 0;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), 0, 0.0f, 1.0f, 1.0f))
{
case 0:
@ -863,7 +866,6 @@ static int32_t defsparser(scriptfile *script)
break;
}
#ifdef SUPERBUILD
if (qloadkvx(nextvoxid, fn))
{
initprintf("Failure loading voxel file \"%s\"\n",fn);
@ -871,7 +873,6 @@ static int32_t defsparser(scriptfile *script)
}
lastvoxid = nextvoxid++;
#endif
}
break;
case T_DEFINEVOXELTILES:
@ -901,13 +902,10 @@ static int32_t defsparser(scriptfile *script)
initprintf("Warning: Ignoring voxel tiles definition.\n");
break;
}
#ifdef SUPERBUILD
for (tilex = ftilenume; tilex <= ltilenume; tilex++)
{
tiletovox[tilex] = lastvoxid;
}
#endif
}
break;
// NEW (ENCOURAGED) DEFINITION SYNTAX
@ -938,7 +936,7 @@ static int32_t defsparser(scriptfile *script)
if (scriptfile_getstring(script,&modelfn)) break;
if (scriptfile_getbraces(script,&modelend)) break;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
lastmodelid = md_loadmodel(modelfn);
if (lastmodelid < 0)
{
@ -1016,7 +1014,7 @@ static int32_t defsparser(scriptfile *script)
initprintf("Warning: Ignoring frame definition.\n");
break;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++)
{
switch (md_defineframe(lastmodelid, framename, tilex, max(0,modelskin), smoothduration,pal))
@ -1081,7 +1079,7 @@ static int32_t defsparser(scriptfile *script)
initprintf("Warning: Ignoring animation definition.\n");
break;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
switch (md_defineanimation(lastmodelid, startframe, endframe, (int32_t)(dfps*(65536.0*.001)), flags))
{
case 0:
@ -1170,7 +1168,7 @@ static int32_t defsparser(scriptfile *script)
break;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
switch (md_defineskin(lastmodelid, skinfn, palnum, max(0,modelskin), surfnum, param, specpower, specfactor))
{
case 0:
@ -1197,7 +1195,7 @@ static int32_t defsparser(scriptfile *script)
{
char *hudtokptr = script->ltextptr;
char happy=1, *frameend;
int32_t ftilenume = -1, ltilenume = -1, tilex = 0, flags = 0;
int32_t ftilenume = -1, ltilenume = -1, tilex = 0, flags = 0, fov = -1;
double xadd = 0.0, yadd = 0.0, zadd = 0.0, angadd = 0.0;
static const tokenlist modelhudtokens[] =
@ -1209,6 +1207,7 @@ static int32_t defsparser(scriptfile *script)
{ "yadd", T_YADD },
{ "zadd", T_ZADD },
{ "angadd", T_ANGADD },
{ "fov", T_FOV },
{ "hide", T_HIDE },
{ "nobob", T_NOBOB },
{ "flipped",T_FLIPPED},
@ -1234,6 +1233,8 @@ static int32_t defsparser(scriptfile *script)
scriptfile_getdouble(script,&zadd); break;
case T_ANGADD:
scriptfile_getdouble(script,&angadd); break;
case T_FOV:
scriptfile_getsymbol(script,&fov); break;
case T_HIDE:
flags |= 1; break;
case T_NOBOB:
@ -1262,10 +1263,10 @@ static int32_t defsparser(scriptfile *script)
initprintf("Warning: Ignoring frame definition.\n");
break;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
for (tilex = ftilenume; tilex <= ltilenume && happy; tilex++)
{
switch (md_definehud(lastmodelid, tilex, xadd, yadd, zadd, angadd, flags))
switch (md_definehud(lastmodelid, tilex, xadd, yadd, zadd, angadd, flags, fov))
{
case 0:
break;
@ -1289,7 +1290,7 @@ static int32_t defsparser(scriptfile *script)
}
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
md_setmisc(lastmodelid,(float)scale,shadeoffs,(float)mzadd,flags);
#endif
@ -1314,10 +1315,8 @@ static int32_t defsparser(scriptfile *script)
if (scriptfile_getstring(script,&fn)) break; //voxel filename
if (nextvoxid == MAXVOXELS) { initprintf("Maximum number of voxels already defined.\n"); break; }
#ifdef SUPERBUILD
if (qloadkvx(nextvoxid, fn)) { initprintf("Failure loading voxel file \"%s\"\n",fn); break; }
lastvoxid = nextvoxid++;
#endif
if (scriptfile_getbraces(script,&modelend)) break;
while (script->textptr < modelend)
@ -1327,10 +1326,8 @@ static int32_t defsparser(scriptfile *script)
//case T_ERROR: initprintf("Error on line %s:%d in voxel tokens\n", script->filename,linenum); break;
case T_TILE:
scriptfile_getsymbol(script,&tilex);
#ifdef SUPERBUILD
if ((uint32_t)tilex < MAXTILES) tiletovox[tilex] = lastvoxid;
else initprintf("Invalid tile number on line %s:%d\n",script->filename, scriptfile_getlinum(script,voxeltokptr));
#endif
break;
case T_TILE0:
scriptfile_getsymbol(script,&tile0); break; //1st tile #
@ -1343,17 +1340,13 @@ static int32_t defsparser(scriptfile *script)
}
if ((tile1 < 0) || (tile0 >= MAXTILES))
{ initprintf("Invalid tile range on line %s:%d\n",script->filename, scriptfile_getlinum(script,voxeltokptr)); break; }
#ifdef SUPERBUILD
for (tilex=tile0; tilex<=tile1; tilex++) tiletovox[tilex] = lastvoxid;
#endif
break; //last tile number (inclusive)
case T_SCALE:
{
double scale=1.0;
scriptfile_getdouble(script,&scale);
#ifdef SUPERBUILD
voxscale[lastvoxid] = (int32_t)(65536*scale);
#endif
break;
}
}
@ -1823,7 +1816,7 @@ static int32_t defsparser(scriptfile *script)
break;
}
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
for (; r0 <= r1; r0++) md_undefinetile(r0);
#endif
}
@ -1832,7 +1825,7 @@ static int32_t defsparser(scriptfile *script)
case T_UNDEFMODELOF:
{
int32_t r0;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
int32_t mid;
#endif
@ -1843,7 +1836,7 @@ static int32_t defsparser(scriptfile *script)
break;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
mid = md_tilehasmodel(r0,0);
if (mid < 0) break;

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@
* See the included license file "BUILDLIC.TXT" for license info.
*/
#ifdef POLYMOST
#ifdef USE_OPENGL
#include "build.h"
#include "compat.h"

View file

@ -1,6 +1,6 @@
//------------------------------------- MD2/MD3 LIBRARY BEGINS -------------------------------------
#ifdef POLYMOST
#ifdef USE_OPENGL
#include "compat.h"
#include "build.h"
@ -372,7 +372,7 @@ int32_t md_defineskin(int32_t modelid, const char *skinfn, int32_t palnum, int32
return 0;
}
int32_t md_definehud(int32_t modelid, int32_t tilex, double xadd, double yadd, double zadd, double angadd, int32_t flags)
int32_t md_definehud(int32_t modelid, int32_t tilex, double xadd, double yadd, double zadd, double angadd, int32_t flags, int32_t fov)
{
if (!mdinited) mdinit();
@ -384,6 +384,7 @@ int32_t md_definehud(int32_t modelid, int32_t tilex, double xadd, double yadd, d
hudmem[(flags>>2)&1][tilex].zadd = zadd;
hudmem[(flags>>2)&1][tilex].angadd = ((int16_t)angadd)|2048;
hudmem[(flags>>2)&1][tilex].flags = (int16_t)flags;
hudmem[(flags>>2)&1][tilex].fov = (int16_t)fov;
return 0;
}
@ -1813,8 +1814,11 @@ int md3postload_polymer(md3model_t *m)
surfi++;
}
return 1;
#else
UNREFERENCED_PARAMETER(m);
#endif
return 1;
}

View file

@ -1,6 +1,6 @@
// blah
#ifdef POLYMOST
#ifdef USE_OPENGL
#define POLYMER_C
#include "polymer.h"
@ -31,6 +31,13 @@ int32_t pr_overridespecular = 0;
float pr_specularpower = 15.0f;
float pr_specularfactor = 1.0f;
int32_t pr_highpalookups = 1;
int32_t pr_overridehud = 0;
float pr_hudxadd = 0.0f;
float pr_hudyadd = 0.0f;
float pr_hudzadd = 0.0f;
int32_t pr_hudangadd = 0;
int32_t pr_hudfov = 426;
float pr_overridemodelscale = 0.0f;
int32_t pr_ati_fboworkaround = 0;
int32_t pr_ati_nodepthoffset = 0;
#ifdef __APPLE__
@ -585,6 +592,8 @@ _prprograminfo prprograms[1 << PR_BIT_COUNT];
int32_t overridematerial;
int32_t globaloldoverridematerial;
int32_t rotatespritematerialbits;
// RENDER TARGETS
_prrt *prrts;
@ -744,10 +753,23 @@ void polymer_uninit(void)
}
}
void polymer_glinit(void)
void polymer_setaspect(int32_t ang)
{
float aspect;
if (pr_customaspect != 0.0f)
aspect = pr_customaspect;
else
aspect = (float)(windowx2-windowx1+1) /
(float)(windowy2-windowy1+1);
bglMatrixMode(GL_PROJECTION);
bglLoadIdentity();
bgluPerspective((float)(ang) / (2048.0f / 360.0f), aspect, 0.01f, 100.0f);
}
void polymer_glinit(void)
{
bglClearColor(0.0f, 0.0f, 0.0f, 1.0f);
bglClearStencil(0);
bglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@ -755,8 +777,6 @@ void polymer_glinit(void)
// texturing
bglEnable(GL_TEXTURE_2D);
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
bglEnable(GL_DEPTH_TEST);
bglDepthFunc(GL_LEQUAL);
@ -769,15 +789,7 @@ void polymer_glinit(void)
else
bglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
if (pr_customaspect != 0.0f)
aspect = pr_customaspect;
else
aspect = (float)(windowx2-windowx1+1) /
(float)(windowy2-windowy1+1);
bglMatrixMode(GL_PROJECTION);
bglLoadIdentity();
bgluPerspective((float)(pr_fov) / (2048.0f / 360.0f), aspect, 0.01f, 100.0f);
polymer_setaspect(pr_fov);
bglMatrixMode(GL_MODELVIEW);
bglLoadIdentity();
@ -1199,21 +1211,18 @@ void polymer_editorpick(void)
searchit = 0;
}
void polymer_rotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16_t picnum, int8_t dashade,
char dapalnum, int32_t dastat, int32_t cx1, int32_t cy1, int32_t cx2, int32_t cy2)
void polymer_inb4rotatesprite(int16_t tilenum, char pal, int8_t shade)
{
UNREFERENCED_PARAMETER(sx);
UNREFERENCED_PARAMETER(sy);
UNREFERENCED_PARAMETER(z);
UNREFERENCED_PARAMETER(a);
UNREFERENCED_PARAMETER(picnum);
UNREFERENCED_PARAMETER(dashade);
UNREFERENCED_PARAMETER(dapalnum);
UNREFERENCED_PARAMETER(dastat);
UNREFERENCED_PARAMETER(cx1);
UNREFERENCED_PARAMETER(cy1);
UNREFERENCED_PARAMETER(cx2);
UNREFERENCED_PARAMETER(cy2);
_prmaterial rotatespritematerial;
polymer_getbuildmaterial(&rotatespritematerial, tilenum, pal, shade, 4);
rotatespritematerialbits = polymer_bindmaterial(rotatespritematerial, NULL, 0);
}
void polymer_postrotatesprite(void)
{
polymer_unbindmaterial(rotatespritematerialbits);
}
void polymer_drawmaskwall(int32_t damaskwallcnt)
@ -2735,7 +2744,7 @@ static void polymer_updatewall(int16_t wallnum)
// it also works, bitches
sec = &sector[sectofwall];
if (sectofwall < 0 || sectofwall > numsectors ||
if (sectofwall < 0 || sectofwall >= numsectors ||
wallnum < 0 || wallnum > numwalls ||
sec->wallptr > wallnum || wallnum >= (sec->wallptr + sec->wallnum))
return; // yay, corrupt map
@ -2828,7 +2837,7 @@ static void polymer_updatewall(int16_t wallnum)
else
xref = 0;
if (wal->nextsector < 0 || wal->nextsector > numsectors)
if (wal->nextsector < 0 || wal->nextsector >= numsectors)
{
Bmemcpy(w->wall.buffer, &s->floor.buffer[(wallnum - sec->wallptr) * 5], sizeof(GLfloat) * 3);
Bmemcpy(&w->wall.buffer[5], &s->floor.buffer[(wal->point2 - sec->wallptr) * 5], sizeof(GLfloat) * 3);
@ -3726,7 +3735,11 @@ static void polymer_drawmdsprite(spritetype *tspr)
bglLoadIdentity();
scale = (1.0/4.0);
scale *= m->scale;
if (pr_overridemodelscale) {
scale *= pr_overridemodelscale;
} else {
scale *= m->bscale;
}
if (tspriteptr[MAXSPRITESONSCREEN] == tspr) {
float playerang, radplayerang, cosminusradplayerang, sinminusradplayerang, hudzoom;

View file

@ -66,7 +66,7 @@ Low priority:
**************************************************************************************************/
#ifdef POLYMOST
#ifdef USE_OPENGL
#include "compat.h"
#include "build.h"
@ -5279,6 +5279,15 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
x1 = hudmem[(dastat&4)>>2][picnum].xadd;
y1 = hudmem[(dastat&4)>>2][picnum].yadd;
z1 = hudmem[(dastat&4)>>2][picnum].zadd;
#ifdef POLYMER
if (pr_overridehud) {
x1 = pr_hudxadd;
y1 = pr_hudyadd;
z1 = pr_hudzadd;
}
#endif
if (!(hudmem[(dastat&4)>>2][picnum].flags&2)) //"NOBOB" is specified in DEF
{
fx = ((double)sx)*(1.0/65536.0);
@ -5312,6 +5321,12 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
}
tspr.ang = hudmem[(dastat&4)>>2][picnum].angadd+globalang;
#ifdef POLYMER
if (pr_overridehud) {
tspr.ang = pr_hudangadd + globalang;
}
#endif
if (dastat&4) { x1 = -x1; y1 = -y1; }
// In Polymost, we don't care if the model is very big
@ -5389,6 +5404,8 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
# ifdef POLYMER
else
{
int32_t fov;
tspriteptr[MAXSPRITESONSCREEN] = &tspr;
bglEnable(GL_ALPHA_TEST);
@ -5397,8 +5414,22 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
spriteext[tspr.owner].roll = a;
spriteext[tspr.owner].zoff = z;
fov = hudmem[(dastat&4)>>2][picnum].fov;
if (fov == -1) {
fov = pr_fov;
}
if (pr_overridehud) {
fov = pr_hudfov;
}
polymer_setaspect(fov);
polymer_drawsprite(MAXSPRITESONSCREEN);
polymer_setaspect(pr_fov);
spriteext[tspr.owner].zoff = 0;
spriteext[tspr.owner].roll = 0;
@ -5454,6 +5485,12 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
bglDisable(GL_DEPTH_TEST);
bglDisable(GL_ALPHA_TEST);
bglEnable(GL_TEXTURE_2D);
# ifdef POLYMER
if (rendmode >= 4) {
polymer_inb4rotatesprite(picnum, dapalnum, dashade);
}
# endif
}
#endif
@ -5607,6 +5644,11 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
#ifdef USE_OPENGL
if (rendmode >= 3)
{
# ifdef POLYMER
if (rendmode >= 4) {
polymer_postrotatesprite();
}
# endif
bglMatrixMode(GL_PROJECTION); bglPopMatrix();
bglMatrixMode(GL_MODELVIEW); bglPopMatrix();
}
@ -6234,6 +6276,13 @@ void polymost_initosdfuncs(void)
{ "r_pr_specularpower", "r_pr_specularpower: overriden specular material power", (void *) &pr_specularpower, CVAR_FLOAT | CVAR_NOSAVE, -10, 1000 },
{ "r_pr_specularfactor", "r_pr_specularfactor: overriden specular material factor", (void *) &pr_specularfactor, CVAR_FLOAT | CVAR_NOSAVE, -10, 1000 },
{ "r_pr_highpalookups", "r_pr_highpalookups: enable/disable highpalookups", (void *) &pr_highpalookups, CVAR_BOOL, 0, 1 },
{ "r_pr_overridehud", "r_pr_overridehud: overrides hud model parameters with values from the pr_hud* cvars; use it to fine-tune DEF tokens", (void *) &pr_overridehud, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
{ "r_pr_hudxadd", "r_pr_hudxadd: overriden HUD xadd; see r_pr_overridehud", (void *) &pr_hudxadd, CVAR_FLOAT | CVAR_NOSAVE, -100, 100 },
{ "r_pr_hudyadd", "r_pr_hudyadd: overriden HUD yadd; see r_pr_overridehud", (void *) &pr_hudyadd, CVAR_FLOAT | CVAR_NOSAVE, -100, 100 },
{ "r_pr_hudzadd", "r_pr_hudzadd: overriden HUD zadd; see r_pr_overridehud", (void *) &pr_hudzadd, CVAR_FLOAT | CVAR_NOSAVE, -100, 100 },
{ "r_pr_hudangadd", "r_pr_hudangadd: overriden HUD angadd; see r_pr_overridehud", (void *) &pr_hudangadd, CVAR_INT | CVAR_NOSAVE, -512, 512 },
{ "r_pr_hudfov", "r_pr_hudfov: overriden HUD fov; see r_pr_overridehud", (void *) &pr_hudfov, CVAR_INT | CVAR_NOSAVE, 0, 1023 },
{ "r_pr_overridemodelscale", "r_pr_overridemodelscale: overrides model scale if non-zero; use it to fine-tune DEF tokens", (void *) &pr_overridemodelscale, CVAR_FLOAT | CVAR_NOSAVE, 0, 500 },
{ "r_pr_ati_fboworkaround", "r_pr_ati_fboworkaround: enable this to workaround an ATI driver bug that causes sprite shadows to be square - you need to restart the renderer for it to take effect", (void *) &pr_ati_fboworkaround, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
{ "r_pr_ati_nodepthoffset", "r_pr_ati_nodepthoffset: enable this to workaround an ATI driver bug that causes sprite drawing to freeze the game on Radeon X1x00 hardware - you need to restart the renderer for it to take effect", (void *) &pr_ati_nodepthoffset, CVAR_BOOL | CVAR_NOSAVE, 0, 1 },
#endif
@ -6350,7 +6399,7 @@ Description of Ken's filter to improve LZW compression of DXT1 format by ~15%: (
I think this improved compression by a few % :)
*/
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
int32_t dxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf, char *packbuf, uint32_t miplen)
{
void *writebuf;

View file

@ -202,7 +202,7 @@ int32_t main(int32_t argc, char *argv[])
}
}
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
if ((argp = Bgetenv("BUILD_NOFOG")) != NULL)
nofog = Batol(argp);
#endif
@ -217,7 +217,7 @@ int32_t main(int32_t argc, char *argv[])
return r;
}
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
void setvsync(int32_t sync)
{
if (vsync == sync) return;
@ -303,7 +303,10 @@ int32_t initsystem(void)
}
else
*/
novideo = nogl = 1;
novideo = 1;
#ifdef USE_OPENGL
nogl = 1;
#endif
}
signal(SIGSEGV, sighandler);
@ -791,18 +794,13 @@ void getvalidmodes(void)
#endif
0
};
static int32_t defaultres[][2] =
{
{1280,1024}
,{1280,960},{1152,864},{1024,768},{800,600},{640,480},
{640,400},{512,384},{480,360},{400,300},{320,240},{320,200},{0,0}
};
SDL_Rect **modes;
#if (SDL_MAJOR_VERSION > 1 || SDL_MINOR_VERSION > 2)
SDL_PixelFormat pf = { NULL, 8, 1, 0,0,0,0, 0,0,0,0, 0,0,0,0 };
#else
SDL_PixelFormat pf = { NULL, 8, 1, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0 };
#endif
SDL_PixelFormat pf;
pf.palette = NULL;
pf.BitsPerPixel = 8;
pf.BytesPerPixel = 1;
int32_t i, j, maxx=0, maxy=0;
if (modeschecked || novideo) return;
@ -810,7 +808,8 @@ void getvalidmodes(void)
validmodecnt=0;
// initprintf("Detecting video modes:\n");
#define ADDMODE(x,y,c,f) if (validmodecnt<MAXVALIDMODES) { \
#define ADDMODE(x,y,c,f) do { \
if (validmodecnt<MAXVALIDMODES) { \
int32_t mn; \
for(mn=0;mn<validmodecnt;mn++) \
if (validmode[mn].xdim==x && validmode[mn].ydim==y && \
@ -823,7 +822,8 @@ void getvalidmodes(void)
validmodecnt++; \
/*initprintf(" - %dx%d %d-bit %s\n", x, y, c, (f&1)?"fullscreen":"windowed");*/ \
} \
}
} \
} while (0)
#define CHECK(w,h) if ((w < maxx) && (h < maxy))
@ -837,9 +837,9 @@ void getvalidmodes(void)
pf.BytesPerPixel = cdepths[j] >> 3;
modes = SDL_ListModes(&pf, SURFACE_FLAGS
#if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3)
// #if (SDL_MAJOR_VERSION == 1 && SDL_MINOR_VERSION < 3)
| SDL_FULLSCREEN // not implemented/working in SDL 1.3 SDL_compat.c
#endif
//#endif
);
if (modes == (SDL_Rect **)0)
@ -851,7 +851,7 @@ void getvalidmodes(void)
if (modes == (SDL_Rect **)-1)
{
for (i=0; defaultres[i][0]; i++)
ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],1)
ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],1);
}
else
{
@ -859,7 +859,7 @@ void getvalidmodes(void)
{
if ((modes[i]->w > MAXXDIM) || (modes[i]->h > MAXYDIM)) continue;
ADDMODE(modes[i]->w, modes[i]->h, cdepths[j], 1)
ADDMODE(modes[i]->w, modes[i]->h, cdepths[j], 1);
if ((modes[i]->w > maxx) && (modes[i]->h > maxy))
{
@ -885,7 +885,7 @@ void getvalidmodes(void)
if (cdepths[j] < 0) continue;
for (i=0; defaultres[i][0]; i++)
CHECK(defaultres[i][0],defaultres[i][1])
ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],0)
ADDMODE(defaultres[i][0],defaultres[i][1],cdepths[j],0);
}
#undef CHECK
@ -987,7 +987,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
if (lockcount) while (lockcount) enddrawing();
#if defined(USE_OPENGL)
#ifdef USE_OPENGL
if (bpp > 8 && sdl_surface) polymost_glreset();
#endif
@ -998,7 +998,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
gammabrightness = 0; // redetect on next mode switch
}
#if defined(USE_OPENGL)
#ifdef USE_OPENGL
if (c > 8)
{
int32_t i, j, multisamplecheck = (glmultisample > 0);

View file

@ -0,0 +1,452 @@
#!BPY
"""
Name: 'ASCII Scene (.ase) v0.16'
Blender: 249
Group: 'Import'
Tooltip: 'ASCII Scene import (*.ase)'
"""
__author__ = "Goofos & Plagman"
__version__ = "0.16"
# goofos at epruegel.de
#
# ***** BEGIN GPL LICENSE BLOCK *****
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
import string, time, sys as osSys
import Blender
from Blender import Draw, Mesh, Window, Object, Scene, NMesh, Key, Ipo, IpoCurve
#import meshtools
def read_main(filename):
global counts
counts = {'verts': 0, 'tris': 0}
start = time.clock()
file = open(filename, "r")
print_boxed("----------------start-----------------")
print 'Import Patch: ', filename
editmode = Window.EditMode() # are we in edit mode? If so ...
if editmode: Window.EditMode(0) # leave edit mode before getting the mesh
lines= file.readlines()
read_file(file, lines)
Blender.Window.DrawProgressBar(1.0, '') # clear progressbar
file.close()
print "----------------end-----------------"
end = time.clock()
seconds = " in %.2f %s" % (end-start, "seconds")
totals = "Verts: %i Tris: %i " % (counts['verts'], counts['tris'])
print_boxed(totals)
message = "Successfully imported " + Blender.sys.basename(filename) + seconds
#meshtools.print_boxed(message)
print_boxed(message)
def print_boxed(text): #Copy/Paste from meshtools, only to remove the beep :)
lines = text.splitlines()
maxlinelen = max(map(len, lines))
if osSys.platform[:3] == "win":
print chr(218)+chr(196) + chr(196)*maxlinelen + chr(196)+chr(191)
for line in lines:
print chr(179) + ' ' + line.ljust(maxlinelen) + ' ' + chr(179)
print chr(192)+chr(196) + chr(196)*maxlinelen + chr(196)+chr(217)
else:
print '+-' + '-'*maxlinelen + '-+'
for line in lines: print '| ' + line.ljust(maxlinelen) + ' |'
print '+-' + '-'*maxlinelen + '-+'
#print '\a\r', # beep when done
class ase_obj:
def __init__(self):
self.name = 'Name'
self.objType = None
self.row0x = None
self.row0y = None
self.row0z = None
self.row1x = None
self.row1y = None
self.row1z = None
self.row2x = None
self.row2y = None
self.row2z = None
self.row3x = None
self.row3y = None
self.row3z = None
self.parent = None
self.obj = None
self.objName = 'Name'
class ase_mesh:
def __init__(self):
self.name = ''
self.vCount = 0
self.fCount = 0
self.frames = []
self.verts = []
self.faces = []
self.animated = 0
self.frameCount = -1
class mesh_vert:
def __init__(self):
self.x = 0.0
self.y = 0.0
self.z = 0.0
self.u = 0.0
self.v = 0.0
self.nx = 0.0
self.ny = 0.0
self.nz = 0.0
self.origi = 0
def make_tuple(self):
return (self.x, self.y, self.z, self.u, self.v, self.nx, self.ny, self.nz)
class mesh_face:
def __init__(self):
self.v1 = mesh_vert()
self.v2 = mesh_vert()
self.v3 = mesh_vert()
self.i1 = 0
self.i2 = 0
self.i3 = 0
def read_file(file, lines):
objects = []
objIdx = 0
objCheck = -1 #needed to skip helper objects
PBidx = 0.0
lineCount = float(len(lines))
processed_indices = []
curFaceID = 0
faceVertID = 0
print 'Read file'
Blender.Window.DrawProgressBar(0.0, "Read File...")
for line in lines:
words = string.split(line)
if (PBidx % 10000) == 0.0:
Blender.Window.DrawProgressBar(PBidx / lineCount, "Read File...")
if not words:
continue
elif objIdx > 0 and me.animated == 1:
# I don't know how to make empty statements, this is to skip everything else
me.animated = me.animated
elif words[0] == '*GEOMOBJECT':
objCheck = 0
newObj = ase_obj()
objects.append(newObj)
obj = objects[objIdx]
objIdx += 1
obj.objType = 'Mesh'
obj.obj = ase_mesh()
me = obj.obj
elif words[0] == '*NODE_NAME' and objCheck != -1:
if objCheck == 0:
obj.name = words[1]
objCheck = 1
elif objCheck == 1:
obj.objName = words[1]
elif words[0] == '*TM_ROW0' and objCheck != -1:
obj.row0x = float(words[1])
obj.row0y = float(words[2])
obj.row0z = float(words[3])
elif words[0] == '*TM_ROW1' and objCheck != -1:
obj.row1x = float(words[1])
obj.row1y = float(words[2])
obj.row1z = float(words[3])
elif words[0] == '*TM_ROW2' and objCheck != -1:
obj.row2x = float(words[1])
obj.row2y = float(words[2])
obj.row2z = float(words[3])
elif words[0] == '*TM_ROW3' and objCheck != -1:
obj.row3x = float(words[1])
obj.row3y = float(words[2])
obj.row3z = float(words[3])
objCheck = -1
elif words[0] == '*MESH_NUMVERTEX':
me.vCount = int(words[1])
for i in range(me.vCount):
me.verts.append(mesh_vert())
elif words[0] == '*MESH_NUMFACES':
me.fCount = int(words[1])
for i in range(me.fCount):
me.faces.append(mesh_face())
elif words[0] == '*MESH_VERTEX':
i = int(words[1])
me.verts[i].x = float(words[2]);
me.verts[i].y = float(words[3]);
me.verts[i].z = float(words[4]);
elif words[0] == '*MESH_FACE':
i = int(words[1].rstrip(":")) # looks like "13:"
v1 = int(words[3]);
v2 = int(words[5]);
v3 = int(words[7]);
me.faces[i].v1.x = me.verts[v1].x;
me.faces[i].v1.y = me.verts[v1].y;
me.faces[i].v1.z = me.verts[v1].z;
me.faces[i].v1.origi = v1
me.faces[i].v2.x = me.verts[v2].x;
me.faces[i].v2.y = me.verts[v2].y;
me.faces[i].v2.z = me.verts[v2].z;
me.faces[i].v2.origi = v2
me.faces[i].v3.x = me.verts[v3].x;
me.faces[i].v3.y = me.verts[v3].y;
me.faces[i].v3.z = me.verts[v3].z;
me.faces[i].v3.origi = v3
elif words[0] == '*MESH_NUMTVERTEX':
del me.verts[:]
uvCount = int(words[1])
for i in range(uvCount):
me.verts.append(mesh_vert())
elif words[0] == '*MESH_TVERT':
i = int(words[1])
me.verts[i].u = float(words[2]);
me.verts[i].v = float(words[3]);
elif words[0] == '*MESH_TFACE':
i = int(words[1])
uv1 = int(words[2]);
uv2 = int(words[3]);
uv3 = int(words[4]);
me.faces[i].v1.u = me.verts[uv1].u;
me.faces[i].v1.v = me.verts[uv1].v;
me.faces[i].v2.u = me.verts[uv2].u;
me.faces[i].v2.v = me.verts[uv2].v;
me.faces[i].v3.u = me.verts[uv3].u;
me.faces[i].v3.v = me.verts[uv3].v;
elif words[0] == '*MESH_FACENORMAL':
curFaceID = int(words[1]) # global, vertexnormal needs this
faceVertID = 0 # same
elif words[0] == '*MESH_VERTEXNORMAL':
nx = float(words[2])
ny = float(words[3])
nz = float(words[4])
if (faceVertID == 0):
me.faces[curFaceID].v1.nx = nx;
me.faces[curFaceID].v1.ny = ny;
me.faces[curFaceID].v1.nz = nz;
elif (faceVertID == 1):
me.faces[curFaceID].v2.nx = nx;
me.faces[curFaceID].v2.ny = ny;
me.faces[curFaceID].v2.nz = nz;
elif (faceVertID == 2):
me.faces[curFaceID].v3.nx = nx;
me.faces[curFaceID].v3.ny = ny;
me.faces[curFaceID].v3.nz = nz;
faceVertID = faceVertID + 1;
elif words[0] == '*MESH_ANIMATION':
me.animated = 1
# now the loop for animation frames
if objIdx > 0 and me.animated == 1:
if words[0] == '*MESH_VERTEX_LIST':
me.frameCount += 1
me.frames.append([])
elif words[0] == '*MESH_VERTEX':
me.frames[me.frameCount].append(mesh_vert())
i = int(words[1])
me.frames[me.frameCount][i].x = float(words[2]);
me.frames[me.frameCount][i].y = float(words[3]);
me.frames[me.frameCount][i].z = float(words[4]);
PBidx += 1.0
spawn_main(objects)
Blender.Redraw()
def spawn_main(objects):
PBidx = 0.0
objCount = float(len(objects))
print 'Import Objects'
Blender.Window.DrawProgressBar(0.0, "Importing Objects...")
for obj in objects:
Blender.Window.DrawProgressBar(PBidx / objCount, "Importing Objects...")
if obj.objType == 'Mesh':
spawn_mesh(obj)
PBidx += 1.0
import random
def spawn_mesh(obj):
objMe = obj.obj
#normal_flag = 1
row0 = obj.row0x, obj.row0y, obj.row0z
row1 = obj.row1x, obj.row1y, obj.row1z
row2 = obj.row2x, obj.row2y, obj.row2z
row3 = obj.row3x, obj.row3y, obj.row3z
newMatrix = Blender.Mathutils.Matrix(row0, row1, row2, row3)
newMatrix.resize4x4()
newObj = Blender.Object.New(obj.objType, obj.name)
newObj.setMatrix(newMatrix)
Blender.Scene.getCurrent().link(newObj)
newMesh = Blender.Mesh.New(obj.objName)
newMesh.getFromObject(newObj.name)
newMesh.vertexUV = 1
newObj.link(newMesh)
del objMe.verts[:]
objMe.vCount = 0
vertDict = {}
#for face in objMe.faces:
#objMe.verts.append(face.v1)
#objMe.verts.append(face.v2)
#objMe.verts.append(face.v3)
#face.i1 = objMe.vCount
#objMe.vCount = objMe.vCount + 1
#face.i2 = objMe.vCount
#objMe.vCount = objMe.vCount + 1
#face.i3 = objMe.vCount
#objMe.vCount = objMe.vCount + 1
for face in objMe.faces:
if not face.v1.make_tuple() in vertDict:
vertDict[face.v1.make_tuple()] = objMe.vCount
objMe.verts.append(face.v1)
objMe.vCount = objMe.vCount + 1
if not face.v2.make_tuple() in vertDict:
vertDict[face.v2.make_tuple()] = objMe.vCount
objMe.verts.append(face.v2)
objMe.vCount = objMe.vCount + 1
if not face.v3.make_tuple() in vertDict:
vertDict[face.v3.make_tuple()] = objMe.vCount
objMe.verts.append(face.v3)
objMe.vCount = objMe.vCount + 1
face.i1 = vertDict[face.v1.make_tuple()]
face.i2 = vertDict[face.v2.make_tuple()]
face.i3 = vertDict[face.v3.make_tuple()]
# Verts
for i in range(objMe.vCount):
xyz = Blender.Mathutils.Vector(objMe.verts[i].x, objMe.verts[i].y, objMe.verts[i].z)
newMesh.verts.extend(xyz)
for i in range(objMe.vCount):
xyz = Blender.Mathutils.Vector(objMe.verts[i].x, objMe.verts[i].y, objMe.verts[i].z)
uv = Blender.Mathutils.Vector(objMe.verts[i].u, objMe.verts[i].v)
norm = Blender.Mathutils.Vector(objMe.verts[i].nx, objMe.verts[i].ny, objMe.verts[i].nz)
newMesh.verts[i].co = xyz;
newMesh.verts[i].uvco = uv;
newMesh.verts[i].no = norm;
if objMe.animated:
objMe.frameCount -= 1 # do we always get an extra frame at the end?
for frame in objMe.frames:
for i in range(objMe.vCount):
xyz = Blender.Mathutils.Vector(frame[objMe.verts[i].origi].x, frame[objMe.verts[i].origi].y, frame[objMe.verts[i].origi].z)
newMesh.verts[i].co = xyz;
newObj.insertShapeKey()
for key in Key.Get() :
key.ipo = Ipo.New('Key', "bleh" + "_ipo")
index = 1
for curveName in key.ipo.curveConsts :
# print curveName
key.ipo.addCurve(curveName)
key.ipo[curveName].interpolation = IpoCurve.InterpTypes.CONST
key.ipo[curveName].addBezier((0, 0))
key.ipo[curveName].addBezier((index, 1))
key.ipo[curveName].addBezier((index + 1, 0))
index+=1
# Faces
for i in range(objMe.fCount):
face = [objMe.faces[i].i1, objMe.faces[i].i2, objMe.faces[i].i3]
newMesh.faces.extend(face)
# UV
#if guiTable['UV'] == 1 and objMe.hasFUV == 1:
#newMesh.faceUV = 1
#for f in objMe.uvFaces:
#uv1 = Blender.Mathutils.Vector(float(objMe.uvVerts[f.uv1].u), float(objMe.uvVerts[f.uv1].v))
#uv2 = Blender.Mathutils.Vector(float(objMe.uvVerts[f.uv2].u), float(objMe.uvVerts[f.uv2].v))
#uv3 = Blender.Mathutils.Vector(float(objMe.uvVerts[f.uv3].u), float(objMe.uvVerts[f.uv3].v))
#newMesh.faces[f.index].uv = [uv1, uv2, uv3]
## normals
#vertices = [coords for n, coords in sorted(objMe.normals)]
#random.seed()
#i = 0
#for v in newMesh.verts:
#no = Blender.Mathutils.Vector(vertices[i][0], vertices[i][1], vertices[i][2])
#v.no = no
#print 'vertice ', i, 'normal : ', v.no
##v.no[0] = vertices[i][0]
##v.no[1] = vertices[i][1]
##v.no[2] = vertices[i][2]
#i = i + 1
newMesh.transform((newObj.getMatrix('worldspace').invert()), 1)
Blender.Set("curframe", objMe.frameCount + 1)
counts['verts'] += objMe.vCount
counts['tris'] += objMe.fCount
print 'Imported Mesh-Object: ', obj.name
def read_ui(filename):
Window.WaitCursor(1)
read_main(filename)
Window.WaitCursor(0)
Blender.Window.FileSelector(read_ui, "Import ASE")

File diff suppressed because it is too large Load diff

View file

@ -22,7 +22,7 @@
#include <signal.h>
#include <stdarg.h>
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
#include "glbuild.h"
#endif
@ -60,7 +60,7 @@ int32_t backgroundidle = 1;
static WORD sysgamma[3][256];
extern int32_t curbrightness, gammabrightness;
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
// OpenGL stuff
static HGLRC hGLRC = 0;
char nofog=0;
@ -464,7 +464,7 @@ int32_t WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, in
*stderr = *fp;
}
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
if ((argp = Bgetenv("BUILD_NOFOG")) != NULL)
nofog = Batol(argp);
if (Bgetenv("BUILD_FORCEGL") != NULL)
@ -594,7 +594,7 @@ static void win_printversion(void)
if (largepagesavailable)
initprintf("Large page support available\n");
#else
initprintf(nedhandle ? "w/ nedmalloc.dll\n" : "\n");
initprintf(nedhandle ? "\nInitialized nedmalloc\n" : "\n");
#endif
}
@ -626,7 +626,7 @@ int32_t initsystem(void)
win_printversion();
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
if (loadgldriver(getenv("BUILD_GLDRV")))
{
initprintf("Failure loading OpenGL. GL modes are unavailable.\n");
@ -658,7 +658,7 @@ void uninitsystem(void)
win_allowtaskswitching(1);
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
unloadgldriver();
#endif
@ -1688,7 +1688,7 @@ int32_t checkvideomode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t fo
// setvideomode() -- set the video mode
//
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
static HWND hGLWindow = NULL;
#endif
@ -1738,7 +1738,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
if (gammabrightness && setgamma() < 0) gammabrightness = 0;
}
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
if (hGLWindow && glinfo.vsync) bwglSwapIntervalEXT(vsync);
#endif
if (inp) AcquireInputDevices(1);
@ -1767,7 +1767,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
#define CHECK(w,h) if ((w < maxx) && (h < maxy))
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
void setvsync(int32_t sync)
{
if (!glinfo.vsync)
@ -1857,16 +1857,11 @@ static int32_t sortmodes(const struct validmode_t *a, const struct validmode_t *
}
void getvalidmodes(void)
{
static int32_t defaultres[][2] =
{
{1920,1440},{1920,1200},{1600,1200},{1280,1024},{1280,960},{1152,864},{1024,768},{1024,600},{800,600},{640,480},
{640,400},{512,384},{480,360},{400,300},{320,240},{320,200},{0,0}
};
int32_t cdepths[2] = { 8, 0 };
int32_t i, j, maxx=0, maxy=0;
HRESULT result;
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
if (desktopbpp > 8 && !nogl) cdepths[1] = desktopbpp;
else cdepths[1] = 0;
#endif
@ -1892,7 +1887,7 @@ void getvalidmodes(void)
}
}
}
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
cdsenummodes();
#endif
@ -2002,7 +1997,7 @@ void showframe(int32_t w)
char *p,*q;
int32_t i,j;
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
if (bpp > 8)
{
if (palfadedelta)
@ -2680,7 +2675,7 @@ static int32_t SetupDIB(int32_t width, int32_t height)
return FALSE;
}
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
//
// ReleaseOpenGL() -- cleans up OpenGL rendering stuff
//
@ -2907,7 +2902,7 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
// support bgra textures
glinfo.bgra = 1;
}
else if (!Bstrcmp((char *)p2, "GL_ARB_texture_compression"))
else if (!Bstrcmp((char *)p2, "GL_ARB_texture_compression") && Bstrcmp(glinfo.vendor,"ATI Technologies Inc."))
{
// support texture compression
glinfo.texcompr = 1;
@ -3016,7 +3011,7 @@ static BOOL CreateAppWindow(int32_t modenum)
{
if (bpp > 8)
{
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
ReleaseOpenGL();
#endif
}
@ -3029,7 +3024,7 @@ static BOOL CreateAppWindow(int32_t modenum)
{
// restore previous display mode and set to normal cooperative level
RestoreDirectDrawMode();
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
}
else if (fs && fullscreen)
{
@ -3121,7 +3116,7 @@ static BOOL CreateAppWindow(int32_t modenum)
{
if (bitspp > 8)
{
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
// yes, start up opengl
if (SetupOpenGL(width,height,bitspp))
return TRUE;
@ -3146,7 +3141,7 @@ static BOOL CreateAppWindow(int32_t modenum)
return TRUE;
}
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
if (bitspp > 8)
{
DEVMODE dmScreenSettings;
@ -3200,7 +3195,7 @@ static BOOL CreateAppWindow(int32_t modenum)
if (bitspp > 8)
{
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
// we want an opengl mode
if (SetupOpenGL(width,height,bitspp))
{
@ -3218,7 +3213,7 @@ static BOOL CreateAppWindow(int32_t modenum)
}
}
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
if (bitspp > 8) loadglextensions();
#endif
@ -3255,7 +3250,7 @@ static void DestroyAppWindow(void)
gammabrightness = 0;
}
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
UninitOpenGL();
#endif
UninitDirectDraw();
@ -3566,7 +3561,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
POINT pt;
HRESULT result; */
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (hWnd == hGLWindow) return DefWindowProc(hWnd,uMsg,wParam,lParam);
#endif
@ -3585,7 +3580,7 @@ static LRESULT CALLBACK WndProcCallback(HWND hWnd, UINT uMsg, WPARAM wParam, LPA
case WM_ACTIVATEAPP:
{
appactive = wParam;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (hGLWindow)
{
if (!appactive && fullscreen)

View file

@ -120,6 +120,7 @@
<ClInclude Include="source\net.h" />
<ClInclude Include="source\player.h" />
<ClInclude Include="source\premap.h" />
<ClInclude Include="source\quotes.h" />
<ClInclude Include="source\savegame.h" />
<ClInclude Include="source\sector.h" />
<ClInclude Include="source\_functio.h" />

View file

@ -354,6 +354,9 @@
<ClInclude Include="source\demo.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
<ClInclude Include="source\quotes.h">
<Filter>eduke32\headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="build\src\a-c.c">

Binary file not shown.

View file

@ -24,16 +24,15 @@ define SFACTORSTEPS 100
define PREVIEW_DRAW_COLOR 11
gamevar showpal 0 0
// 2d mode corruption checker interval, 120 = 1 second
gamevar checkinterval 1200 0
// whether to use overridden aspect/range values when entering 3d mode (software/Polymost).
// tweak with keys 7,8,9,0 on the top row
gamevar use_custom_aspect 0 0 // this is now the same as r_usenewaspect
gamevar davr 65536 0
gamevar dayx 65536 0
// see end of file for user key defs
// see end of file for more user settings and examples
////////// END USER SETTINGS //////////
@ -72,18 +71,6 @@ definequote LIGHTQUOTE light %d %d %d %d %d %d %d %d %d %d %d %d %d %d
// sec range radius fade ang horiz prio tile
// Corruption checker
definequote 19 PANIC!!! SECTOR OR WALL LIMIT EXCEEDED!!!
definequote 20 SECTOR[%d].WALLPTR=%d out of range: numwalls=%d
definequote 21 SECTOR[%d].WALLPTR=%d inconsistent, expected %d
definequote 22 SECTOR[%d]: wallptr+wallnum=%d out of range: numwalls=%d
definequote 23 WALL[%d].POINT2=%d out of range [%d, %d]
definequote 24 WALL[%d].NEXTWALL=%d out of range: numwalls=%d
definequote 25 WALL[%d].NEXTSECTOR=%d out of range: numsectors=%d
definequote 26 SPRITE[%d].SECTNUM=%d. Expect problems!
definequote 27 SPRITE[%d].PICNUM=%d out of range, resetting to 0
definequote 28 WALL[%d] has nextsector but no nextwall or vice versa!
define PRSCALE 1000
define MAXSPECULAR 100000
@ -393,7 +380,9 @@ defstate fiddlewithlights
}
ends
defstate userkeys_3d ends // forward-ref
// forward refs
defstate userkeys_3d ends
defstate userdrawlabel ends
onevent EVENT_PREKEYS3D
// state testkeyavail
@ -1009,124 +998,29 @@ defstate js // jump to current sprite
updatecursectnum
ends
defstate jumptosec // (tmp)
ifge tmp 0 ifl tmp numsectors nullop else return
set j sector[tmp].wallptr
set posx wall[j].x
set posy wall[j].y
var sec 0 0
var wal 0 0
defstate jumptowal // (wal)
ifge wal 0 ifl wal numwalls nullop else return
set posx wall[wal].x
set posy wall[wal].y
updatecursectnum
ends
// Map corruption checker
// now included in Mapster32 natively
/*
defstate corruptchk
var ewall
var endwall
var ok
ifle numsectors MAXSECTORS ifle numwalls MAXWALLS nullop else
{ quote 19 printmessage16 19 return }
set ok 1
set ewall 0 // expected wall index
for i allsectors
{
set k 1
ifge sector[i].wallptr 0 ifl sector[i].wallptr numwalls nullop else
{
qsprintf TQUOTE 20 i sector[i].wallptr numwalls
quote TQUOTE printmessage16 TQUOTE
set k 0
}
ifn ewall sector[i].wallptr
{
qsprintf TQUOTE 21 i sector[i].wallptr ewall
quote TQUOTE printmessage16 TQUOTE
set ewall sector[i].wallptr
}
add ewall sector[i].wallnum
set endwall sector[i].wallptr add endwall sector[i].wallnum
ifg endwall numwalls
{
qsprintf TQUOTE 22 i endwall numwalls
quote TQUOTE printmessage16 TQUOTE
set k 0
}
and ok k
ifn k 0
{
sub endwall 1
for j wallsofsector i
{
ifge wall[j].point2 sector[i].wallptr ifle wall[i].point2 endwall nullop else
{
qsprintf TQUOTE 23 j wall[j].point2 sector[i].wallptr endwall
quote TQUOTE printmessage16 TQUOTE
set ok 0
}
ifge wall[j].nextwall numwalls
{
qsprintf TQUOTE 24 j wall[j].nextwall numwalls
quote TQUOTE printmessage16 TQUOTE
set ok 0
}
ifge wall[j].nextsector numsectors
{
qsprintf TQUOTE 25 j wall[j].nextsector numsectors
quote TQUOTE printmessage16 TQUOTE
set ok 0
}
set k 0
ifge wall[j].nextsector 0, xor k 1
ifge wall[j].nextwall 0, xor k 1
ife k 1
{
qsprintf TQUOTE 28 j
quote TQUOTE printmessage16 TQUOTE
set ok 0
}
}
}
}
for i allsprites
{
ifl .sectnum 0
{
qsprintf TQUOTE 26 i .sectnum
quote TQUOTE printmessage16 TQUOTE
set ok 0
}
ifge .picnum 0 ifl .picnum MAXTILES nullop else
{
qsprintf TQUOTE 27 i .picnum
quote TQUOTE printmessage16 TQUOTE
set .picnum 0
set ok 0
}
}
ife ok 0
print "--"
defstate jumptosec // (sec)
ifge sec 0 ifl sec numsectors nullop else return
set wal sector[sec].wallptr
state jumptowal
ends
*/
gamevar d2d_lastcheck 0 0
onevent EVENT_DRAW2DSCREEN
var tmp
var xx
state userdrawlabel
ifge cursectnum 0
{
state connectlocators
@ -1135,14 +1029,6 @@ onevent EVENT_DRAW2DSCREEN
state previewdoors2d
ifl checkinterval 120, set checkinterval 120
set tmp totalclock, sub tmp checkinterval
ifl d2d_lastcheck tmp
{
set d2d_lastcheck totalclock
// state corruptchk
}
ifn showpal 0
{
set xx 100
@ -1237,7 +1123,23 @@ defstate chselshade
ends
////////// USER KEY SETTINGS //////////
////////// USER AREA //////////
// key settings
defstate userkeys_3d
ifholdkey KEY_SEMI ifhitkey KEY_C state chselshade
ends
/*
// example for custom labels
defstate userdrawlabel
for i allsprites
{
ifactor 2978
{
qsprintf TQUOTE "MOVABLE EX:%d OW:%d", sprite[i].owner, sprite[i].extra
drawlabel TQUOTE .x .y .z 0 31
}
}
ends
*/

View file

@ -152,3 +152,26 @@ defstate consttest
qsprintf TQUOTE "%d %d %d %d" -2147483648 MIN_CONSTANT i j
quote TQUOTE, quote " "
ends
defstate anmtest
var yo
for i range MAXTILES
{
set j tilesizx[i], or j tilesizy[i]
ifn j 0
{
set yo picanm[i]
shiftl yo 8, shiftr yo 24 // sign-extend
ifl yo 0, inv yo
ifge yo tilesizy[i]
{
qsprintf TQUOTE "Tile %d's y offset >= y size" i
quote TQUOTE
}
}
}
ends

View file

@ -33,8 +33,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# define ACTOR_STATIC static
#endif
#define KILLIT(KX) {deletesprite(KX);goto BOLT;}
#define KILLIT(KX) { deletesprite(KX); goto BOLT; }
extern int32_t g_numEnvSoundsPlaying;
extern int32_t g_noEnemies;
@ -894,16 +893,16 @@ int32_t A_IncurDamage(int32_t sn)
if (A_CheckSpriteTileFlags(actor[sn].picnum,SPRITE_PROJECTILE) && (SpriteProjectile[sn].workslike & PROJECTILE_RPG))
{
g_player[p].ps->posvel.x +=
g_player[p].ps->vel.x +=
actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<2;
g_player[p].ps->posvel.y +=
g_player[p].ps->vel.y +=
actor[sn].extra*(sintable[actor[sn].ang&2047])<<2;
}
else if (A_CheckSpriteTileFlags(actor[sn].picnum,SPRITE_PROJECTILE))
{
g_player[p].ps->posvel.x +=
g_player[p].ps->vel.x +=
actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<1;
g_player[p].ps->posvel.y +=
g_player[p].ps->vel.y +=
actor[sn].extra*(sintable[actor[sn].ang&2047])<<1;
}
@ -916,15 +915,15 @@ int32_t A_IncurDamage(int32_t sn)
case SEENINE__STATIC:
case OOZFILTER__STATIC:
case EXPLODINGBARREL__STATIC:
g_player[p].ps->posvel.x +=
g_player[p].ps->vel.x +=
actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<2;
g_player[p].ps->posvel.y +=
g_player[p].ps->vel.y +=
actor[sn].extra*(sintable[actor[sn].ang&2047])<<2;
break;
default:
g_player[p].ps->posvel.x +=
g_player[p].ps->vel.x +=
actor[sn].extra*(sintable[(actor[sn].ang+512)&2047])<<1;
g_player[p].ps->posvel.y +=
g_player[p].ps->vel.y +=
actor[sn].extra*(sintable[actor[sn].ang&2047])<<1;
break;
}
@ -1282,7 +1281,7 @@ ACTOR_STATIC void G_MoveFallers(void)
s->z -= (16<<8);
T2 = s->ang;
x = s->extra;
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
if (j == FIREEXT || j == RPG || j == RADIUSEXPLOSION || j == SEENINE || j == OOZFILTER)
{
@ -1540,7 +1539,7 @@ ACTOR_STATIC void G_MoveStandables(void)
{
p = A_FindPlayer(s,&x);
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
if (s->owner == -2)
if (g_player[p].ps->on_crane == i)
@ -1692,7 +1691,7 @@ ACTOR_STATIC void G_MoveStandables(void)
x = s->extra;
s->extra = 1;
l = s->ang;
IFHIT { actor[i].t_data[6] = 3;
if ((j = A_IncurDamage(i)) >= 0) { actor[i].t_data[6] = 3;
T3 = 16;
}
s->extra = x;
@ -2061,7 +2060,7 @@ DETONATE:
case TRASH__STATIC:
if (s->xvel == 0) s->xvel = 1;
IFMOVING
if (A_SetSprite(i, CLIPMASK0))
{
A_Fall(i);
if (krand()&1) s->zvel -= 256;
@ -2283,7 +2282,7 @@ CLEAR_THE_BOLT:
case CANWITHSOMETHING3__STATIC:
case CANWITHSOMETHING4__STATIC:
A_Fall(i);
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
A_PlaySound(VENT_BUST,i);
@ -2497,7 +2496,7 @@ ACTOR_STATIC void G_MoveWeapons(void)
}
if (!(SpriteProjectile[i].workslike & PROJECTILE_BOUNCESOFFWALLS) &&
s->yvel >= 0 && sprite[s->yvel].sectnum < MAXSECTORS)
s->yvel >= 0 && sprite[s->yvel].sectnum != MAXSECTORS)
if (FindDistance2D(s->x-sprite[s->yvel].x,s->y-sprite[s->yvel].y) < 256)
j = 49152|s->yvel;
@ -2914,7 +2913,7 @@ ACTOR_STATIC void G_MoveWeapons(void)
if (s->picnum == COOLEXPLOSION1)
{
if ((j&49152) == 49152 && sprite[j&(MAXSPRITES-1)].picnum != APLAYER)
goto BOLT;
goto COOLEXPLOSION;
s->xvel = 0;
s->zvel = 0;
}
@ -3086,6 +3085,7 @@ ACTOR_STATIC void G_MoveWeapons(void)
}
if (s->picnum == COOLEXPLOSION1)
{
COOLEXPLOSION:
s->shade++;
if (s->shade >= 40) KILLIT(i);
}
@ -3215,7 +3215,7 @@ ACTOR_STATIC void G_MoveTransports(void)
if (onfloorz && sectlotag == 1 && g_player[p].ps->on_ground &&
g_player[p].ps->pos.z >= sector[sect].floorz &&
(TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH) || g_player[p].ps->posvel.z > 2048))
(TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH) || g_player[p].ps->vel.z > 2048))
// if( onfloorz && sectlotag == 1 && g_player[p].ps->pos.z > (sector[sect].floorz-(6<<8)) )
{
k = 1;
@ -3230,14 +3230,14 @@ ACTOR_STATIC void G_MoveTransports(void)
sector[sprite[OW].sectnum].ceilingz;
/*
g_player[p].ps->posvel.x = 4096-(krand()&8192);
g_player[p].ps->posvel.y = 4096-(krand()&8192);
g_player[p].ps->vel.x = 4096-(krand()&8192);
g_player[p].ps->vel.y = 4096-(krand()&8192);
*/
if (TEST_SYNC_KEY(g_player[p].sync->bits, SK_CROUCH))
g_player[p].ps->posvel.z += 512;
g_player[p].ps->vel.z += 512;
}
if (onfloorz && sectlotag == 2 && g_player[p].ps->pos.z <= sector[sect].ceilingz /*&& g_player[p].ps->posvel.z == 0*/)
if (onfloorz && sectlotag == 2 && g_player[p].ps->pos.z <= sector[sect].ceilingz /*&& g_player[p].ps->vel.z == 0*/)
{
k = 1;
// if( sprite[j].extra <= 0) break;
@ -3253,8 +3253,8 @@ ACTOR_STATIC void G_MoveTransports(void)
g_player[p].ps->jumping_toggle = 1;
g_player[p].ps->jumping_counter = 0;
g_player[p].ps->posvel.z = 0;
// g_player[p].ps->posvel.z += 1024;
g_player[p].ps->vel.z = 0;
// g_player[p].ps->vel.z += 1024;
}
if (k == 1)
@ -3575,7 +3575,7 @@ ACTOR_STATIC void G_MoveActors(void)
break;
case RAT__STATIC:
A_Fall(i);
IFMOVING
if (A_SetSprite(i, CLIPMASK0))
{
if ((krand()&255) < 3) A_PlaySound(RATTY,i);
s->ang += (krand()&31)-15+(sintable[(t[0]<<8)&2047]>>11);
@ -3767,7 +3767,7 @@ ACTOR_STATIC void G_MoveActors(void)
}
else if (g_noEnemies == 2) s->cstat = 257;
}
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
if (s->extra < 0 && t[0] != -1)
{
@ -4005,7 +4005,7 @@ ACTOR_STATIC void G_MoveActors(void)
s->picnum = GREENSLIME+2;
s->extra = 1;
s->pal = 1;
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
if (j == FREEZEBLAST) goto BOLT;
for (j=16; j >= 0 ; j--)
@ -4138,7 +4138,7 @@ ACTOR_STATIC void G_MoveActors(void)
}
}
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
A_PlaySound(SLIM_DYING,i);
@ -4744,7 +4744,7 @@ DETONATEB:
}
else
{
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
for (x=0; x<32; x++)
RANDOMSCRAP;
@ -4761,7 +4761,7 @@ DETONATEB:
t[1]+=8;
if (g_damageCameras)
{
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
t[0] = 1; // static
s->cstat = (int16_t)32768;
@ -6195,17 +6195,16 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
}
else
{
t[2] +=
G_GetAngleDelta(t[2]+512,getangle(g_player[p].ps->pos.x-s->x,g_player[p].ps->pos.y-s->y))>>2;
t[2] += G_GetAngleDelta(t[2]+512,getangle(g_player[p].ps->pos.x-s->x,g_player[p].ps->pos.y-s->y))>>2;
sc->ceilingshade = 0;
}
IFHIT
if ((j = A_IncurDamage(i)) >= 0)
{
t[3]++;
if (t[3] == 5)
if (++t[3] == 5)
{
s->zvel += 1024;
P_DoQuote(7,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_WASTED, g_player[myconnectindex].ps);
}
}
@ -6312,7 +6311,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
if (GetAnimationGoal(&sector[s->sectnum].ceilingz) >= 0)
break;
default:
activatebysector(s->sectnum,i);
G_ActivateBySector(s->sectnum,i);
t[0] = 0;
break;
}
@ -6821,7 +6820,7 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3
{
IFHITSECT
{
P_DoQuote(8,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_UNLOCKED,g_player[myconnectindex].ps);
l = headspritestat[STAT_EFFECTOR];
while (l >= 0)
@ -8035,6 +8034,48 @@ void G_MoveWorld(void)
switch (DynamicTileMap[sprite[i].picnum])
{
case DIPSWITCH__STATIC:
case DIPSWITCH2__STATIC:
case DIPSWITCH3__STATIC:
case PULLSWITCH__STATIC:
case SLOTDOOR__STATIC:
case LIGHTSWITCH__STATIC:
case SPACELIGHTSWITCH__STATIC:
case SPACEDOORSWITCH__STATIC:
case FRANKENSTINESWITCH__STATIC:
case POWERSWITCH1__STATIC:
case LOCKSWITCH1__STATIC:
case POWERSWITCH2__STATIC:
case TECHSWITCH__STATIC:
case ACCESSSWITCH__STATIC:
case ACCESSSWITCH2__STATIC:
{
int32_t x, y;
if ((s->cstat & 32768) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT) ||
!inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum))
{
if (actor[i].lightptr != NULL)
{
polymer_deletelight(actor[i].lightId);
actor[i].lightId = -1;
actor[i].lightptr = NULL;
}
break;
}
x = ((sintable[(s->ang+512)&2047])>>7);
y = ((sintable[(s->ang)&2047])>>7);
s->x += x;
s->y += y;
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 768, 255+(48<<8)+(48<<16),PR_LIGHT_PRIO_LOW);
s->x -= x;
s->y -= y;
}
break;
case ATOMICHEALTH__STATIC:
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2 * 3, 128+(128<<8)+(255<<16),PR_LIGHT_PRIO_HIGH_GAME);
break;
@ -8043,11 +8084,23 @@ void G_MoveWorld(void)
case FIRE2__STATIC:
case BURNING__STATIC:
case BURNING2__STATIC:
{
uint32_t color;
/*
if (Actor[i].floorz - Actor[i].ceilingz < 128) break;
if (s->z > Actor[i].floorz+2048) break;
*/
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2, 255+(95<<8),PR_LIGHT_PRIO_HIGH_GAME);
switch (s->pal)
{
case 1: color = 128+(128<<8)+(255<<16); break;
case 2: color = 255+(48<<8)+(48<<16); break;
case 8: color = 48+(255<<8)+(48<<16); break;
default: color = 255+(95<<8); break;
}
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), LIGHTRAD2, color, PR_LIGHT_PRIO_HIGH_GAME);
}
break;
case OOZFILTER__STATIC:
@ -8139,47 +8192,6 @@ void G_MoveWorld(void)
s->y += y;
}
break;
case DIPSWITCH__STATIC:
case DIPSWITCH2__STATIC:
case DIPSWITCH3__STATIC:
case PULLSWITCH__STATIC:
case SLOTDOOR__STATIC:
case LIGHTSWITCH__STATIC:
case SPACELIGHTSWITCH__STATIC:
case SPACEDOORSWITCH__STATIC:
case FRANKENSTINESWITCH__STATIC:
case POWERSWITCH1__STATIC:
case LOCKSWITCH1__STATIC:
case POWERSWITCH2__STATIC:
case TECHSWITCH__STATIC:
case ACCESSSWITCH__STATIC:
case ACCESSSWITCH2__STATIC:
{
int32_t x, y;
if ((s->cstat & 32768) || A_CheckSpriteFlags(i, SPRITE_NOLIGHT) ||
!inside(s->x+((sintable[(s->ang+512)&2047])>>9), s->y+((sintable[(s->ang)&2047])>>9), s->sectnum))
{
if (actor[i].lightptr != NULL)
{
polymer_deletelight(actor[i].lightId);
actor[i].lightId = -1;
actor[i].lightptr = NULL;
}
break;
}
x = ((sintable[(s->ang+512)&2047])>>7);
y = ((sintable[(s->ang)&2047])>>7);
s->x += x;
s->y += y;
G_AddGameLight(0, i, ((s->yrepeat*tilesizy[s->picnum])<<1), 768, 255+(48<<8)+(48<<16),PR_LIGHT_PRIO_LOW);
s->x -= x;
s->y -= y;
}
break;
}
}
}

View file

@ -202,7 +202,7 @@ void G_PlayAnim(const char *fn,char t)
{
char *animbuf;
int32_t i, length=0, numframes=0;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
int32_t ogltexfiltermode=gltexfiltermode;
#endif
int32_t handle=-1;
@ -243,7 +243,7 @@ void G_PlayAnim(const char *fn,char t)
//setbrightness(ud.brightness>>2,tempbuf,2);
P_SetGamePalette(g_player[myconnectindex].ps,ANIMPAL,10);
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
gltexfiltermode = 0;
gltexapplyprops();
#endif
@ -302,7 +302,7 @@ void G_PlayAnim(const char *fn,char t)
}
ENDOFANIMLOOP:
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
gltexfiltermode = ogltexfiltermode;
gltexapplyprops();
#endif

File diff suppressed because it is too large Load diff

View file

@ -187,7 +187,7 @@ void CONFIG_SetDefaults(void)
ud.config.ScreenWidth = 1024;
ud.config.ScreenHeight = 768;
ud.config.ScreenMode = 0;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
ud.config.ScreenBPP = 32;
#else
ud.config.ScreenBPP = 8;
@ -832,7 +832,7 @@ void CONFIG_WriteBinds(void) // save binds and aliases to <cfgname>_settings.cfg
Bfree(ptr);
}
void CONFIG_WriteSetup(void)
void CONFIG_WriteSetup(uint32_t flags)
{
int32_t dummy;
char tempbuf[1024];
@ -844,12 +844,6 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Misc", "Executions",++ud.executions,FALSE,FALSE);
for (dummy=0; dummy<10; dummy++)
{
Bsprintf(buf,"WeaponChoice%d",dummy);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc",buf,g_player[myconnectindex].wchoice[dummy],FALSE,FALSE);
}
SCRIPT_PutNumber(ud.config.scripthandle, "Setup","ConfigVersion",BYTEVERSION_JF,FALSE,FALSE);
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "ForceSetup",ud.config.ForceSetup,FALSE,FALSE);
SCRIPT_PutNumber(ud.config.scripthandle, "Setup", "NoAutoLoad",ud.config.NoAutoLoad,FALSE,FALSE);
@ -858,23 +852,44 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Polymer",glrendmode == 4 && bpp > 8,FALSE,FALSE);
#endif
if (!NAM)
{
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,FALSE,FALSE);
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "Password",ud.pwlockout);
}
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenBPP",ud.config.ScreenBPP,FALSE,FALSE); // JBF 20040523
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenHeight",ud.config.ScreenHeight,FALSE,FALSE); // JBF 20031206
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenMode",ud.config.ScreenMode,FALSE,FALSE); // JBF 20031206
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "ScreenWidth",ud.config.ScreenWidth,FALSE,FALSE); // JBF 20031206
SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&g_grpNamePtr[0]);
if (g_noSetup == 0)
SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]);
// exit early after only updating the values that can be changed from the startup window
if (flags & 1)
{
SCRIPT_Save(ud.config.scripthandle, setupfilename);
SCRIPT_Free(ud.config.scripthandle);
OSD_Printf("Updated %s\n",setupfilename);
return;
}
#ifdef RENDERTYPEWIN
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPositioning", windowpos, FALSE, FALSE);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosX", windowx, FALSE, FALSE);
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "WindowPosY", windowy, FALSE, FALSE);
#endif
for (dummy=0; dummy<10; dummy++)
{
Bsprintf(buf,"WeaponChoice%d",dummy);
SCRIPT_PutNumber(ud.config.scripthandle, "Misc",buf,g_player[myconnectindex].wchoice[dummy],FALSE,FALSE);
}
if (!NAM)
{
SCRIPT_PutNumber(ud.config.scripthandle, "Screen Setup", "Out",ud.lockout,FALSE,FALSE);
SCRIPT_PutString(ud.config.scripthandle, "Screen Setup", "Password",ud.pwlockout);
}
#ifdef _WIN32
SCRIPT_PutNumber(ud.config.scripthandle, "Updates", "CheckForUpdates", ud.config.CheckForUpdates, FALSE, FALSE);
@ -984,13 +999,6 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","PlayerName",&szPlayerName[0]);
SCRIPT_PutString(ud.config.scripthandle, "Comm Setup","RTSName",&ud.rtsname[0]);
SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&g_grpNamePtr[0]);
// #ifdef _WIN32
if (g_noSetup == 0)
SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&g_modDir[0]);
// #endif
{
char commmacro[] = "CommbatMacro# ";

View file

@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int32_t CONFIG_ReadSetup( void );
void CONFIG_GetSetupFilename( void );
void CONFIG_WriteSetup( void );
void CONFIG_WriteSetup(uint32_t flags);
void CONFIG_SetupMouse( void );
void CONFIG_SetupJoystick( void );
void CONFIG_SetDefaultKeys(int32_t type);

View file

@ -138,8 +138,8 @@ void G_OpenDemoWrite(void)
if ((g_player[myconnectindex].ps->gm&MODE_GAME) && g_player[myconnectindex].ps->dead_flag)
{
Bstrcpy(ScriptQuotes[122], "CANNOT START DEMO RECORDING WHEN DEAD!");
P_DoQuote(122, g_player[myconnectindex].ps);
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "CANNOT START DEMO RECORDING WHEN DEAD!");
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
ud.recstat = ud.m_recstat = 0;
return;
}
@ -156,30 +156,35 @@ void G_OpenDemoWrite(void)
OSD_Printf("contain a RESIZEARRAY command, you can force recording with the\n");
OSD_Printf("`demorec_force' cvar. Alternatively, you can disable diff recording\n");
OSD_Printf("with the `demorec_diffs' cvar.\n\n");
Bstrcpy(ScriptQuotes[122], "FAILED STARTING DEMO RECORDING. SEE OSD FOR DETAILS.");
P_DoQuote(122, g_player[myconnectindex].ps);
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "FAILED STARTING DEMO RECORDING. SEE OSD FOR DETAILS.");
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
ud.recstat = ud.m_recstat = 0;
return;
}
}
while (1)
do
{
if (demonum == 10000) return;
Bsprintf(d, "edemo%d.edm", demonum++);
g_demo_filePtr = fopen(d, "rb");
if (g_modDir[0] != '/')
Bsprintf(d,"%s/edemo%d.edm",g_modDir, demonum++);
else Bsprintf(d, "edemo%d.edm", demonum++);
g_demo_filePtr = Bfopen(d, "rb");
if (g_demo_filePtr == NULL) break;
Bfclose(g_demo_filePtr);
}
while (1);
if ((g_demo_filePtr = fopen(d,"wb")) == NULL) return;
if ((g_demo_filePtr = Bfopen(d,"wb")) == NULL) return;
i=sv_saveandmakesnapshot(g_demo_filePtr, demorec_diffs_cvar, demorec_diffcompress_cvar,
demorec_synccompress_cvar|(demorec_seeds_cvar<<1));
if (i)
{
Bstrcpy(ScriptQuotes[122], "FAILED STARTING DEMO RECORDING. SEE OSD FOR DETAILS.");
P_DoQuote(122, g_player[myconnectindex].ps);
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "FAILED STARTING DEMO RECORDING. SEE OSD FOR DETAILS.");
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
Bfclose(g_demo_filePtr), g_demo_filePtr=NULL;
ud.recstat = ud.m_recstat = 0;
return;
@ -189,8 +194,8 @@ void G_OpenDemoWrite(void)
demo_synccompress = demorec_synccompress_cvar;
demorec_difftics = demorec_difftics_cvar;
Bstrcpy(ScriptQuotes[122], "DEMO RECORDING STARTED");
P_DoQuote(122, g_player[myconnectindex].ps);
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "DEMO RECORDING STARTED");
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
ud.reccnt = 0;
ud.recstat = ud.m_recstat = 1; //
@ -269,8 +274,8 @@ void G_CloseDemoWrite(void)
sv_freemem();
Bstrcpy(ScriptQuotes[122], "DEMO RECORDING STOPPED");
P_DoQuote(122, g_player[myconnectindex].ps);
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4], "DEMO RECORDING STOPPED");
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
}
#if KRANDDEBUG
krd_print("krandrec.log");

View file

@ -35,7 +35,7 @@ extern "C" {
#ifdef POLYMER
#include "polymer.h"
#else
#ifdef POLYMOST
#ifdef USE_OPENGL
#include "polymost.h"
#endif
#endif
@ -52,19 +52,19 @@ extern "C" {
#define VERSION "2.0.0devel"
#define HEAD2 APPNAME" "VERSION
#define GAMEDUKE 0
#define GAMENAM 1
#define GAMEWW2 3
#define GAME_DUKE 0
#define GAME_NAM 1
#define GAME_WW2 3
#define VOLUMEALL (g_Shareware == 0)
#define PLUTOPAK (g_scriptVersion == 14)
#define VOLUMEONE (g_Shareware == 1)
#define NAM (g_gameType & 1)
#define WW2GI (g_gameType & 2)
#define NAM (g_gameType & GAME_NAM)
#define WW2GI (g_gameType & GAME_WW2)
// increase by 3, because atomic GRP adds 1, and Shareware adds 2
#define BYTEVERSION_JF 195
#define BYTEVERSION_JF 198
#define BYTEVERSION_13 27
#define BYTEVERSION_14 116
#define BYTEVERSION_15 117
@ -86,15 +86,10 @@ extern "C" {
#define TICSPERFRAME 4
#define TICRATE 120
#define MAXQUOTES 16384
#define MAXQUOTELEN 128
#define OBITQUOTEINDEX MAXQUOTES-128
#define SUICIDEQUOTEINDEX MAXQUOTES-32
#define NO 0
#define YES 1
#define PACKBUF_SIZE 65535
#define PACKBUF_SIZE 2048
#define TILE_SAVESHOT (MAXTILES-1)
#define TILE_LOADSHOT (MAXTILES-3)
@ -118,6 +113,7 @@ extern "C" {
#include "music.h"
#include "player.h"
#include "actors.h"
#include "quotes.h"
#include "global.h"
#include "sector.h"
#include "net.h"

View file

@ -25,7 +25,7 @@ extern "C"
#define ENET_VERSION_MAJOR 1
#define ENET_VERSION_MINOR 3
#define ENET_VERSION_PATCH 0
#define ENET_VERSION_PATCH 1
#define ENET_VERSION_CREATE(major, minor, patch) (((major)<<16) | ((minor)<<8) | (patch))
#define ENET_VERSION ENET_VERSION_CREATE(ENET_VERSION_MAJOR, ENET_VERSION_MINOR, ENET_VERSION_PATCH)

View file

@ -178,6 +178,7 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
ENetOutgoingCommand * outgoingCommand;
ENetListIterator currentCommand;
ENetProtocolCommand commandNumber;
int wasSent = 1;
for (currentCommand = enet_list_begin (& peer -> sentReliableCommands);
currentCommand != enet_list_end (& peer -> sentReliableCommands);
@ -207,6 +208,8 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
if (currentCommand == enet_list_end (& peer -> outgoingReliableCommands))
return ENET_PROTOCOL_COMMAND_NONE;
wasSent = 0;
}
if (channelID < peer -> channelCount)
@ -227,6 +230,7 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl
if (outgoingCommand -> packet != NULL)
{
if (wasSent)
peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength;
-- outgoingCommand -> packet -> referenceCount;
@ -256,6 +260,7 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet
size_t channelCount;
ENetPeer * currentPeer;
ENetProtocol verifyCommand;
UNREFERENCED_PARAMETER(header);
channelCount = ENET_NET_TO_HOST_32 (command -> connect.channelCount);
@ -614,6 +619,7 @@ enet_protocol_handle_ping (ENetHost * host, ENetPeer * peer, const ENetProtocol
UNREFERENCED_PARAMETER(host);
UNREFERENCED_PARAMETER(peer);
UNREFERENCED_PARAMETER(command);
return 0;
}
@ -1266,7 +1272,7 @@ enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * even
return 0;
}
static void
static int
enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
{
ENetProtocol * command = & host -> commands [host -> commandCount];
@ -1276,6 +1282,7 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
ENetChannel *channel;
enet_uint16 reliableWindow;
size_t commandSize;
int windowExceeded = 0, windowWrap = 0, canPing = 1;
currentCommand = enet_list_begin (& peer -> outgoingReliableCommands);
@ -1285,38 +1292,53 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
channel = outgoingCommand -> command.header.channelID < peer -> channelCount ? & peer -> channels [outgoingCommand -> command.header.channelID] : NULL;
reliableWindow = outgoingCommand -> reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE;
if (channel != NULL &&
if (channel != NULL)
{
if (! windowWrap &&
outgoingCommand -> sendAttempts < 1 &&
! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) &&
(channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE ||
channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) |
(((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow)))))
break;
commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK];
if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] ||
buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] ||
peer -> mtu - host -> packetSize < commandSize)
windowWrap = 1;
if (windowWrap)
{
host -> continueSending = 1;
currentCommand = enet_list_next (currentCommand);
break;
continue;
}
}
if (outgoingCommand -> packet != NULL)
{
if (! windowExceeded)
{
enet_uint32 windowSize = (peer -> packetThrottle * peer -> windowSize) / ENET_PEER_PACKET_THROTTLE_SCALE;
if (peer -> reliableDataInTransit + outgoingCommand -> fragmentLength > ENET_MAX (windowSize, peer -> mtu))
break;
windowExceeded = 1;
}
if (windowExceeded)
{
currentCommand = enet_list_next (currentCommand);
if ((enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength))
continue;
}
}
canPing = 0;
commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK];
if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] ||
buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] ||
peer -> mtu - host -> packetSize < commandSize ||
(outgoingCommand -> packet != NULL &&
(enet_uint16) (peer -> mtu - host -> packetSize) < (enet_uint16) (commandSize + outgoingCommand -> fragmentLength)))
{
host -> continueSending = 1;
break;
}
}
currentCommand = enet_list_next (currentCommand);
@ -1370,6 +1392,8 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer)
host -> commandCount = command - host -> commands;
host -> bufferCount = buffer - host -> buffers;
return canPing;
}
static int
@ -1407,10 +1431,9 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch
enet_protocol_check_timeouts (host, currentPeer, event) == 1)
return 1;
if (! enet_list_empty (& currentPeer -> outgoingReliableCommands))
enet_protocol_send_reliable_outgoing_commands (host, currentPeer);
else
if (enet_list_empty (& currentPeer -> sentReliableCommands) &&
if ((enet_list_empty (& currentPeer -> outgoingReliableCommands) ||
enet_protocol_send_reliable_outgoing_commands (host, currentPeer)) &&
enet_list_empty (& currentPeer -> sentReliableCommands) &&
ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> lastReceiveTime) >= ENET_PEER_PING_INTERVAL &&
currentPeer -> mtu - host -> packetSize >= sizeof (ENetProtocolPing))
{

View file

@ -71,6 +71,7 @@ extern int32_t G_GetVersionFromWebsite(char *buffer);
#define UPDATEINTERVAL 604800 // 1w
#else
static int32_t usecwd = 0;
#include <sys/ioctl.h>
#endif /* _WIN32 */
int32_t g_quitDeadline = 0;
@ -528,7 +529,7 @@ void G_HandleSpecialKeys(void)
// CONTROL_ProcessBinds();
if (ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
if (g_networkMode != NET_DEDICATED_SERVER && ALT_IS_PRESSED && KB_KeyPressed(sc_Enter))
{
if (setgamemode(!ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP))
{
@ -546,7 +547,7 @@ void G_HandleSpecialKeys(void)
{
KB_ClearKeyDown(sc_F12);
screencapture("duke0000.tga",0);
P_DoQuote(103,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_SCREEN_SAVED,g_player[myconnectindex].ps);
}
// only dispatch commands here when not in a game
@ -1695,7 +1696,7 @@ static void G_PrintCoords(int32_t snum)
printext256(250L,y,31,-1,tempbuf,0);
Bsprintf(tempbuf,"A/H= %d,%d",g_player[snum].ps->ang,g_player[snum].ps->horiz);
printext256(250L,y+9L,31,-1,tempbuf,0);
Bsprintf(tempbuf,"ZV= %d",g_player[snum].ps->posvel.z);
Bsprintf(tempbuf,"ZV= %d",g_player[snum].ps->vel.z);
printext256(250L,y+18L,31,-1,tempbuf,0);
Bsprintf(tempbuf,"OG= %d",g_player[snum].ps->on_ground);
printext256(250L,y+27L,31,-1,tempbuf,0);
@ -1727,7 +1728,7 @@ void G_PrintGameQuotes(void)
else if (j > 12) k += 24;
}
if (g_player[screenpeek].ps->fta > 1 && (g_player[screenpeek].ps->ftq < 115 || g_player[screenpeek].ps->ftq > 117))
if (g_player[screenpeek].ps->fta > 1 && (g_player[screenpeek].ps->ftq < QUOTE_RESERVED || g_player[screenpeek].ps->ftq > QUOTE_RESERVED3))
{
if (g_player[screenpeek].ps->fta > 6)
k += 7;
@ -1778,7 +1779,7 @@ void G_PrintGameQuotes(void)
k = 0;
if (g_player[screenpeek].ps->ftq == 115 || g_player[screenpeek].ps->ftq == 116 || g_player[screenpeek].ps->ftq == 117)
if (g_player[screenpeek].ps->ftq >= QUOTE_RESERVED && g_player[screenpeek].ps->ftq <= QUOTE_RESERVED3)
{
k = 140;//quotebot-8-4;
}
@ -1826,8 +1827,8 @@ void P_DoQuote(int32_t q, DukePlayer_t *p)
if (ud.fta_on == 0)
return;
if (p->fta > 0 && q != 115 && q != 116)
if (p->ftq == 115 || p->ftq == 116) return;
if (p->fta > 0 && q != QUOTE_RESERVED && q != QUOTE_RESERVED2)
if (p->ftq == QUOTE_RESERVED || p->ftq == QUOTE_RESERVED2) return;
p->fta = 100;
@ -1997,7 +1998,7 @@ void G_GameExit(const char *t)
if (!(t[0] == ' ' && t[1] == 0))
{
char titlebuf[256];
Bsprintf(titlebuf,HEAD2 " %s",s_buildDate);
Bsprintf(titlebuf,HEAD2 " %s",s_buildRev);
wm_msgbox(titlebuf, "%s", (char *)t);
}
}
@ -2479,7 +2480,7 @@ void G_SetCrosshairColor(int32_t r, int32_t g, int32_t b)
makepalookup(CROSSHAIR_PAL,tempbuf,CrosshairColors.r>>2, CrosshairColors.g>>2, CrosshairColors.b>>2,1);
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
Bmemcpy(&hictinting[CROSSHAIR_PAL], &CrosshairColors, sizeof(palette_t));
hictinting[CROSSHAIR_PAL].f = 9;
#endif
@ -2535,7 +2536,7 @@ void G_DisplayRest(int32_t smoothratio)
walltype *wal;
int32_t cposx, cposy, cang;
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
// this takes care of fullscreen tint for OpenGL
if (getrendermode() >= 3)
@ -2791,7 +2792,7 @@ void G_DisplayRest(int32_t smoothratio)
if (ud.coords)
G_PrintCoords(screenpeek);
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
{
extern int32_t mdpause;
@ -3220,6 +3221,8 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
int32_t tmpyx=yxaspect, tmpvr=viewingrange;
if (g_networkMode == NET_DEDICATED_SERVER) return;
if (pub > 0 || getrendermode() >= 3) // JBF 20040101: redraw background always
{
if (getrendermode() >= 3 || ud.screen_size > 8 || (ud.screen_size == 8 && ud.statusbarscale<100))
@ -3345,7 +3348,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
}
else if (getrendermode() > 0 && ud.screen_tilting /*&& (p->rotscrnang || p->orotscrnang)*/)
{
#ifdef POLYMOST
#ifdef USE_OPENGL
setrollangle(p->orotscrnang + mulscale16(((p->rotscrnang - p->orotscrnang + 1024)&2047)-1024,smoothratio));
#endif
p->orotscrnang = p->rotscrnang; // JBF: save it for next time
@ -3416,7 +3419,7 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
VM_OnEvent(EVENT_DISPLAYROOMS, g_player[screenpeek].ps->i, screenpeek, -1);
if (((gotpic[MIRROR>>3]&(1<<(MIRROR&7))) > 0)
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
&& (getrendermode() != 4)
#endif
)
@ -5633,7 +5636,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
t->xrepeat = t->yrepeat = 0;
continue;
case CHAIR3__STATIC:
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
{
t->cstat &= ~4;
@ -5899,7 +5902,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
t->picnum = GROWSPARK+((totalclock>>4)&3);
break;
case RPG__STATIC:
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 &&
!(spriteext[i].flags & SPREXT_NOTMD))
{
@ -5922,7 +5925,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
case RECON__STATIC:
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
{
t->cstat &= ~4;
@ -5962,7 +5965,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
}
else*/
t->ang = g_player[p].ps->ang+mulscale16((int32_t)(((g_player[p].ps->ang+1024- g_player[p].ps->oang)&2047)-1024),smoothratio);
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (bpp > 8 && usemodels && md_tilehasmodel(t->picnum, t->pal) >= 0)
{
static int32_t targetang = 0;
@ -6043,7 +6046,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
if (s->owner == -1)
{
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
{
k = 0;
@ -6098,7 +6101,7 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio)
continue;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
{
k = 0;
@ -6192,12 +6195,12 @@ PALONLY:
t->ang = sprpos[i].ang;
}
*/
if ((unsigned)((intptr_t *)t4-&script[0]) > (unsigned)(&script[g_scriptSize]-&script[0]))
goto skip;
if ((intptr_t *)t4 >= &script[0] && (intptr_t *)t4 <= (&script[0]+g_scriptSize))
{
l = *(((intptr_t *)t4)+2); //For TerminX: was *(int32_t *)(t4+8)
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
{
k = 0;
@ -6261,8 +6264,8 @@ PALONLY:
}
else if (display_mirror == 1)
t->cstat |= 4;
}
skip:
if (g_player[screenpeek].ps->inv_amount[GET_HEATS] > 0 && g_player[screenpeek].ps->heat_on &&
(A_CheckEnemySprite(s) || A_CheckSpriteFlags(t->owner,SPRITE_NVG) || s->picnum == APLAYER || s->statnum == STAT_DUMMYPLAYER))
{
@ -6309,7 +6312,7 @@ PALONLY:
yrep = tsprite[spritesortcnt].yrepeat;// - (klabs(daz-t->z)>>11);
tsprite[spritesortcnt].yrepeat = yrep;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(t->picnum,t->pal) >= 0)
{
tsprite[spritesortcnt].yrepeat = 0;
@ -6362,6 +6365,7 @@ PALONLY:
break;
case FIRE__STATIC:
case FIRE2__STATIC:
t->cstat |= 128;
case BURNING__STATIC:
case BURNING2__STATIC:
if (sprite[s->owner].picnum != TREE1 && sprite[s->owner].picnum != TREE2)
@ -6376,7 +6380,7 @@ PALONLY:
t->picnum += (s->shade>>1);
break;
case PLAYERONWATER__STATIC:
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,s->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
{
k = 0;
@ -6439,7 +6443,7 @@ PALONLY:
case CAMERA1__STATIC:
case RAT__STATIC:
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,s->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
{
t->cstat &= ~4;
@ -6661,7 +6665,7 @@ GAME_STATIC void G_DoCheats(void)
if (!((ch >= 'a' && ch <= 'z') || (ch >= '0' && ch <= '9')))
{
g_player[myconnectindex].ps->cheat_phase = 0;
// P_DoQuote(46,g_player[myconnectindex].ps);
// P_DoQuote(QUOTE_46,g_player[myconnectindex].ps);
return;
}
@ -6709,14 +6713,14 @@ FOUNDCHEAT:
KB_FlushKeyBoardQueue();
g_player[myconnectindex].ps->cheat_phase = 0;
P_DoQuote(119,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_ALL_WEAPONS, g_player[myconnectindex].ps);
return;
case CHEAT_INVENTORY:
KB_FlushKeyBoardQueue();
g_player[myconnectindex].ps->cheat_phase = 0;
G_CheatGetInv();
P_DoQuote(120,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_ALL_INV, g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0;
return;
@ -6724,7 +6728,7 @@ FOUNDCHEAT:
g_player[myconnectindex].ps->got_access = 7;
KB_FlushKeyBoardQueue();
g_player[myconnectindex].ps->cheat_phase = 0;
P_DoQuote(121,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_ALL_KEYS, g_player[myconnectindex].ps);
return;
case CHEAT_DEBUG:
@ -6743,7 +6747,7 @@ FOUNDCHEAT:
ud.clipping = 1-ud.clipping;
KB_FlushKeyBoardQueue();
g_player[myconnectindex].ps->cheat_phase = 0;
P_DoQuote(112+ud.clipping,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_NOCLIP-ud.clipping, g_player[myconnectindex].ps);
return;
case CHEAT_RESERVED2:
@ -6753,7 +6757,7 @@ FOUNDCHEAT:
return;
case CHEAT_ALLEN:
P_DoQuote(79,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_ALLEN,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0;
KB_ClearKeyDown(sc_N);
return;
@ -6779,7 +6783,7 @@ FOUNDCHEAT:
sprite[g_player[myconnectindex].ps->i].lotag = 0;
sprite[g_player[myconnectindex].ps->i].pal = g_player[myconnectindex].ps->palookup;
P_DoQuote(17,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_GODMODE_ON,g_player[myconnectindex].ps);
}
else
{
@ -6787,7 +6791,7 @@ FOUNDCHEAT:
sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health;
actor[g_player[myconnectindex].ps->i].extra = -1;
g_player[myconnectindex].ps->last_extra = g_player[myconnectindex].ps->max_player_health;
P_DoQuote(18,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_GODMODE_OFF,g_player[myconnectindex].ps);
}
sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health;
@ -6816,9 +6820,9 @@ FOUNDCHEAT:
sprite[g_player[myconnectindex].ps->i].hitag = 0;
sprite[g_player[myconnectindex].ps->i].lotag = 0;
sprite[g_player[myconnectindex].ps->i].pal = g_player[myconnectindex].ps->palookup;
Bstrcpy(ScriptQuotes[122],"COME GET SOME!");
Bstrcpy(ScriptQuotes[QUOTE_RESERVED4],"COME GET SOME!");
S_PlaySound(DUKE_GETWEAPON2);
P_DoQuote(122,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_RESERVED4, g_player[myconnectindex].ps);
G_CheatGetInv();
for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++)
g_player[myconnectindex].ps->gotweapon |= (1<<weapon);
@ -6834,7 +6838,7 @@ FOUNDCHEAT:
sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health;
actor[g_player[myconnectindex].ps->i].extra = -1;
g_player[myconnectindex].ps->last_extra = g_player[myconnectindex].ps->max_player_health;
P_DoQuote(18,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_GODMODE_OFF, g_player[myconnectindex].ps);
}
sprite[g_player[myconnectindex].ps->i].extra = g_player[myconnectindex].ps->max_player_health;
@ -6859,10 +6863,10 @@ FOUNDCHEAT:
P_AddAmmo(weapon, g_player[myconnectindex].ps, g_player[myconnectindex].ps->max_ammo_amount[weapon]);
G_CheatGetInv();
g_player[myconnectindex].ps->got_access = 7;
P_DoQuote(5,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_EVERYTHING, g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0;
// P_DoQuote(21,g_player[myconnectindex].ps);
// P_DoQuote(QUOTE_21,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue();
g_player[myconnectindex].ps->inven_icon = 1;
@ -6937,14 +6941,14 @@ FOUNDCHEAT:
g_cameraDistance = 0;
g_cameraClock = totalclock;
}
P_DoQuote(22,g_player[myconnectindex].ps);
// P_DoQuote(QUOTE_CHEATS_DISABLED,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue();
return;
case CHEAT_TIME:
P_DoQuote(21,g_player[myconnectindex].ps);
// P_DoQuote(QUOTE_21,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue();
return;
@ -6965,7 +6969,7 @@ FOUNDCHEAT:
}
G_OperateForceFields(g_player[myconnectindex].ps->i,-1);
P_DoQuote(100,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_UNLOCK,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue();
return;
@ -6979,7 +6983,7 @@ FOUNDCHEAT:
case CHEAT_ITEMS:
G_CheatGetInv();
g_player[myconnectindex].ps->got_access = 7;
P_DoQuote(5,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_EVERYTHING,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue();
return;
@ -6992,7 +6996,7 @@ FOUNDCHEAT:
show2dsector[i] = 255;
for (i=0; i<(MAXWALLS>>3); i++)
show2dwall[i] = 255;
P_DoQuote(111,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_SHOW_MAP_ON, g_player[myconnectindex].ps);
}
else
{
@ -7000,14 +7004,14 @@ FOUNDCHEAT:
show2dsector[i] = 0;
for (i=0; i<(MAXWALLS>>3); i++)
show2dwall[i] = 0;
P_DoQuote(1,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_SHOW_MAP_OFF, g_player[myconnectindex].ps);
}
g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue();
return;
case CHEAT_TODD:
P_DoQuote(99,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_TODD,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue();
return;
@ -7019,7 +7023,7 @@ FOUNDCHEAT:
return;
case CHEAT_BETA:
P_DoQuote(105,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_BETA,g_player[myconnectindex].ps);
KB_ClearKeyDown(sc_H);
g_player[myconnectindex].ps->cheat_phase = 0;
KB_FlushKeyBoardQueue();
@ -7029,19 +7033,22 @@ FOUNDCHEAT:
g_player[myconnectindex].ps->inv_amount[GET_STEROIDS] = 399;
g_player[myconnectindex].ps->inv_amount[GET_HEATS] = 1200;
g_player[myconnectindex].ps->cheat_phase = 0;
P_DoQuote(37,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEAT_STEROIDS,g_player[myconnectindex].ps);
KB_FlushKeyBoardQueue();
return;
case CHEAT_MONSTERS:
{
char *s[] = { "ON", "OFF", "ON" };
char *s[] = { "ON", "OFF" };
if (++g_noEnemies == 3)
g_noEnemies = 0;
g_noEnemies++;
if (g_noEnemies == 3) g_noEnemies = 0;
g_player[screenpeek].ps->cheat_phase = 0;
Bsprintf(ScriptQuotes[122],"MONSTERS: %s",s[(uint8_t)g_noEnemies]);
P_DoQuote(122,g_player[myconnectindex].ps);
Bsprintf(ScriptQuotes[QUOTE_RESERVED4], "MONSTERS: %s", s[g_noEnemies%1]);
P_DoQuote(QUOTE_RESERVED4,g_player[myconnectindex].ps);
KB_FlushKeyBoardQueue();
return;
}
@ -7073,13 +7080,13 @@ FOUNDCHEAT:
{
if (ud.player_skill == 4)
{
P_DoQuote(22,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_CHEATS_DISABLED,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->cheat_phase = 0;
}
else
{
g_player[myconnectindex].ps->cheat_phase = 1;
// P_DoQuote(25,g_player[myconnectindex].ps);
// P_DoQuote(QUOTE_25,g_player[myconnectindex].ps);
cheatbuflen = 0;
}
KB_FlushKeyboardQueue();
@ -7192,14 +7199,14 @@ void G_HandleLocalKeys(void)
{
CONTROL_ClearButton(gamefunc_Show_Opponents_Weapon);
ud.config.ShowOpponentWeapons = ud.showweapons = 1-ud.showweapons;
P_DoQuote(82-ud.showweapons,g_player[screenpeek].ps);
P_DoQuote(QUOTE_WEAPON_MODE_OFF-ud.showweapons,g_player[screenpeek].ps);
}
if (BUTTON(gamefunc_Toggle_Crosshair))
{
CONTROL_ClearButton(gamefunc_Toggle_Crosshair);
ud.crosshair = !ud.crosshair;
P_DoQuote(21-ud.crosshair,g_player[screenpeek].ps);
P_DoQuote(QUOTE_CROSSHAIR_OFF-ud.crosshair,g_player[screenpeek].ps);
}
if (ud.overhead_on && BUTTON(gamefunc_Map_Follow_Mode))
@ -7212,7 +7219,7 @@ void G_HandleLocalKeys(void)
ud.foly = g_player[screenpeek].ps->opos.y;
ud.fola = g_player[screenpeek].ps->oang;
}
P_DoQuote(83+ud.scrollmode,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_MAP_FOLLOW_OFF+ud.scrollmode,g_player[myconnectindex].ps);
}
if (KB_UnBoundKeyPressed(sc_ScrollLock))
@ -7338,7 +7345,7 @@ void G_HandleLocalKeys(void)
{
if (SHIFTS_IS_PRESSED)
{
if (i == 5 && g_player[myconnectindex].ps->fta > 0 && g_player[myconnectindex].ps->ftq == 26)
if (i == 5 && g_player[myconnectindex].ps->fta > 0 && g_player[myconnectindex].ps->ftq == QUOTE_MUSIC)
{
i = (VOLUMEALL?MAXVOLUMES*MAXLEVELS:6);
g_musicIndex = (g_musicIndex+1)%i;
@ -7351,10 +7358,10 @@ void G_HandleLocalKeys(void)
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL)
{
if (S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex))
Bsprintf(ScriptQuotes[26],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]);
Bsprintf(ScriptQuotes[QUOTE_MUSIC],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]);
else
Bsprintf(ScriptQuotes[26],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].musicfn[0]);
P_DoQuote(26,g_player[myconnectindex].ps);
Bsprintf(ScriptQuotes[QUOTE_MUSIC],"PLAYING %s",&MapInfo[(uint8_t)g_musicIndex].musicfn[0]);
P_DoQuote(QUOTE_MUSIC,g_player[myconnectindex].ps);
}
return;
}
@ -7473,7 +7480,7 @@ void G_HandleLocalKeys(void)
FAKE_F2:
if (sprite[g_player[myconnectindex].ps->i].extra <= 0)
{
P_DoQuote(118,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_SAVE_DEAD,g_player[myconnectindex].ps);
return;
}
ChangeToMenu(350);
@ -7542,7 +7549,7 @@ FAKE_F3:
if (sprite[g_player[myconnectindex].ps->i].extra <= 0)
{
P_DoQuote(118,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_SAVE_DEAD,g_player[myconnectindex].ps);
return;
}
g_screenCapture = 1;
@ -7571,32 +7578,32 @@ FAKE_F3:
g_cameraDistance = 0;
g_cameraClock = totalclock;
}
P_DoQuote(109+g_player[myconnectindex].ps->over_shoulder_on,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_VIEW_MODE_OFF+g_player[myconnectindex].ps->over_shoulder_on,g_player[myconnectindex].ps);
}
if (KB_UnBoundKeyPressed(sc_F5) && ud.config.MusicDevice >= 0)
{
KB_ClearKeyDown(sc_F5);
if (MapInfo[(uint8_t)g_musicIndex].alt_musicfn != NULL)
Bstrcpy(ScriptQuotes[26],&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]);
Bstrcpy(ScriptQuotes[QUOTE_MUSIC],&MapInfo[(uint8_t)g_musicIndex].alt_musicfn[0]);
else if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL)
{
Bstrcpy(ScriptQuotes[26],&MapInfo[(uint8_t)g_musicIndex].musicfn[0]);
Bstrcat(ScriptQuotes[26],". USE SHIFT-F5 TO CHANGE.");
Bstrcpy(ScriptQuotes[QUOTE_MUSIC],&MapInfo[(uint8_t)g_musicIndex].musicfn[0]);
Bstrcat(ScriptQuotes[QUOTE_MUSIC],". USE SHIFT-F5 TO CHANGE.");
}
else ScriptQuotes[26][0] = '\0';
P_DoQuote(26,g_player[myconnectindex].ps);
else ScriptQuotes[QUOTE_MUSIC][0] = '\0';
P_DoQuote(QUOTE_MUSIC, g_player[myconnectindex].ps);
}
if (KB_UnBoundKeyPressed(sc_F8))
{
KB_ClearKeyDown(sc_F8);
ud.fta_on = !ud.fta_on;
if (ud.fta_on) P_DoQuote(23,g_player[myconnectindex].ps);
if (ud.fta_on) P_DoQuote(QUOTE_MESSAGES_ON,g_player[myconnectindex].ps);
else
{
ud.fta_on = 1;
P_DoQuote(24,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_MESSAGES_OFF,g_player[myconnectindex].ps);
ud.fta_on = 0;
}
}
@ -7673,7 +7680,7 @@ FAKE_F3:
{
CONTROL_ClearButton(gamefunc_AutoRun);
ud.auto_run = 1-ud.auto_run;
P_DoQuote(85+ud.auto_run,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_RUN_MODE_OFF+ud.auto_run,g_player[myconnectindex].ps);
}
if (BUTTON(gamefunc_Map))
@ -7745,7 +7752,7 @@ static void G_ShowParameterHelp(void)
"\nSee eduke32 -debughelp for debug parameters"
;
#if defined RENDERTYPEWIN
Bsnprintf(tempbuf, sizeof(tempbuf), HEAD2 " %s", s_buildDate);
Bsnprintf(tempbuf, sizeof(tempbuf), HEAD2 " %s", s_buildRev);
wm_msgbox(tempbuf,s);
#else
initprintf("%s\n",s);
@ -7771,7 +7778,7 @@ static void G_ShowDebugHelp(void)
"-conversion YYYYMMDD\tSelects CON script version for compatibility with older mods\n"
;
#if defined RENDERTYPEWIN
Bsnprintf(tempbuf, sizeof(tempbuf), HEAD2 " %s", s_buildDate);
Bsnprintf(tempbuf, sizeof(tempbuf), HEAD2 " %s", s_buildRev);
wm_msgbox(tempbuf,s);
#else
initprintf("%s\n",s);
@ -7809,7 +7816,7 @@ static int32_t getfilenames(const char *path, char kind[])
}
static char *autoloadmasks[] = { "*.grp", "*.zip", "*.pk3" };
#define NUMAUTOLOADMASKS 3
#define NUMAUTOLOADMASKS (int32_t)(sizeof(autoloadmasks)/sizeof(autoloadmasks[0]))
static void G_DoAutoload(const char *fn)
{
@ -7829,7 +7836,7 @@ static void G_DoAutoload(const char *fn)
}
}
static char *makename(char *destname, char *OGGname, const char *origname)
static char *S_OggifyFilename(char *destname, char *OGGname, const char *origname)
{
if (!origname)
return destname;
@ -7859,7 +7866,7 @@ static int32_t S_DefineSound(int32_t ID,char *name)
{
if (ID >= MAXSOUNDS)
return 1;
g_sounds[ID].filename1 =makename(g_sounds[ID].filename1,name,g_sounds[ID].filename);
g_sounds[ID].filename1 =S_OggifyFilename(g_sounds[ID].filename1,name,g_sounds[ID].filename);
// initprintf("(%s)(%s)(%s)\n",g_sounds[ID].filename1,name,g_sounds[ID].filename);
// S_LoadSound(ID);
return 0;
@ -7899,7 +7906,7 @@ static int32_t S_DefineMusic(char *ID,char *name)
ID = MapInfo[sel].musicfn;
}
MapInfo[sel].alt_musicfn = makename(MapInfo[sel].alt_musicfn,name,ID);
MapInfo[sel].alt_musicfn = S_OggifyFilename(MapInfo[sel].alt_musicfn,name,ID);
// initprintf("%-15s | ",ID);
// initprintf("%3d %2d %2d | %s\n",sel,ep,lev,MapInfo[sel].alt_musicfn);
// S_PlayMusic(ID,sel);
@ -8190,7 +8197,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
initprintf("\n");
i = 1;
while (i < argc)
do
{
c = (char *)argv[i];
if ((*c == '-')
@ -8255,7 +8262,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
Bsprintf(defaultduke3dgrp, "nam.grp");
Bsprintf(defaultduke3ddef, "nam.def");
Bsprintf(defaultconfilename, "nam.con");
g_gameType = GAMENAM;
g_gameType = GAME_NAM;
i++;
continue;
}
@ -8264,7 +8271,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
Bsprintf(defaultduke3dgrp, "ww2gi.grp");
Bsprintf(defaultduke3ddef, "ww2gi.def");
Bsprintf(defaultconfilename, "ww2gi.con");
g_gameType = GAMEWW2;
g_gameType = GAME_WW2;
i++;
continue;
}
@ -8318,7 +8325,14 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
}
if (!Bstrcasecmp(c+1,"server"))
{
g_netServerMode = 1;
g_networkMode = NET_SERVER;
g_noSetup = g_noLogo = TRUE;
i++;
continue;
}
if (!Bstrcasecmp(c+1,"dedicated"))
{
g_networkMode = NET_DEDICATED_SERVER;
g_noSetup = g_noLogo = TRUE;
i++;
continue;
@ -8648,6 +8662,7 @@ static void G_CheckCommandLine(int32_t argc, const char **argv)
}
i++;
}
while (i < argc);
}
}
@ -8884,7 +8899,7 @@ static void G_Cleanup(void)
void G_Shutdown(void)
{
CONFIG_WriteSetup();
CONFIG_WriteSetup(0);
S_SoundShutdown();
S_MusicShutdown();
CONTROL_Shutdown();
@ -9142,7 +9157,7 @@ static void G_Startup(void)
}
for (i=0; i<MAXPLAYERS; i++)
g_player[i].playerreadyflag = 0;
g_player[i].pingcnt = 0;
if (quitevent)
{
@ -9305,6 +9320,7 @@ int32_t app_main(int32_t argc,const char **argv)
break;
}
}
if (i == argc && win_checkinstance())
{
if (!wm_ynbox("EDuke32","Another Build game is currently running. "
@ -9344,7 +9360,8 @@ int32_t app_main(int32_t argc,const char **argv)
Bstrcpy(tempbuf, APPNAME);
wm_setapptitle(tempbuf);
initprintf(HEAD2 " %s\n", s_buildDate);
initprintf(HEAD2 " %s\n", s_buildRev);
initprintf("Compiled %s\n", __DATE__" "__TIME__);
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
addsearchpath("/usr/share/games/jfduke3d");
@ -9435,7 +9452,7 @@ int32_t app_main(int32_t argc,const char **argv)
Bfree(str);
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
glusetexcache = -1;
#endif
@ -9483,7 +9500,7 @@ int32_t app_main(int32_t argc,const char **argv)
}
#endif
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (glusetexcache == -1)
{
ud.config.useprecache = glusetexcompr = 1;
@ -9574,14 +9591,14 @@ int32_t app_main(int32_t argc,const char **argv)
}
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
Bsprintf(tempbuf,"%s/%s",g_modDir,TEXCACHEFILE);
Bstrcpy(TEXCACHEFILE,tempbuf);
#endif
}
// shitcan the old cache directory
#if 0 && defined(POLYMOST) && defined(USE_OPENGL)
#if 0 && defined(USE_OPENGL)
{
struct stat st;
char dir[BMAX_PATH];
@ -9747,7 +9764,7 @@ CLEAN_DIRECTORY:
if (g_scriptDebug)
initprintf("CON debugging activated (level %d).\n",g_scriptDebug);
if (g_netServerMode)
if (g_networkMode == NET_SERVER || g_networkMode == NET_DEDICATED_SERVER)
{
ENetAddress address = { ENET_HOST_ANY, g_netPort };
g_netServer = enet_host_create(&address, MAXPLAYERS, CHAN_MAX, 0, 0);
@ -9838,10 +9855,12 @@ CLEAN_DIRECTORY:
initprintf("Initializing OSD...\n");
Bsprintf(tempbuf, HEAD2 " %s", s_buildDate);
Bsprintf(tempbuf, HEAD2 " %s", s_buildRev);
OSD_SetVersion(tempbuf, 10,0);
registerosdcommands();
if (g_networkMode != NET_DEDICATED_SERVER)
{
if (CONTROL_Startup(1, &GetTime, TICRATE))
{
fprintf(stderr, "There was an error initializing the CONTROL system.\n");
@ -9859,6 +9878,7 @@ CLEAN_DIRECTORY:
// JBF 20040215: evil and nasty place to do this, but joysticks are evil and nasty too
for (i=0; i<joynumaxes; i++)
setjoydeadzone(i,ud.config.JoystickAnalogueDead[i],ud.config.JoystickAnalogueSaturate[i]);
}
{
char *ptr = Bstrdup(setupfilename), *p = strtok(ptr,".");
@ -9869,12 +9889,13 @@ CLEAN_DIRECTORY:
Bfree(ptr);
}
i = clipmapinfo_load("_clipshape0.map");
if (i>0)
if ((i = clipmapinfo_load("_clipshape0.map")) > 0)
initprintf("There was an error loading the sprite clipping map (status %d).\n", i);
OSD_Exec("autoexec.cfg");
if (g_networkMode != NET_DEDICATED_SERVER)
{
if (setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP) < 0)
{
int32_t i = 0;
@ -9885,7 +9906,7 @@ CLEAN_DIRECTORY:
initprintf("Failure setting video mode %dx%dx%d %s! Attempting safer mode...\n",
ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP,ud.config.ScreenMode?"fullscreen":"windowed");
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
{
int32_t j = 0;
while (setgamemode(0,xres[i],yres[i],bpp[j]) < 0)
@ -9916,6 +9937,7 @@ CLEAN_DIRECTORY:
S_MusicStartup();
S_SoundStartup();
}
// loadtmb();
if (ud.warp_on > 1 && (!g_netServer && ud.multimode < 2))
@ -9939,8 +9961,11 @@ CLEAN_DIRECTORY:
MAIN_LOOP_RESTART:
if (g_networkMode != NET_DEDICATED_SERVER)
{
G_GetCrosshairColor();
G_SetCrosshairColor(CrosshairColors.r, CrosshairColors.g, CrosshairColors.b);
}
if (ud.warp_on == 0)
{
@ -9965,8 +9990,11 @@ MAIN_LOOP_RESTART:
Net_WaitForServer();
}
else G_DisplayLogo();
else if (g_networkMode != NET_DEDICATED_SERVER)
G_DisplayLogo();
if (g_networkMode != NET_DEDICATED_SERVER)
{
if (G_PlaybackDemo())
{
FX_StopAllSounds();
@ -9975,6 +10003,7 @@ MAIN_LOOP_RESTART:
goto MAIN_LOOP_RESTART;
}
}
}
else if (ud.warp_on == 1)
{
G_NewGame(ud.m_volume_number,ud.m_level_number,ud.m_player_skill);
@ -10015,19 +10044,51 @@ MAIN_LOOP_RESTART:
}
sampletimer();
MUSIC_Update();
Net_GetPackets();
G_HandleLocalKeys();
// only allow binds to function if the player is actually in a game (not in a menu, typing, et cetera) or demo
bindsenabled = g_player[myconnectindex].ps->gm & (MODE_GAME|MODE_DEMO);
#ifndef _WIN32
// stdin -> OSD input for dedicated server
if (g_networkMode == NET_DEDICATED_SERVER)
{
int32_t nb, flag = 1;
char ch;
static uint32_t bufpos = 0;
static char buf[128];
ioctl(0, FIONBIO, &flag);
if ((nb = read(0, &ch, 1)) > 0 && bufpos < sizeof(buf))
{
if (ch != '\n')
buf[bufpos++] = ch;
if (ch == '\n' || bufpos >= sizeof(buf))
{
buf[bufpos] = 0;
OSD_Dispatch(buf);
bufpos = 0;
}
}
}
else
#endif
{
MUSIC_Update();
G_HandleLocalKeys();
}
OSD_DispatchQueued();
if (!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO)) && totalclock >= ototalclock+TICSPERFRAME)
if (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME)
{
if (g_networkMode != NET_DEDICATED_SERVER)
{
CONTROL_ProcessBinds();
getinput(myconnectindex);
}
avg.fvel += loc.fvel;
avg.svel += loc.svel;
@ -10051,23 +10112,34 @@ MAIN_LOOP_RESTART:
}
*/
j = 0;
do
{
int32_t clockbeforetic;
sampletimer();
if (ready2send == 0) break;
ototalclock += TICSPERFRAME;
if (((ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) &&
(g_player[myconnectindex].ps->gm&MODE_GAME) && G_MoveLoop())
j++;
}
while (!(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO)) && totalclock >= ototalclock+TICSPERFRAME);
clockbeforetic = totalclock;
if (((ud.show_help == 0 && (g_player[myconnectindex].ps->gm&MODE_MENU) != MODE_MENU) || ud.recstat == 2 || (g_netServer || ud.multimode > 1)) &&
(g_player[myconnectindex].ps->gm&MODE_GAME))
G_MoveLoop();
sampletimer();
if (totalclock - clockbeforetic >= TICSPERFRAME)
{
// computing a tic takes longer than a tic, so we're slowing
// the game down. rather than tightly spinning here, go draw
// a frame since we're fucked anyway
break;
}
}
while (((g_netClient || g_netServer) || !(g_player[myconnectindex].ps->gm & (MODE_MENU|MODE_DEMO))) && totalclock >= ototalclock+TICSPERFRAME);
if (j) continue;
}
G_DoCheats();
@ -10094,6 +10166,12 @@ MAIN_LOOP_RESTART:
g_multiMapState = NULL;
}
if (g_networkMode == NET_DEDICATED_SERVER)
{
idle();
goto skipframe;
}
if (framewaiting)
{
framewaiting--;
@ -10128,6 +10206,7 @@ MAIN_LOOP_RESTART:
framewaiting++;
}
skipframe:
if (g_player[myconnectindex].ps->gm&MODE_DEMO)
goto MAIN_LOOP_RESTART;
}
@ -10146,7 +10225,7 @@ GAME_STATIC GAME_INLINE int32_t G_MoveLoop()
int32_t G_DoMoveThings(void)
{
int32_t i, j;
int32_t i;
ud.camerasprite = -1;
lockclock += TICSPERFRAME;
@ -10184,12 +10263,12 @@ int32_t G_DoMoveThings(void)
sprite[hitinfo.hitsprite].picnum == APLAYER && sprite[hitinfo.hitsprite].yvel != screenpeek &&
g_player[sprite[hitinfo.hitsprite].yvel].ps->dead_flag == 0)
{
if (g_player[screenpeek].ps->fta == 0 || g_player[screenpeek].ps->ftq == 117)
if (g_player[screenpeek].ps->fta == 0 || g_player[screenpeek].ps->ftq == QUOTE_RESERVED3)
{
if (ldist(&sprite[g_player[screenpeek].ps->i],&sprite[hitinfo.hitsprite]) < 9216)
{
Bsprintf(ScriptQuotes[117],"%s",&g_player[sprite[hitinfo.hitsprite].yvel].user_name[0]);
g_player[screenpeek].ps->fta = 12, g_player[screenpeek].ps->ftq = 117;
Bsprintf(ScriptQuotes[QUOTE_RESERVED3],"%s",&g_player[sprite[hitinfo.hitsprite].yvel].user_name[0]);
g_player[screenpeek].ps->fta = 12, g_player[screenpeek].ps->ftq = QUOTE_RESERVED3;
}
}
else if (g_player[screenpeek].ps->fta > 2) g_player[screenpeek].ps->fta -= 3;
@ -10289,42 +10368,7 @@ int32_t G_DoMoveThings(void)
}
if (g_netClient) //Slave
{
input_t *nsyn = (input_t *)&inputfifo[0][myconnectindex];
packbuf[0] = PACKET_SLAVE_TO_MASTER;
j = 1;
Bmemcpy(&packbuf[j], &nsyn[0], offsetof(input_t, filler));
j += offsetof(input_t, filler);
Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->pos.x, sizeof(vec3_t) * 2);
j += sizeof(vec3_t) * 2;
Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->posvel.x, sizeof(vec3_t));
j += sizeof(vec3_t);
*(int16_t *)&packbuf[j] = g_player[myconnectindex].ps->ang;
j += sizeof(int16_t);
Bmemcpy(&packbuf[j], &g_player[myconnectindex].ps->horiz, sizeof(int16_t) * 2);
j += sizeof(int16_t) * 2;
i = g_player[myconnectindex].ps->i;
{
char buf[1024];
j = qlz_compress((char *)(packbuf)+1, (char *)buf, j, state_compress);
Bmemcpy((char *)(packbuf)+1, (char *)buf, j);
j++;
}
packbuf[j++] = myconnectindex;
enet_peer_send(g_netClientPeer, CHAN_MOVE, enet_packet_create(packbuf, j, 0));
}
Net_ClientMove();
return 0;
}
@ -10403,6 +10447,9 @@ void G_BonusScreen(int32_t bonusonly)
350, 380,VICTORY1+8,86,59
};
if (g_networkMode == NET_DEDICATED_SERVER)
return;
Bsprintf(tempbuf, "%s - " APPNAME, g_gameNamePtr);
wm_setapptitle(tempbuf);

View file

@ -64,6 +64,17 @@ enum LogoFlags_t {
LOGO_TENSCREEN = 0x00000200
};
typedef enum basepal_ {
BASEPAL = 0,
WATERPAL,
SLIMEPAL,
DREALMSPAL,
TITLEPAL,
ENDINGPAL,
ANIMPAL,
BASEPALCOUNT
} basepal_t;
#define deletesprite A_DeleteSprite
void A_DeleteSprite(int32_t s);
@ -227,23 +238,9 @@ extern palette_t DefaultCrosshairColors;
extern uint32_t g_frameDelay;
// Watch out for MAXBASEPALS in the engine before increasing this
#define BASEPALCOUNT 7
extern uint8_t water_pal[768],slime_pal[768],title_pal[768],dre_alms[768],ending_pal[768],*anim_pal;
extern uint8_t *basepaltable[BASEPALCOUNT];
typedef enum basepal_ {
BASEPAL = 0,
WATERPAL,
SLIMEPAL,
DREALMSPAL,
TITLEPAL,
ENDINGPAL,
ANIMPAL
} basepal_t;
extern user_defs ud;
int32_t A_CheckInventorySprite(spritetype *s);
@ -313,12 +310,11 @@ static inline int32_t G_GetTeamPalette(int32_t team)
int32_t G_GetVersionFromWebsite(char *buffer);
#endif
#if defined(RENDERTYPEWIN) && defined(USE_OPENGL)
#ifdef RENDERTYPEWIN
void app_crashhandler(void);
#ifdef USE_OPENGL
extern char forcegl;
#endif
#if defined(RENDERTYPEWIN)
void app_crashhandler(void);
#endif
#if KRANDDEBUG

View file

@ -1084,38 +1084,37 @@ void C_InitHashes()
#define IFELSE_MAGIC 31337
static int32_t g_ifElseAborted;
static int32_t C_SetScriptSize(int32_t size)
static int32_t C_SetScriptSize(int32_t newsize)
{
intptr_t oscriptPtr = (unsigned)(g_scriptPtr-script);
intptr_t ocaseScriptPtr = (unsigned)(g_caseScriptPtr-script);
intptr_t oparsingEventPtr = (unsigned)(g_parsingEventPtr-script);
intptr_t oparsingActorPtr = (unsigned)(g_parsingActorPtr-script);
char *scriptptrs;
intptr_t *newscript;
intptr_t i, j;
int32_t osize = g_scriptSize;
char *scriptptrs;
char *newbitptr;
for (i=MAXSECTORS-1; i>=0; i--)
{
if (labelcode[i] && labeltype[i] != LABEL_DEFINE)
{
labelcode[i] -= (intptr_t)&script[0];
}
j = (intptr_t)labelcode[i]-(intptr_t)&script[0];
labelcode[i] = (intptr_t)j;
}
scriptptrs = Bcalloc(1,g_scriptSize * sizeof(uint8_t));
scriptptrs = Bcalloc(1, g_scriptSize * sizeof(uint8_t));
for (i=g_scriptSize-1; i>=0; i--)
{
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)) && !((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize])))
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
{
if ((intptr_t)script[i] < (intptr_t)&script[0] || (intptr_t)script[i] >= (intptr_t)&script[g_scriptSize])
{
g_numCompilerErrors++;
initprintf("Internal compiler error at %"PRIdPTR" (0x%"PRIxPTR")\n",i,i);
}
// if (bitptr[i] == 0 && ((intptr_t)script[i] >= (intptr_t)(&script[0]) && (intptr_t)script[i] < (intptr_t)(&script[g_scriptSize])))
// initprintf("oh no!\n");
if (bitptr[i>>3]&(BITPTR_POINTER<<(i&7)))
{
scriptptrs[i] = 1;
script[i] -= (intptr_t)&script[0];
}
@ -1129,6 +1128,7 @@ static int32_t C_SetScriptSize(int32_t size)
j = (intptr_t)actorscrptr[i]-(intptr_t)&script[0];
actorscrptr[i] = (intptr_t *)j;
}
if (actorLoadEventScrptr[i])
{
j = (intptr_t)actorLoadEventScrptr[i]-(intptr_t)&script[0];
@ -1143,14 +1143,10 @@ static int32_t C_SetScriptSize(int32_t size)
apScriptGameEvent[i] = (intptr_t *)j;
}
//initprintf("offset: %d\n",(unsigned)(g_scriptPtr-script));
g_scriptSize = size;
initprintf("Resizing code buffer to %d*%d bytes\n",g_scriptSize, (int32_t)sizeof(intptr_t));
initprintf("Resizing code buffer to %d*%d bytes\n",newsize, (int32_t)sizeof(intptr_t));
newscript = (intptr_t *)Brealloc(script, g_scriptSize * sizeof(intptr_t));
// bitptr = (char *)Brealloc(bitptr, g_scriptSize * sizeof(uint8_t));
newbitptr = Bcalloc(1,(((size+7)>>3)+1) * sizeof(uint8_t));
newscript = (intptr_t *)Brealloc(script, newsize * sizeof(intptr_t));
newbitptr = Bcalloc(1,(((newsize+7)>>3)+1) * sizeof(uint8_t));
if (newscript == NULL || newbitptr == NULL)
{
@ -1161,14 +1157,13 @@ static int32_t C_SetScriptSize(int32_t size)
return 1;
}
if (size >= osize)
if (newsize >= osize)
{
Bmemset(&newscript[osize],0,(size-osize) * sizeof(intptr_t));
// Bmemset(&bitptr[osize],0,size-osize);
Bmemset(&newscript[0]+osize,0,(newsize-osize) * sizeof(uint8_t));
Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((osize+7)>>3));
}
else
Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((size+7)>>3));
Bmemcpy(newbitptr,bitptr,sizeof(uint8_t) *((newsize+7)>>3));
Bfree(bitptr);
bitptr = newbitptr;
@ -1178,10 +1173,8 @@ static int32_t C_SetScriptSize(int32_t size)
script = newscript;
}
g_scriptSize = newsize;
g_scriptPtr = (intptr_t *)(script+oscriptPtr);
// initprintf("script: %d, bitptr: %d\n",script,bitptr);
//initprintf("offset: %d\n",(unsigned)(g_scriptPtr-script));
if (g_caseScriptPtr)
g_caseScriptPtr = (intptr_t *)(script+ocaseScriptPtr);
@ -1196,28 +1189,17 @@ static int32_t C_SetScriptSize(int32_t size)
{
if (labelcode[i] && labeltype[i] != LABEL_DEFINE)
{
labelcode[i] += (intptr_t)&script[0];
j = (intptr_t)labelcode[i]+(intptr_t)&script[0];
labelcode[i] = j;
}
}
if (size >= osize)
{
for (i=g_scriptSize-(size-osize)-1; i>=0; i--)
for (i=(((newsize>=osize)?osize:newsize))-1; i>=0; i--)
if (scriptptrs[i])
{
j = (intptr_t)script[i]+(intptr_t)&script[0];
script[i] = j;
}
}
else
{
for (i=g_scriptSize-1; i>=0; i--)
if (scriptptrs[i])
{
j = (intptr_t)script[i]+(intptr_t)&script[0];
script[i] = j;
}
}
for (i=MAXTILES-1; i>=0; i--)
{
@ -1539,6 +1521,9 @@ static int32_t C_GetKeyword(void)
C_SkipComments();
if (*textptr == '\0') // EOF
return 0;
temptextptr = textptr;
while (isaltok(*temptextptr) == 0)
@ -2788,6 +2773,8 @@ static int32_t C_ParseCommand(void)
return 0;
case CON_ACTOR:
case CON_USERACTOR:
case CON_EVENTLOADACTOR:
if (g_processingState || g_parsingActorPtr)
{
C_ReportError(ERROR_FOUNDWITHIN);
@ -2798,6 +2785,12 @@ static int32_t C_ParseCommand(void)
g_scriptPtr--;
g_parsingActorPtr = g_scriptPtr;
if (tw == CON_USERACTOR)
{
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
}
C_SkipComments();
j = 0;
while (isaltok(*(textptr+j)))
@ -2806,11 +2799,35 @@ static int32_t C_ParseCommand(void)
j++;
}
g_szCurrentBlockName[j] = 0;
if (tw == CON_USERACTOR)
{
j = *g_scriptPtr;
if (j > 2)
{
C_ReportError(-1);
initprintf("%s:%d: warning: invalid useractor type.\n",g_szScriptFileName,g_lineNumber);
g_numCompilerWarnings++;
j = 0;
}
}
C_GetNextValue(LABEL_DEFINE);
// Bsprintf(g_szCurrentBlockName,"%s",label+(g_numLabels<<6));
g_scriptPtr--;
if (tw == CON_EVENTLOADACTOR)
{
actorLoadEventScrptr[*g_scriptPtr] = g_parsingActorPtr;
g_checkingIfElse = 0;
return 0;
}
actorscrptr[*g_scriptPtr] = g_parsingActorPtr;
if (tw == CON_USERACTOR)
ActorType[*g_scriptPtr] = j;
for (j=0; j<4; j++)
{
bitptr[(g_parsingActorPtr+j-script)>>3] &= ~(1<<((g_parsingActorPtr+j-script)&7));
@ -2913,127 +2930,6 @@ static int32_t C_ParseCommand(void)
return 0;
case CON_EVENTLOADACTOR:
if (g_processingState || g_parsingActorPtr)
{
C_ReportError(ERROR_FOUNDWITHIN);
g_numCompilerErrors++;
}
g_numBraces = 0;
g_scriptPtr--;
g_parsingActorPtr = g_scriptPtr;
C_SkipComments();
j = 0;
while (isaltok(*(textptr+j)))
{
g_szCurrentBlockName[j] = textptr[j];
j++;
}
g_szCurrentBlockName[j] = 0;
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
actorLoadEventScrptr[*g_scriptPtr] = g_parsingActorPtr;
g_checkingIfElse = 0;
return 0;
case CON_USERACTOR:
if (g_processingState || g_parsingActorPtr)
{
C_ReportError(ERROR_FOUNDWITHIN);
g_numCompilerErrors++;
}
g_numBraces = 0;
g_scriptPtr--;
g_parsingActorPtr = g_scriptPtr;
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
C_SkipComments();
j = 0;
while (isaltok(*(textptr+j)))
{
g_szCurrentBlockName[j] = textptr[j];
j++;
}
g_szCurrentBlockName[j] = 0;
j = *g_scriptPtr;
if (j > 2)
{
C_ReportError(-1);
initprintf("%s:%d: warning: invalid useractor type.\n",g_szScriptFileName,g_lineNumber);
g_numCompilerWarnings++;
j = 0;
}
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
actorscrptr[*g_scriptPtr] = g_parsingActorPtr;
ActorType[*g_scriptPtr] = j;
for (j=0; j<4; j++)
{
bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
*(g_parsingActorPtr+j) = 0;
if (j == 3)
{
j = 0;
while (C_GetKeyword() == -1)
{
C_GetNextValue(LABEL_DEFINE);
g_scriptPtr--;
j |= *g_scriptPtr;
}
bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
*g_scriptPtr = j;
g_scriptPtr++;
break;
}
else
{
if (C_GetKeyword() >= 0)
{
for (i=4-j; i; i--)
{
bitptr[(g_scriptPtr-script)>>3] &= ~(BITPTR_POINTER<<((g_scriptPtr-script)&7));
*(g_scriptPtr++) = 0;
}
break;
}
switch (j)
{
case 0:
C_GetNextValue(LABEL_DEFINE);
break;
case 1:
C_GetNextValue(LABEL_ACTION);
break;
case 2:
if ((C_GetNextValue(LABEL_MOVE|LABEL_DEFINE) == 0) && (*(g_scriptPtr-1) != 0) && (*(g_scriptPtr-1) != 1))
{
C_ReportError(-1);
bitptr[(g_scriptPtr-script-1)>>3] &= ~(1<<((g_scriptPtr-script-1)&7));
*(g_scriptPtr-1) = 0;
initprintf("%s:%d: warning: expected a move, found a constant.\n",g_szScriptFileName,g_lineNumber);
g_numCompilerWarnings++;
}
break;
}
if (*(g_scriptPtr-1) >= (intptr_t)&script[0] && *(g_scriptPtr-1) < (intptr_t)&script[g_scriptSize])
bitptr[(g_parsingActorPtr+j-script)>>3] |= (BITPTR_POINTER<<((g_parsingActorPtr+j-script)&7));
else bitptr[(g_parsingActorPtr+j-script)>>3] &= ~(1<<((g_parsingActorPtr+j-script)&7));
*(g_parsingActorPtr+j) = *(g_scriptPtr-1);
}
}
g_checkingIfElse = 0;
return 0;
case CON_INSERTSPRITEQ:
/*
if (!C_CheckEventSync(g_currentEvent))
@ -5375,7 +5271,7 @@ repeatcase:
int32_t fullscreen = ud.config.ScreenMode;
int32_t xdim = ud.config.ScreenWidth, ydim = ud.config.ScreenHeight, bpp = ud.config.ScreenBPP;
int32_t usemouse = ud.config.UseMouse, usejoy = ud.config.UseJoystick;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
int32_t glrm = glrendmode;
#endif
@ -5403,7 +5299,7 @@ repeatcase:
}
Bstrcpy(temp,tempbuf);
CONFIG_WriteSetup();
CONFIG_WriteSetup(1);
if (g_modDir[0] != '/')
Bsprintf(setupfilename,"%s/",g_modDir);
else setupfilename[0] = 0;
@ -5419,7 +5315,7 @@ repeatcase:
ud.config.ScreenBPP = bpp;
ud.config.UseMouse = usemouse;
ud.config.UseJoystick = usejoy;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
glrendmode = glrm;
#endif
@ -5552,8 +5448,8 @@ repeatcase:
tempbuf[i] = '\0';
if (MapInfo[j *MAXLEVELS+k].name == NULL)
MapInfo[j *MAXLEVELS+k].name = Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
if (MapInfo[j*MAXLEVELS+k].name == NULL)
MapInfo[j*MAXLEVELS+k].name = Bcalloc(Bstrlen(tempbuf)+1,sizeof(uint8_t));
else if ((Bstrlen(tempbuf)+1) > sizeof(MapInfo[j*MAXLEVELS+k].name))
MapInfo[j *MAXLEVELS+k].name = Brealloc(MapInfo[j*MAXLEVELS+k].name,(Bstrlen(tempbuf)+1));
@ -5582,6 +5478,7 @@ repeatcase:
if (ScriptQuotes[k] == NULL)
ScriptQuotes[k] = Bcalloc(MAXQUOTELEN,sizeof(uint8_t));
if (!ScriptQuotes[k])
{
ScriptQuotes[k] = NULL;

View file

@ -83,56 +83,47 @@ void VM_ScriptInfo(void)
void VM_OnEvent(register int32_t iEventID, register int32_t iActor, register int32_t iPlayer, register int32_t lDist)
{
if (iEventID < 0 || iEventID >= MAXGAMEEVENTS || apScriptGameEvent[iEventID] == 0)
if (!apScriptGameEvent[iEventID])
return;
{
intptr_t *oinsptr=insptr;
vmstate_t vm_backup;
vmstate_t tempvm = { iActor, iPlayer, lDist, &actor[iActor].t_data[0],
&sprite[iActor], 0
};
&sprite[iActor], 0 };
insptr = apScriptGameEvent[iEventID];
Bmemcpy(&vm_backup, &vm, sizeof(vmstate_t));
Bmemcpy(&vm, &tempvm, sizeof(vmstate_t));
insptr = apScriptGameEvent[iEventID];
VM_Execute(0);
if (vm.g_flags & VM_KILL)
{
// if player was set to squish, first stop that...
if (vm.g_p >= 0)
{
if (g_player[vm.g_p].ps->actorsqu == vm.g_i)
if (vm.g_p >= 0 && g_player[vm.g_p].ps->actorsqu == vm.g_i)
g_player[vm.g_p].ps->actorsqu = -1;
}
deletesprite(vm.g_i);
}
Bmemcpy(&vm, &vm_backup, sizeof(vmstate_t));
insptr=oinsptr;
insptr = oinsptr;
}
}
static int32_t VM_CheckSquished(void)
static inline int32_t VM_CheckSquished(void)
{
sectortype *sc = &sector[vm.g_sp->sectnum];
int32_t squishme = 0;
if ((vm.g_sp->picnum == APLAYER && ud.clipping) || sc->lotag == 23)
if ((vm.g_sp->picnum == APLAYER && ud.clipping) || sc->lotag == 23 ||
(vm.g_sp->pal == 1 ?
!(sc->floorz - sc->ceilingz < (32<<8) && (sc->lotag&32768) == 0) :
!(sc->floorz - sc->ceilingz < (12<<8))))
return 0;
squishme = (sc->floorz - sc->ceilingz < (12<<8)); // && (sc->lotag&32768) == 0;
if (vm.g_sp->pal == 1)
squishme = (sc->floorz - sc->ceilingz < (32<<8) && (sc->lotag&32768) == 0);
if (!squishme)
return 0;
P_DoQuote(10, g_player[vm.g_p].ps);
P_DoQuote(QUOTE_SQUISHED, g_player[vm.g_p].ps);
if (A_CheckEnemySprite(vm.g_sp)) vm.g_sp->xvel = 0;
@ -152,13 +143,12 @@ GAMEEXEC_STATIC GAMEEXEC_INLINE void P_ForceAngle(DukePlayer_t *p)
p->horiz += 64;
p->return_to_center = 9;
p->look_ang = n>>1;
p->rotscrnang = n>>1;
p->look_ang = p->rotscrnang = n>>1;
}
GAMEEXEC_STATIC int32_t A_Dodge(spritetype *s)
{
int32_t bx,by,bxvect,byvect,d,i;
int32_t bx,by,bxvect,byvect,i;
int32_t mx = s->x, my = s->y;
int32_t mxvect = sintable[(s->ang+512)&2047];
int32_t myvect = sintable[s->ang&2047];
@ -168,7 +158,7 @@ GAMEEXEC_STATIC int32_t A_Dodge(spritetype *s)
for (i=headspritestat[STAT_PROJECTILE]; i>=0; i=nextspritestat[i]) //weapons list
{
if (OW == i/* || SECT != s->sectnum*/)
if (OW == i)
continue;
bx = SX-mx;
@ -176,11 +166,9 @@ GAMEEXEC_STATIC int32_t A_Dodge(spritetype *s)
bxvect = sintable[(SA+512)&2047];
byvect = sintable[SA&2047];
if (mxvect *bx + myvect *by >= 0)
if (bxvect*bx + byvect*by < 0)
if ((mxvect * bx) + (myvect * by) >= 0 && (bxvect * bx) + (byvect * by) < 0)
{
d = bxvect*by - byvect*bx;
if (klabs(d) < 65536*64)
if (klabs((bxvect * by) - (byvect * bx)) < 65536<<6)
{
s->ang -= 512+(krand()&1024);
return 1;
@ -384,7 +372,7 @@ GAMEEXEC_STATIC GAMEEXEC_INLINE void VM_AlterAng(int32_t a)
intptr_t *moveptr;
int32_t ticselapsed = (vm.g_t[0])&31;
if ((moveptr = (intptr_t *)vm.g_t[1]) < &script[0] || moveptr > (&script[0]+g_scriptSize))
if ((moveptr = (intptr_t *)vm.g_t[1]) < &script[0] || moveptr > &script[g_scriptSize])
{
vm.g_t[1] = 0;
OSD_Printf(OSD_ERROR "bad moveptr for actor %d (%d)!\n", vm.g_i, vm.g_sp->picnum);
@ -508,8 +496,8 @@ GAMEEXEC_STATIC void VM_Move(void)
if (a&face_player_smart && !deadflag)
{
int32_t newx = g_player[vm.g_p].ps->pos.x+(g_player[vm.g_p].ps->posvel.x/768);
int32_t newy = g_player[vm.g_p].ps->pos.y+(g_player[vm.g_p].ps->posvel.y/768);
int32_t newx = g_player[vm.g_p].ps->pos.x+(g_player[vm.g_p].ps->vel.x/768);
int32_t newy = g_player[vm.g_p].ps->pos.y+(g_player[vm.g_p].ps->vel.y/768);
goalang = getangle(newx-vm.g_sp->x,newy-vm.g_sp->y);
angdif = G_GetAngleDelta(vm.g_sp->ang,goalang)>>2;
@ -518,18 +506,16 @@ GAMEEXEC_STATIC void VM_Move(void)
vm.g_sp->ang += angdif;
}
if ((moveptr = (intptr_t *)vm.g_t[1]) >= &script[0] && moveptr <= (&script[0]+g_scriptSize))
{
if (a&geth) vm.g_sp->xvel += ((*moveptr)-vm.g_sp->xvel)>>1;
if (a&getv) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)>>1;
}
else
if ((moveptr = (intptr_t *)vm.g_t[1]) < &script[0] || moveptr > &script[g_scriptSize])
{
vm.g_t[1] = 0;
OSD_Printf(OSD_ERROR "bad moveptr for actor %d (%d)!\n", vm.g_i, vm.g_sp->picnum);
return;
}
if (a&geth) vm.g_sp->xvel += ((*moveptr)-vm.g_sp->xvel)>>1;
if (a&getv) vm.g_sp->zvel += ((*(moveptr+1)<<4)-vm.g_sp->zvel)>>1;
if (a&dodgebullet && !deadflag)
A_Dodge(vm.g_sp);
@ -613,13 +599,13 @@ GAMEEXEC_STATIC void VM_Move(void)
if (vm.g_x < 512)
{
g_player[vm.g_p].ps->posvel.x = 0;
g_player[vm.g_p].ps->posvel.y = 0;
g_player[vm.g_p].ps->vel.x = 0;
g_player[vm.g_p].ps->vel.y = 0;
}
else
{
g_player[vm.g_p].ps->posvel.x = mulscale(g_player[vm.g_p].ps->posvel.x,g_player[vm.g_p].ps->runspeed-0x2000,16);
g_player[vm.g_p].ps->posvel.y = mulscale(g_player[vm.g_p].ps->posvel.y,g_player[vm.g_p].ps->runspeed-0x2000,16);
g_player[vm.g_p].ps->vel.x = mulscale(g_player[vm.g_p].ps->vel.x,g_player[vm.g_p].ps->runspeed-0x2000,16);
g_player[vm.g_p].ps->vel.y = mulscale(g_player[vm.g_p].ps->vel.y,g_player[vm.g_p].ps->runspeed-0x2000,16);
}
}
else if (vm.g_sp->picnum != DRONE && vm.g_sp->picnum != SHARK && vm.g_sp->picnum != COMMANDER)
@ -881,15 +867,13 @@ skip_check:
continue;
case CON_IFPDISTL:
insptr++;
VM_DoConditional(vm.g_x < *insptr);
VM_DoConditional(vm.g_x < *(++insptr));
if (vm.g_x > MAXSLEEPDIST && actor[vm.g_i].timetosleep == 0)
actor[vm.g_i].timetosleep = SLEEPTIME;
continue;
case CON_IFPDISTG:
insptr++;
VM_DoConditional(vm.g_x > *insptr);
VM_DoConditional(vm.g_x > *(++insptr));
if (vm.g_x > MAXSLEEPDIST && actor[vm.g_i].timetosleep == 0)
actor[vm.g_i].timetosleep = SLEEPTIME;
continue;
@ -957,7 +941,7 @@ skip_check:
case CON_MIKESND:
insptr++;
if ((vm.g_sp->yvel<0 || vm.g_sp->yvel>=MAXSOUNDS))
if (((unsigned)vm.g_sp->yvel >= MAXSOUNDS))
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->yvel);
insptr++;
@ -1009,8 +993,7 @@ skip_check:
continue;
case CON_SOUNDONCE:
insptr++;
if ((*insptr<0 || *insptr>=MAXSOUNDS))
if (((unsigned)*(++insptr) >= MAXSOUNDS))
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr++);
continue;
@ -1024,7 +1007,7 @@ skip_check:
{
int32_t i = Gv_GetVarX(*insptr++), j = Gv_GetVarX(*insptr++);
if ((j<0 || j>=MAXSOUNDS))
if (((unsigned)j >= MAXSOUNDS))
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],j);
insptr++;
@ -1036,8 +1019,7 @@ skip_check:
continue;
case CON_IFSOUND:
insptr++;
if ((*insptr<0 || *insptr>=MAXSOUNDS))
if (((unsigned)*(++insptr) >= MAXSOUNDS))
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr++;
@ -1048,8 +1030,7 @@ skip_check:
continue;
case CON_STOPSOUND:
insptr++;
if ((*insptr<0 || *insptr>=MAXSOUNDS))
if (((unsigned)*(++insptr) >= MAXSOUNDS))
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr++;
@ -1078,8 +1059,7 @@ skip_check:
}
case CON_GLOBALSOUND:
insptr++;
if ((*insptr<0 || *insptr>=MAXSOUNDS))
if (((unsigned)*(++insptr) >= MAXSOUNDS))
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr++;
@ -1091,8 +1071,7 @@ skip_check:
continue;
case CON_SOUND:
insptr++;
if ((*insptr<0 || *insptr>=MAXSOUNDS))
if ((unsigned)*(++insptr) >= MAXSOUNDS)
{
OSD_Printf(CON_ERROR "Invalid sound %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr++;
@ -1154,7 +1133,7 @@ skip_check:
{
j = vm.g_sp->sectnum;
pushmove((vec3_t *)vm.g_sp,(int16_t *)&j,128L,(4L<<8),(4L<<8),CLIPMASK0);
if (j != vm.g_sp->sectnum && j >= 0 && j < MAXSECTORS)
if ((unsigned)j < MAXSECTORS)
changespritesect(vm.g_i,j);
A_PlaySound(THUD,vm.g_i);
}
@ -1176,8 +1155,10 @@ skip_check:
// fix for flying/jumping monsters getting stuck in water
{
intptr_t *moveptr = (intptr_t *)vm.g_t[1];
if (vm.g_sp->hitag & jumptoplayer || (actorscrptr[vm.g_sp->picnum] &&
moveptr >= &script[0] && moveptr <= (&script[0]+g_scriptSize) && *(moveptr+1)))
if (vm.g_sp->hitag & jumptoplayer ||
(actorscrptr[vm.g_sp->picnum] &&
(unsigned int)(moveptr - &script[0]) <= (unsigned int)(&script[g_scriptSize] - &script[0]) &&
*(moveptr+1)))
{
// OSD_Printf("%d\n",*(moveptr+1));
break;
@ -1205,8 +1186,7 @@ skip_check:
insptr++;
return 1;
case CON_ADDAMMO:
insptr++;
if ((*insptr<0 || *insptr>=MAX_WEAPONS))
if (((unsigned)*(++insptr) >= MAX_WEAPONS))
{
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr += 2; break;
@ -1263,8 +1243,7 @@ skip_check:
continue;
case CON_ADDWEAPON:
insptr++;
if ((*insptr<0 ||*insptr>=MAX_WEAPONS))
if (((unsigned)*(++insptr) >= MAX_WEAPONS))
{
OSD_Printf(CON_ERROR "Invalid weapon ID %d\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr);
insptr += 2;
@ -1437,7 +1416,7 @@ skip_check:
{
case CON_ACTIVATEBYSECTOR:
if ((var1<0 || var1>=numsectors)) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;}
activatebysector(var1, var2);
G_ActivateBySector(var1, var2);
break;
case CON_OPERATESECTORS:
if ((var1<0 || var1>=numsectors)) {OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],var1); break;}
@ -1451,7 +1430,7 @@ skip_check:
setaspect(var1, var2);
break;
case CON_SSP:
if ((var1<0 || var1>=MAXSPRITES)) { OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],var1); break;}
if ((unsigned)var1 >= MAXSPRITES) { OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],var1); break;}
A_SetSprite(var1, var2);
break;
}
@ -1463,9 +1442,9 @@ skip_check:
{
int32_t lVar1 = Gv_GetVarX(*insptr++), lVar2 = Gv_GetVarX(*insptr++), res;
if ((lVar1<0 || lVar1>=MAXSPRITES || lVar2<0 || lVar2>=MAXSPRITES))
if ((unsigned)lVar1 >= MAXSPRITES || (unsigned)lVar2 >= MAXSPRITES)
{
OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],lVar1<0||lVar1>=MAXSPRITES?lVar1:lVar2);
OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],(unsigned)lVar1 >= MAXSPRITES ? lVar1 : lVar2);
res=0;
}
else res=cansee(sprite[lVar1].x,sprite[lVar1].y,sprite[lVar1].z,sprite[lVar1].sectnum,
@ -1522,7 +1501,7 @@ skip_check:
{
int32_t i=*insptr++;
int32_t j=Gv_GetVarX(*insptr++);
if ((j < 0 || j > MAXSTATUS))
if ((unsigned)j > MAXSTATUS)
{
OSD_Printf(CON_ERROR "invalid status list %d\n",g_errorLineNum,keyw[g_tw],j);
continue;
@ -1536,7 +1515,7 @@ skip_check:
{
int32_t i=*insptr++;
int32_t j=Gv_GetVarX(*insptr++);
if ((j < 0 || j >= MAXSPRITES))
if ((unsigned)j >= MAXSPRITES)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
continue;
@ -1550,7 +1529,7 @@ skip_check:
{
int32_t i=*insptr++;
int32_t j=Gv_GetVarX(*insptr++);
if ((j < 0 || j >= MAXSPRITES))
if ((unsigned)j >= MAXSPRITES)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
continue;
@ -1564,7 +1543,7 @@ skip_check:
{
int32_t i=*insptr++;
int32_t j=Gv_GetVarX(*insptr++);
if ((j < 0 || j > numsectors))
if ((unsigned)j >= (unsigned)numsectors)
{
OSD_Printf(CON_ERROR "invalid sector %d\n",g_errorLineNum,keyw[g_tw],j);
continue;
@ -1578,7 +1557,7 @@ skip_check:
{
int32_t i=*insptr++;
int32_t j=Gv_GetVarX(*insptr++);
if ((j < 0 || j >= MAXSPRITES))
if ((unsigned)j >= MAXSPRITES)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
continue;
@ -1592,7 +1571,7 @@ skip_check:
{
int32_t i=*insptr++;
int32_t j=Gv_GetVarX(*insptr++);
if ((j < 0 || j >= MAXSPRITES))
if ((unsigned)j >= MAXSPRITES)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],j);
continue;
@ -1719,7 +1698,7 @@ skip_check:
Bstrcpy(ScriptQuotes[i],g_player[vm.g_p].user_name);
break;
case STR_VERSION:
Bsprintf(tempbuf,HEAD2 " %s",s_buildDate);
Bsprintf(tempbuf,HEAD2 " %s",s_buildRev);
Bstrcpy(ScriptQuotes[i],tempbuf);
break;
case STR_GAMETYPE:
@ -1745,12 +1724,12 @@ skip_check:
Bstrcpy(ScriptQuotes[i],ScriptQuotes[j]);
break;
case CON_CHANGESPRITESECT:
if ((i<0 || i>=MAXSPRITES))
if ((unsigned)i >= MAXSPRITES)
{
OSD_Printf(CON_ERROR "Invalid sprite %d\n",g_errorLineNum,keyw[g_tw],i);
break;
}
if ((j<0 || j>=numsectors))
if ((unsigned)j >= (unsigned)numsectors)
{
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],j);
break;
@ -1771,12 +1750,12 @@ nullquote:
int32_t i = Gv_GetVarX(*insptr++);
int32_t j = Gv_GetVarX(*insptr++);
if ((i<0 || i>=MAXSPRITES))
if ((unsigned)i >= MAXSPRITES)
{
OSD_Printf(CON_ERROR "Invalid sprite: %d\n",g_errorLineNum,keyw[g_tw],i);
continue;
}
if ((j<0 || j>=MAXSTATUS))
if ((unsigned)j >= MAXSTATUS)
{
OSD_Printf(CON_ERROR "Invalid statnum: %d\n",g_errorLineNum,keyw[g_tw],j);
continue;
@ -1974,7 +1953,7 @@ nullquote:
{
int32_t distvar = *insptr++, xvar = Gv_GetVarX(*insptr++), yvar = Gv_GetVarX(*insptr++);
if ((xvar < 0 || yvar < 0 || xvar >= MAXSPRITES || yvar >= MAXSPRITES))
if ((unsigned)xvar >= MAXSPRITES || (unsigned)yvar >= MAXSPRITES)
{
OSD_Printf(CON_ERROR "invalid sprite\n",g_errorLineNum,keyw[g_tw]);
continue;
@ -1989,7 +1968,7 @@ nullquote:
{
int32_t distvar = *insptr++, xvar = Gv_GetVarX(*insptr++), yvar = Gv_GetVarX(*insptr++);
if ((xvar < 0 || yvar < 0 || xvar >= MAXSPRITES || yvar >= MAXSPRITES))
if ((unsigned)xvar >= MAXSPRITES || (unsigned)yvar >= MAXSPRITES)
{
OSD_Printf(CON_ERROR "invalid sprite\n",g_errorLineNum,keyw[g_tw]);
continue;
@ -2055,7 +2034,7 @@ nullquote:
{
int32_t lIn=Gv_GetVarX(*insptr++);
int32_t j;
if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors))
if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors)
{
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum);
continue;
@ -2085,7 +2064,7 @@ nullquote:
{
int32_t j;
if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors))
if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors)
{
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum);
insptr++;
@ -2125,7 +2104,7 @@ nullquote:
actor[vm.g_i].shootzvel = 1;
}
if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors))
if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors)
{
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum);
insptr++;
@ -2148,7 +2127,7 @@ nullquote:
{
int32_t j=Gv_GetVarX(*insptr++);
if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors))
if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors)
{
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum);
actor[vm.g_i].shootzvel=0;
@ -2174,7 +2153,7 @@ nullquote:
{
int32_t j=Gv_GetVarX(*insptr++);
if ((vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= numsectors))
if ((unsigned)vm.g_sp->sectnum >= (unsigned)numsectors)
{
OSD_Printf(CON_ERROR "Invalid sector %d\n",g_errorLineNum,keyw[g_tw],vm.g_sp->sectnum);
actor[vm.g_i].shootzvel=0;
@ -2276,7 +2255,7 @@ nullquote:
int32_t x2=scale(Gv_GetVarX(*insptr++),xdim,320);
int32_t y2=scale(Gv_GetVarX(*insptr++),ydim,200);
int32_t smoothratio = min(max((totalclock - ototalclock) * (65536 / 4),0),65536);
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
int32_t j;
#endif
@ -2296,7 +2275,7 @@ nullquote:
continue;
}
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
j = glprojectionhacks;
glprojectionhacks = 0;
#endif
@ -2358,7 +2337,7 @@ nullquote:
drawmasks();
G_RestoreInterpolations();
G_UpdateScreenArea();
#if defined(USE_OPENGL) && defined(POLYMOST)
#ifdef USE_OPENGL
glprojectionhacks = j;
#endif
continue;
@ -2708,7 +2687,7 @@ nullquote:
if (tw == CON_SETSPRITE)
{
if ((spritenum < 0 || spritenum >= MAXSPRITES))
if ((unsigned)spritenum >= MAXSPRITES)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],spritenum);
continue;
@ -2720,7 +2699,7 @@ nullquote:
{
int32_t cliptype = Gv_GetVarX(*insptr++);
if ((spritenum < 0 && spritenum >= MAXSPRITES))
if ((unsigned)spritenum >= MAXSPRITES)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],spritenum);
insptr++;
@ -2770,7 +2749,7 @@ nullquote:
case CON_SPAWN:
insptr++;
if (vm.g_sp->sectnum >= 0 && vm.g_sp->sectnum < MAXSECTORS)
if ((unsigned)vm.g_sp->sectnum < MAXSECTORS)
A_Spawn(vm.g_i,*insptr);
insptr++;
continue;
@ -2806,7 +2785,7 @@ nullquote:
int32_t dnum = *insptr++;
int32_t s, l, j;
if (vm.g_sp->sectnum >= 0 && vm.g_sp->sectnum < MAXSECTORS)
if ((unsigned)vm.g_sp->sectnum < MAXSECTORS)
for (j=(*insptr)-1; j>=0; j--)
{
if (vm.g_sp->picnum == BLIMP && dnum == SCRAP1)
@ -2922,13 +2901,19 @@ nullquote:
if (g_netServer)
{
int32_t jj = 0;
P_ResetPlayer(vm.g_p);
packbuf[0] = PACKET_PLAYER_SPAWN;
packbuf[1] = vm.g_p;
packbuf[2] = 0;
packbuf[jj++] = PACKET_PLAYER_SPAWN;
packbuf[jj++] = vm.g_p;
enet_host_broadcast(g_netServer, CHAN_GAMESTATE , enet_packet_create(packbuf, 3, ENET_PACKET_FLAG_RELIABLE));
Bmemcpy(&packbuf[jj], &g_player[vm.g_p].ps->pos.x, sizeof(vec3_t) * 2);
jj += sizeof(vec3_t) * 2;
packbuf[jj++] = 0;
enet_host_broadcast(g_netServer, CHAN_GAMESTATE , enet_packet_create(packbuf, jj, ENET_PACKET_FLAG_RELIABLE));
}
}
P_UpdateScreenPal(g_player[vm.g_p].ps);
@ -3048,7 +3033,7 @@ nullquote:
if ((l&8) && g_player[vm.g_p].ps->on_ground && TEST_SYNC_KEY(g_player[vm.g_p].sync->bits, SK_CROUCH))
j = 1;
else if ((l&16) && g_player[vm.g_p].ps->jumping_counter == 0 && !g_player[vm.g_p].ps->on_ground &&
g_player[vm.g_p].ps->posvel.z > 2048)
g_player[vm.g_p].ps->vel.z > 2048)
j = 1;
else if ((l&32) && g_player[vm.g_p].ps->jumping_counter > 348)
j = 1;
@ -3138,7 +3123,7 @@ nullquote:
insptr++;
{
int32_t j = Gv_GetVarX(*insptr++);
if ((j < 0 || j >= MAXVOLUMES*MAXLEVELS))
if ((unsigned)j >= MAXVOLUMES*MAXLEVELS)
{
OSD_Printf(CON_ERROR "Invalid map number: %d\n",g_errorLineNum,keyw[g_tw],j);
continue;
@ -3183,7 +3168,8 @@ nullquote:
insptr++;
if (sector[vm.g_sp->sectnum].lotag == 0)
{
neartag(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(32<<8),vm.g_sp->sectnum,vm.g_sp->ang,&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,768L,1);
neartag(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z-(32<<8),vm.g_sp->sectnum,vm.g_sp->ang,
&neartagsector,&neartagwall,&neartagsprite,&neartaghitdist,768L,5);
if (neartagsector >= 0 && isanearoperator(sector[neartagsector].lotag))
if ((sector[neartagsector].lotag&0xff) == 23 || sector[neartagsector].floorz == sector[neartagsector].ceilingz)
if ((sector[neartagsector].lotag&16384) == 0)
@ -3399,7 +3385,7 @@ nullquote:
intptr_t *oinsptr = insptr++;
int32_t index = Gv_GetVarX(*insptr++);
insptr = oinsptr;
if (index < 0 || index >= MAXSPRITES-1)
if ((unsigned)index >= MAXSPRITES-1)
{
OSD_Printf(CON_ERROR "invalid array index\n",g_errorLineNum,keyw[g_tw]);
Gv_GetVarX(*insptr++);
@ -3781,7 +3767,7 @@ nullquote:
int32_t lSprite=Gv_GetVarX(*insptr++), lVar1=*insptr++;
int32_t lVar2=*insptr++;
if ((lSprite < 0 || lSprite >= MAXSPRITES))
if ((unsigned)lSprite >= MAXSPRITES)
{
OSD_Printf(CON_ERROR "invalid sprite ID %d\n",g_errorLineNum,keyw[g_tw],lSprite);
if (lVar1 == MAXGAMEVARS || lVar1 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++;
@ -3811,7 +3797,7 @@ nullquote:
{
int32_t lVar1=*insptr++, lVar2=*insptr++;
if ((iPlayer < 0 || iPlayer >= playerswhenstarted))
if ((unsigned)iPlayer >= (unsigned)playerswhenstarted)
{
OSD_Printf(CON_ERROR "invalid player ID %d\n",g_errorLineNum,keyw[g_tw],iPlayer);
if (lVar1 == MAXGAMEVARS || lVar1 & ((MAXGAMEVARS<<2)|(MAXGAMEVARS<<3))) insptr++;
@ -3907,7 +3893,7 @@ nullquote:
insptr++;
if ((j < 0 || j >= playerswhenstarted))
if ((unsigned)j >= (unsigned)playerswhenstarted)
{
OSD_Printf(CON_ERROR "Invalid player ID %d\n",g_errorLineNum,keyw[g_tw],j);
continue;
@ -4044,10 +4030,10 @@ nullquote:
insptr++;
{
int32_t j=*insptr++;
int32_t index = Gv_GetVar(*insptr++, vm.g_i, vm.g_p);
int32_t index = Gv_GetVarX(*insptr++);
int32_t j1=*insptr++;
int32_t index1 = Gv_GetVar(*insptr++, vm.g_i, vm.g_p);
int32_t value = Gv_GetVar(*insptr++, vm.g_i, vm.g_p);
int32_t index1 = Gv_GetVarX(*insptr++);
int32_t value = Gv_GetVarX(*insptr++);
if (index > aGameArrays[j].size || index1 > aGameArrays[j1].size) continue;
if ((index+value)>aGameArrays[j].size) value=aGameArrays[j].size-index;
@ -4638,7 +4624,7 @@ nullquote:
continue;
}
if ((vm.g_p < 0 || vm.g_p >= MAXPLAYERS))
if ((unsigned)vm.g_p >= MAXPLAYERS)
{
OSD_Printf(CON_ERROR "bad player for quote %d: (%d)\n",g_errorLineNum,keyw[g_tw],(int32_t)*insptr,vm.g_p);
insptr++;
@ -4788,7 +4774,7 @@ void A_LoadActor(int32_t iActor)
vm.g_flags &= ~(VM_RETURN|VM_KILL|VM_NOEXECUTE);
if (vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= MAXSECTORS)
if ((unsigned)vm.g_sp->sectnum >= MAXSECTORS)
{
// if(A_CheckEnemySprite(vm.g_sp))
// g_player[vm.g_p].ps->actors_killed++;
@ -4821,7 +4807,7 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
insptr = 4 + (actorscrptr[vm.g_sp->picnum]);
if (vm.g_sp->sectnum < 0 || vm.g_sp->sectnum >= MAXSECTORS)
if ((unsigned)vm.g_sp->sectnum >= MAXSECTORS)
{
if (A_CheckEnemySprite(vm.g_sp))
g_player[vm.g_p].ps->actors_killed++;
@ -4832,8 +4818,7 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
/* Qbix: Changed variables to be aware of the sizeof *insptr
* (whether it is int32_t vs intptr_t), Although it is specifically cast to intptr_t*
* which might be corrected if the code is converted to use offsets */
if (vm.g_t[4] > (intptr_t)&script[0] && vm.g_t[4] < (intptr_t)&script[g_scriptSize])
if ((unsigned)(vm.g_t[4]-(intptr_t)&script[0]) <= (unsigned)((intptr_t)&script[g_scriptSize]-(intptr_t)&script[0]))
{
vm.g_sp->lotag += TICSPERFRAME;
@ -4853,8 +4838,9 @@ void A_Execute(int32_t iActor,int32_t iPlayer,int32_t lDist)
if (vm.g_flags & VM_KILL)
{
// if player was set to squish, first stop that...
if (g_player[vm.g_p].ps->actorsqu == vm.g_i)
if (vm.g_p >= 0 && g_player[vm.g_p].ps->actorsqu == vm.g_i)
g_player[vm.g_p].ps->actorsqu = -1;
deletesprite(vm.g_i);
return;
}
@ -5195,7 +5181,7 @@ void G_RestoreMapState(mapstate_t *save)
Net_ResetPrediction();
clearfifo();
G_ClearFIFO();
G_ResetTimers();
}
}

File diff suppressed because it is too large Load diff

View file

@ -635,10 +635,10 @@ int32_t __fastcall Gv_GetVar(register int32_t id, register int32_t iActor, regis
default:
return ((aGameVars[id].val.lValue ^ -negateResult) + negateResult);
case GAMEVAR_PERPLAYER:
if (iPlayer < 0 || iPlayer >= MAXPLAYERS) goto bad_id;
if ((unsigned)iPlayer >= MAXPLAYERS) goto bad_id;
return ((aGameVars[id].val.plValues[iPlayer] ^ -negateResult) + negateResult);
case GAMEVAR_PERACTOR:
if (iActor < 0 || iActor >= MAXSPRITES) goto bad_id;
if ((unsigned)iActor >= MAXSPRITES) goto bad_id;
return ((aGameVars[id].val.plValues[iActor] ^ -negateResult) + negateResult);
case GAMEVAR_INTPTR:
return (((*((int32_t *)aGameVars[id].val.lValue)) ^ -negateResult) + negateResult);
@ -667,12 +667,12 @@ void __fastcall Gv_SetVar(register int32_t id, register int32_t lValue, register
aGameVars[id].val.lValue=lValue;
return;
case GAMEVAR_PERPLAYER:
if (iPlayer < 0 || iPlayer > MAXPLAYERS-1) goto badplayer;
if ((unsigned)iPlayer > MAXPLAYERS-1) goto badindex;
// for the current player
aGameVars[id].val.plValues[iPlayer]=lValue;
return;
case GAMEVAR_PERACTOR:
if (iActor < 0 || iActor > MAXSPRITES-1) goto badactor;
if ((unsigned)iActor > MAXSPRITES-1) goto badindex;
aGameVars[id].val.plValues[iActor]=lValue;
return;
case GAMEVAR_INTPTR:
@ -691,14 +691,11 @@ badvarid:
g_errorLineNum,keyw[g_tw],id,vm.g_i,sprite[vm.g_i].picnum,vm.g_p);
return;
badplayer:
OSD_Printf(CON_ERROR "Gv_SetVar(): invalid player (%d) for gamevar %s from sprite %d, player %d\n",
g_errorLineNum,keyw[g_tw],iPlayer,aGameVars[id].szLabel,vm.g_i,vm.g_p);
return;
badactor:
OSD_Printf(CON_ERROR "Gv_SetVar(): invalid actor (%d) for gamevar %s from sprite %d (%d), player %d\n",
g_errorLineNum,keyw[g_tw],iActor,aGameVars[id].szLabel,vm.g_i,sprite[vm.g_i].picnum,vm.g_p);
badindex:
OSD_Printf(CON_ERROR "Gv_SetVar(): invalid index (%d) for gamevar %s from sprite %d, player %d\n",
g_errorLineNum,keyw[g_tw],
aGameVars[id].dwFlags & GAMEVAR_PERACTOR ? iActor : iPlayer,
aGameVars[id].szLabel,vm.g_i,vm.g_p);
return;
}
@ -805,11 +802,11 @@ void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue)
aGameVars[id].val.lValue=lValue;
return;
case GAMEVAR_PERPLAYER:
if (vm.g_p < 0 || vm.g_p > MAXPLAYERS-1) goto badplayer;
if ((unsigned)vm.g_p > MAXPLAYERS-1) goto badindex;
aGameVars[id].val.plValues[vm.g_p]=lValue;
return;
case GAMEVAR_PERACTOR:
if (vm.g_i < 0 || vm.g_i > MAXSPRITES-1) goto badactor;
if ((unsigned)vm.g_i > MAXSPRITES-1) goto badindex;
aGameVars[id].val.plValues[vm.g_i]=lValue;
return;
case GAMEVAR_INTPTR:
@ -823,14 +820,11 @@ void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue)
return;
}
badplayer:
OSD_Printf(CON_ERROR "Gv_SetVar(): invalid player (%d) for gamevar %s\n",
g_errorLineNum,keyw[g_tw],vm.g_p,aGameVars[id].szLabel);
return;
badactor:
OSD_Printf(CON_ERROR "Gv_SetVar(): invalid actor (%d) for gamevar %s\n",
g_errorLineNum,keyw[g_tw],vm.g_i,aGameVars[id].szLabel);
badindex:
OSD_Printf(CON_ERROR "Gv_SetVar(): invalid index (%d) for gamevar %s\n",
g_errorLineNum,keyw[g_tw],
aGameVars[id].dwFlags & GAMEVAR_PERACTOR ? vm.g_i : vm.g_p,
aGameVars[id].szLabel);
return;
}
@ -1532,7 +1526,7 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("NUMSECTORS",(intptr_t)&numsectors, GAMEVAR_SYSTEM | GAMEVAR_SHORTPTR | GAMEVAR_READONLY);
Gv_NewVar("lastsavepos",(intptr_t)&g_lastSaveSlot, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_SYNCCHECK);
#ifdef POLYMOST
#ifdef USE_OPENGL
Gv_NewVar("rendmode",(intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK);
#else
Gv_NewVar("rendmode", 0, GAMEVAR_READONLY | GAMEVAR_SYSTEM | GAMEVAR_SYNCCHECK);
@ -1689,7 +1683,7 @@ void Gv_RefreshPointers(void)
aGameVars[Gv_GetVarIndex("NUMSECTORS")].val.lValue = (intptr_t)&numsectors;
aGameVars[Gv_GetVarIndex("lastsavepos")].val.lValue = (intptr_t)&g_lastSaveSlot;
#ifdef POLYMOST
#ifdef USE_OPENGL
aGameVars[Gv_GetVarIndex("rendmode")].val.lValue = (intptr_t)&rendmode;
#endif
}

View file

@ -23,9 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define __global_c__
#include "global.h"
#include "duke3d.h"
#include "rev.h"
const char *s_buildDate = "20100727";
const char *s_buildDate = "20110109";
char *MusicPtr = NULL;
int32_t g_musicSize;

View file

@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAXINTERPOLATIONS MAXSPRITES
G_EXTERN const char *s_buildRev;
G_EXTERN DukeStatus_t sbar;
G_EXTERN actor_t actor[MAXSPRITES];
G_EXTERN animwalltype animwall[MAXANIMWALLS];

View file

@ -32,14 +32,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct grpfile grpfiles[numgrpfiles] =
{
{ "Duke Nukem 3D", 0xBBC9CE44, 26524524, GAMEDUKE, NULL },
{ "Duke Nukem 3D: Atomic Edition", 0xF514A6AC, 44348015, GAMEDUKE, NULL },
{ "Duke Nukem 3D: Atomic Edition", 0xFD3DCFF1, 44356548, GAMEDUKE, NULL },
{ "Duke Nukem 3D Shareware", 0x983AD923, 11035779, GAMEDUKE, NULL },
{ "Duke Nukem 3D Mac Shareware", 0xC5F71561, 10444391, GAMEDUKE, NULL },
{ "NAM", 0x75C1F07B, 43448927, GAMENAM, NULL },
{ "Napalm", 0x3DE1589A, 44365728, GAMENAM, NULL },
{ "WW2GI", 0x907B82BF, 77939508, GAMEWW2, NULL },
{ "Duke Nukem 3D", 0xBBC9CE44, 26524524, GAME_DUKE, NULL },
{ "Duke Nukem 3D: Atomic Edition", 0xF514A6AC, 44348015, GAME_DUKE, NULL },
{ "Duke Nukem 3D: Atomic Edition", 0xFD3DCFF1, 44356548, GAME_DUKE, NULL },
{ "Duke Nukem 3D Shareware", 0x983AD923, 11035779, GAME_DUKE, NULL },
{ "Duke Nukem 3D Mac Shareware", 0xC5F71561, 10444391, GAME_DUKE, NULL },
{ "NAM", 0x75C1F07B, 43448927, GAME_NAM, NULL },
{ "Napalm", 0x3DE1589A, 44365728, GAME_NAM, NULL },
{ "WW2GI", 0x907B82BF, 77939508, GAME_WW2, NULL },
};
struct grpfile *foundgrps = NULL;

View file

@ -1012,14 +1012,13 @@ VoiceNode *MV_AllocVoice(int32_t priority)
if (LL_Empty(&VoicePool, next, prev))
{
// check if we have a higher priority than a voice that is playing.
voice = VoiceList.next;
for (node = voice->next; node != &VoiceList; node = node->next)
for (voice = node = VoiceList.next; node != &VoiceList; node = node->next)
{
if (node->priority < voice->priority)
voice = node;
}
if (priority >= voice->priority && voice->handle > MV_Ok)
if (priority >= voice->priority && voice != &VoiceList && voice->handle >= MV_MinVoiceHandle)
MV_Kill(voice->handle);
if (LL_Empty(&VoicePool, next, prev))
@ -1074,14 +1073,14 @@ int32_t MV_VoiceAvailable(int32_t priority)
voice = node;
}
if ((voice != &VoiceList) && (priority >= voice->priority))
if ((voice == &VoiceList) || (priority < voice->priority))
{
RestoreInterrupts();
return TRUE;
return FALSE;
}
RestoreInterrupts();
return FALSE;
return TRUE;
}

View file

@ -363,6 +363,7 @@ const char *keyw[] =
"printmessage256",
"printext256",
"printext16",
"drawlabel",
"getnumber16",
"getnumber256",
"qsprintf",
@ -3266,14 +3267,18 @@ repeatcase:
case CON_QUOTE:
case CON_ERRORINS:
case CON_PRINTMESSAGE16:
case CON_PRINTMESSAGE256:
case CON_PRINTEXT256:
case CON_PRINTEXT16:
case CON_DRAWLABEL:
if (C_GetNextVarOrString()==-1)
return 1;
if (tw==CON_PRINTMESSAGE256)
C_GetManyVars(2);
else if (tw==CON_PRINTEXT256 || tw==CON_PRINTEXT16)
else if (tw >= CON_PRINTEXT256)
C_GetManyVars(5);
return 0;
case CON_GETNUMBER16:

View file

@ -467,6 +467,7 @@ enum ScriptKeywords_t
CON_PRINTMESSAGE256,
CON_PRINTEXT256,
CON_PRINTEXT16,
CON_DRAWLABEL,
CON_GETNUMBER16,
CON_GETNUMBER256,
CON_QSPRINTF,

View file

@ -60,7 +60,7 @@ static instype *x_sortingstateptr;
extern void message(const char *fmt, ...);
// from sector.c vvv
static int32_t ldist(spritetype *s1,spritetype *s2)
static int32_t ldist(const spritetype *s1, const spritetype *s2)
{
int32_t x= klabs(s1->x-s2->x);
int32_t y= klabs(s1->y-s2->y);
@ -73,7 +73,7 @@ static int32_t ldist(spritetype *s1,spritetype *s2)
}
}
static int32_t dist(spritetype *s1,spritetype *s2)
static int32_t dist(const spritetype *s1, const spritetype *s2)
{
int32_t x= klabs(s1->x-s2->x);
int32_t y= klabs(s1->y-s2->y);
@ -2385,6 +2385,7 @@ badindex:
case CON_PRINTMESSAGE256:
case CON_PRINTEXT256:
case CON_PRINTEXT16:
case CON_DRAWLABEL:
insptr++;
{
int32_t i=*insptr++;
@ -2395,31 +2396,56 @@ badindex:
{
int32_t x=(tw>=CON_PRINTMESSAGE256)?Gv_GetVarX(*insptr++):0;
int32_t y=(tw>=CON_PRINTMESSAGE256)?Gv_GetVarX(*insptr++):0;
int32_t col=(tw>=CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0;
int32_t backcol=(tw>=CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0;
int32_t fontsize=(tw>=CON_PRINTEXT256)?Gv_GetVarX(*insptr++):0;
if (tw==CON_ERRORINS) vm.flags |= VMFLAG_ERROR;
if (tw==CON_PRINT || tw==CON_ERRORINS)
{
OSD_Printf("%s\n", quotetext);
if (tw==CON_ERRORINS)
vm.flags |= VMFLAG_ERROR;
}
else if (tw==CON_QUOTE)
{
message("%s", quotetext);
}
else if (tw==CON_PRINTMESSAGE16)
{
if (qsetmode != 200)
printmessage16("%s", quotetext);
}
else if (tw==CON_PRINTMESSAGE256)
{
if (qsetmode == 200)
printmessage256(x, y, quotetext);
}
else if (tw==CON_PRINTEXT256)
{
if (qsetmode == 200)
{
if (col<0 || col>=256) col=0;
if (backcol<0 || backcol>=256) backcol=-1;
printext256(x, y, col, backcol, quotetext, fontsize);
}
}
else if (tw==CON_PRINTEXT16)
{
printext16(x, y, editorcolors[col&15], backcol<0 ? -1 : editorcolors[backcol&15],
if (qsetmode != 200)
printext16(x, y, editorcolors[col&255], backcol<0 ? -1 : editorcolors[backcol&255],
quotetext, fontsize);
}
else if (tw==CON_DRAWLABEL)
{
if (qsetmode != 200)
{
drawsmallabel(quotetext,
editorcolors[backcol&255], // col
fontsize < 0 ? -1 : editorcolors[fontsize&255], // backcol
x, y, col); // x y z
}
}
}
}
continue;

View file

@ -563,7 +563,7 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("numsprites",(intptr_t)&numsprites, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
Gv_NewVar("numtiles",(intptr_t)&numtiles, GAMEVAR_SYSTEM | GAMEVAR_INTPTR | GAMEVAR_READONLY);
#ifdef POLYMOST
#ifdef USE_OPENGL
Gv_NewVar("rendmode",(intptr_t)&rendmode, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
#endif
@ -668,6 +668,8 @@ static void Gv_AddSystemVars(void)
Gv_NewArray("tilesizx", (void *)tilesizx, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
Gv_NewArray("tilesizy", (void *)tilesizy, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFSHORT);
// Gv_NewArray("picsiz", (void *)picsiz, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);
Gv_NewArray("picanm", (void *)picanm, MAXTILES, GAMEARRAY_READONLY|GAMEARRAY_OFINT);
Gv_NewArray("show2dsector", (void *)show2dsector, (MAXSECTORS+7)>>3, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);
Gv_NewArray("show2dwall", (void *)show2dwall, (MAXWALLS+7)>>3, GAMEARRAY_READONLY|GAMEARRAY_OFCHAR);

View file

@ -44,9 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define TEST_SYNC_KEY(bits, sync_num) TEST(bits, BIT(sync_num))
#define IFWITHIN(B,E) if((PN)>=(B) && (PN)<=(E))
#define IFMOVING if(A_SetSprite(i,CLIPMASK0))
#define IFHIT j=A_IncurDamage(i);if(j >= 0)
#define IFWITHIN(B,E) if ((PN)>=(B) && (PN)<=(E))
#define AFLAMABLE(X) (X==BOX||X==TREE1||X==TREE2||X==TIRE||X==CONE)
#define rnd(X) ((krand()>>8)>=(255-(X)))

View file

@ -29,7 +29,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
const char *defsfilename = "duke3d.def";
extern char keystatus[];
extern int16_t defaultspritecstat;
extern int32_t horiz, qsetmode;
extern vec3_t pos;
extern int16_t ang, cursectnum;
@ -38,8 +37,6 @@ extern char names[MAXTILES][25];
extern int32_t ydim16, xdimgame, ydimgame, bppgame, xdim2d, ydim2d;
extern int32_t zmode, kensplayerheight, zlock;
extern int16_t editstatus, searchit;
extern int32_t searchx, searchy, osearchx, osearchy; //search input
extern int16_t searchsector, searchwall, searchstat; //search output
@ -48,10 +45,10 @@ extern int16_t searchbottomwall;
#define COLOR_RED 248
#define COLOR_WHITE 31
#define NUMOPTIONS 9
char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
//#define NUMOPTIONS 9
//char option[NUMOPTIONS] = {0,0,0,0,0,0,1,0,0};
uint8_t keys[NUMBUILDKEYS] =
uint8_t default_buildkeys[NUMBUILDKEYS] =
{
0xc8,0xd0,0xcb,0xcd,0x2a,0x9d,0x1d,0x39,
0x1e,0x2c,0xd1,0xc9,0x47,0x49,
@ -68,7 +65,6 @@ extern void updatenumsprites(void);
extern int32_t lastpm16time, synctics;
extern int32_t halfxdim16, midydim16, zoom;
extern void fixrepeats(int16_t i);
static char autospritehelp=0,autosecthelp=0;
//int16_t MinRate=24, MinD=3;

View file

@ -2358,7 +2358,7 @@ cheat_for_port_credits:
menutext(c,70+19+19+19,MENUHIGHLIGHT(3),PHX(-5),SkillNames[3]);
break;
case 230:
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
rotatesprite(320<<15,19<<16,65536L,0,MENUBAR,16,0,10,0,0,xdim-1,ydim-1);
menutext(320>>1,24,0,0,"RENDERER SETUP");
@ -2784,7 +2784,7 @@ cheat_for_port_credits:
break;
case 9:
if (x==io) ud.screen_tilting = 1-ud.screen_tilting;
#ifdef POLYMOST
#ifdef USE_OPENGL
if (!ud.screen_tilting) setrollangle(0);
#endif
modval(0,1,(int32_t *)&ud.screen_tilting,1,probey==io);
@ -3078,7 +3078,7 @@ cheat_for_port_credits:
c = (320>>1)-120;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
x = (7/*+(getrendermode() >= 3)*/);
#else
x = 7;
@ -3282,7 +3282,7 @@ cheat_for_port_credits:
nfs = newfullscreen;
nbpp = (newvidmode==validmodecnt)?bpp:validmode[newvidmode].bpp;
nrend = (vidsets[newvidset] & 0x20000) ? (nbpp==8?2:
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
glrendmode
#else
0
@ -3326,7 +3326,7 @@ cheat_for_port_credits:
ud.detail = 1-ud.detail;
break;
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
/* switch (gltexfiltermode)
{
case 0:
@ -3398,7 +3398,7 @@ cheat_for_port_credits:
r_ambientlightrecip = 1.f/r_ambientlight;
}
}
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
else
{
int32_t filter = gltexfiltermode;
@ -5150,8 +5150,8 @@ VOLUME_ALL_40x:
else if (g_netServer)
enet_host_broadcast(g_netServer, CHAN_GAMESTATE, enet_packet_create(tempbuf, 4, ENET_PACKET_FLAG_RELIABLE));
Bsprintf(ScriptQuotes[116],"VOTE FAILED");
P_DoQuote(116,g_player[myconnectindex].ps);
Bsprintf(ScriptQuotes[QUOTE_RESERVED2],"VOTE FAILED");
P_DoQuote(QUOTE_RESERVED2,g_player[myconnectindex].ps);
g_player[myconnectindex].ps->gm &= ~MODE_MENU;
}
}

File diff suppressed because it is too large Load diff

View file

@ -25,6 +25,92 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "enet/enet.h"
#define NET_SECTOR_WALLPTR 0x00000001
#define NET_SECTOR_WALLNUM 0x00000002
#define NET_SECTOR_CEILINGZ 0x00000004
#define NET_SECTOR_FLOORZ 0x00000008
#define NET_SECTOR_CEILINGSTAT 0x00000010
#define NET_SECTOR_FLOORSTAT 0x00000020
#define NET_SECTOR_CEILINGPIC 0x00000040
#define NET_SECTOR_CEILINGSLOPE 0x00000080
#define NET_SECTOR_CEILINGSHADE 0x00000100
#define NET_SECTOR_CEILINGPAL 0x00000200
#define NET_SECTOR_CEILINGXPAN 0x00000400
#define NET_SECTOR_CEILINGYPAN 0x00000800
#define NET_SECTOR_FLOORPIC 0x00001000
#define NET_SECTOR_FLOORSLOPE 0x00002000
#define NET_SECTOR_FLOORSHADE 0x00004000
#define NET_SECTOR_FLOORPAL 0x00008000
#define NET_SECTOR_FLOORXPAN 0x00010000
#define NET_SECTOR_FLOORYPAN 0x00020000
#define NET_SECTOR_VISIBILITY 0x00040000
#define NET_SECTOR_LOTAG 0x00080000
#define NET_SECTOR_HITAG 0x00100000
#define NET_SECTOR_EXTRA 0x00200000
#define NET_WALL_X 0x00000001
#define NET_WALL_Y 0x00000002
#define NET_WALL_POINT2 0x00000004
#define NET_WALL_NEXTWALL 0x00000008
#define NET_WALL_NEXTSECTOR 0x00000010
#define NET_WALL_CSTAT 0x00000020
#define NET_WALL_PICNUM 0x00000040
#define NET_WALL_OVERPICNUM 0x00000080
#define NET_WALL_SHADE 0x00000100
#define NET_WALL_PAL 0x00000200
#define NET_WALL_XREPEAT 0x00000400
#define NET_WALL_YREPEAT 0x00000800
#define NET_WALL_XPANNING 0x00001000
#define NET_WALL_YPANNING 0x00002000
#define NET_WALL_LOTAG 0x00004000
#define NET_WALL_HITAG 0x00008000
#define NET_WALL_EXTRA 0x00010000
#define NET_SPRITE_X 0x00000001
#define NET_SPRITE_Y 0x00000002
#define NET_SPRITE_Z 0x00000004
#define NET_SPRITE_SHADE 0x00000008
#define NET_SPRITE_PAL 0x00000010
#define NET_SPRITE_CLIPDIST 0x00000020
#define NET_SPRITE_XREPEAT 0x00000040
#define NET_SPRITE_YREPEAT 0x00000080
#define NET_SPRITE_XOFFSET 0x00000100
#define NET_SPRITE_YOFFSET 0x00000200
#define NET_SPRITE_SECTNUM 0x00000400
#define NET_SPRITE_STATNUM 0x00000800
#define NET_SPRITE_ANG 0x00001000
#define NET_SPRITE_OWNER 0x00002000
#define NET_SPRITE_XVEL 0x00004000
#define NET_SPRITE_YVEL 0x00008000
#define NET_SPRITE_ZVEL 0x00010000
#define NET_SPRITE_LOTAG 0x00020000
#define NET_SPRITE_HITAG 0x00040000
#define NET_SPRITE_EXTRA 0x00080000
#define NET_SPRITE_CSTAT 0x00100000
#define NET_SPRITE_PICNUM 0x00200000
#define NET_ACTOR_T1 0x00000001
#define NET_ACTOR_T2 0x00000002
#define NET_ACTOR_T3 0x00000004
#define NET_ACTOR_T4 0x00000008
#define NET_ACTOR_T5 0x00000010
#define NET_ACTOR_T6 0x00000020
#define NET_ACTOR_T7 0x00000040
#define NET_ACTOR_T8 0x00000080
#define NET_ACTOR_T9 0x00000100
#define NET_ACTOR_T10 0x00000200
#define NET_ACTOR_PICNUM 0x00000400
#define NET_ACTOR_ANG 0x00000800
#define NET_ACTOR_EXTRA 0x00001000
#define NET_ACTOR_OWNER 0x00002000
#define NET_ACTOR_MOVFLAG 0x00004000
#define NET_ACTOR_TEMPANG 0x00008000
#define NET_ACTOR_TIMETOSLEEP 0x00010000
#define NET_ACTOR_FLAGS 0x00020000
#define NET_ACTOR_PTR1 0x00040000
#define NET_ACTOR_PTR2 0x00080000
#define NET_ACTOR_PTR3 0x00100000
enum netchan_t
{
CHAN_MOVE, // unreliable movement packets
@ -48,6 +134,7 @@ enum DukePacket_t
PACKET_REQUEST_GAMESTATE,
PACKET_VERSION,
PACKET_AUTH,
PACKET_PLAYER_PING,
PACKET_PLAYER_READY,
PACKET_MAP_STREAM,
@ -69,13 +156,21 @@ enum DukePacket_t
PACKET_MAP_VOTE_CANCEL,
};
enum NetDisconnect_t
enum netdisconnect_t
{
DISC_BAD_PASSWORD = 1,
DISC_KICKED,
DISC_BANNED
};
enum netmode_t
{
NET_CLIENT = 0,
NET_SERVER,
NET_DEDICATED_CLIENT, // client on dedicated server
NET_DEDICATED_SERVER
};
extern ENetHost *g_netClient;
extern ENetHost *g_netServer;
extern ENetPeer *g_netClientPeer;
@ -83,16 +178,17 @@ extern char g_netPassword[32];
extern int32_t g_netDisconnect;
extern int32_t g_netPlayersWaiting;
extern int32_t g_netPort;
extern int32_t g_netServerMode;
extern int32_t g_networkMode;
extern int32_t g_netSync;
extern int32_t lastsectupdate[MAXSECTORS];
extern int32_t lastupdate[MAXSPRITES];
extern int32_t lastwallupdate[MAXWALLS];
extern int8_t g_netStatnums[8];
extern int16_t g_netStatnums[10];
extern mapstate_t *g_multiMapState;
int32_t Net_PackSprite(int32_t i,uint8_t *pbuf);
int32_t Net_UnpackSprite(int32_t i,uint8_t *pbuf);
void Net_ClientMove(void);
void Net_Connect(const char *srvaddr);
void Net_Disconnect(void);
void Net_EnterMessage(void);

View file

@ -1165,7 +1165,7 @@ static int32_t osdcmd_listplayers(const osdfuncparm_t *parm)
ENetPeer *currentPeer;
char ipaddr[32];
if (parm->numparms != 0)
if (parm && parm->numparms != 0)
return OSDCMD_SHOWHELP;
if (!g_netServer)
@ -1174,6 +1174,8 @@ static int32_t osdcmd_listplayers(const osdfuncparm_t *parm)
return OSDCMD_OK;
}
initprintf("Connected clients:\n");
for (currentPeer = g_netServer -> peers;
currentPeer < & g_netServer -> peers [g_netServer -> peerCount];
++ currentPeer)
@ -1222,6 +1224,7 @@ static int32_t osdcmd_kick(const osdfuncparm_t *parm)
}
initprintf("Player %s not found!\n", parm->parms[0]);
osdcmd_listplayers(NULL);
return OSDCMD_OK;
}
@ -1264,6 +1267,7 @@ static int32_t osdcmd_kickban(const osdfuncparm_t *parm)
}
initprintf("Player %s not found!\n", parm->parms[0]);
osdcmd_listplayers(NULL);
return OSDCMD_OK;
}

View file

@ -31,7 +31,7 @@ int32_t osdhightile = 0;
void GAME_drawosdchar(int32_t x, int32_t y, char ch, int32_t shade, int32_t pal)
{
int16_t ac;
#if !defined(POLYMOST) || !defined(USE_OPENGL)
#ifndef USE_OPENGL
int32_t usehightile = 0;
#endif
int32_t ht = usehightile;
@ -49,7 +49,7 @@ void GAME_drawosdstr(int32_t x, int32_t y, char *ch, int32_t len, int32_t shade,
int16_t ac;
char *ptr = OSD_GetTextPtr();
char *fmt = OSD_GetFmtPtr();
#if !defined(POLYMOST) || !defined(USE_OPENGL)
#ifndef USE_OPENGL
int32_t usehightile = 0;
#endif
int32_t ht = usehightile;

View file

@ -2007,7 +2007,7 @@ static void G_DrawTileScaled(int32_t x, int32_t y, int32_t tilenum, int32_t shad
if (orientation&4)
a = 1024;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(tilenum,p) > 0)
y += (224-weapsc(224));
#endif
@ -2958,7 +2958,7 @@ void P_DisplayWeapon(int32_t snum)
int32_t g_myAimMode = 0, g_myAimStat = 0, g_oldAimStat = 0;
int32_t mouseyaxismode = -1;
int32_t jump_timer = 0;
int32_t g_emuJumpTics = 0;
void getinput(int32_t snum)
{
@ -2996,7 +2996,7 @@ void getinput(int32_t snum)
if (g_myAimStat > g_oldAimStat)
{
g_myAimMode ^= 1;
P_DoQuote(44+g_myAimMode,p);
P_DoQuote(QUOTE_MOUSE_AIMING_OFF+g_myAimMode,p);
}
}
@ -3166,12 +3166,12 @@ void getinput(int32_t snum)
j = 12;
if (BUTTON(gamefunc_Jump) && p->on_ground)
jump_timer = 4;
g_emuJumpTics = 4;
loc.bits = (jump_timer > 0 || BUTTON(gamefunc_Jump))<<SK_JUMP;
loc.bits = (g_emuJumpTics > 0 || BUTTON(gamefunc_Jump))<<SK_JUMP;
if (jump_timer > 0)
jump_timer--;
if (g_emuJumpTics > 0)
g_emuJumpTics--;
loc.bits |= BUTTON(gamefunc_Crouch)<<SK_CROUCH;
loc.bits |= BUTTON(gamefunc_Fire)<<SK_FIRE;
@ -3404,7 +3404,7 @@ static int32_t P_DoCounters(DukePlayer_t *p)
{
p->scuba_on = 1;
p->inven_icon = 6;
P_DoQuote(76,p);
P_DoQuote(QUOTE_SCUBA_ON,p);
}
else
{
@ -3665,8 +3665,8 @@ void P_CheckTouchDamage(DukePlayer_t *p,int32_t j)
p->pals.g = 0;
p->pals.b = 0;
p->posvel.x = -(sintable[(p->ang+512)&2047]<<8);
p->posvel.y = -(sintable[(p->ang)&2047]<<8);
p->vel.x = -(sintable[(p->ang+512)&2047]<<8);
p->vel.y = -(sintable[(p->ang)&2047]<<8);
A_PlaySound(DUKE_LONGTERM_PAIN,p->i);
{
@ -3848,13 +3848,13 @@ void P_FragPlayer(int32_t snum)
if (snum == screenpeek)
{
Bsprintf(ScriptQuotes[115],"KILLED BY %s",&g_player[p->frag_ps].user_name[0]);
P_DoQuote(115,p);
Bsprintf(ScriptQuotes[QUOTE_RESERVED],"KILLED BY %s",&g_player[p->frag_ps].user_name[0]);
P_DoQuote(QUOTE_RESERVED,p);
}
else
{
Bsprintf(ScriptQuotes[116],"KILLED %s",&g_player[snum].user_name[0]);
P_DoQuote(116,g_player[p->frag_ps].ps);
Bsprintf(ScriptQuotes[QUOTE_RESERVED2],"KILLED %s",&g_player[snum].user_name[0]);
P_DoQuote(QUOTE_RESERVED2,g_player[p->frag_ps].ps);
}
if (ud.obituaries)
@ -3941,13 +3941,13 @@ void P_ProcessWeapon(int32_t snum)
{
p->holster_weapon = 1;
p->weapon_pos = -1;
P_DoQuote(73,p);
P_DoQuote(QUOTE_WEAPON_LOWERED,p);
}
else if (p->holster_weapon == 1 && p->weapon_pos == -9)
{
p->holster_weapon = 0;
p->weapon_pos = 10;
P_DoQuote(74,p);
P_DoQuote(QUOTE_WEAPON_RAISED,p);
}
}
@ -4027,7 +4027,7 @@ void P_ProcessWeapon(int32_t snum)
{
p->holster_weapon = 0;
p->weapon_pos = 10;
P_DoQuote(74,p);
P_DoQuote(QUOTE_WEAPON_RAISED,p);
}
}
else
@ -4110,7 +4110,7 @@ void P_ProcessWeapon(int32_t snum)
(hitinfo.pos.y-p->pos.y)*(hitinfo.pos.y-p->pos.y)) < (290*290))
{
p->pos.z = p->opos.z;
p->posvel.z = 0;
p->vel.z = 0;
(*kb) = 1;
if (aplWeaponInitialSound[p->curr_weapon][snum] > 0)
{
@ -4290,7 +4290,7 @@ void P_ProcessWeapon(int32_t snum)
&& *kb < (aplWeaponFireDelay[p->curr_weapon][snum]+1))
{
p->pos.z = p->opos.z;
p->posvel.z = 0;
p->vel.z = 0;
}
if (*kb == aplWeaponSound2Time[p->curr_weapon][snum])
@ -4485,6 +4485,9 @@ void P_ProcessInput(int32_t snum)
uint8_t *kb = &p->kickback_pic;
int16_t tempsect;
if (g_player[snum].playerquitflag == 0)
return;
p->player_par++;
VM_OnEvent(EVENT_PROCESSINPUT, p->i, snum, -1);
@ -4567,8 +4570,8 @@ void P_ProcessInput(int32_t snum)
{
// I think this is what makes the player slide off enemies... might be a good sprite flag to add later
j = getangle(sprite[j].x-p->pos.x,sprite[j].y-p->pos.y);
p->posvel.x -= sintable[(j+512)&2047]<<4;
p->posvel.y -= sintable[j&2047]<<4;
p->vel.x -= sintable[(j+512)&2047]<<4;
p->vel.y -= sintable[j&2047]<<4;
}
}
@ -4597,7 +4600,7 @@ void P_ProcessInput(int32_t snum)
if (p->customexitsound >= 0)
{
S_PlaySound(p->customexitsound);
P_DoQuote(102,p);
P_DoQuote(QUOTE_WEREGONNAFRYYOURASS,p);
}
}
else if (p->timebeforeexit == 1)
@ -4689,7 +4692,7 @@ void P_ProcessInput(int32_t snum)
p->pos.y = SY;
p->pos.z = SZ;
p->ang = SA;
p->posvel.x = p->posvel.y = s->xvel = 0;
p->vel.x = p->vel.y = s->xvel = 0;
p->look_ang = 0;
p->rotscrnang = 0;
@ -4802,9 +4805,9 @@ void P_ProcessInput(int32_t snum)
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
// jump
if (p->posvel.z > 0) p->posvel.z = 0;
p->posvel.z -= 348;
if (p->posvel.z < -(256*6)) p->posvel.z = -(256*6);
if (p->vel.z > 0) p->vel.z = 0;
p->vel.z -= 348;
if (p->vel.z < -(256*6)) p->vel.z = -(256*6);
}
}
else if (TEST_SYNC_KEY(sb_snum, SK_CROUCH))
@ -4814,32 +4817,32 @@ void P_ProcessInput(int32_t snum)
if (aGameVars[g_iReturnVarID].val.lValue == 0)
{
// crouch
if (p->posvel.z < 0) p->posvel.z = 0;
p->posvel.z += 348;
if (p->posvel.z > (256*6)) p->posvel.z = (256*6);
if (p->vel.z < 0) p->vel.z = 0;
p->vel.z += 348;
if (p->vel.z > (256*6)) p->vel.z = (256*6);
}
}
else
{
// normal view
if (p->posvel.z < 0)
if (p->vel.z < 0)
{
p->posvel.z += 256;
if (p->posvel.z > 0)
p->posvel.z = 0;
p->vel.z += 256;
if (p->vel.z > 0)
p->vel.z = 0;
}
if (p->posvel.z > 0)
if (p->vel.z > 0)
{
p->posvel.z -= 256;
if (p->posvel.z < 0)
p->posvel.z = 0;
p->vel.z -= 256;
if (p->vel.z < 0)
p->vel.z = 0;
}
}
if (p->posvel.z > 2048)
p->posvel.z >>= 1;
if (p->vel.z > 2048)
p->vel.z >>= 1;
p->pos.z += p->posvel.z;
p->pos.z += p->vel.z;
if (p->pos.z > (fz-(15<<8)))
p->pos.z += ((fz-(15<<8))-p->pos.z)>>1;
@ -4847,7 +4850,7 @@ void P_ProcessInput(int32_t snum)
if (p->pos.z < cz)
{
p->pos.z = cz;
p->posvel.z = 0;
p->vel.z = 0;
}
if (p->scuba_on && (krand()&255) < 8)
@ -5004,16 +5007,16 @@ void P_ProcessInput(int32_t snum)
else
{
p->on_ground = 0;
p->posvel.z += (g_spriteGravity+80); // (TICSPERFRAME<<6);
if (p->posvel.z >= (4096+2048)) p->posvel.z = (4096+2048);
if (p->posvel.z > 2400 && p->falling_counter < 255)
p->vel.z += (g_spriteGravity+80); // (TICSPERFRAME<<6);
if (p->vel.z >= (4096+2048)) p->vel.z = (4096+2048);
if (p->vel.z > 2400 && p->falling_counter < 255)
{
p->falling_counter++;
if (p->falling_counter >= 38 && p->scream_voice <= FX_Ok)
p->scream_voice = A_PlaySound(DUKE_SCREAM,p->i);
}
if ((p->pos.z+p->posvel.z) >= (fz-(i<<8)) && p->cursectnum >= 0) // hit the ground
if ((p->pos.z+p->vel.z) >= (fz-(i<<8)) && p->cursectnum >= 0) // hit the ground
if (sector[p->cursectnum].lotag != 1)
{
if (p->falling_counter > 62)
@ -5040,7 +5043,7 @@ void P_ProcessInput(int32_t snum)
p->pals.b = 0;
p->pals.f = 32;
}
else if (p->posvel.z > 2048)
else if (p->vel.z > 2048)
A_PlaySound(DUKE_LAND,p->i);
}
}
@ -5057,8 +5060,8 @@ void P_ProcessInput(int32_t snum)
p->scream_voice = -1;
}
if (psectlotag != 1 && psectlotag != 2 && p->on_ground == 0 && p->posvel.z > (6144>>1))
p->hard_landing = p->posvel.z>>10;
if (psectlotag != 1 && psectlotag != 2 && p->on_ground == 0 && p->vel.z > (6144>>1))
p->hard_landing = p->vel.z>>10;
p->on_ground = 1;
@ -5069,8 +5072,8 @@ void P_ProcessInput(int32_t snum)
k = ((fz-(i<<8))-p->pos.z)>>1;
if (klabs(k) < 256) k = 0;
p->pos.z += k;
p->posvel.z -= 768;
if (p->posvel.z < 0) p->posvel.z = 0;
p->vel.z -= 768;
if (p->vel.z < 0) p->vel.z = 0;
}
else if (p->jumping_counter == 0)
{
@ -5078,7 +5081,7 @@ void P_ProcessInput(int32_t snum)
if (p->on_warping_sector == 0 && p->pos.z > fz-(16<<8))
{
p->pos.z = fz-(16<<8);
p->posvel.z >>= 1;
p->vel.z >>= 1;
}
}
@ -5128,11 +5131,11 @@ void P_ProcessInput(int32_t snum)
if (psectlotag == 1 && p->jumping_counter > 768)
{
p->jumping_counter = 0;
p->posvel.z = -512;
p->vel.z = -512;
}
else
{
p->posvel.z -= (sintable[(2048-128+p->jumping_counter)&2047])/12;
p->vel.z -= (sintable[(2048-128+p->jumping_counter)&2047])/12;
p->jumping_counter += 180;
p->on_ground = 0;
}
@ -5140,18 +5143,18 @@ void P_ProcessInput(int32_t snum)
else
{
p->jumping_counter = 0;
p->posvel.z = 0;
p->vel.z = 0;
}
}
p->pos.z += p->posvel.z;
p->pos.z += p->vel.z;
if ((psectlotag != 2 || cz != sector[p->cursectnum].ceilingz) && p->pos.z < (cz+(4<<8)))
{
p->jumping_counter = 0;
if (p->posvel.z < 0)
p->posvel.x = p->posvel.y = 0;
p->posvel.z = 128;
if (p->vel.z < 0)
p->vel.x = p->vel.y = 0;
p->vel.z = 128;
p->pos.z = cz+(4<<8);
}
}
@ -5161,8 +5164,8 @@ void P_ProcessInput(int32_t snum)
*kb > 1 && *kb < *aplWeaponFireDelay[p->curr_weapon]))
{
doubvel = 0;
p->posvel.x = 0;
p->posvel.y = 0;
p->vel.x = 0;
p->vel.y = 0;
}
else if (g_player[snum].sync->avel) //p->ang += syncangvel * constant
{
@ -5203,7 +5206,7 @@ void P_ProcessInput(int32_t snum)
if (p->on_ground && truefdist <= PHEIGHT+(16<<8) && P_CheckFloorDamage(p, j))
{
P_DoQuote(75, p);
P_DoQuote(QUOTE_BOOTS_ON, p);
p->inv_amount[GET_BOOTS] -= 2;
if (p->inv_amount[GET_BOOTS] <= 0)
{
@ -5231,7 +5234,7 @@ void P_ProcessInput(int32_t snum)
if (g_player[snum].sync->extbits&(1<<5) || g_player[snum].sync->avel > 0)
VM_OnEvent(EVENT_TURNRIGHT,p->i,snum, -1);
if (p->posvel.x || p->posvel.y || g_player[snum].sync->fvel || g_player[snum].sync->svel)
if (p->vel.x || p->vel.y || g_player[snum].sync->fvel || g_player[snum].sync->svel)
{
p->crack_time = 777;
@ -5275,8 +5278,8 @@ void P_ProcessInput(int32_t snum)
if (p->jetpack_on == 0 && p->inv_amount[GET_STEROIDS] > 0 && p->inv_amount[GET_STEROIDS] < 400)
doubvel <<= 1;
p->posvel.x += ((g_player[snum].sync->fvel*doubvel)<<6);
p->posvel.y += ((g_player[snum].sync->svel*doubvel)<<6);
p->vel.x += ((g_player[snum].sync->fvel*doubvel)<<6);
p->vel.y += ((g_player[snum].sync->svel*doubvel)<<6);
j = 0;
@ -5285,16 +5288,16 @@ void P_ProcessInput(int32_t snum)
else if (p->on_ground && (TEST_SYNC_KEY(sb_snum, SK_CROUCH) || (*kb > 10 && aplWeaponWorksLike[p->curr_weapon][snum] == KNEE_WEAPON)))
j = 0x2000;
p->posvel.x = mulscale16(p->posvel.x,p->runspeed-j);
p->posvel.y = mulscale16(p->posvel.y,p->runspeed-j);
p->vel.x = mulscale16(p->vel.x,p->runspeed-j);
p->vel.y = mulscale16(p->vel.y,p->runspeed-j);
if (klabs(p->posvel.x) < 2048 && klabs(p->posvel.y) < 2048)
p->posvel.x = p->posvel.y = 0;
if (klabs(p->vel.x) < 2048 && klabs(p->vel.y) < 2048)
p->vel.x = p->vel.y = 0;
if (shrunk)
{
p->posvel.x = mulscale16(p->posvel.x,p->runspeed-(p->runspeed>>1)+(p->runspeed>>2));
p->posvel.y = mulscale16(p->posvel.y,p->runspeed-(p->runspeed>>1)+(p->runspeed>>2));
p->vel.x = mulscale16(p->vel.x,p->runspeed-(p->runspeed>>1)+(p->runspeed>>2));
p->vel.y = mulscale16(p->vel.y,p->runspeed-(p->runspeed>>1)+(p->runspeed>>2));
}
}
@ -5307,12 +5310,12 @@ HORIZONLY:
if (ud.clipping)
{
p->pos.x += p->posvel.x>>14;
p->pos.y += p->posvel.y>>14;
p->pos.x += p->vel.x>>14;
p->pos.y += p->vel.y>>14;
updatesector(p->pos.x,p->pos.y,&p->cursectnum);
changespritesect(p->i,p->cursectnum);
}
else if ((j = clipmove((vec3_t *)p,&p->cursectnum, p->posvel.x,p->posvel.y,164L,(4L<<8),i,CLIPMASK0)))
else if ((j = clipmove((vec3_t *)p,&p->cursectnum, p->vel.x,p->vel.y,164L,(4L<<8),i,CLIPMASK0)))
P_CheckTouchDamage(p, j);
if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk)
@ -5369,7 +5372,7 @@ HORIZONLY:
{
if (!(sector[s->sectnum].lotag&0x8000) && (isanunderoperator(sector[s->sectnum].lotag) ||
isanearoperator(sector[s->sectnum].lotag)))
activatebysector(s->sectnum,p->i);
G_ActivateBySector(s->sectnum,p->i);
if (j)
{
P_QuickKill(p);
@ -5377,7 +5380,7 @@ HORIZONLY:
}
}
else if (klabs(fz-cz) < (32<<8) && isanunderoperator(sector[p->cursectnum].lotag))
activatebysector(p->cursectnum,p->i);
G_ActivateBySector(p->cursectnum,p->i);
}
i = 0;
@ -5809,7 +5812,7 @@ void computergetinput(int32_t snum, input_t *syn)
if (fightdist < 128) fightdist = 128;
dist = ksqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
if (dist == 0) dist = 1;
daang = getangle(x2+(g_player[goalplayer[snum]].ps->posvel.x>>14)-x1,y2+(g_player[goalplayer[snum]].ps->posvel.y>>14)-y1);
daang = getangle(x2+(g_player[goalplayer[snum]].ps->vel.x>>14)-x1,y2+(g_player[goalplayer[snum]].ps->vel.y>>14)-y1);
zang = 100-((z2-z1)*8)/dist;
fightdist = max(fightdist,(klabs(z2-z1)>>4));
@ -6048,13 +6051,13 @@ void computergetinput(int32_t snum, input_t *syn)
int16_t dasect = p->cursectnum;
Bmemcpy(&vect,p,sizeof(vec3_t));
i = clipmove(&vect,&dasect,p->posvel.x,p->posvel.y,164L,4L<<8,4L<<8,CLIPMASK0);
i = clipmove(&vect,&dasect,p->vel.x,p->vel.y,164L,4L<<8,4L<<8,CLIPMASK0);
if (!i)
{
Bmemcpy(&vect,p,sizeof(vec3_t));
vect.z += (24<<8);
dasect = p->cursectnum;
i = clipmove(&vect,&dasect,p->posvel.x,p->posvel.y,164L,4L<<8,4L<<8,CLIPMASK0);
i = clipmove(&vect,&dasect,p->vel.x,p->vel.y,164L,4L<<8,4L<<8,CLIPMASK0);
}
}
if (i)

View file

@ -33,6 +33,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define AUTO_AIM_ANGLE 48
#define PHEIGHT (38<<8)
#define TRIPBOMB_TRIPWIRE 0x00000001
#define TRIPBOMB_TIMER 0x00000002
#define PIPEBOMB_REMOTE 0x00000001
#define PIPEBOMB_TIMER 0x00000002
enum dukeinv_t {
GET_STEROIDS,
GET_SHIELD,
@ -116,12 +122,6 @@ enum playeraction_t {
pfacing = 0x00010000
};
#define TRIPBOMB_TRIPWIRE 0x00000001
#define TRIPBOMB_TIMER 0x00000002
#define PIPEBOMB_REMOTE 0x00000001
#define PIPEBOMB_TIMER 0x00000002
#pragma pack(push,1)
typedef struct {
int32_t ox,oy,oz;
@ -137,7 +137,7 @@ typedef struct {
} DukeStatus_t;
typedef struct {
vec3_t pos, opos, posvel;
vec3_t pos, opos, vel, npos;
int32_t bobposx, bobposy;
int32_t truefz, truecz, player_par;
int32_t randomflamex, exitx, exity;
@ -213,7 +213,7 @@ typedef struct {
int32_t pcolor, pteam;
uint8_t frags[MAXPLAYERS], wchoice[MAX_WEAPONS];
char vote, gotvote, playerreadyflag, playerquitflag;
char vote, gotvote, pingcnt, playerquitflag;
char user_name[32];
} playerdata_t;
#pragma pack(pop)
@ -261,7 +261,7 @@ extern int32_t g_numObituaries;
extern int32_t g_numSelfObituaries;
extern int32_t g_weapon_offset;
extern int32_t g_weapon_xoffset;
extern int32_t jump_timer;
extern int32_t g_emuJumpTics;
extern int32_t lastvisinc;
extern int32_t mouseyaxismode;
extern int32_t ticrandomseed;

View file

@ -489,7 +489,7 @@ void G_CacheMapData(void)
if (waloff[i] == 0)
loadtile((int16_t)i);
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
// PRECACHE
if (ud.config.useprecache)
{
@ -544,7 +544,7 @@ void G_CacheMapData(void)
OSD_Printf("Cache time: %dms\n", endtime-starttime);
}
void xyzmirror(int32_t i,int32_t wn)
void G_SetupCamTile(int32_t i,int32_t wn)
{
//if (waloff[wn] == 0) loadtile(wn);
setviewtotile(wn,tilesizy[wn],tilesizx[wn]);
@ -678,7 +678,7 @@ void P_ResetPlayer(int32_t snum)
g_player[snum].ps->weapreccnt = 0;
g_player[snum].ps->fta = 0;
g_player[snum].ps->ftq = 0;
g_player[snum].ps->posvel.x = g_player[snum].ps->posvel.y = 0;
g_player[snum].ps->vel.x = g_player[snum].ps->vel.y = 0;
g_player[snum].ps->rotscrnang = 0;
g_player[snum].ps->runspeed = g_playerFriction;
g_player[snum].ps->falling_counter = 0;
@ -782,9 +782,9 @@ void P_ResetStatus(int32_t snum)
p->newowner =-1;
p->jumping_counter = 0;
p->hard_landing = 0;
p->posvel.x = 0;
p->posvel.y = 0;
p->posvel.z = 0;
p->vel.x = 0;
p->vel.y = 0;
p->vel.z = 0;
fricxv = 0;
fricyv = 0;
p->somethingonplayer =-1;
@ -1560,31 +1560,26 @@ void G_ResetTimers(void)
g_moveThingsCount = 0;
}
void clearfifo(void)
void G_ClearFIFO(void)
{
int32_t i = 0;
extern int32_t jump_timer;
int32_t i = MAXPLAYERS-1;
jump_timer = 0;
avg.fvel = avg.svel = avg.avel = avg.horz = avg.bits = avg.extbits = 0;
g_emuJumpTics = 0;
Bmemset(&avg, 0, sizeof(input_t));
clearbufbyte(&loc,sizeof(input_t),0L);
clearbufbyte(&inputfifo,sizeof(input_t)*MOVEFIFOSIZ*MAXPLAYERS,0L);
for (; i<MAXPLAYERS; i++)
for (; i >= 0; i--)
{
// Bmemset(g_player[i].inputfifo,0,sizeof(g_player[i].inputfifo));
if (g_player[i].sync != NULL)
Bmemset(g_player[i].sync,0,sizeof(input_t));
g_player[i].vote = 0;
g_player[i].gotvote = 0;
Bmemset(g_player[i].sync, 0, sizeof(input_t));
g_player[i].vote = g_player[i].gotvote = 0;
}
// clearbufbyte(playerquitflag,MAXPLAYERS,0x01);
}
extern int32_t voting, vote_map, vote_episode;
int32_t G_FindLevelForFilename(const char *fn)
int32_t G_FindLevelByFile(const char *fn)
{
int32_t volume, level;
@ -1637,8 +1632,10 @@ static void G_LoadMapHack(char *outbuf, const char *filename)
if (filename != NULL)
Bstrcpy(outbuf, filename);
p = Bstrrchr(outbuf,'.');
if (!p) Bstrcat(outbuf,".mhk");
if (!p)
Bstrcat(outbuf,".mhk");
else
{
p[1]='m';
@ -1646,7 +1643,9 @@ static void G_LoadMapHack(char *outbuf, const char *filename)
p[3]='k';
p[4]=0;
}
if (!loadmaphack(outbuf)) initprintf("Loaded map hack file '%s'\n",outbuf);
if (!loadmaphack(outbuf))
initprintf("Loaded map hack file '%s'\n",outbuf);
}
int32_t G_EnterLevel(int32_t g)
@ -1671,18 +1670,21 @@ int32_t G_EnterLevel(int32_t g)
if ((g&MODE_DEMO) == 0 && ud.recstat == 2)
ud.recstat = 0;
if (g_networkMode != NET_DEDICATED_SERVER)
{
FX_StopAllSounds();
S_ClearSoundLocks();
FX_SetReverb(0);
setgamemode(ud.config.ScreenMode,ud.config.ScreenWidth,ud.config.ScreenHeight,ud.config.ScreenBPP);
}
if (boardfilename[0] != 0 && ud.m_level_number == 7 && ud.m_volume_number == 0)
{
int32_t volume, level;
Bcorrectfilename(boardfilename,0);
volume = level = G_FindLevelForFilename(boardfilename);
volume = level = G_FindLevelByFile(boardfilename);
if (level != MAXLEVELS*MAXVOLUMES)
{
@ -1811,7 +1813,6 @@ int32_t G_EnterLevel(int32_t g)
}
else
{
i = strlen(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename);
copybufbyte(MapInfo[(ud.volume_number*MAXLEVELS)+ud.level_number].filename,&levname[0],i);
levname[i] = 255;
@ -1871,7 +1872,7 @@ int32_t G_EnterLevel(int32_t g)
G_OpenDemoWrite();
if (VOLUMEONE && ud.level_number == 0 && ud.recstat != 2)
P_DoQuote(40,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_F1HELP,g_player[myconnectindex].ps);
TRAVERSE_CONNECT(i)
switch (DynamicTileMap[sector[sprite[g_player[i].ps->i].sectnum].floorpicnum])
@ -1904,7 +1905,7 @@ int32_t G_EnterLevel(int32_t g)
ud.last_level = ud.level_number+1;
clearfifo();
G_ClearFIFO();
for (i=g_numInterpolations-1; i>=0; i--) bakipos[i] = *curipos[i];

View file

@ -32,7 +32,7 @@ extern int32_t g_numRealPalettes;
extern int32_t voting,vote_map,vote_episode;
extern palette_t CrosshairColors;
int32_t G_EnterLevel(int32_t g);
int32_t G_FindLevelForFilename(const char *fn);
int32_t G_FindLevelByFile(const char *fn);
void G_CacheMapData(void);
void G_FadeLoad(int32_t r,int32_t g,int32_t b,int32_t start,int32_t end,int32_t step);
void G_FreeMapState(int32_t mapnum);
@ -45,7 +45,7 @@ void P_ResetInventory(int32_t snum);
void P_ResetPlayer(int32_t snum);
void P_ResetStatus(int32_t snum);
void P_ResetWeapons(int32_t snum);
void clearfifo(void);
void xyzmirror(int32_t i,int32_t wn);
void G_ClearFIFO(void);
void G_SetupCamTile(int32_t i,int32_t wn);
#endif

View file

@ -0,0 +1,96 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 2011 EDuke32 developers and contributors
This file is part of EDuke32.
EDuke32 is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License version 2
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
//-------------------------------------------------------------------------
#ifndef __quotes_h__
#define __quotes_h__
#define MAXQUOTES 16384
#define MAXQUOTELEN 128
#define OBITQUOTEINDEX MAXQUOTES-128
#define SUICIDEQUOTEINDEX MAXQUOTES-32
#define QUOTE_SHOW_MAP_OFF 1
#define QUOTE_ACTIVATED 2
#define QUOTE_MEDKIT 3
#define QUOTE_LOCKED 4
#define QUOTE_CHEAT_EVERYTHING 5
#define QUOTE_BOOTS 6
#define QUOTE_WASTED 7
#define QUOTE_UNLOCKED 8
#define QUOTE_FOUND_SECRET 9
#define QUOTE_SQUISHED 10
#define QUOTE_USED_STEROIDS 12
#define QUOTE_DEACTIVATED 15
#define QUOTE_CHEAT_GODMODE_ON 17
#define QUOTE_CHEAT_GODMODE_OFF 18
#define QUOTE_CROSSHAIR_OFF 21
#define QUOTE_CHEATS_DISABLED 22
#define QUOTE_MESSAGES_ON 23
#define QUOTE_MESSAGES_OFF 24
#define QUOTE_MUSIC 26
#define QUOTE_CHEAT_STEROIDS 37
#define QUOTE_F1HELP 40
#define QUOTE_MOUSE_AIMING_OFF 44
#define QUOTE_HOLODUKE_ON 47
#define QUOTE_HOLODUKE_OFF 48
#define QUOTE_HOLODUKE_NOT_FOUND 49
#define QUOTE_JETPACK_NOT_FOUND 50
#define QUOTE_JETPACK_ON 52
#define QUOTE_JETPACK_OFF 53
#define QUOTE_NEED_BLUE_KEY 70
#define QUOTE_NEED_RED_KEY 71
#define QUOTE_NEED_YELLOW_KEY 72
#define QUOTE_WEAPON_LOWERED 73
#define QUOTE_WEAPON_RAISED 74
#define QUOTE_BOOTS_ON 75
#define QUOTE_SCUBA_ON 76
#define QUOTE_CHEAT_ALLEN 79
#define QUOTE_MIGHTY_FOOT 80
#define QUOTE_WEAPON_MODE_OFF 82
#define QUOTE_MAP_FOLLOW_OFF 83
#define QUOTE_RUN_MODE_OFF 85
#define QUOTE_JETPACK 88
#define QUOTE_SCUBA 89
#define QUOTE_STEROIDS 90
#define QUOTE_HOLODUKE 91
#define QUOTE_CHEAT_TODD 99
#define QUOTE_CHEAT_UNLOCK 100
#define QUOTE_NVG 101
#define QUOTE_WEREGONNAFRYYOURASS 102
#define QUOTE_SCREEN_SAVED 103
#define QUOTE_CHEAT_BETA 105
#define QUOTE_NVG_OFF 107
#define QUOTE_VIEW_MODE_OFF 109
#define QUOTE_SHOW_MAP_ON 111
#define QUOTE_CHEAT_NOCLIP 113
#define QUOTE_SAVE_BAD_VERSION 114
#define QUOTE_RESERVED 115
#define QUOTE_RESERVED2 116
#define QUOTE_RESERVED3 117
#define QUOTE_SAVE_DEAD 118
#define QUOTE_CHEAT_ALL_WEAPONS 119
#define QUOTE_CHEAT_ALL_INV 120
#define QUOTE_CHEAT_ALL_KEYS 121
#define QUOTE_RESERVED4 122
#define QUOTE_SAVE_BAD_PLAYERS 124
#endif

View file

@ -0,0 +1 @@
const char *s_buildRev = "rXXXX";

View file

@ -99,7 +99,7 @@ int32_t G_LoadSaveHeader(char spot,struct savehead *saveh)
if (kdfread(&bv,sizeof(bv),1,fil) != 1) goto corrupt;
/* if (bv != BYTEVERSION)
{
P_DoQuote(114,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_SAVE_BAD_VERSION,g_player[myconnectindex].ps);
kclose(fil);
return 1;
}*/
@ -154,7 +154,7 @@ int32_t G_LoadPlayer(int32_t spot)
if (kdfread(&bv,sizeof(bv),1,fil) != 1) return -1;
if (bv != BYTEVERSION)
{
P_DoQuote(114,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_SAVE_BAD_VERSION,g_player[myconnectindex].ps);
kclose(fil);
ototalclock = totalclock;
ready2send = 1;
@ -167,7 +167,7 @@ int32_t G_LoadPlayer(int32_t spot)
kclose(fil);
ototalclock = totalclock;
ready2send = 1;
P_DoQuote(124,g_player[myconnectindex].ps);
P_DoQuote(QUOTE_SAVE_BAD_PLAYERS,g_player[myconnectindex].ps);
return 1;
}
else ud.multimode = nump;
@ -255,7 +255,7 @@ int32_t G_LoadPlayer(int32_t spot)
if (kdfread(&i,sizeof(int32_t),1,fil) != 1) goto corrupt;
#endif // POLYMER
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
for (i=0; i<MAXSPRITES; i++)
if (spriteext[i].mdanimtims)
spriteext[i].mdanimtims+=mdtims;
@ -495,13 +495,17 @@ int32_t G_LoadPlayer(int32_t spot)
Bstrcpy(MapInfo[ud.level_number].musicfn,levname);
}
if (ud.config.MusicToggle && MapInfo[(uint8_t)g_musicIndex].musicfn != NULL &&
if (ud.config.MusicToggle)
{
if (MapInfo[(uint8_t)g_musicIndex].musicfn != NULL &&
(i != g_musicIndex || MapInfo[MAXVOLUMES*MAXLEVELS+2].alt_musicfn))
{
S_StopMusic();
S_PlayMusic(&MapInfo[(uint8_t)g_musicIndex].musicfn[0],g_musicIndex);
}
S_PauseMusic(0);
}
g_player[myconnectindex].ps->gm = MODE_GAME;
ud.recstat = 0;
@ -590,7 +594,7 @@ int32_t G_LoadPlayer(int32_t spot)
ready2send = 1;
clearfifo();
G_ClearFIFO();
Net_WaitForServer();
G_ResetTimers();
@ -676,7 +680,7 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&numsectors,sizeof(numsectors),1,fil);
dfwrite(&sector[0],sizeof(sectortype),MAXSECTORS,fil);
dfwrite(&sprite[0],sizeof(spritetype),MAXSPRITES,fil);
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
for (i=0; i<MAXSPRITES; i++)
if (spriteext[i].mdanimtims)
{
@ -695,7 +699,7 @@ int32_t G_SavePlayer(int32_t spot)
dfwrite(&i,sizeof(int32_t),1,fil);
#endif // POLYMER
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
for (i=0; i<MAXSPRITES; i++)if (spriteext[i].mdanimtims)spriteext[i].mdanimtims+=mdtims;
#endif
dfwrite(&headspritesect[0],sizeof(headspritesect[0]),MAXSECTORS+1,fil);
@ -895,8 +899,8 @@ int32_t G_SavePlayer(int32_t spot)
if ((!g_netServer && ud.multimode < 2))
{
strcpy(ScriptQuotes[122],"GAME SAVED");
P_DoQuote(122,g_player[myconnectindex].ps);
strcpy(ScriptQuotes[QUOTE_RESERVED4],"GAME SAVED");
P_DoQuote(QUOTE_RESERVED4,g_player[myconnectindex].ps);
}
ready2send = 1;
@ -1341,8 +1345,10 @@ static uint32_t calcsz(const dataspec_t *spec)
}
static void sv_postudload();
#ifdef USE_OPENGL
static void sv_prespriteextsave();
static void sv_postspriteext();
#endif
static void sv_calcbitptrsize();
static void sv_prescriptsave_once();
static void sv_prescriptload_once();
@ -1424,11 +1430,11 @@ static const dataspec_t svgm_secwsp[] =
{ 0, &headspritestat[0], sizeof(headspritestat[0]), MAXSTATUS+1 },
{ 0, &prevspritestat[0], sizeof(prevspritestat[0]), MAXSPRITES },
{ 0, &nextspritestat[0], sizeof(nextspritestat[0]), MAXSPRITES },
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
{ DS_SAVEFN, (void *)&sv_prespriteextsave, 0, 1 },
#endif
{ DS_DYNAMIC, &spriteext, sizeof(spriteext_t), MAXSPRITES },
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
{ DS_SAVEFN|DS_LOADFN, (void *)&sv_postspriteext, 0, 1 },
#endif
{ DS_NOCHK, &SpriteFlags[0], sizeof(SpriteFlags[0]), MAXTILES },
@ -1818,7 +1824,7 @@ static void sv_postudload()
}
//static int32_t lockclock_dummy;
#if defined(POLYMOST) && defined(USE_OPENGL)
#ifdef USE_OPENGL
static void sv_prespriteextsave()
{
int32_t i;

View file

@ -307,7 +307,7 @@ void G_DoSectorAnimations(void)
if (sprite[g_player[p].ps->i].owner >= 0)
{
g_player[p].ps->pos.z += v;
g_player[p].ps->posvel.z = 0;
g_player[p].ps->vel.z = 0;
if (p == myconnectindex)
{
my.z += v;
@ -381,7 +381,7 @@ void G_AnimateCamSprite(void)
if (waloff[TILE_VIEWSCR] == 0)
allocatepermanenttile(TILE_VIEWSCR,tilesizx[PN],tilesizy[PN]);
else walock[TILE_VIEWSCR] = 255;
xyzmirror(OW,/*PN*/TILE_VIEWSCR);
G_SetupCamTile(OW,/*PN*/TILE_VIEWSCR);
}
}
else T1++;
@ -1046,8 +1046,8 @@ void G_OperateActivators(int32_t low,int32_t snum)
if (snum >= 0 && snum < ud.multimode)
{
if (sector[SECT].lotag&16384)
P_DoQuote(4,g_player[snum].ps);
else P_DoQuote(8,g_player[snum].ps);
P_DoQuote(QUOTE_LOCKED,g_player[snum].ps);
else P_DoQuote(QUOTE_UNLOCKED,g_player[snum].ps);
}
}
else
@ -1222,21 +1222,21 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype)
{
if ((g_player[snum].ps->got_access&1))
g_player[snum].ps->access_incs = 1;
else P_DoQuote(70,g_player[snum].ps);
else P_DoQuote(QUOTE_NEED_BLUE_KEY,g_player[snum].ps);
}
else if (switchpal == 21)
{
if (g_player[snum].ps->got_access&2)
g_player[snum].ps->access_incs = 1;
else P_DoQuote(71,g_player[snum].ps);
else P_DoQuote(QUOTE_NEED_RED_KEY,g_player[snum].ps);
}
else if (switchpal == 23)
{
if (g_player[snum].ps->got_access&4)
g_player[snum].ps->access_incs = 1;
else P_DoQuote(72,g_player[snum].ps);
else P_DoQuote(QUOTE_NEED_YELLOW_KEY,g_player[snum].ps);
}
if (g_player[snum].ps->access_incs == 1)
@ -1565,11 +1565,11 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype)
case 25:
actor[x].t_data[4] = !actor[x].t_data[4];
if (actor[x].t_data[4])
P_DoQuote(15,g_player[snum].ps);
else P_DoQuote(2,g_player[snum].ps);
P_DoQuote(QUOTE_DEACTIVATED,g_player[snum].ps);
else P_DoQuote(QUOTE_ACTIVATED,g_player[snum].ps);
break;
case 21:
P_DoQuote(2,g_player[screenpeek].ps);
P_DoQuote(QUOTE_ACTIVATED,g_player[screenpeek].ps);
break;
}
}
@ -1603,7 +1603,7 @@ int32_t P_ActivateSwitch(int32_t snum,int32_t w,int32_t switchtype)
}
void activatebysector(int32_t sect,int32_t j)
void G_ActivateBySector(int32_t sect,int32_t j)
{
int32_t i = headspritesect[sect];
int32_t didit = 0;
@ -2383,7 +2383,7 @@ void A_DamageObject(int32_t i,int32_t sn)
sprite[i].xvel = -(sprite[sn].extra<<2);
j = SECT;
pushmove((vec3_t *)&sprite[i],&j,128L,(4L<<8),(4L<<8),CLIPMASK0);
if (j != SECT && j >= 0 && j < MAXSECTORS)
if (j != SECT && (unsigned)j < MAXSECTORS)
changespritesect(i,j);
}
}
@ -2521,7 +2521,7 @@ void G_HandleSharedKeys(int32_t snum)
{
p->quick_kick = 14;
if (p->fta == 0 || p->ftq == 80)
P_DoQuote(80,p);
P_DoQuote(QUOTE_MIGHTY_FOOT,p);
}
}
@ -2597,7 +2597,7 @@ void G_HandleSharedKeys(int32_t snum)
P_UpdateScreenPal(p);
p->inven_icon = 5;
A_PlaySound(NITEVISION_ONOFF,p->i);
P_DoQuote(106+(!p->heat_on),p);
P_DoQuote(QUOTE_NVG_OFF-p->heat_on,p);
}
}
@ -2611,7 +2611,7 @@ void G_HandleSharedKeys(int32_t snum)
{
p->inv_amount[GET_STEROIDS]--;
A_PlaySound(DUKE_TAKEPILLS,p->i);
P_DoQuote(12,p);
P_DoQuote(QUOTE_USED_STEROIDS,p);
}
if (p->inv_amount[GET_STEROIDS] > 0)
p->inven_icon = 2;
@ -2710,7 +2710,8 @@ CHECKINV1:
if (dainv || p->inv_amount[GET_FIRSTAID])
{
static const int32_t i[8] = { 3, 90, 91, 88, 101, 89, 6, 0 };
static const int32_t i[8] = { QUOTE_MEDKIT, QUOTE_STEROIDS, QUOTE_HOLODUKE,
QUOTE_JETPACK, QUOTE_NVG, QUOTE_SCUBA, QUOTE_BOOTS, 0 };
P_DoQuote(i[dainv-1], p);
}
}
@ -2919,11 +2920,11 @@ CHECKINV1:
T4 = T5 = 0;
SP = snum;
sprite[i].extra = 0;
P_DoQuote(47,p);
P_DoQuote(QUOTE_HOLODUKE_ON,p);
A_PlaySound(TELEPORTER,p->holoduke_on);
}
}
else P_DoQuote(49,p);
else P_DoQuote(QUOTE_HOLODUKE_NOT_FOUND,p);
}
}
else
@ -2934,7 +2935,7 @@ CHECKINV1:
{
A_PlaySound(TELEPORTER,p->holoduke_on);
p->holoduke_on = -1;
P_DoQuote(48,p);
P_DoQuote(QUOTE_HOLODUKE_OFF,p);
}
}
}
@ -2966,7 +2967,7 @@ CHECKINV1:
}
}
if (TEST_SYNC_KEY(sb_snum, SK_JETPACK) && p->newowner == -1)
if (p->newowner == -1 && TEST_SYNC_KEY(sb_snum, SK_JETPACK))
{
aGameVars[g_iReturnVarID].val.lValue = 0;
VM_OnEvent(EVENT_USEJETPACK,g_player[snum].ps->i,snum, -1);
@ -2986,19 +2987,19 @@ CHECKINV1:
A_PlaySound(DUKE_JETPACK_ON,p->i);
P_DoQuote(52,p);
P_DoQuote(QUOTE_JETPACK_ON,p);
}
else
{
p->hard_landing = 0;
p->posvel.z = 0;
p->vel.z = 0;
A_PlaySound(DUKE_JETPACK_OFF,p->i);
S_StopEnvSound(DUKE_JETPACK_IDLE,p->i);
S_StopEnvSound(DUKE_JETPACK_ON,p->i);
P_DoQuote(53,p);
P_DoQuote(QUOTE_JETPACK_OFF,p);
}
}
else P_DoQuote(50,p);
else P_DoQuote(QUOTE_JETPACK_NOT_FOUND,p);
}
}
@ -3031,13 +3032,14 @@ int32_t A_CheckHitSprite(int32_t i, int16_t *hitsp)
SZ += zoff;
*hitsp = hitinfo.hitsprite;
if (hitinfo.hitwall >= 0 && (wall[hitinfo.hitwall].cstat&16) && A_CheckEnemySprite(&sprite[i]))
return((1<<30));
return (FindDistance2D(hitinfo.pos.x-SX,hitinfo.pos.y-SY));
}
static int32_t hitawall(DukePlayer_t *p,int16_t *hitw)
static int32_t P_FindWall(DukePlayer_t *p,int16_t *hitw)
{
hitdata_t hitinfo;
@ -3064,7 +3066,7 @@ void P_CheckSectors(int32_t snum)
case 32767:
sector[p->cursectnum].lotag = 0;
P_DoQuote(9,p);
P_DoQuote(QUOTE_FOUND_SECRET,p);
p->secret_rooms++;
return;
case -1:
@ -3144,7 +3146,7 @@ void P_CheckSectors(int32_t snum)
p->toggle_key_flag = 1;
hitscanwall = -1;
i = hitawall(p,&hitscanwall);
i = P_FindWall(p,&hitscanwall);
if (i < 1280 && hitscanwall >= 0 && wall[hitscanwall].overpicnum == MIRROR)
if (wall[hitscanwall].lotag > 0 && !A_CheckSoundPlaying(p->i,wall[hitscanwall].lotag) && snum == screenpeek)
@ -3247,7 +3249,7 @@ void P_CheckSectors(int32_t snum)
return;
case NUKEBUTTON__STATIC:
hitawall(p,&j);
P_FindWall(p,&j);
if (j >= 0 && wall[j].overpicnum == 0)
if (actor[neartagsprite].t_data[0] == 0)
{

View file

@ -85,7 +85,7 @@ typedef struct {
extern map_t MapInfo[(MAXVOLUMES+1)*MAXLEVELS]; // +1 volume for "intro", "briefing" music
void activatebysector(int32_t sect,int32_t j);
void G_ActivateBySector(int32_t sect,int32_t j);
int32_t A_CallSound(int32_t sn,int32_t whatsprite);
int32_t A_CheckHitSprite(int32_t i,int16_t *hitsp);
void A_DamageObject(int32_t i,int32_t sn);

View file

@ -386,7 +386,7 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
((g_sounds[num].m&8) && ud.lockout) ||
ud.config.SoundToggle == 0 ||
g_sounds[num].num >= MAXSOUNDINSTANCES ||
i < 0 || i >= MAXSPRITES ||
(unsigned)i >= MAXSPRITES ||
FX_VoiceAvailable(g_sounds[num].pr) == 0 ||
(g_player[myconnectindex].ps->timebeforeexit > 0 && g_player[myconnectindex].ps->timebeforeexit <= GAMETICSPERSEC*3) ||
g_player[myconnectindex].ps->gm&MODE_MENU) return -1;
@ -458,6 +458,8 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
pitch -= 1024;
break;
default:
if (sndist > 32767 && PN != MUSICANDSFX && (g_sounds[num].m & 3) == 0)
return -1;
if (g_player[screenpeek].ps->cursectnum > -1 && sector[g_player[screenpeek].ps->cursectnum].lotag == 2 && (g_sounds[num].m&4) == 0)
pitch = -768;
break;
@ -611,7 +613,7 @@ int32_t S_PlaySound(int32_t num)
int32_t A_PlaySound(uint32_t num, int32_t i)
{
if ((int32_t)num > g_maxSoundPos) return -1;
if ((unsigned)num > (unsigned)g_maxSoundPos) return -1;
return i < 0 ? S_PlaySound(num) : S_PlaySound3D(num, i, (vec3_t *)&sprite[i]);
}
@ -619,7 +621,7 @@ void S_StopEnvSound(int32_t num, int32_t i)
{
int32_t j, iter = 0;
if (num < 0 || num > g_maxSoundPos || g_sounds[num].num <= 0)
if ((unsigned)num > (unsigned)g_maxSoundPos || g_sounds[num].num <= 0)
return;
do
@ -690,7 +692,7 @@ void S_Update(void)
{
i = g_sounds[j].SoundOwner[k].i;
if (i < 0 || i >= MAXSPRITES || g_sounds[j].num == 0 || g_sounds[j].SoundOwner[k].voice <= FX_Ok)
if ((unsigned)i >= MAXSPRITES || g_sounds[j].num == 0 || g_sounds[j].SoundOwner[k].voice <= FX_Ok)
continue;
if (!FX_SoundActive(g_sounds[j].SoundOwner[k].voice))
@ -734,9 +736,7 @@ void S_Update(void)
break;
}
if (g_sounds[j].m&16) sndist = 0;
if (sndist < ((255-LOUDESTVOLUME)<<6))
if (g_sounds[j].m&16 || sndist < ((255-LOUDESTVOLUME)<<6))
sndist = ((255-LOUDESTVOLUME)<<6);
FX_Pan3D(g_sounds[j].SoundOwner[k].voice, sndang>>4, sndist>>6);

View file

@ -95,7 +95,7 @@ static inline int32_t getfilenames(char *path)
#define POPULATE_GAME 4
#define POPULATE_GAMEDIRS 8
#if defined(POLYMOST)
#ifdef USE_OPENGL
extern char TEXCACHEFILE[];
#endif

View file

@ -73,6 +73,8 @@ then
echo rm mapster32.debug.exe
rm mapster32.debug.exe
# throw the svn revision into a header. this is ugly.
echo "const char *s_buildRev = \"r$head\";" > source/rev.h
# clean the tree and build debug first
echo "${make[@]}" RELEASE=0 $clean all
"${make[@]}" RELEASE=0 $clean all