git-svn-id: https://svn.eduke32.com/eduke32@1393 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2009-05-28 02:55:46 +00:00
parent d897eca725
commit 4e5bde3a79
8 changed files with 70 additions and 64 deletions

View file

@ -3366,18 +3366,20 @@ void kzclose()
//====================== ZIP decompression code ends ========================= //====================== ZIP decompression code ends =========================
//===================== HANDY PICTURE function begins ======================== //===================== HANDY PICTURE function begins ========================
#include "cache1d.h"
void kpzload(const char *filnam, intptr_t *pic, int32_t *bpl, int32_t *xsiz, int32_t *ysiz) void kpzload(const char *filnam, intptr_t *pic, int32_t *bpl, int32_t *xsiz, int32_t *ysiz)
{ {
char *buf; char *buf;
int32_t leng; int32_t leng;
int32_t handle = kopen4load((char *)filnam, 0);
(*pic) = 0; (*pic) = 0;
if (!kzopen(filnam)) return; if (handle < 0) return;
leng = kzfilelength(); leng = kfilelength(handle);
buf = (char *)malloc(leng); if (!buf) return; buf = (char *)malloc(leng); if (!buf) return;
kzread(buf,leng); kread(handle,buf,leng);
kzclose(); kclose(handle);
kpgetdim(buf,leng,xsiz,ysiz); kpgetdim(buf,leng,xsiz,ysiz);
(*bpl) = ((*xsiz)<<2); (*bpl) = ((*xsiz)<<2);

View file

@ -5955,7 +5955,7 @@ void polymost_initosdfuncs(void)
(void *)&r_parallaxskyclamping, CVAR_BOOL, 0, 0, 1 }, (void *)&r_parallaxskyclamping, CVAR_BOOL, 0, 0, 1 },
{ "r_parallaxskypanning","r_parallaxskypanning: enable/disable parallaxed floor/ceiling panning when drawing a parallaxed sky", { "r_parallaxskypanning","r_parallaxskypanning: enable/disable parallaxed floor/ceiling panning when drawing a parallaxed sky",
(void *)&r_parallaxskypanning, CVAR_BOOL, 0, 0, 1 }, (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_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_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 }, { "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_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_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_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_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_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_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, 0, -10, 10 }, { "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, 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, 0, 0, 1 }, { "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, 0, -10, 1000 }, { "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, 0, -10, 1000 }, { "r_pr_specularfactor", "r_pr_specularfactor: overriden specular material factor", (void*)&pr_specularfactor, CVAR_FLOAT | CVAR_NOSAVE, 0, -10, 1000 },
#endif #endif
{ "r_models","r_models: enable/disable model rendering in >8-bit mode",(void *)&usemodels, CVAR_BOOL, 0, 0, 1 }, { "r_models","r_models: enable/disable model rendering in >8-bit mode",(void *)&usemodels, CVAR_BOOL, 0, 0, 1 },

View file

@ -7832,14 +7832,14 @@ void G_MoveWorld(void)
while (i >= 0) while (i >= 0)
{ {
j = nextspritestat[i];
if (A_CheckSpriteFlags(i, SPRITE_NOEVENTCODE)) if (A_CheckSpriteFlags(i, SPRITE_NOEVENTCODE))
{ {
i = j; i = nextspritestat[i];
continue; continue;
} }
j = nextspritestat[i];
pl = A_FindPlayer(&sprite[i],&p); pl = A_FindPlayer(&sprite[i],&p);
X_OnEvent(EVENT_GAME,i, pl, p); X_OnEvent(EVENT_GAME,i, pl, p);
i = j; i = j;

View file

@ -7469,6 +7469,21 @@ static void Keys2d(void)
searchsector=cursectornum; 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 (keystatus[KEYSC_TAB]) //TAB
{ {
if (cursectornum >= 0) if (cursectornum >= 0)
@ -10286,21 +10301,6 @@ static void Keys2d3d(void)
else message("Sprite clipping enabled"); 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 if (eitherCTRL) //CTRL
{ {
char *f; char *f;

View file

@ -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","ForceSetup",&ud.config.ForceSetup);
SCRIPT_GetNumber(ud.config.scripthandle, "Setup","NoAutoLoad",&ud.config.NoAutoLoad); SCRIPT_GetNumber(ud.config.scripthandle, "Setup","NoAutoLoad",&ud.config.NoAutoLoad);
#ifdef _WIN32 // #ifdef _WIN32
if (g_noSetup == 0 && mod_dir[0] == '/') if (g_noSetup == 0 && mod_dir[0] == '/')
{ {
struct stat st; struct stat st;
SCRIPT_GetString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]); 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) if ((st.st_mode & S_IFDIR) != S_IFDIR)
{ {
@ -687,7 +687,7 @@ int32_t CONFIG_ReadSetup(void)
} }
} }
} }
#endif // #endif
{ {
extern char defaultduke3dgrp[BMAX_PATH]; extern char defaultduke3dgrp[BMAX_PATH];
@ -1249,10 +1249,10 @@ void CONFIG_WriteSetup(void)
SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]); SCRIPT_PutString(ud.config.scripthandle, "Setup","SelectedGRP",&duke3dgrp[0]);
#ifdef _WIN32 // #ifdef _WIN32
if (g_noSetup == 0) if (g_noSetup == 0)
SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]); SCRIPT_PutString(ud.config.scripthandle, "Setup","ModDir",&mod_dir[0]);
#endif // #endif
{ {
char commmacro[] = "CommbatMacro# "; char commmacro[] = "CommbatMacro# ";

View file

@ -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 (s->owner >= 0 && display_mirror == 0 && g_player[p].ps->over_shoulder_on == 0)
if (ud.multimode < 2 || (ud.multimode > 1 && p == screenpeek)) if (ud.multimode < 2 || (ud.multimode > 1 && p == screenpeek))
{ {
// t->owner = -1; if (getrendermode() == 4)
// t->xrepeat = t->yrepeat = 0;
t->cstat |= 16384; t->cstat |= 16384;
else
{
t->owner = -1;
t->xrepeat = t->yrepeat = 0;
continue;
}
#if defined(POLYMOST) && defined(USE_OPENGL) #if defined(POLYMOST) && defined(USE_OPENGL)
if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD)) if (getrendermode() >= 3 && usemodels && md_tilehasmodel(s->picnum,t->pal) >= 0 && !(spriteext[i].flags&SPREXT_NOTMD))
{ {

View file

@ -1515,9 +1515,11 @@ static int32_t C_GetNextKeyword(void) //Returns its code #
if (i == CON_LEFTBRACE || i == CON_RIGHTBRACE || i == CON_NULLOP) if (i == CON_LEFTBRACE || i == CON_RIGHTBRACE || i == CON_NULLOP)
*g_scriptPtr = i + (IFELSE_MAGIC<<12); *g_scriptPtr = i + (IFELSE_MAGIC<<12);
else *g_scriptPtr = i + (g_lineNumber<<12); else *g_scriptPtr = i + (g_lineNumber<<12);
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
textptr += l; textptr += l;
g_scriptPtr++; g_scriptPtr++;
if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug)
initprintf("%s:%d: debug: translating keyword `%s'.\n",g_szScriptFileName,g_lineNumber,keyw[i]); initprintf("%s:%d: debug: translating keyword `%s'.\n",g_szScriptFileName,g_lineNumber,keyw[i]);
return i; return i;
@ -2362,30 +2364,31 @@ static int32_t C_ParseCommand(void)
return 0; return 0;
} }
i = hash_find(&gamevarH,label+(g_numLabels<<6)); if (hash_find(&gamevarH,label+(g_numLabels<<6))>=0)
if (i>=0)
{ {
g_numCompilerWarnings++; g_numCompilerWarnings++;
C_ReportError(WARNING_NAMEMATCHESVAR); C_ReportError(WARNING_NAMEMATCHESVAR);
} }
i = hash_find(&labelH,label+(g_numLabels<<6)); if ((i = hash_find(&labelH,label+(g_numLabels<<6))) >= 0)
if (i>=0)
{ {
g_numCompilerWarnings++; g_numCompilerWarnings++;
initprintf("%s:%d: warning: duplicate move `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6)); initprintf("%s:%d: warning: duplicate move `%s' ignored.\n",g_szScriptFileName,g_lineNumber,label+(g_numLabels<<6));
} }
if (i == -1) if (i == -1)
{ {
hash_add(&labelH,label+(g_numLabels<<6),g_numLabels); hash_add(&labelH,label+(g_numLabels<<6),g_numLabels);
labeltype[g_numLabels] = LABEL_MOVE; labeltype[g_numLabels] = LABEL_MOVE;
labelcode[g_numLabels++] = (intptr_t) g_scriptPtr; labelcode[g_numLabels++] = (intptr_t) g_scriptPtr;
} }
for (j=1; j>=0; j--) for (j=1; j>=0; j--)
{ {
if (C_GetKeyword() >= 0) break; if (C_GetKeyword() >= 0) break;
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE);
} }
for (k=j; k>=0; k--) for (k=j; k>=0; k--)
{ {
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));

View file

@ -2756,7 +2756,7 @@ static int32_t X_DoExecute(void)
break; break;
case CON_IFONWATER: 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; break;
case CON_IFINWATER: case CON_IFINWATER:
@ -2921,9 +2921,8 @@ static int32_t X_DoExecute(void)
break; break;
case CON_GUTS: case CON_GUTS:
insptr += 2; A_DoGuts(vm.g_i,*(insptr+1),*(insptr+2));
A_DoGuts(vm.g_i,*(insptr-1),*insptr); insptr += 3;
insptr++;
break; break;
case CON_IFSPAWNEDBY: case CON_IFSPAWNEDBY:
@ -3626,7 +3625,6 @@ static int32_t X_DoExecute(void)
P_CheckWeapon(g_player[j].ps); P_CheckWeapon(g_player[j].ps);
else P_SelectNextInvItem(g_player[j].ps); else P_SelectNextInvItem(g_player[j].ps);
} }
break; break;
case CON_GETPLAYERANGLE: case CON_GETPLAYERANGLE:
@ -3664,7 +3662,6 @@ static int32_t X_DoExecute(void)
int32_t index = Gv_GetVarX(*insptr++); int32_t index = Gv_GetVarX(*insptr++);
int32_t value = 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) 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); 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,19 +3746,17 @@ static int32_t X_DoExecute(void)
insptr++; insptr++;
{ {
int32_t j=*insptr++; int32_t j=*insptr++;
{
int32_t index = Gv_GetVar(*insptr++, vm.g_i, vm.g_p); int32_t index = Gv_GetVar(*insptr++, vm.g_i, vm.g_p);
int32_t j1=*insptr++; int32_t j1=*insptr++;
int32_t index1 = Gv_GetVar(*insptr++, vm.g_i, vm.g_p); 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 value = Gv_GetVar(*insptr++, vm.g_i, vm.g_p);
if (index>aGameArrays[j].size) break;
if (index1>aGameArrays[j1].size) break; if (index > aGameArrays[j].size || index1 > aGameArrays[j1].size) break;
if ((index+value)>aGameArrays[j].size) value=aGameArrays[j].size-index; if ((index+value)>aGameArrays[j].size) value=aGameArrays[j].size-index;
if ((index1+value)>aGameArrays[j1].size) value=aGameArrays[j1].size-index1; if ((index1+value)>aGameArrays[j1].size) value=aGameArrays[j1].size-index1;
memcpy(aGameArrays[j1].plValues+index1,aGameArrays[j].plValues+index,value*sizeof(int)); Bmemcpy(aGameArrays[j1].plValues+index1, aGameArrays[j].plValues+index, value * sizeof(intptr_t));
break; break;
} }
}
case CON_RANDVAR: case CON_RANDVAR:
insptr++; insptr++;