From 4e5bde3a7924aaa4f974db7eb0baa5d83adace27 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 28 May 2009 02:55:46 +0000 Subject: [PATCH] git-svn-id: https://svn.eduke32.com/eduke32@1393 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/kplib.c | 10 ++++--- polymer/eduke32/build/src/polymost.c | 16 ++++++------ polymer/eduke32/source/actors.c | 6 ++--- polymer/eduke32/source/astub.c | 30 ++++++++++----------- polymer/eduke32/source/config.c | 10 +++---- polymer/eduke32/source/game.c | 12 ++++++--- polymer/eduke32/source/gamedef.c | 11 +++++--- polymer/eduke32/source/gameexec.c | 39 ++++++++++++---------------- 8 files changed, 70 insertions(+), 64 deletions(-) diff --git a/polymer/eduke32/build/src/kplib.c b/polymer/eduke32/build/src/kplib.c index b3f735da8..346ca6520 100644 --- a/polymer/eduke32/build/src/kplib.c +++ b/polymer/eduke32/build/src/kplib.c @@ -3366,18 +3366,20 @@ void kzclose() //====================== ZIP decompression code ends ========================= //===================== HANDY PICTURE function begins ======================== +#include "cache1d.h" void kpzload(const char *filnam, intptr_t *pic, int32_t *bpl, int32_t *xsiz, int32_t *ysiz) { char *buf; int32_t leng; + int32_t handle = kopen4load((char *)filnam, 0); (*pic) = 0; - if (!kzopen(filnam)) return; - leng = kzfilelength(); + if (handle < 0) return; + leng = kfilelength(handle); buf = (char *)malloc(leng); if (!buf) return; - kzread(buf,leng); - kzclose(); + kread(handle,buf,leng); + kclose(handle); kpgetdim(buf,leng,xsiz,ysiz); (*bpl) = ((*xsiz)<<2); diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 4de4d0870..27ee7fab0 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -5955,7 +5955,7 @@ void polymost_initosdfuncs(void) (void *)&r_parallaxskyclamping, CVAR_BOOL, 0, 0, 1 }, { "r_parallaxskypanning","r_parallaxskypanning: enable/disable parallaxed floor/ceiling panning when drawing a parallaxed sky", (void *)&r_parallaxskypanning, CVAR_BOOL, 0, 0, 1 }, - { "r_polygonmode","r_polygonmode: debugging feature",(void *)&glpolygonmode, CVAR_INT, 0, 0, 3 }, + { "r_polygonmode","r_polygonmode: debugging feature",(void *)&glpolygonmode, CVAR_INT | CVAR_NOSAVE, 0, 0, 3 }, { "r_redbluemode","r_redbluemode: enable/disable experimental OpenGL red-blue glasses mode",(void *)&glredbluemode, CVAR_BOOL, 0, 0, 1 }, { "r_shadescale","r_shadescale: multiplier for lighting",(void *)&shadescale, CVAR_FLOAT, 0, 0, 10 }, { "r_swapinterval","r_swapinterval: sets the GL swap interval (VSync)",(void *)&vsync, CVAR_BOOL|CVAR_FUNCPTR, 0, 0, 1 }, @@ -5985,15 +5985,15 @@ void polymost_initosdfuncs(void) { "r_pr_fov", "r_pr_fov: sets the field of vision in build angle", (void*)&pr_fov, CVAR_INT, 0, 0, 1023}, { "r_pr_billboardingmode", "r_pr_billboardingmode: face sprite display method. 0: classic mode; 1: polymost mode", (void*)&pr_billboardingmode, CVAR_INT, 0, 0, 1 }, { "r_pr_verbosity", "r_pr_verbosity: verbosity level of the polymer renderer", (void*)&pr_verbosity, CVAR_INT, 0, 0, 3 }, - { "r_pr_wireframe", "r_pr_wireframe: toggles wireframe mode", (void*)&pr_wireframe, CVAR_INT, 0, 0, 1 }, + { "r_pr_wireframe", "r_pr_wireframe: toggles wireframe mode", (void*)&pr_wireframe, CVAR_INT | CVAR_NOSAVE, 0, 0, 1 }, { "r_pr_vbos", "r_pr_vbos: contols Vertex Buffer Object usage. 0: no VBOs. 1: VBOs for map data. 2: VBOs for model data.", (void*)&pr_vbos, CVAR_INT, 0, 0, 2 }, { "r_pr_gpusmoothing", "r_pr_gpusmoothing: toggles model animation interpolation", (void*)&pr_gpusmoothing, CVAR_INT, 0, 0, 1 }, - { "r_pr_overrideparallax", "r_pr_overrideparallax: overrides parallax mapping scale and bias values with values from the pr_parallaxscale and pr_parallaxbias cvars; use it to fine-tune DEF tokens", (void*)&pr_overrideparallax, CVAR_BOOL, 0, 0, 1 }, - { "r_pr_parallaxscale", "r_pr_parallaxscale: overriden parallax mapping offset scale", (void*)&pr_parallaxscale, CVAR_FLOAT, 0, -10, 10 }, - { "r_pr_parallaxbias", "r_pr_parallaxbias: overriden parallax mapping offset bias", (void*)&pr_parallaxbias, CVAR_FLOAT, 0, -10, 10 }, - { "r_pr_overridespecular", "r_pr_overridespecular: overrides specular material power and factor values with values from the pr_specularpower and pr_specularfactor cvars; use it to fine-tune DEF tokens", (void*)&pr_overridespecular, CVAR_BOOL, 0, 0, 1 }, - { "r_pr_specularpower", "r_pr_specularpower: overriden specular material power", (void*)&pr_specularpower, CVAR_FLOAT, 0, -10, 1000 }, - { "r_pr_specularfactor", "r_pr_specularfactor: overriden specular material factor", (void*)&pr_specularfactor, CVAR_FLOAT, 0, -10, 1000 }, + { "r_pr_overrideparallax", "r_pr_overrideparallax: overrides parallax mapping scale and bias values with values from the pr_parallaxscale and pr_parallaxbias cvars; use it to fine-tune DEF tokens", (void*)&pr_overrideparallax, CVAR_BOOL | CVAR_NOSAVE, 0, 0, 1 }, + { "r_pr_parallaxscale", "r_pr_parallaxscale: overriden parallax mapping offset scale", (void*)&pr_parallaxscale, CVAR_FLOAT | CVAR_NOSAVE, 0, -10, 10 }, + { "r_pr_parallaxbias", "r_pr_parallaxbias: overriden parallax mapping offset bias", (void*)&pr_parallaxbias, CVAR_FLOAT | CVAR_NOSAVE, 0, -10, 10 }, + { "r_pr_overridespecular", "r_pr_overridespecular: overrides specular material power and factor values with values from the pr_specularpower and pr_specularfactor cvars; use it to fine-tune DEF tokens", (void*)&pr_overridespecular, CVAR_BOOL | CVAR_NOSAVE, 0, 0, 1 }, + { "r_pr_specularpower", "r_pr_specularpower: overriden specular material power", (void*)&pr_specularpower, CVAR_FLOAT | CVAR_NOSAVE, 0, -10, 1000 }, + { "r_pr_specularfactor", "r_pr_specularfactor: overriden specular material factor", (void*)&pr_specularfactor, CVAR_FLOAT | CVAR_NOSAVE, 0, -10, 1000 }, #endif { "r_models","r_models: enable/disable model rendering in >8-bit mode",(void *)&usemodels, CVAR_BOOL, 0, 0, 1 }, diff --git a/polymer/eduke32/source/actors.c b/polymer/eduke32/source/actors.c index 3edd7324b..ba85f34a4 100644 --- a/polymer/eduke32/source/actors.c +++ b/polymer/eduke32/source/actors.c @@ -7832,14 +7832,14 @@ void G_MoveWorld(void) while (i >= 0) { - j = nextspritestat[i]; - if (A_CheckSpriteFlags(i, SPRITE_NOEVENTCODE)) { - i = j; + i = nextspritestat[i]; continue; } + j = nextspritestat[i]; + pl = A_FindPlayer(&sprite[i],&p); X_OnEvent(EVENT_GAME,i, pl, p); i = j; diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index c783138d6..00df3fd8f 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -7469,6 +7469,21 @@ static void Keys2d(void) searchsector=cursectornum; + if (eitherCTRL && keystatus[KEYSC_Z]) // CTRL+Z + { + keystatus[KEYSC_Z] = 0; + if (eitherSHIFT) + { + if (map_undoredo(1)) message("Nothing to redo!"); + else message("Restored revision %d",map_revision-1); + } + else + { + if (map_undoredo(0)) message("Nothing to undo!"); + else message("Revision %d undone",map_revision); + } + } + if (keystatus[KEYSC_TAB]) //TAB { if (cursectornum >= 0) @@ -10286,21 +10301,6 @@ static void Keys2d3d(void) else message("Sprite clipping enabled"); } - if (eitherCTRL && keystatus[KEYSC_Z]) // CTRL+Z - { - keystatus[KEYSC_Z] = 0; - if (eitherSHIFT) - { - if (map_undoredo(1)) message("Nothing to redo!"); - else message("Restored revision %d",map_revision-1); - } - else - { - if (map_undoredo(0)) message("Nothing to undo!"); - else message("Revision %d undone",map_revision); - } - } - if (eitherCTRL) //CTRL { char *f; diff --git a/polymer/eduke32/source/config.c b/polymer/eduke32/source/config.c index 991e66ae3..22c1b6240 100644 --- a/polymer/eduke32/source/config.c +++ b/polymer/eduke32/source/config.c @@ -672,13 +672,13 @@ int32_t CONFIG_ReadSetup(void) SCRIPT_GetNumber(ud.config.scripthandle, "Setup","ForceSetup",&ud.config.ForceSetup); SCRIPT_GetNumber(ud.config.scripthandle, "Setup","NoAutoLoad",&ud.config.NoAutoLoad); -#ifdef _WIN32 +// #ifdef _WIN32 if (g_noSetup == 0 && mod_dir[0] == '/') { struct stat st; SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]); - if (stat(mod_dir, &st) >= 0) + if (stat(mod_dir, &st)) { if ((st.st_mode & S_IFDIR) != S_IFDIR) { @@ -687,7 +687,7 @@ int32_t CONFIG_ReadSetup(void) } } } -#endif +// #endif { extern char defaultduke3dgrp[BMAX_PATH]; @@ -1249,10 +1249,10 @@ void CONFIG_WriteSetup(void) SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]); -#ifdef _WIN32 +// #ifdef _WIN32 if (g_noSetup == 0) SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]); -#endif +// #endif { char commmacro[] = "CommbatMacro# "; diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 9f12f731b..c3cd8db9b 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -7179,9 +7179,15 @@ void G_DoSpriteAnimations(int32_t x,int32_t y,int32_t a,int32_t smoothratio) if (s->owner >= 0 && display_mirror == 0 && g_player[p].ps->over_shoulder_on == 0) if (ud.multimode < 2 || (ud.multimode > 1 && p == screenpeek)) { -// t->owner = -1; -// t->xrepeat = t->yrepeat = 0; - t->cstat |= 16384; + if (getrendermode() == 4) + t->cstat |= 16384; + else + { + t->owner = -1; + t->xrepeat = t->yrepeat = 0; + continue; + } + #if defined(POLYMOST) && defined(USE_OPENGL) if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) { diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index 6d52b9a54..f3019ddbf 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -1515,9 +1515,11 @@ static int32_t C_GetNextKeyword(void) //Returns its code # if (i == CON_LEFTBRACE || i == CON_RIGHTBRACE || i == CON_NULLOP) *g_scriptPtr = i + (IFELSE_MAGIC<<12); else *g_scriptPtr = i + (g_lineNumber<<12); + bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); textptr += l; g_scriptPtr++; + if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) initprintf("%s:%d: debug: translating keyword `%s'.\n",g_szScriptFileName,g_lineNumber,keyw[i]); return i; @@ -2362,30 +2364,31 @@ static int32_t C_ParseCommand(void) return 0; } - i = hash_find(&gamevarH,label+(g_numLabels<<6)); - if (i>=0) + if (hash_find(&gamevarH,label+(g_numLabels<<6))>=0) { g_numCompilerWarnings++; C_ReportError(WARNING_NAMEMATCHESVAR); } - i = hash_find(&labelH,label+(g_numLabels<<6)); - if (i>=0) + if ((i = hash_find(&labelH,label+(g_numLabels<<6))) >= 0) { g_numCompilerWarnings++; initprintf("%s:%d: warning: duplicate move `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); } + if (i == -1) { hash_add(&labelH,label+(g_numLabels<<6),g_numLabels); labeltype[g_numLabels] = LABEL_MOVE; labelcode[g_numLabels++] = (intptr_t) g_scriptPtr; } + for (j=1; j>=0; j--) { if (C_GetKeyword() >= 0) break; C_GetNextValue(LABEL_DEFINE); } + for (k=j; k>=0; k--) { bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); diff --git a/polymer/eduke32/source/gameexec.c b/polymer/eduke32/source/gameexec.c index aac0479c2..3eedc2a25 100644 --- a/polymer/eduke32/source/gameexec.c +++ b/polymer/eduke32/source/gameexec.c @@ -2756,7 +2756,7 @@ static int32_t X_DoExecute(void) break; case CON_IFONWATER: - X_DoConditional(klabs(vm.g_sp->z-sector[vm.g_sp->sectnum].floorz) < (32<<8) && sector[vm.g_sp->sectnum].lotag == 1); + X_DoConditional(sector[vm.g_sp->sectnum].lotag == 1 && klabs(vm.g_sp->z-sector[vm.g_sp->sectnum].floorz) < (32<<8)); break; case CON_IFINWATER: @@ -2788,23 +2788,23 @@ static int32_t X_DoExecute(void) break; case GET_SHIELD: - g_player[vm.g_p].ps->shield_amount += *insptr;// 100; + g_player[vm.g_p].ps->shield_amount += *insptr;// 100; if (g_player[vm.g_p].ps->shield_amount > g_player[vm.g_p].ps->max_shield_amount) g_player[vm.g_p].ps->shield_amount = g_player[vm.g_p].ps->max_shield_amount; break; case GET_SCUBA: - g_player[vm.g_p].ps->scuba_amount = *insptr;// 1600; + g_player[vm.g_p].ps->scuba_amount = *insptr;// 1600; g_player[vm.g_p].ps->inven_icon = 6; break; case GET_HOLODUKE: - g_player[vm.g_p].ps->holoduke_amount = *insptr;// 1600; + g_player[vm.g_p].ps->holoduke_amount = *insptr;// 1600; g_player[vm.g_p].ps->inven_icon = 3; break; case GET_JETPACK: - g_player[vm.g_p].ps->jetpack_amount = *insptr;// 1600; + g_player[vm.g_p].ps->jetpack_amount = *insptr;// 1600; g_player[vm.g_p].ps->inven_icon = 4; break; @@ -2921,9 +2921,8 @@ static int32_t X_DoExecute(void) break; case CON_GUTS: - insptr += 2; - A_DoGuts(vm.g_i,*(insptr-1),*insptr); - insptr++; + A_DoGuts(vm.g_i,*(insptr+1),*(insptr+2)); + insptr += 3; break; case CON_IFSPAWNEDBY: @@ -3626,7 +3625,6 @@ static int32_t X_DoExecute(void) P_CheckWeapon(g_player[j].ps); else P_SelectNextInvItem(g_player[j].ps); } - break; case CON_GETPLAYERANGLE: @@ -3664,7 +3662,6 @@ static int32_t X_DoExecute(void) int32_t index = Gv_GetVarX(*insptr++); int32_t value = Gv_GetVarX(*insptr++); -// SetGameArrayID(j,index,value); if (j<0 || j >= g_gameArrayCount || index >= aGameArrays[j].size || index < 0) { OSD_Printf(OSD_ERROR "Gv_SetVar(): tried to set invalid array ID (%d) or index out of bounds from sprite %d (%d), player %d\n",j,vm.g_i,sprite[vm.g_i].picnum,vm.g_p); @@ -3749,18 +3746,16 @@ static int32_t X_DoExecute(void) insptr++; { int32_t j=*insptr++; - { - int32_t index = Gv_GetVar(*insptr++, vm.g_i, vm.g_p); - 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); - if (index>aGameArrays[j].size) break; - if (index1>aGameArrays[j1].size) break; - if ((index+value)>aGameArrays[j].size) value=aGameArrays[j].size-index; - if ((index1+value)>aGameArrays[j1].size) value=aGameArrays[j1].size-index1; - memcpy(aGameArrays[j1].plValues+index1,aGameArrays[j].plValues+index,value*sizeof(int)); - break; - } + int32_t index = Gv_GetVar(*insptr++, vm.g_i, vm.g_p); + 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); + + if (index > aGameArrays[j].size || index1 > aGameArrays[j1].size) break; + if ((index+value)>aGameArrays[j].size) value=aGameArrays[j].size-index; + if ((index1+value)>aGameArrays[j1].size) value=aGameArrays[j1].size-index1; + Bmemcpy(aGameArrays[j1].plValues+index1, aGameArrays[j].plValues+index, value * sizeof(intptr_t)); + break; } case CON_RANDVAR: