Very few actual changes... mostly formatting fixes from astyle

git-svn-id: https://svn.eduke32.com/eduke32@1593 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2010-01-23 22:12:02 +00:00
parent addf597188
commit e65891aad6
33 changed files with 1541 additions and 1655 deletions

View file

@ -265,7 +265,7 @@ $(JAUDIOLIBDIR)/$(JAUDIOLIB):
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)
printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(JAUDIOLIBDIR)\033[0;35m \033[0m\n" printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)/$(JAUDIOLIBDIR)\033[0;35m \033[0m\n"
endif endif
$(MAKE) -C $(JAUDIOLIBDIR) PRETTY_OUTPUT=$(PRETTY_OUTPUT) EROOT=$(EROOT) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) $(MAKE) -C $(JAUDIOLIBDIR) PRETTY_OUTPUT=$(PRETTY_OUTPUT) EROOT=$(EROOT) RELEASE=$(RELEASE) OPTLEVEL=$(OPTLEVEL) DEBUGANYWAY=$(DEBUGANYWAY)
ifeq ($(PRETTY_OUTPUT),1) ifeq ($(PRETTY_OUTPUT),1)
printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m \033[0m\n" printf "\033[K\033[0;35mChanging dir to \033[1;35m$(CURDIR)\033[0;35m \033[0m\n"
endif endif

View file

@ -1,5 +1,6 @@
#ifndef __osxbits_h__ #ifndef __osxbits_h__
#define __osxbits_h__ #define __osxbits_h__
#include <sys/types.h>
int32_t osx_msgbox(char *name, char *msg); int32_t osx_msgbox(char *name, char *msg);
int32_t osx_ynbox(char *name, char *msg); int32_t osx_ynbox(char *name, char *msg);

View file

@ -54,6 +54,9 @@ extern float pr_specularpower;
extern float pr_specularfactor; extern float pr_specularfactor;
extern int32_t pr_ati_fboworkaround; extern int32_t pr_ati_fboworkaround;
extern int32_t pr_ati_nodepthoffset; extern int32_t pr_ati_nodepthoffset;
#ifdef __APPLE__
extern int32_t pr_ati_textureformat_one;
#endif
extern int32_t r_pr_maxlightpasses; extern int32_t r_pr_maxlightpasses;

View file

@ -2639,7 +2639,7 @@ static int32_t kzcheckhash(const char *filnam, char **zipnam, int32_t *fileoffs,
(*zipnam) = &kzhashbuf[*(int32_t *)&kzhashbuf[i+8]]; (*zipnam) = &kzhashbuf[*(int32_t *)&kzhashbuf[i+8]];
(*fileoffs) = *(int32_t *)&kzhashbuf[i+12]; (*fileoffs) = *(int32_t *)&kzhashbuf[i+12];
(*fileleng) = *(int32_t *)&kzhashbuf[i+16]; (*fileleng) = *(int32_t *)&kzhashbuf[i+16];
(*iscomp) = kzhashbuf[i+20]; (*iscomp) = *(int32_t *)&kzhashbuf[i+20];
return(1); return(1);
} }
return(0); return(0);

View file

@ -1050,6 +1050,20 @@ static md2model_t *md2load(int32_t fil, const char *filnam)
{ {
m->glcmds[i] = B_LITTLE32(m->glcmds[i]); m->glcmds[i] = B_LITTLE32(m->glcmds[i]);
} }
for (i = head.numtris-1; i>=0; i--)
{
m->tris[i].v[0] = B_LITTLE16(m->tris[i].v[0]);
m->tris[i].v[1] = B_LITTLE16(m->tris[i].v[1]);
m->tris[i].v[2] = B_LITTLE16(m->tris[i].v[2]);
m->tris[i].u[0] = B_LITTLE16(m->tris[i].u[0]);
m->tris[i].u[1] = B_LITTLE16(m->tris[i].u[1]);
m->tris[i].u[2] = B_LITTLE16(m->tris[i].u[2]);
}
for(i = head.numuv-1; i>=0; i--)
{
m->uv[i].u = B_LITTLE16(m->uv[i].u);
m->uv[i].v = B_LITTLE16(m->uv[i].v);
}
} }
#endif #endif

View file

@ -56,9 +56,8 @@ DEALINGS IN THE SOFTWARE.
// #define NOINLINE // #define NOINLINE
#endif #endif
#include "nedmalloc.h" #include "nedmalloc.h"
#if defined(WIN32) #if defined(_WIN32)
#include <malloc.h> #include <malloc.h>
#endif #endif
#ifdef __linux__ #ifdef __linux__

View file

@ -82,6 +82,7 @@ Low priority:
#include "engine_priv.h" #include "engine_priv.h"
#include "hightile.h" #include "hightile.h"
#include "polymost.h" #include "polymost.h"
#include "polymer.h"
#include "scriptfile.h" #include "scriptfile.h"
#include "cache1d.h" #include "cache1d.h"
#include "kplib.h" #include "kplib.h"
@ -1378,6 +1379,9 @@ void writexcache(char *fn, int32_t len, int32_t dameth, char effect, texcachehea
if (gi != GL_TRUE) goto failure; // an uncompressed mipmap if (gi != GL_TRUE) goto failure; // an uncompressed mipmap
bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_INTERNAL_FORMAT, (GLint *)&gi); bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_INTERNAL_FORMAT, (GLint *)&gi);
if (bglGetError() != GL_NO_ERROR) goto failure; if (bglGetError() != GL_NO_ERROR) goto failure;
#ifdef __APPLE__
if(pr_ati_textureformat_one && gi == 1 ) gi = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
#endif
pict.format = B_LITTLE32(gi); pict.format = B_LITTLE32(gi);
bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_WIDTH, (GLint *)&gi); bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_WIDTH, (GLint *)&gi);
if (bglGetError() != GL_NO_ERROR) goto failure; if (bglGetError() != GL_NO_ERROR) goto failure;
@ -1523,7 +1527,7 @@ int32_t gloadtile_cached(int32_t fil, texcacheheader *head, int32_t *doalloc, pt
GLint format; GLint format;
bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_INTERNAL_FORMAT, &format); bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_INTERNAL_FORMAT, &format);
if (bglGetError() != GL_NO_ERROR) goto failure; if (bglGetError() != GL_NO_ERROR) goto failure;
format = B_LITTLE32(format); // format = B_LITTLE32(format);
if (pict.format != format) if (pict.format != format)
{ {
OSD_Printf("invalid texture cache file format %d %d\n",pict.format, format); OSD_Printf("invalid texture cache file format %d %d\n",pict.format, format);
@ -6234,15 +6238,15 @@ int32_t dedxtfilter(int32_t fil, texcachepicture *pict, char *pic, void *midbuf,
void *inbuf; void *inbuf;
#if (USEKENFILTER == 0) #if (USEKENFILTER == 0)
uint32_t cleng; uint32_t cleng;
if (kread(fil, &cleng, sizeof(uint32_t)) != sizeof(uint32_t)) return -1; cleng = B_LITTLE32(cleng); if (Bread(fil, &cleng, sizeof(uint32_t)) != sizeof(uint32_t)) return -1; cleng = B_LITTLE32(cleng);
#ifdef USELZF #ifdef USELZF
if (ispacked && cleng < pict->size) inbuf = packbuf; else inbuf = pic; if (ispacked && cleng < pict->size) inbuf = packbuf; else inbuf = pic;
if (kread(fil, inbuf, cleng) != cleng) return -1; if (Bread(fil, inbuf, cleng) != cleng) return -1;
if (ispacked && cleng < pict->size) if (ispacked && cleng < pict->size)
if (qlz_decompress(packbuf, pic, state_decompress) == 0) return -1; if (qlz_decompress(packbuf, pic, state_decompress) == 0) return -1;
#else #else
if (ispacked) inbuf = packbuf; else inbuf = pic; if (ispacked) inbuf = packbuf; else inbuf = pic;
if (kread(fil, inbuf, cleng) != cleng) return -1; if (Bread(fil, inbuf, cleng) != cleng) return -1;
if (ispacked && lzwuncompress(packbuf, cleng, pic, pict->size) != pict->size) return -1; if (ispacked && lzwuncompress(packbuf, cleng, pic, pict->size) != pict->size) return -1;
#endif #endif
#else #else

View file

@ -1147,6 +1147,14 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
initprintf("Enabling ATI R520 polygon offset workaround.\n"); initprintf("Enabling ATI R520 polygon offset workaround.\n");
} else } else
pr_ati_nodepthoffset = 0; pr_ati_nodepthoffset = 0;
#ifdef __APPLE__
//See bug description at http://lists.apple.com/archives/mac-opengl/2005/Oct/msg00169.html
if (!Bstrncmp(glinfo.renderer,"ATI Radeon 9600", 15)) {
pr_ati_textureformat_one = 1;
initprintf("Enabling ATI Radeon 9600 texture format workaround.\n");
} else
pr_ati_textureformat_one = 0;
#endif
} else } else
pr_ati_fboworkaround = 0; pr_ati_fboworkaround = 0;
#endif #endif
@ -1530,20 +1538,24 @@ static SDL_Surface * loadappicon(void)
// handleevents() -- process the SDL message queue // handleevents() -- process the SDL message queue
// returns !0 if there was an important event worth checking (like quitting) // returns !0 if there was an important event worth checking (like quitting)
// //
static inline void SetKey(int32_t key, int32_t state)
{
keystatus[remap[key]] = state;
if (state)
{
keyfifo[keyfifoend] = remap[key];
keyfifo[(keyfifoend+1)&(KEYFIFOSIZ-1)] = state;
keyfifoend = ((keyfifoend+2)&(KEYFIFOSIZ-1));
}
}
int32_t handleevents(void) int32_t handleevents(void)
{ {
int32_t code, rv=0, j; int32_t code, rv=0, j;
SDL_Event ev; SDL_Event ev;
#define SetKey(key,state) { \
keystatus[remap[key]] = state; \
if (state) { \
keyfifo[keyfifoend] = remap[key]; \
keyfifo[(keyfifoend+1)&(KEYFIFOSIZ-1)] = state; \
keyfifoend = ((keyfifoend+2)&(KEYFIFOSIZ-1)); \
} \
}
while (SDL_PollEvent(&ev)) while (SDL_PollEvent(&ev))
{ {
switch (ev.type) switch (ev.type)
@ -2087,7 +2099,7 @@ static int32_t buildkeytranslationtable(void)
#if defined _WIN32 #if defined _WIN32
# define WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN
# include <windows.h> # include <windows.h>
#elif defined __linux || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ #elif defined __linux || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __APPLE__
# include <sys/mman.h> # include <sys/mman.h>
#endif #endif
@ -2102,7 +2114,7 @@ void makeasmwriteable(void)
initprint("Error making code writeable\n"); initprint("Error making code writeable\n");
return; return;
} }
# elif defined __linux || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ # elif defined __linux || defined __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ || defined __APPLE__
int32_t pagesize; int32_t pagesize;
size_t dep_begin_page; size_t dep_begin_page;
pagesize = sysconf(_SC_PAGE_SIZE); pagesize = sysconf(_SC_PAGE_SIZE);

View file

@ -788,13 +788,16 @@ static struct _joydevicedefn *thisjoydef = NULL, joyfeatures[] =
#undef featurecount #undef featurecount
// I don't see any pressing need to store the key-up events yet // I don't see any pressing need to store the key-up events yet
#define SetKey(key,state) { \ static inline void SetKey(int32_t key, int32_t state)
keystatus[remap[key]] = state; \ {
if (state) { \ keystatus[remap[key]] = state;
keyfifo[keyfifoend] = remap[key]; \
keyfifo[(keyfifoend+1)&(KEYFIFOSIZ-1)] = state; \ if (state)
keyfifoend = ((keyfifoend+2)&(KEYFIFOSIZ-1)); \ {
} \ keyfifo[keyfifoend] = remap[key];
keyfifo[(keyfifoend+1)&(KEYFIFOSIZ-1)] = state;
keyfifoend = ((keyfifoend+2)&(KEYFIFOSIZ-1));
}
} }
char map_dik_code(int32_t scanCode) char map_dik_code(int32_t scanCode)
@ -883,7 +886,7 @@ void setkeypresscallback(void (*callback)(int32_t, int32_t)) { keypresscallback
void setmousepresscallback(void (*callback)(int32_t, int32_t)) { mousepresscallback = callback; } void setmousepresscallback(void (*callback)(int32_t, int32_t)) { mousepresscallback = callback; }
void setjoypresscallback(void (*callback)(int32_t, int32_t)) { joypresscallback = callback; } void setjoypresscallback(void (*callback)(int32_t, int32_t)) { joypresscallback = callback; }
#define DINPUT_EVENTS 4 #define DINPUT_EVENTS 16
DWORD WINAPI ProcessMouse(LPVOID lpThreadParameter) DWORD WINAPI ProcessMouse(LPVOID lpThreadParameter)
{ {
@ -909,11 +912,13 @@ DWORD WINAPI ProcessMouse(LPVOID lpThreadParameter)
result = IDirectInputDevice7_GetDeviceData(lpDID[MOUSE], sizeof(DIDEVICEOBJECTDATA), result = IDirectInputDevice7_GetDeviceData(lpDID[MOUSE], sizeof(DIDEVICEOBJECTDATA),
(LPDIDEVICEOBJECTDATA)&didod[0], &dwElements, 0); (LPDIDEVICEOBJECTDATA)&didod[0], &dwElements, 0);
if (!dwElements || result != DI_OK) if (!dwElements || (result != DI_OK && result != DI_BUFFEROVERFLOW))
continue; continue;
do do
{ {
int32_t bit = 1<<(didod[dwElements-1].dwOfs - DIMOFS_BUTTON0);
switch (didod[dwElements-1].dwOfs) switch (didod[dwElements-1].dwOfs)
{ {
case DIMOFS_X: case DIMOFS_X:
@ -941,74 +946,21 @@ DWORD WINAPI ProcessMouse(LPVOID lpThreadParameter)
} }
break; break;
case DIMOFS_BUTTON0:
{
if (didod[dwElements-1].dwData & 0x80) mouseb |= 1;
else mouseb &= ~1;
if (mousepresscallback)
mousepresscallback(1, mouseb & 1);
}
break;
case DIMOFS_BUTTON1:
{
if (didod[dwElements-1].dwData & 0x80) mouseb |= 2;
else mouseb &= ~2;
if (mousepresscallback)
mousepresscallback(2, mouseb & 2);
}
break;
case DIMOFS_BUTTON2:
{
if (didod[dwElements-1].dwData & 0x80) mouseb |= 4;
else mouseb &= ~4;
if (mousepresscallback)
mousepresscallback(3, mouseb & 4);
}
break;
case DIMOFS_BUTTON3:
{
if (didod[dwElements-1].dwData & 0x80) mouseb |= 8;
else mouseb &= ~8;
if (mousepresscallback)
mousepresscallback(4, mouseb & 8);
}
break;
case DIMOFS_BUTTON4: case DIMOFS_BUTTON4:
{
OSD_Printf("got button4\n");
if (didod[dwElements-1].dwData & 0x80) mouseb |= 64;
else mouseb &= ~64;
if (mousepresscallback)
mousepresscallback(7, mouseb & 64);
}
break;
case DIMOFS_BUTTON5: case DIMOFS_BUTTON5:
{
OSD_Printf("got button5\n");
if (didod[dwElements-1].dwData & 0x80) mouseb |= 128;
else mouseb &= ~128;
if (mousepresscallback)
mousepresscallback(8, mouseb & 128);
}
break;
case DIMOFS_BUTTON6: case DIMOFS_BUTTON6:
{
OSD_Printf("got button6\n");
if (didod[dwElements-1].dwData & 0x80) mouseb |= 256;
else mouseb &= ~256;
if (mousepresscallback)
mousepresscallback(9, mouseb & 256);
}
break;
case DIMOFS_BUTTON7: case DIMOFS_BUTTON7:
{ didod[dwElements-1].dwOfs += 2; // skip mousewheel buttons
OSD_Printf("got button7\n"); bit = 1<<(didod[dwElements-1].dwOfs - DIMOFS_BUTTON0);
if (didod[dwElements-1].dwData & 0x80) mouseb |= 512; case DIMOFS_BUTTON0:
else mouseb &= ~512; case DIMOFS_BUTTON1:
case DIMOFS_BUTTON2:
case DIMOFS_BUTTON3:
if (didod[dwElements-1].dwData & 0x80) mouseb |= bit;
else mouseb &= ~bit;
if (mousepresscallback) if (mousepresscallback)
mousepresscallback(10, mouseb & 512); mousepresscallback(didod[dwElements-1].dwOfs - DIMOFS_BUTTON0 + 1, mouseb & bit);
} break;
break;
} }
} }
while (--dwElements); while (--dwElements);

View file

@ -144,10 +144,6 @@
RelativePath=".\build\include\mmulti.h" RelativePath=".\build\include\mmulti.h"
> >
</File> </File>
<File
RelativePath=".\build\include\mmulti_unstable.h"
>
</File>
<File <File
RelativePath=".\build\include\nedmalloc.h" RelativePath=".\build\include\nedmalloc.h"
> >
@ -284,10 +280,6 @@
RelativePath=".\build\src\mdsprite.c" RelativePath=".\build\src\mdsprite.c"
> >
</File> </File>
<File
RelativePath=".\build\src\mmulti_unstable.c"
>
</File>
<File <File
RelativePath=".\build\src\nedmalloc.c" RelativePath=".\build\src\nedmalloc.c"
> >

View file

@ -402,7 +402,7 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
if ((daz > ActorExtra[spritenum].ceilingz) && (daz <= ActorExtra[spritenum].floorz)/* if ((daz > ActorExtra[spritenum].ceilingz) && (daz <= ActorExtra[spritenum].floorz)/*
&& &&
(osectnum == dasectnum || cansee(oldx, oldy, spr->z - bg, osectnum, spr->x, spr->y, daz - bg, dasectnum))*/ (osectnum == dasectnum || cansee(oldx, oldy, spr->z - bg, osectnum, spr->x, spr->y, daz - bg, dasectnum))*/
) )
spr->z = daz; spr->z = daz;
else if (retval == 0) retval = 16384+dasectnum; else if (retval == 0) retval = 16384+dasectnum;
@ -458,9 +458,10 @@ int32_t A_MoveSprite(int32_t spritenum, const vec3_t *change, uint32_t cliptype)
inline int32_t A_SetSprite(int32_t i,uint32_t cliptype) inline int32_t A_SetSprite(int32_t i,uint32_t cliptype)
{ {
vec3_t davect = { (sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14, vec3_t davect = {(sprite[i].xvel*(sintable[(sprite[i].ang+512)&2047]))>>14,
(sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14, (sprite[i].xvel*(sintable[sprite[i].ang&2047]))>>14,
sprite[i].zvel }; sprite[i].zvel
};
return (A_MoveSprite(i,&davect,cliptype)==0); return (A_MoveSprite(i,&davect,cliptype)==0);
} }
@ -3355,7 +3356,7 @@ static void G_MoveTransports(void)
if (onfloorz) if (onfloorz)
{ {
if (sprite[j].statnum == STAT_PROJECTILE || if (sprite[j].statnum == STAT_PROJECTILE ||
(G_CheckPlayerInSector(sect) == -1 && G_CheckPlayerInSector(sprite[OW].sectnum) == -1)) (G_CheckPlayerInSector(sect) == -1 && G_CheckPlayerInSector(sprite[OW].sectnum) == -1))
{ {
sprite[j].x += (sprite[OW].x-SX); sprite[j].x += (sprite[OW].x-SX);
sprite[j].y += (sprite[OW].y-SY); sprite[j].y += (sprite[OW].y-SY);
@ -5675,38 +5676,38 @@ static void G_MoveEffectors(void) //STATNUM 3
x = (s->xvel*sintable[s->ang&2047])>>14; x = (s->xvel*sintable[s->ang&2047])>>14;
TRAVERSE_CONNECT(p) TRAVERSE_CONNECT(p)
if (sector[g_player[p].ps->cursectnum].lotag != 2) if (sector[g_player[p].ps->cursectnum].lotag != 2)
{
if (g_playerSpawnPoints[p].os == s->sectnum)
{ {
if (g_playerSpawnPoints[p].os == s->sectnum) g_playerSpawnPoints[p].ox += m;
g_playerSpawnPoints[p].oy += x;
}
if (s->sectnum == sprite[g_player[p].ps->i].sectnum)
{
rotatepoint(s->x,s->y,g_player[p].ps->posx,g_player[p].ps->posy,q,&g_player[p].ps->posx,&g_player[p].ps->posy);
g_player[p].ps->posx += m;
g_player[p].ps->posy += x;
g_player[p].ps->bobposx += m;
g_player[p].ps->bobposy += x;
g_player[p].ps->ang += q;
if (g_netServer || numplayers > 1)
{ {
g_playerSpawnPoints[p].ox += m; g_player[p].ps->oposx = g_player[p].ps->posx;
g_playerSpawnPoints[p].oy += x; g_player[p].ps->oposy = g_player[p].ps->posy;
} }
if (sprite[g_player[p].ps->i].extra <= 0)
if (s->sectnum == sprite[g_player[p].ps->i].sectnum)
{ {
rotatepoint(s->x,s->y,g_player[p].ps->posx,g_player[p].ps->posy,q,&g_player[p].ps->posx,&g_player[p].ps->posy); sprite[g_player[p].ps->i].x = g_player[p].ps->posx;
sprite[g_player[p].ps->i].y = g_player[p].ps->posy;
g_player[p].ps->posx += m;
g_player[p].ps->posy += x;
g_player[p].ps->bobposx += m;
g_player[p].ps->bobposy += x;
g_player[p].ps->ang += q;
if (g_netServer || numplayers > 1)
{
g_player[p].ps->oposx = g_player[p].ps->posx;
g_player[p].ps->oposy = g_player[p].ps->posy;
}
if (sprite[g_player[p].ps->i].extra <= 0)
{
sprite[g_player[p].ps->i].x = g_player[p].ps->posx;
sprite[g_player[p].ps->i].y = g_player[p].ps->posy;
}
} }
} }
}
j = headspritesect[s->sectnum]; j = headspritesect[s->sectnum];
while (j >= 0) while (j >= 0)
{ {
@ -5758,7 +5759,7 @@ static void G_MoveEffectors(void) //STATNUM 3
{ {
l = nextspritesect[j]; l = nextspritesect[j];
if (sprite[j].statnum == STAT_ACTOR && A_CheckEnemySprite(&sprite[j]) && if (sprite[j].statnum == STAT_ACTOR && A_CheckEnemySprite(&sprite[j]) &&
sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS)
{ {
k = sprite[j].sectnum; k = sprite[j].sectnum;
updatesector(sprite[j].x,sprite[j].y,&k); updatesector(sprite[j].x,sprite[j].y,&k);
@ -5931,7 +5932,7 @@ static void G_MoveEffectors(void) //STATNUM 3
{ {
l = nextspritesect[j]; l = nextspritesect[j];
if (sprite[j].statnum == STAT_ACTOR && A_CheckEnemySprite(&sprite[j]) && if (sprite[j].statnum == STAT_ACTOR && A_CheckEnemySprite(&sprite[j]) &&
sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS) sprite[j].picnum != SECTOREFFECTOR && sprite[j].picnum != LOCATORS)
{ {
// if(sprite[j].sectnum != s->sectnum) // if(sprite[j].sectnum != s->sectnum)
{ {
@ -7140,8 +7141,8 @@ static void G_MoveEffectors(void) //STATNUM 3
} }
TRAVERSE_CONNECT(p) TRAVERSE_CONNECT(p)
if (sprite[g_player[p].ps->i].sectnum == s->sectnum && g_player[p].ps->on_ground) if (sprite[g_player[p].ps->i].sectnum == s->sectnum && g_player[p].ps->on_ground)
g_player[p].ps->posz += s->zvel; g_player[p].ps->posz += s->zvel;
A_MoveSector(i); A_MoveSector(i);
setsprite(i,(vec3_t *)s); setsprite(i,(vec3_t *)s);

View file

@ -245,7 +245,7 @@ void create_map_snapshot(void)
{ {
mapstate->sectors = (sectortype *)Bcalloc(1, sizeof(sectortype) * numsectors); mapstate->sectors = (sectortype *)Bcalloc(1, sizeof(sectortype) * numsectors);
mapstate->sectsiz = j = qlz_compress(&sector[0], (char *)&mapstate->sectors[0], mapstate->sectsiz = j = qlz_compress(&sector[0], (char *)&mapstate->sectors[0],
sizeof(sectortype) * numsectors, state_compress); sizeof(sectortype) * numsectors, state_compress);
mapstate->sectors = (sectortype *)Brealloc(mapstate->sectors, j); mapstate->sectors = (sectortype *)Brealloc(mapstate->sectors, j);
mapstate->sectcrc = tempcrc; mapstate->sectcrc = tempcrc;
} }
@ -266,7 +266,7 @@ void create_map_snapshot(void)
{ {
mapstate->walls = (walltype *)Bcalloc(1, sizeof(walltype) * numwalls); mapstate->walls = (walltype *)Bcalloc(1, sizeof(walltype) * numwalls);
mapstate->wallsiz = j = qlz_compress(&wall[0], (char *)&mapstate->walls[0], mapstate->wallsiz = j = qlz_compress(&wall[0], (char *)&mapstate->walls[0],
sizeof(walltype) * numwalls, state_compress); sizeof(walltype) * numwalls, state_compress);
mapstate->walls = (walltype *)Brealloc(mapstate->walls, j); mapstate->walls = (walltype *)Brealloc(mapstate->walls, j);
mapstate->wallcrc = tempcrc; mapstate->wallcrc = tempcrc;
} }
@ -299,7 +299,7 @@ void create_map_snapshot(void)
} }
} }
mapstate->spritesiz = j = qlz_compress(&tspri[0], (char *)&mapstate->sprites[0], mapstate->spritesiz = j = qlz_compress(&tspri[0], (char *)&mapstate->sprites[0],
sizeof(spritetype) * numsprites, state_compress); sizeof(spritetype) * numsprites, state_compress);
mapstate->sprites = (spritetype *)Brealloc(mapstate->sprites, j); mapstate->sprites = (spritetype *)Brealloc(mapstate->sprites, j);
mapstate->spritecrc = tempcrc; mapstate->spritecrc = tempcrc;
Bfree(tspri); Bfree(tspri);
@ -5951,7 +5951,7 @@ static void Keys3d(void)
FX_StopAllSounds(); FX_StopAllSounds();
S_ClearSoundLocks(); S_ClearSoundLocks();
#ifdef POLYMER #ifdef POLYMER
for (i=0;i<MAXSPRITES;i++) for (i=0; i<MAXSPRITES; i++)
if (spritelightptr[i] != NULL) if (spritelightptr[i] != NULL)
{ {
polymer_deletelight(spritelightid[i]); polymer_deletelight(spritelightid[i]);
@ -5994,7 +5994,7 @@ static void Keys3d(void)
shadepreview=!shadepreview; shadepreview=!shadepreview;
message("Map shade preview %s",shadepreview?"enabled":"disabled"); message("Map shade preview %s",shadepreview?"enabled":"disabled");
#ifdef POLYMER #ifdef POLYMER
for (i=0;i<MAXSPRITES;i++) for (i=0; i<MAXSPRITES; i++)
if (spritelightptr[i] != NULL) if (spritelightptr[i] != NULL)
{ {
polymer_deletelight(spritelightid[i]); polymer_deletelight(spritelightid[i]);
@ -7926,7 +7926,7 @@ static void Keys2d(void)
(search_lotag!=0 && search_lotag==wall[i].lotag)) (search_lotag!=0 && search_lotag==wall[i].lotag))
&&((search_hitag==0)|| &&((search_hitag==0)||
(search_hitag!=0 && search_hitag==wall[i].hitag)) (search_hitag!=0 && search_hitag==wall[i].hitag))
) )
{ {
pos.x=(wall[i].x)-(((wall[i].x)-(wall[wall[i].point2].x))/2); pos.x=(wall[i].x)-(((wall[i].x)-(wall[wall[i].point2].x))/2);
pos.y=(wall[i].y)-(((wall[i].y)-(wall[wall[i].point2].y))/2); pos.y=(wall[i].y)-(((wall[i].y)-(wall[wall[i].point2].y))/2);
@ -10140,8 +10140,8 @@ void ExtPreCheckKeys(void) // just before drawrooms
spritelightptr[i]->flags.invalidate = 1; spritelightptr[i]->flags.invalidate = 1;
} }
if ((sprite[i].xvel != spritelightptr[i]->color[0]) || if ((sprite[i].xvel != spritelightptr[i]->color[0]) ||
(sprite[i].yvel != spritelightptr[i]->color[1]) || (sprite[i].yvel != spritelightptr[i]->color[1]) ||
(sprite[i].zvel != spritelightptr[i]->color[2])) (sprite[i].zvel != spritelightptr[i]->color[2]))
{ {
spritelightptr[i]->color[0] = sprite[i].xvel; spritelightptr[i]->color[0] = sprite[i].xvel;
spritelightptr[i]->color[1] = sprite[i].yvel; spritelightptr[i]->color[1] = sprite[i].yvel;
@ -10202,8 +10202,8 @@ void ExtPreCheckKeys(void) // just before drawrooms
spritelightptr[i]->flags.invalidate = 1; spritelightptr[i]->flags.invalidate = 1;
} }
if ((sprite[i].xvel != spritelightptr[i]->color[0]) || if ((sprite[i].xvel != spritelightptr[i]->color[0]) ||
(sprite[i].yvel != spritelightptr[i]->color[1]) || (sprite[i].yvel != spritelightptr[i]->color[1]) ||
(sprite[i].zvel != spritelightptr[i]->color[2])) (sprite[i].zvel != spritelightptr[i]->color[2]))
{ {
spritelightptr[i]->color[0] = sprite[i].xvel; spritelightptr[i]->color[0] = sprite[i].xvel;
spritelightptr[i]->color[1] = sprite[i].yvel; spritelightptr[i]->color[1] = sprite[i].yvel;

File diff suppressed because it is too large Load diff

View file

@ -1178,14 +1178,14 @@ static int32_t C_SetScriptSize(int32_t size)
return 0; return 0;
} }
static inline int32_t ispecial(const char c) static inline int32_t ispecial(const char c)
{ {
if (c == ' ' || c == 0x0d || c == '(' || c == ')' || if (c == ' ' || c == 0x0d || c == '(' || c == ')' ||
c == ',' || c == ';' || (c == 0x0a && ++g_lineNumber)) c == ',' || c == ';' || (c == 0x0a && ++g_lineNumber))
return 1; return 1;
return 0; return 0;
} }
#define C_NextLine() while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++ #define C_NextLine() while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0) textptr++
@ -4006,7 +4006,7 @@ static int32_t C_ParseCommand(void)
C_ReportError(ERROR_NOTAGAMEARRAY); C_ReportError(ERROR_NOTAGAMEARRAY);
return 1; return 1;
} }
C_SkipComments();// skip comments and whitespace C_SkipComments();// skip comments and whitespace
if (*textptr != '[') if (*textptr != '[')
{ {
@ -5565,16 +5565,16 @@ repeatcase:
textptr++; textptr++;
} }
else while (*textptr != ' ' && *textptr != '\t' && *textptr != '\r' && *textptr != '\n') else while (*textptr != ' ' && *textptr != '\t' && *textptr != '\r' && *textptr != '\n')
{
g_sounds[k].filename[i++] = *textptr++;
if (i >= BMAX_PATH)
{ {
initprintf("%s:%d: error: sound filename exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,BMAX_PATH); g_sounds[k].filename[i++] = *textptr++;
g_numCompilerErrors++; if (i >= BMAX_PATH)
C_SkipComments(); {
break; initprintf("%s:%d: error: sound filename exceeds limit of %d characters.\n",g_szScriptFileName,g_lineNumber,BMAX_PATH);
g_numCompilerErrors++;
C_SkipComments();
break;
}
} }
}
g_sounds[k].filename[i] = '\0'; g_sounds[k].filename[i] = '\0';
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE);
@ -6002,12 +6002,12 @@ void C_Compile(const char *filenam)
{ {
#ifdef WIN32 #ifdef WIN32
Bsprintf(tempbuf,"Duke Nukem 3D game data was not found. A valid copy of '%s' or other compatible data is needed to run EDuke32.\n\n" Bsprintf(tempbuf,"Duke Nukem 3D game data was not found. A valid copy of '%s' or other compatible data is needed to run EDuke32.\n\n"
"You can find '%s' in the 'DN3DINST' or 'ATOMINST' directory on your Duke Nukem 3D installation CD.\n\n" "You can find '%s' in the 'DN3DINST' or 'ATOMINST' directory on your Duke Nukem 3D installation CD.\n\n"
"If you don't already own a copy of Duke or haven't seen your disc in years, don't worry -- you can download the full, registered " "If you don't already own a copy of Duke or haven't seen your disc in years, don't worry -- you can download the full, registered "
"version of Duke Nukem 3D: Atomic Edition immediately for only $5.99 through our partnership with GOG.com.\n\n" "version of Duke Nukem 3D: Atomic Edition immediately for only $5.99 through our partnership with GOG.com.\n\n"
"Not a typo; it's less than 6 bucks. Get Duke now?\n\n" "Not a typo; it's less than 6 bucks. Get Duke now?\n\n"
"(Clicking yes will bring you to our web store)", "(Clicking yes will bring you to our web store)",
g_grpNamePtr,g_grpNamePtr); g_grpNamePtr,g_grpNamePtr);
if (wm_ynbox("Important - Duke Nukem 3D not found - EDuke32",tempbuf)) if (wm_ynbox("Important - Duke Nukem 3D not found - EDuke32",tempbuf))
{ {

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#include "duke3d.h" #include "duke3d.h"
const char *s_buildDate = "20100107"; const char *s_buildDate = "20100122";
char *MusicPtr = NULL; char *MusicPtr = NULL;
int32_t g_musicSize; int32_t g_musicSize;

View file

@ -107,7 +107,5 @@ int32_t FX_StopAllSounds( void );
int32_t FX_StartDemandFeedPlayback( void ( *function )( char **ptr, uint32_t *length ), int32_t FX_StartDemandFeedPlayback( void ( *function )( char **ptr, uint32_t *length ),
int32_t rate, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t rate, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right,
int32_t priority, uint32_t callbackval ); int32_t priority, uint32_t callbackval );
int32_t FX_StartRecording( int32_t MixRate, void ( *function )( char *ptr, int32_t length ) );
void FX_StopRecord( void );
#endif #endif

View file

@ -24,7 +24,11 @@
#include <SDL/SDL.h> #include <SDL/SDL.h>
#include <SDL/SDL_mixer.h> #if defined(SDL_FRAMEWORK)
# include <SDL_mixer/SDL_mixer.h>
#else
# include <SDL/SDL_mixer.h>
#endif
#include <SDL/SDL_thread.h> #include <SDL/SDL_thread.h>
#include "driver_sdl.h" #include "driver_sdl.h"

View file

@ -36,6 +36,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "multivoc.h" #include "multivoc.h"
#include "fx_man.h" #include "fx_man.h"
#ifdef __POWERPC__
static inline uint16_t SWAP16(uint16_t s)
{
return (s >> 8) | (s << 8);
}
static inline uint32_t SWAP32(uint32_t s)
{
return (s >> 24) | (s << 24) | ((s&0xff00) << 8) | ((s & 0xff0000) >> 8);
}
#define LITTLE16 SWAP16
#define LITTLE32 SWAP32
#else
#define LITTLE16
#define LITTLE32
#endif
#define TRUE ( 1 == 1 ) #define TRUE ( 1 == 1 )
#define FALSE ( !TRUE ) #define FALSE ( !TRUE )
@ -930,43 +948,6 @@ int32_t FX_StartDemandFeedPlayback
} }
/*---------------------------------------------------------------------
Function: FX_StartRecording
Starts the sound recording engine.
---------------------------------------------------------------------*/
int32_t FX_StartRecording
(
int32_t MixRate,
void (*function)(char *ptr, int32_t length)
)
{
int32_t status;
FX_SetErrorCode(FX_InvalidCard);
status = FX_Warning;
return(status);
}
/*---------------------------------------------------------------------
Function: FX_StopRecord
Stops the sound record engine.
---------------------------------------------------------------------*/
void FX_StopRecord
(
void
)
{
}
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: FX_PlayAuto Function: FX_PlayAuto
@ -1017,22 +998,22 @@ int32_t FX_PlayLoopedAuto(char *ptr, uint32_t length, int32_t loopstart, int32_t
uint32_t callbackval) uint32_t callbackval)
{ {
int32_t handle = -1; int32_t handle = -1;
printf("FX_PlayLoopedAuto %X\n",*(int32_t *)ptr);
switch (*(int32_t *)ptr) switch (*(int32_t *)ptr)
{ {
case 'C'+('r'<<8)+('e'<<16)+('a'<<24): case LITTLE32('C'+('r'<<8)+('e'<<16)+('a'<<24)):
handle = MV_PlayLoopedVOC(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval); handle = MV_PlayLoopedVOC(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval);
break; break;
case 'R'+('I'<<8)+('F'<<16)+('F'<<24): case LITTLE32('R'+('I'<<8)+('F'<<16)+('F'<<24)):
handle = MV_PlayLoopedWAV(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval); handle = MV_PlayLoopedWAV(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval);
break; break;
case 'O'+('g'<<8)+('g'<<16)+('S'<<24): case LITTLE32('O'+('g'<<8)+('g'<<16)+('S'<<24)):
handle = MV_PlayLoopedVorbis(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval); handle = MV_PlayLoopedVorbis(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval);
break; break;
default: default:
switch (*(int32_t *)(ptr + 8)) switch (*(int32_t *)(ptr + 8))
{ {
case 'W'+('A'<<8)+('V'<<16)+('E'<<24): case LITTLE32('W'+('A'<<8)+('V'<<16)+('E'<<24)):
handle = MV_PlayLoopedWAV(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval); handle = MV_PlayLoopedWAV(ptr, length, loopstart, loopend, pitchoffset, vol, left, right, priority, callbackval);
break; break;
} }
@ -1061,19 +1042,19 @@ int32_t FX_PlayAuto3D(char *ptr, uint32_t length, int32_t pitchoffset, int32_t a
switch (*(int32_t *)ptr) switch (*(int32_t *)ptr)
{ {
case 'C'+('r'<<8)+('e'<<16)+('a'<<24): // Crea case LITTLE32('C'+('r'<<8)+('e'<<16)+('a'<<24)): // Crea
handle = MV_PlayVOC3D(ptr, length, pitchoffset, angle, distance, priority, callbackval); handle = MV_PlayVOC3D(ptr, length, pitchoffset, angle, distance, priority, callbackval);
break; break;
case 'R'+('I'<<8)+('F'<<16)+('F'<<24): // RIFF case LITTLE32('R'+('I'<<8)+('F'<<16)+('F'<<24)): // RIFF
handle = MV_PlayWAV3D(ptr, length, pitchoffset, angle, distance, priority, callbackval); handle = MV_PlayWAV3D(ptr, length, pitchoffset, angle, distance, priority, callbackval);
break; break;
case 'O'+('g'<<8)+('g'<<16)+('S'<<24): // OggS case LITTLE32('O'+('g'<<8)+('g'<<16)+('S'<<24)): // OggS
handle = MV_PlayVorbis3D(ptr, length, pitchoffset, angle, distance, priority, callbackval); handle = MV_PlayVorbis3D(ptr, length, pitchoffset, angle, distance, priority, callbackval);
break; break;
default: default:
switch (*(int32_t *)(ptr + 8)) switch (*(int32_t *)(ptr + 8))
{ {
case 'W'+('A'<<8)+('V'<<16)+('E'<<24): // WAVE case LITTLE32('W'+('A'<<8)+('V'<<16)+('E'<<24)): // WAVE
handle = MV_PlayWAV3D(ptr, length, pitchoffset, angle, distance, priority, callbackval); handle = MV_PlayWAV3D(ptr, length, pitchoffset, angle, distance, priority, callbackval);
break; break;
} }

View file

@ -109,7 +109,6 @@ Pan MV_PanTable[ MV_NumPanPositions ][ 255 + 1 ];
int32_t MV_Installed = FALSE; int32_t MV_Installed = FALSE;
static int32_t MV_TotalVolume = MV_MaxTotalVolume; static int32_t MV_TotalVolume = MV_MaxTotalVolume;
static int32_t MV_MaxVoices = 1; static int32_t MV_MaxVoices = 1;
static int32_t MV_Recording;
static int32_t MV_BufferSize = MixBufferSize; static int32_t MV_BufferSize = MixBufferSize;
static int32_t MV_BufferLength; static int32_t MV_BufferLength;
@ -142,7 +141,6 @@ static int32_t MV_MixPage = 0;
static int32_t MV_VoiceHandle = MV_MinVoiceHandle; static int32_t MV_VoiceHandle = MV_MinVoiceHandle;
static void (*MV_CallBackFunc)(uint32_t) = NULL; static void (*MV_CallBackFunc)(uint32_t) = NULL;
static void (*MV_RecordFunc)(char *ptr, int32_t length) = NULL;
static void (*MV_MixFunction)(VoiceNode *voice, int32_t buffer); static void (*MV_MixFunction)(VoiceNode *voice, int32_t buffer);
int32_t MV_MaxVolume = 255; int32_t MV_MaxVolume = 255;
@ -241,10 +239,6 @@ const char *MV_ErrorString
ErrorString = "Invalid mix mode request in Multivoc."; ErrorString = "Invalid mix mode request in Multivoc.";
break; break;
case MV_NullRecordFunction :
ErrorString = "Null record function passed to MV_StartRecording.";
break;
default : default :
ErrorString = "Unknown Multivoc error code."; ErrorString = "Unknown Multivoc error code.";
break; break;
@ -914,35 +908,6 @@ playbackstatus MV_GetNextWAVBlock
} }
/*---------------------------------------------------------------------
Function: MV_ServiceRecord
Starts recording of the waiting buffer.
---------------------------------------------------------------------*/
/*
static void MV_ServiceRecord
(
void
)
{
if (MV_RecordFunc)
{
MV_RecordFunc(MV_MixBuffer[ 0 ] + MV_MixPage * MixBufferSize,
MixBufferSize);
}
// Toggle which buffer we'll mix next
MV_MixPage++;
if (MV_MixPage >= NumberOfBuffers)
{
MV_MixPage = 0;
}
}
*/
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: MV_GetVoice Function: MV_GetVoice
@ -1150,11 +1115,6 @@ VoiceNode *MV_AllocVoice
VoiceNode *voice; VoiceNode *voice;
VoiceNode *node; VoiceNode *node;
if (MV_Recording)
{
return(NULL);
}
DisableInterrupts(); DisableInterrupts();
// Check if we have any free voices // Check if we have any free voices
@ -1987,39 +1947,6 @@ void MV_StopPlayback
} }
/*---------------------------------------------------------------------
Function: MV_StartRecording
Starts the sound recording engine.
---------------------------------------------------------------------*/
int32_t MV_StartRecording
(
int32_t MixRate,
void (*function)(char *ptr, int32_t length)
)
{
MV_SetErrorCode(MV_UnsupportedCard);
return(MV_Error);
}
/*---------------------------------------------------------------------
Function: MV_StopRecord
Stops the sound record engine.
---------------------------------------------------------------------*/
void MV_StopRecord
(
void
)
{
}
/*--------------------------------------------------------------------- /*---------------------------------------------------------------------
Function: MV_StartDemandFeedPlayback Function: MV_StartDemandFeedPlayback
@ -2839,8 +2766,6 @@ int32_t MV_Init
MV_Installed = TRUE; MV_Installed = TRUE;
MV_CallBackFunc = NULL; MV_CallBackFunc = NULL;
MV_RecordFunc = NULL;
MV_Recording = FALSE;
MV_ReverbLevel = 0; MV_ReverbLevel = 0;
MV_ReverbTable = NULL; MV_ReverbTable = NULL;
@ -2902,12 +2827,6 @@ int32_t MV_Shutdown
MV_Installed = FALSE; MV_Installed = FALSE;
// Stop the sound recording engine
if (MV_Recording)
{
MV_StopRecord();
}
// Stop the sound playback engine // Stop the sound playback engine
MV_StopPlayback(); MV_StopPlayback();

View file

@ -73,8 +73,6 @@ void MV_SetReverbDelay( int32_t delay );
int32_t MV_SetMixMode( int32_t numchannels, int32_t samplebits ); int32_t MV_SetMixMode( int32_t numchannels, int32_t samplebits );
int32_t MV_StartPlayback( void ); int32_t MV_StartPlayback( void );
void MV_StopPlayback( void ); void MV_StopPlayback( void );
int32_t MV_StartRecording( int32_t MixRate, void ( *function )( char *ptr, int32_t length ) );
void MV_StopRecord( void );
int32_t MV_StartDemandFeedPlayback( void ( *function )( char **ptr, uint32_t *length ), int32_t MV_StartDemandFeedPlayback( void ( *function )( char **ptr, uint32_t *length ),
int32_t rate, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right, int32_t rate, int32_t pitchoffset, int32_t vol, int32_t left, int32_t right,
int32_t priority, uint32_t callbackval ); int32_t priority, uint32_t callbackval );

View file

@ -50,7 +50,7 @@ typedef struct
int32_t checkingSwitch; int32_t checkingSwitch;
int32_t numCases; int32_t numCases;
instype *caseScriptPtr; // the pointer to the start of the case table in a switch statement instype *caseScriptPtr; // the pointer to the start of the case table in a switch statement
// first entry is 'default' code. // first entry is 'default' code.
instype *caseCodePtr; // the pointer to the start of the different cases' code instype *caseCodePtr; // the pointer to the start of the different cases' code
int32_t labelsOnly; int32_t labelsOnly;
int32_t numBraces; int32_t numBraces;
@ -206,8 +206,8 @@ const char *keyw[] =
"getsector", "getsector",
"setwall", "setwall",
"getwall", "getwall",
"setsprite", "setsprite",
"getsprite", "getsprite",
"gettspr", "gettspr",
"settspr", "settspr",
@ -834,7 +834,7 @@ static void C_GetNextVarType(int32_t type)
// constant where gamevar expected // constant where gamevar expected
if ((type==0 || type==GAMEVAR_SPECIAL) && !cs.labelsOnly && if ((type==0 || type==GAMEVAR_SPECIAL) && !cs.labelsOnly &&
(isdigit(*textptr) || ((*textptr == '-') && isdigit(*(textptr+1))))) (isdigit(*textptr) || ((*textptr == '-') && isdigit(*(textptr+1)))))
{ {
// if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug) // if (!(g_numCompilerErrors || g_numCompilerWarnings) && g_scriptDebug)
// initprintf("%s:%d: debug: accepted constant %d in place of gamevar.\n",g_szScriptFileName,g_lineNumber,atol(textptr)); // initprintf("%s:%d: debug: accepted constant %d in place of gamevar.\n",g_szScriptFileName,g_lineNumber,atol(textptr));
@ -1016,14 +1016,14 @@ static void C_GetNextVarType(int32_t type)
textptr++; textptr++;
/// now pointing at 'xxx' /// now pointing at 'xxx'
C_GetNextLabelName(); C_GetNextLabelName();
/*initprintf("found xxx label of '%s'\n", label+(g_numLabels*MAXLABELLEN));*/ /*initprintf("found xxx label of '%s'\n", label+(g_numLabels*MAXLABELLEN));*/
if (id == g_iSpriteVarID || id==3) if (id == g_iSpriteVarID || id==3)
lLabelID = C_GetLabelNameID(SpriteLabels, &spriteH, strtolower(tlabel,Bstrlen(tlabel))); lLabelID = C_GetLabelNameID(SpriteLabels, &spriteH, strtolower(tlabel,Bstrlen(tlabel)));
else if (id == g_iSectorVarID) else if (id == g_iSectorVarID)
lLabelID = C_GetLabelNameID(SectorLabels, &sectorH, strtolower(tlabel,Bstrlen(tlabel))); lLabelID = C_GetLabelNameID(SectorLabels, &sectorH, strtolower(tlabel,Bstrlen(tlabel)));
else if (id == g_iWallVarID) else if (id == g_iWallVarID)
lLabelID = C_GetLabelNameID(WallLabels, &wallH, strtolower(tlabel,Bstrlen(tlabel))); lLabelID = C_GetLabelNameID(WallLabels, &wallH, strtolower(tlabel,Bstrlen(tlabel)));
//printf("LabelID is %d\n",lLabelID); //printf("LabelID is %d\n",lLabelID);
if (lLabelID == -1) if (lLabelID == -1)
{ {
g_numCompilerErrors++; g_numCompilerErrors++;
@ -1064,7 +1064,7 @@ static void C_GetNextVarType(int32_t type)
{ {
C_ReportError(-1); C_ReportError(-1);
initprintf("%s:%d: error: label %s=%d not suitable as array index. (max: 65535)\n",g_szScriptFileName,g_lineNumber, label+(id*MAXLABELLEN), num); initprintf("%s:%d: error: label %s=%d not suitable as array index. (max: 65535)\n",g_szScriptFileName,g_lineNumber, label+(id*MAXLABELLEN), num);
g_numCompilerErrors++; g_numCompilerErrors++;
} }
else if (num != (int16_t)num) else if (num != (int16_t)num)
{ {
@ -1718,7 +1718,7 @@ static int32_t C_ParseCommand(void)
*g_scriptPtr++ = j; *g_scriptPtr++ = j;
return 0; return 0;
} }
C_ReportError(-1); C_ReportError(-1);
initprintf("%s:%d: error: state `%s' not found.\n",g_szScriptFileName,g_lineNumber,tlabel); initprintf("%s:%d: error: state `%s' not found.\n",g_szScriptFileName,g_lineNumber,tlabel);
g_numCompilerErrors++; g_numCompilerErrors++;
@ -1753,7 +1753,7 @@ static int32_t C_ParseCommand(void)
cs.currentEvent = j; cs.currentEvent = j;
cs.parsingEventOfs = g_scriptPtr-script; cs.parsingEventOfs = g_scriptPtr-script;
//Bsprintf(g_szBuf,"Adding Event for %d at %lX",j, g_parsingEventPtr); AddLog(g_szBuf); //Bsprintf(g_szBuf,"Adding Event for %d at %lX",j, g_parsingEventPtr); AddLog(g_szBuf);
if (j<0 || j >= MAXEVENTS) if (j<0 || j >= MAXEVENTS)
{ {
initprintf("%s:%d: error: invalid event ID.\n",g_szScriptFileName,g_lineNumber); initprintf("%s:%d: error: invalid event ID.\n",g_szScriptFileName,g_lineNumber);
@ -1892,7 +1892,7 @@ static int32_t C_ParseCommand(void)
return 0; return 0;
tscrptr = (instype *)script+offset; tscrptr = (instype *)script+offset;
*tscrptr = (ofstype) (g_scriptPtr-script)-offset; // relative offset *tscrptr = (ofstype)(g_scriptPtr-script)-offset; // relative offset
} }
else else
{ {
@ -1934,7 +1934,7 @@ static int32_t C_ParseCommand(void)
ofstype tempoffset; ofstype tempoffset;
//AddLog("Got Switch statement"); //AddLog("Got Switch statement");
// if (cs.checkingSwitch) Bsprintf(g_szBuf,"ERROR::%s %d: cs.checkingSwitch=",__FILE__,__LINE__, cs.checkingSwitch); AddLog(g_szBuf); // if (cs.checkingSwitch) Bsprintf(g_szBuf,"ERROR::%s %d: cs.checkingSwitch=",__FILE__,__LINE__, cs.checkingSwitch); AddLog(g_szBuf);
cs.checkingSwitch++; // allow nesting (if other things work) cs.checkingSwitch++; // allow nesting (if other things work)
C_GetNextVar(); // Get The ID of the DEF C_GetNextVar(); // Get The ID of the DEF
@ -1949,16 +1949,16 @@ static int32_t C_ParseCommand(void)
temptextptr = textptr; temptextptr = textptr;
// probably does not allow nesting... // probably does not allow nesting...
//AddLog("Counting Case Statements..."); //AddLog("Counting Case Statements...");
j = C_CountCaseStatements(); j = C_CountCaseStatements();
// initprintf("Done Counting Case Statements for switch %d: found %d.\n", cs.checkingSwitch,j); // initprintf("Done Counting Case Statements for switch %d: found %d.\n", cs.checkingSwitch,j);
g_scriptPtr += j*2; g_scriptPtr += j*2;
cs.caseCodePtr = g_scriptPtr; cs.caseCodePtr = g_scriptPtr;
C_SkipComments(); C_SkipComments();
g_scriptPtr -= j*2; // allocate buffer for the table g_scriptPtr -= j*2; // allocate buffer for the table
tempscrptr = (instype *)(script+tempoffset); tempscrptr = (instype *)(script+tempoffset);
// if (cs.checkingSwitch>1) Bsprintf(g_szBuf,"ERROR::%s %d: cs.checkingSwitch=",__FILE__,__LINE__, cs.checkingSwitch); AddLog(g_szBuf); // if (cs.checkingSwitch>1) Bsprintf(g_szBuf,"ERROR::%s %d: cs.checkingSwitch=",__FILE__,__LINE__, cs.checkingSwitch); AddLog(g_szBuf);
if (j<0) if (j<0)
return 1; return 1;
@ -1974,7 +1974,7 @@ static int32_t C_ParseCommand(void)
*g_scriptPtr++ = -1; // code offset *g_scriptPtr++ = -1; // code offset
C_SkipComments(); C_SkipComments();
} }
//Bsprintf(g_szBuf,"SWITCH1: '%.22s'",textptr); AddLog(g_szBuf); //Bsprintf(g_szBuf,"SWITCH1: '%.22s'",textptr); AddLog(g_szBuf);
cs.numCases = 0; cs.numCases = 0;
while (C_ParseCommand() == 0) while (C_ParseCommand() == 0)
{ {
@ -1982,9 +1982,9 @@ static int32_t C_ParseCommand(void)
} }
tempscrptr = (instype *)(script+tempoffset); tempscrptr = (instype *)(script+tempoffset);
//Bsprintf(g_szBuf,"SWITCHXX: '%.22s'",textptr); AddLog(g_szBuf); //Bsprintf(g_szBuf,"SWITCHXX: '%.22s'",textptr); AddLog(g_szBuf);
// done processing switch. clean up. // done processing switch. clean up.
// if (cs.checkingSwitch < 1) Bsprintf(g_szBuf,"ERROR::%s %d: cs.checkingSwitch=%d",__FILE__,__LINE__, cs.checkingSwitch); AddLog(g_szBuf); // if (cs.checkingSwitch < 1) Bsprintf(g_szBuf,"ERROR::%s %d: cs.checkingSwitch=%d",__FILE__,__LINE__, cs.checkingSwitch); AddLog(g_szBuf);
if (tempscrptr) if (tempscrptr)
{ {
int32_t t,n; // !!! int32_t t,n; // !!!
@ -2008,14 +2008,14 @@ static int32_t C_ParseCommand(void)
// for (j=3;j<3+tempscrptr[1]*2;j+=2)initprintf("%5d %8x\n",tempscrptr[j],tempscrptr[j+1]); // for (j=3;j<3+tempscrptr[1]*2;j+=2)initprintf("%5d %8x\n",tempscrptr[j],tempscrptr[j+1]);
tempscrptr[0] = (ofstype)(g_scriptPtr-cs.caseCodePtr); // save 'end' location as offset from code-place tempscrptr[0] = (ofstype)(g_scriptPtr-cs.caseCodePtr); // save 'end' location as offset from code-place
} }
// else Bsprintf(g_szBuf,"ERROR::%s %d",__FILE__,__LINE__); AddLog(g_szBuf); // else Bsprintf(g_szBuf,"ERROR::%s %d",__FILE__,__LINE__); AddLog(g_szBuf);
cs.numCases = 0; cs.numCases = 0;
cs.caseScriptPtr = NULL; cs.caseScriptPtr = NULL;
cs.caseCodePtr = NULL; cs.caseCodePtr = NULL;
// decremented in endswitch. Don't decrement here... // decremented in endswitch. Don't decrement here...
// cs.checkingSwitch--; // allow nesting (maybe if other things work) // cs.checkingSwitch--; // allow nesting (maybe if other things work)
tempscrptr = NULL; tempscrptr = NULL;
// if (cs.checkingSwitch) Bsprintf(g_szBuf,"ERROR::%s %d: cs.checkingSwitch=%d",__FILE__,__LINE__, cs.checkingSwitch); AddLog(g_szBuf); // if (cs.checkingSwitch) Bsprintf(g_szBuf,"ERROR::%s %d: cs.checkingSwitch=%d",__FILE__,__LINE__, cs.checkingSwitch); AddLog(g_szBuf);
//AddLog("End of Switch statement"); //AddLog("End of Switch statement");
} }
break; break;
@ -2035,13 +2035,13 @@ repeatcase:
} }
cs.numCases++; cs.numCases++;
//Bsprintf(g_szBuf,"case1: %.12s",textptr); AddLog(g_szBuf); //Bsprintf(g_szBuf,"case1: %.12s",textptr); AddLog(g_szBuf);
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE);
if (*textptr == ':') if (*textptr == ':')
textptr++; textptr++;
//Bsprintf(g_szBuf,"case2: %.12s",textptr); AddLog(g_szBuf); //Bsprintf(g_szBuf,"case2: %.12s",textptr); AddLog(g_szBuf);
j = *(--g_scriptPtr); // get value j = *(--g_scriptPtr); // get value
//Bsprintf(g_szBuf,"case: Value of case %d is %d",(int32_t)cs.numCases,(int32_t)j); AddLog(g_szBuf); //Bsprintf(g_szBuf,"case: Value of case %d is %d",(int32_t)cs.numCases,(int32_t)j); AddLog(g_szBuf);
if (cs.caseScriptPtr) if (cs.caseScriptPtr)
{ {
for (i=(cs.numCases/2)-1; i>=0; i--) for (i=(cs.numCases/2)-1; i>=0; i--)
@ -2055,7 +2055,7 @@ repeatcase:
cs.caseScriptPtr[cs.numCases++] = j; // save value cs.caseScriptPtr[cs.numCases++] = j; // save value
cs.caseScriptPtr[cs.numCases] = (ofstype)(g_scriptPtr - cs.caseCodePtr); // offset from beginning of cases' code cs.caseScriptPtr[cs.numCases] = (ofstype)(g_scriptPtr - cs.caseCodePtr); // offset from beginning of cases' code
} }
//Bsprintf(g_szBuf,"case3: %.12s",textptr); AddLog(g_szBuf); //Bsprintf(g_szBuf,"case3: %.12s",textptr); AddLog(g_szBuf);
j = C_GetKeyword(); j = C_GetKeyword();
if (j == CON_CASE) if (j == CON_CASE)
{ {
@ -2063,11 +2063,11 @@ repeatcase:
C_GetNextKeyword(); // eat 'case' C_GetNextKeyword(); // eat 'case'
goto repeatcase; goto repeatcase;
} }
//Bsprintf(g_szBuf,"case4: '%.12s'",textptr); AddLog(g_szBuf); //Bsprintf(g_szBuf,"case4: '%.12s'",textptr); AddLog(g_szBuf);
tempoffset = (unsigned)(tempscrptr-script); tempoffset = (unsigned)(tempscrptr-script);
while (C_ParseCommand() == 0) while (C_ParseCommand() == 0)
{ {
//Bsprintf(g_szBuf,"case5 '%.25s'",textptr); AddLog(g_szBuf); //Bsprintf(g_szBuf,"case5 '%.25s'",textptr); AddLog(g_szBuf);
j = C_GetKeyword(); j = C_GetKeyword();
if (j == CON_CASE) if (j == CON_CASE)
{ {
@ -2078,7 +2078,7 @@ repeatcase:
} }
} }
tempscrptr = (instype *)(script+tempoffset); tempscrptr = (instype *)(script+tempoffset);
//AddLog("End Case"); //AddLog("End Case");
return 0; return 0;
// break; // break;
} }
@ -2101,7 +2101,7 @@ repeatcase:
} }
if (cs.caseScriptPtr) if (cs.caseScriptPtr)
cs.caseScriptPtr[0] = (ofstype)(g_scriptPtr-cs.caseCodePtr); // save offset from cases' code cs.caseScriptPtr[0] = (ofstype)(g_scriptPtr-cs.caseCodePtr); // save offset from cases' code
//Bsprintf(g_szBuf,"default: '%.22s'",textptr); AddLog(g_szBuf); //Bsprintf(g_szBuf,"default: '%.22s'",textptr); AddLog(g_szBuf);
while (C_ParseCommand() == 0) while (C_ParseCommand() == 0)
{ {
//Bsprintf(g_szBuf,"defaultParse: '%.22s'",textptr); AddLog(g_szBuf); //Bsprintf(g_szBuf,"defaultParse: '%.22s'",textptr); AddLog(g_szBuf);
@ -2318,7 +2318,7 @@ repeatcase:
} }
C_GetNextLabelName(); C_GetNextLabelName();
//printf("Got Label '%.20s'\n",textptr); //printf("Got Label '%.20s'\n",textptr);
// Check to see it's already defined // Check to see it's already defined
if (hash_find(&keywH, tlabel) >= 0) if (hash_find(&keywH, tlabel) >= 0)
{ {
@ -2857,7 +2857,7 @@ repeatcase:
case CON_DEFINEQUOTE: case CON_DEFINEQUOTE:
case CON_REDEFINEQUOTE: case CON_REDEFINEQUOTE:
if (tw == CON_DEFINEQUOTE) if (tw == CON_DEFINEQUOTE)
g_scriptPtr--; g_scriptPtr--;
C_GetNextValue(LABEL_DEFINE); C_GetNextValue(LABEL_DEFINE);
@ -3319,7 +3319,7 @@ void C_Compile(const char *filenameortext, int32_t isfilename)
C_AddDefaultDefinitions(); C_AddDefaultDefinitions();
script = Bcalloc(g_scriptSize, sizeof(instype)); script = Bcalloc(g_scriptSize, sizeof(instype));
// initprintf("script: %d\n",script); // initprintf("script: %d\n",script);
if (!script || !label || !labelval || !labeltype || !constants) if (!script || !label || !labelval || !labeltype || !constants)
{ {
initprintf("C_Compile(): ERROR: out of memory!\n"); initprintf("C_Compile(): ERROR: out of memory!\n");

View file

@ -278,7 +278,7 @@ static int32_t X_DoSort(const int32_t *lv, const int32_t *rv)
vm.flags |= VMFLAG_ERROR; \ vm.flags |= VMFLAG_ERROR; \
continue; \ continue; \
} \ } \
int32_t X_DoExecute(int32_t once) int32_t X_DoExecute(int32_t once)
{ {
register int32_t tw = *insptr; register int32_t tw = *insptr;
@ -358,15 +358,15 @@ skip_check:
insptr += lCases*2; insptr += lCases*2;
lCodeInsPtr = insptr; lCodeInsPtr = insptr;
//Bsprintf(g_szBuf,"lEnd= %d *lpDefault=%d",lEnd,*lpDefault); AddLog(g_szBuf); //Bsprintf(g_szBuf,"lEnd= %d *lpDefault=%d",lEnd,*lpDefault); AddLog(g_szBuf);
//Bsprintf(g_szBuf,"Checking %d cases for %d",lCases, lValue); AddLog(g_szBuf); //Bsprintf(g_szBuf,"Checking %d cases for %d",lCases, lValue); AddLog(g_szBuf);
left = 0; left = 0;
right = lCases-1; right = lCases-1;
while (!bMatched) while (!bMatched)
{ {
//Bsprintf(g_szBuf,"Checking #%d Value= %d",lCheckCase, lpCases[lCheckCase*2]); AddLog(g_szBuf); //Bsprintf(g_szBuf,"Checking #%d Value= %d",lCheckCase, lpCases[lCheckCase*2]); AddLog(g_szBuf);
lCheckCase=(left+right)/2; lCheckCase=(left+right)/2;
// initprintf("(%2d..%2d..%2d) [%2d..%2d..%2d]==%2d\n",left,lCheckCase,right,lpCases[left*2],lpCases[lCheckCase*2],lpCases[right*2],lValue); // initprintf("(%2d..%2d..%2d) [%2d..%2d..%2d]==%2d\n",left,lCheckCase,right,lpCases[left*2],lpCases[lCheckCase*2],lpCases[right*2],lValue);
if (lpCases[lCheckCase*2] > lValue) if (lpCases[lCheckCase*2] > lValue)
right = lCheckCase-1; right = lCheckCase-1;
else if (lpCases[lCheckCase*2] < lValue) else if (lpCases[lCheckCase*2] < lValue)
@ -374,10 +374,10 @@ skip_check:
else if (lpCases[lCheckCase*2] == lValue) else if (lpCases[lCheckCase*2] == lValue)
{ {
//AddLog("Found Case Match"); //AddLog("Found Case Match");
//Bsprintf(g_szBuf,"insptr=%d. lCheckCase=%d, offset=%d, &script[0]=%d", (int32_t)insptr,(int32_t)lCheckCase,lpCases[lCheckCase*2+1],(int32_t)&script[0]); AddLog(g_szBuf); //Bsprintf(g_szBuf,"insptr=%d. lCheckCase=%d, offset=%d, &script[0]=%d", (int32_t)insptr,(int32_t)lCheckCase,lpCases[lCheckCase*2+1],(int32_t)&script[0]); AddLog(g_szBuf);
// fake a 2-d Array // fake a 2-d Array
insptr = lCodeInsPtr + lpCases[lCheckCase*2+1]; insptr = lCodeInsPtr + lpCases[lCheckCase*2+1];
//Bsprintf(g_szBuf,"insptr=%d. ", (int32_t)insptr); AddLog(g_szBuf); //Bsprintf(g_szBuf,"insptr=%d. ", (int32_t)insptr); AddLog(g_szBuf);
X_DoExecute(0); X_DoExecute(0);
//AddLog("Done Executing Case"); //AddLog("Done Executing Case");
bMatched=1; bMatched=1;
@ -399,7 +399,7 @@ skip_check:
// } // }
} }
insptr = (instype *)(lCodeInsPtr + lEnd); insptr = (instype *)(lCodeInsPtr + lEnd);
//Bsprintf(g_szBuf,"insptr=%d. ", (int32_t)insptr); AddLog(g_szBuf); //Bsprintf(g_szBuf,"insptr=%d. ", (int32_t)insptr); AddLog(g_szBuf);
//AddLog("Done Processing Switch"); //AddLog("Done Processing Switch");
continue; continue;
} }
@ -478,7 +478,7 @@ skip_check:
continue; continue;
} }
#if 0 #if 0
case CON_SETSPRITE: case CON_SETSPRITE:
insptr++; insptr++;
{ {
// syntax [gs]etsprite[<var>].x <VAR> // syntax [gs]etsprite[<var>].x <VAR>
@ -590,9 +590,9 @@ skip_check:
if (vm.flags&VMFLAG_ERROR) continue; if (vm.flags&VMFLAG_ERROR) continue;
ssiz = (aGameArrays[si].dwFlags&GAMEARRAY_VARSIZE) ? ssiz = (aGameArrays[si].dwFlags&GAMEARRAY_VARSIZE) ?
Gv_GetVarN(aGameArrays[si].size) : aGameArrays[si].size; Gv_GetVarN(aGameArrays[si].size) : aGameArrays[si].size;
dsiz = (aGameArrays[di].dwFlags&GAMEARRAY_VARSIZE) ? dsiz = (aGameArrays[di].dwFlags&GAMEARRAY_VARSIZE) ?
Gv_GetVarN(aGameArrays[si].size) : aGameArrays[di].size; Gv_GetVarN(aGameArrays[si].size) : aGameArrays[di].size;
if (sidx > ssiz || didx > dsiz) continue; if (sidx > ssiz || didx > dsiz) continue;
if ((sidx+numelts) > ssiz) numelts = ssiz-sidx; if ((sidx+numelts) > ssiz) numelts = ssiz-sidx;
@ -1233,8 +1233,8 @@ skip_check:
case ITER_WALLSOFSECTOR: case ITER_WALLSOFSECTOR:
if (parm2 < 0 || parm2 >= MAXSECTORS) if (parm2 < 0 || parm2 >= MAXSECTORS)
goto badindex; goto badindex;
for(jj=sector[parm2].wallptr, endwall=jj+sector[parm2].wallnum-1; for (jj=sector[parm2].wallptr, endwall=jj+sector[parm2].wallnum-1;
jj<=endwall && !vm.flags; jj++) jj<=endwall && !vm.flags; jj++)
{ {
Gv_SetVarX(var, jj); Gv_SetVarX(var, jj);
insptr = beg; insptr = beg;
@ -1251,7 +1251,8 @@ skip_check:
insptr = beg; insptr = beg;
X_DoExecute(1); X_DoExecute(1);
jj = wall[jj].point2; jj = wall[jj].point2;
} while (jj != parm2 && !vm.flags); }
while (jj != parm2 && !vm.flags);
break; break;
case ITER_RANGE: case ITER_RANGE:
for (jj=0; jj<parm2 && !vm.flags; jj++) for (jj=0; jj<parm2 && !vm.flags; jj++)
@ -1375,8 +1376,8 @@ badindex:
if (tw != CON_IFHOLDKEY) if (tw != CON_IFHOLDKEY)
{ {
if (!(key==0 || key==KEYSC_ESC || key==KEYSC_TILDE || key==KEYSC_gENTER || if (!(key==0 || key==KEYSC_ESC || key==KEYSC_TILDE || key==KEYSC_gENTER ||
key==KEYSC_LALT || key==KEYSC_RALT || key==KEYSC_LCTRL || key==KEYSC_RCTRL || key==KEYSC_LALT || key==KEYSC_RALT || key==KEYSC_LCTRL || key==KEYSC_RCTRL ||
key==KEYSC_LSHIFT || key==KEYSC_RSHIFT)) key==KEYSC_LSHIFT || key==KEYSC_RSHIFT))
keystatus[key] = 0; keystatus[key] = 0;
} }
} }
@ -1443,7 +1444,7 @@ badindex:
X_ERROR_INVALIDSP(); X_ERROR_INVALIDSP();
j = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z/*-((krand()&41)<<8)*/,vm.g_sp->sectnum, j = cansee(vm.g_sp->x,vm.g_sp->y,vm.g_sp->z/*-((krand()&41)<<8)*/,vm.g_sp->sectnum,
pos.x, pos.y, pos.z /*-((krand()&41)<<8)*/, cursectnum); pos.x, pos.y, pos.z /*-((krand()&41)<<8)*/, cursectnum);
X_DoConditional(j); X_DoConditional(j);
} }
continue; continue;
@ -1537,7 +1538,7 @@ badindex:
vm.flags |= VMFLAG_ERROR; vm.flags |= VMFLAG_ERROR;
} }
if ((tw==CON_DUPSPRITE && numsprites >= MAXSPRITES) || if ((tw==CON_DUPSPRITE && numsprites >= MAXSPRITES) ||
(tw==CON_DUPSPRITE && spritesortcnt >= MAXSPRITESONSCREEN)) (tw==CON_DUPSPRITE && spritesortcnt >= MAXSPRITESONSCREEN))
{ {
OSD_Printf(CON_ERROR "Maximum number of sprites reached.\n",g_errorLineNum,keyw[g_tw]); OSD_Printf(CON_ERROR "Maximum number of sprites reached.\n",g_errorLineNum,keyw[g_tw]);
vm.flags |= VMFLAG_ERROR; vm.flags |= VMFLAG_ERROR;
@ -2216,7 +2217,7 @@ badindex:
while (*insptr != -1 && numvals < 32) while (*insptr != -1 && numvals < 32)
arg[numvals++] = Gv_GetVarX(*insptr++); arg[numvals++] = Gv_GetVarX(*insptr++);
insptr++; // skip the NOP insptr++; // skip the NOP
i = 0; i = 0;
@ -2299,7 +2300,7 @@ dodefault:
// <type> <maxdist(varid)> <varid> // <type> <maxdist(varid)> <varid>
int32_t lType=*insptr++; int32_t lType=*insptr++;
int32_t lMaxDist = (tw==CON_FINDNEARSPRITE || tw==CON_FINDNEARSPRITE3D)? int32_t lMaxDist = (tw==CON_FINDNEARSPRITE || tw==CON_FINDNEARSPRITE3D)?
*insptr++ : Gv_GetVarX(*insptr++); *insptr++ : Gv_GetVarX(*insptr++);
int32_t lVarID=*insptr++; int32_t lVarID=*insptr++;
int32_t lFound=-1, j, k = MAXSTATUS-1; int32_t lFound=-1, j, k = MAXSTATUS-1;

View file

@ -132,7 +132,7 @@ static int32_t __fastcall X_AccessSector(int32_t how, int32_t lVar1, int32_t lLa
{ {
int32_t lValue; int32_t lValue;
int32_t i = (how&ACCESS_USEVARS) ? sprite[vm.g_i].sectnum : lVar1; int32_t i = (how&ACCESS_USEVARS) ? sprite[vm.g_i].sectnum : lVar1;
if ((how&ACCESS_USEVARS) && lVar1 != g_iThisActorID) if ((how&ACCESS_USEVARS) && lVar1 != g_iThisActorID)
i = Gv_GetVarX(lVar1); i = Gv_GetVarX(lVar1);
@ -344,14 +344,14 @@ static int32_t __fastcall X_AccessSprite(int32_t how, int32_t lVar1, int32_t lLa
return lValue; return lValue;
} }
badactor: badactor:
// OSD_Printf(CON_ERROR "tried to set %s on invalid target sprite (%d) from spr %d pic %d gv %s\n",g_errorLineNum,keyw[g_tw], // OSD_Printf(CON_ERROR "tried to set %s on invalid target sprite (%d) from spr %d pic %d gv %s\n",g_errorLineNum,keyw[g_tw],
// SpriteLabels[lLabelID].name,i,vm.g_i,vm.g_sp->picnum, // SpriteLabels[lLabelID].name,i,vm.g_i,vm.g_sp->picnum,
// (lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended"); // (lVar1<MAXGAMEVARS)?aGameVars[lVar1].szLabel:"extended");
OSD_Printf(CON_ERROR "tried to set %s on invalid target sprite (%d)\n",g_errorLineNum,keyw[g_tw], OSD_Printf(CON_ERROR "tried to set %s on invalid target sprite (%d)\n",g_errorLineNum,keyw[g_tw],
SpriteLabels[lLabelID].name,i); SpriteLabels[lLabelID].name,i);
return -1; return -1;
readonly: readonly:
OSD_Printf(CON_ERROR "Sprite structure member `%s' is read-only.\n",g_errorLineNum,keyw[g_tw],SpriteLabels[lLabelID].name); OSD_Printf(CON_ERROR "Sprite structure member `%s' is read-only.\n",g_errorLineNum,keyw[g_tw],SpriteLabels[lLabelID].name);
return -1; return -1;
} }

View file

@ -108,7 +108,7 @@ int32_t Gv_NewArray(const char *pszLabel, void *arrayptr, intptr_t asize, uint32
g_numCompilerErrors++; g_numCompilerErrors++;
C_ReportError(-1); C_ReportError(-1);
initprintf("%s:%d: error: invalid array size %d. Must be between 1 and 65536\n",g_szScriptFileName,g_lineNumber,(int32_t)asize); initprintf("%s:%d: error: invalid array size %d. Must be between 1 and 65536\n",g_szScriptFileName,g_lineNumber,(int32_t)asize);
return 0; return 0;
} }
i = g_gameArrayCount; i = g_gameArrayCount;
@ -376,86 +376,86 @@ int32_t __fastcall Gv_GetVarX(register int32_t id)
void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue) void __fastcall Gv_SetVarX(register int32_t id, register int32_t lValue)
{ {
if (id & (0xFFFFFFFF-(MAXGAMEVARS-1))) if (id & (0xFFFFFFFF-(MAXGAMEVARS-1)))
{
if (id&(MAXGAMEVARS<<2)) // array
{ {
if (id&(MAXGAMEVARS<<2)) // array register int32_t index;
int32_t siz;
index = (id>>16)&0xffff;
if (!(id&MAXGAMEVARS))
index = Gv_GetVarN(index);
id &= (MAXGAMEARRAYS-1);
if (aGameArrays[id].dwFlags & GAMEARRAY_VARSIZE)
siz = Gv_GetVarN(aGameArrays[id].size);
else siz = aGameArrays[id].size;
if (index < 0 || index >= siz)
{ {
register int32_t index; OSD_Printf(CON_ERROR "Gv_SetVarX(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,index);
int32_t siz; vm.flags |= VMFLAG_ERROR;
index = (id>>16)&0xffff;
if (!(id&MAXGAMEVARS))
index = Gv_GetVarN(index);
id &= (MAXGAMEARRAYS-1);
if (aGameArrays[id].dwFlags & GAMEARRAY_VARSIZE)
siz = Gv_GetVarN(aGameArrays[id].size);
else siz = aGameArrays[id].size;
if (index < 0 || index >= siz)
{
OSD_Printf(CON_ERROR "Gv_SetVarX(): invalid array index (%s[%d])\n",g_errorLineNum,keyw[g_tw],aGameArrays[id].szLabel,index);
vm.flags |= VMFLAG_ERROR;
return;
}
switch (aGameArrays[id].dwFlags & GAMEARRAY_TYPEMASK)
{
case 0:
case GAMEARRAY_OFINT:
((int32_t *)aGameArrays[id].vals)[index] = lValue;
return;
case GAMEARRAY_OFSHORT:
((int16_t *)aGameArrays[id].vals)[index] = (int16_t)lValue;
return;
case GAMEARRAY_OFCHAR:
((uint8_t *)aGameArrays[id].vals)[index] = (uint8_t)lValue;
return;
default:
OSD_Printf(CON_ERROR "Gv_SetVarX() (array): WTF??\n",g_errorLineNum,keyw[g_tw]);
vm.flags |= VMFLAG_ERROR;
return;
}
return; return;
} }
if (id&(MAXGAMEVARS<<3)) // struct shortcut vars switch (aGameArrays[id].dwFlags & GAMEARRAY_TYPEMASK)
{ {
register int32_t index, memberid; case 0:
case GAMEARRAY_OFINT:
((int32_t *)aGameArrays[id].vals)[index] = lValue;
return;
case GAMEARRAY_OFSHORT:
((int16_t *)aGameArrays[id].vals)[index] = (int16_t)lValue;
return;
case GAMEARRAY_OFCHAR:
((uint8_t *)aGameArrays[id].vals)[index] = (uint8_t)lValue;
return;
default:
OSD_Printf(CON_ERROR "Gv_SetVarX() (array): WTF??\n",g_errorLineNum,keyw[g_tw]);
vm.flags |= VMFLAG_ERROR;
return;
}
return;
}
index = (id>>16)&0x7fff; if (id&(MAXGAMEVARS<<3)) // struct shortcut vars
if (!(id&MAXGAMEVARS)) {
index = Gv_GetVarN(index); register int32_t index, memberid;
memberid = (id>>2)&31; index = (id>>16)&0x7fff;
if (!(id&MAXGAMEVARS))
index = Gv_GetVarN(index);
switch (id&3) memberid = (id>>2)&31;
{
case 0: //if (id == g_iSpriteVarID) switch (id&3)
X_AccessSprite(1, index, memberid, lValue); {
return; case 0: //if (id == g_iSpriteVarID)
case 1: //else if (id == g_iSectorVarID) X_AccessSprite(1, index, memberid, lValue);
return;
case 1: //else if (id == g_iSectorVarID)
// if (index == vm.g_i) index = sprite[vm.g_i].sectnum; // if (index == vm.g_i) index = sprite[vm.g_i].sectnum;
X_AccessSector(1, index, memberid, lValue); X_AccessSector(1, index, memberid, lValue);
return; return;
case 2: //else if (id == g_iWallVarID) case 2: //else if (id == g_iWallVarID)
X_AccessWall(1, index, memberid, lValue); X_AccessWall(1, index, memberid, lValue);
return; return;
case 3: case 3:
X_AccessTsprite(1, index, memberid, lValue); X_AccessTsprite(1, index, memberid, lValue);
return; return;
// default: // default:
// OSD_Printf(CON_ERROR "Gv_SetVarX(): WTF??\n",g_errorLineNum,keyw[g_tw]); // OSD_Printf(CON_ERROR "Gv_SetVarX(): WTF??\n",g_errorLineNum,keyw[g_tw]);
// return; // return;
}
} }
OSD_Printf(CON_ERROR "Gv_SetVarX(): invalid gamevar ID (%d)\n",g_errorLineNum,keyw[g_tw],id);
vm.flags |= VMFLAG_ERROR;
return;
} }
OSD_Printf(CON_ERROR "Gv_SetVarX(): invalid gamevar ID (%d)\n",g_errorLineNum,keyw[g_tw],id);
vm.flags |= VMFLAG_ERROR;
return;
}
switch (aGameVars[id].dwFlags & switch (aGameVars[id].dwFlags &
(GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR)) (GAMEVAR_USER_MASK|GAMEVAR_INTPTR|GAMEVAR_SHORTPTR|GAMEVAR_CHARPTR))
{ {
@ -589,7 +589,7 @@ static void Gv_AddSystemVars(void)
Gv_NewVar("startposy",(intptr_t)&startposy, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM); Gv_NewVar("startposy",(intptr_t)&startposy, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("startposz",(intptr_t)&startposz, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM); Gv_NewVar("startposz",(intptr_t)&startposz, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("startang",(intptr_t)&startang, GAMEVAR_READONLY | GAMEVAR_SHORTPTR | GAMEVAR_SYSTEM); Gv_NewVar("startang",(intptr_t)&startang, GAMEVAR_READONLY | GAMEVAR_SHORTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("startsectnum",(intptr_t)&startsectnum, GAMEVAR_READONLY | GAMEVAR_SHORTPTR | GAMEVAR_SYSTEM); Gv_NewVar("startsectnum",(intptr_t)&startsectnum, GAMEVAR_READONLY | GAMEVAR_SHORTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("mousxplc",(intptr_t)&mousxplc, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM); Gv_NewVar("mousxplc",(intptr_t)&mousxplc, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);
Gv_NewVar("mousyplc",(intptr_t)&mousyplc, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM); Gv_NewVar("mousyplc",(intptr_t)&mousyplc, GAMEVAR_READONLY | GAMEVAR_INTPTR | GAMEVAR_SYSTEM);

View file

@ -2430,32 +2430,32 @@ cheat_for_port_credits:
#ifdef POLYMER #ifdef POLYMER
else else
{ {
float ratios[] = { 0.0, 1.33, 1.66, 1.78, 1.85, 2.35 }; float ratios[] = { 0.0, 1.33, 1.66, 1.78, 1.85, 2.35 };
int32_t j = (sizeof(ratios)/sizeof(ratios[0])); int32_t j = (sizeof(ratios)/sizeof(ratios[0]));
for (i = 0; i<j; i++) for (i = 0; i<j; i++)
if (ratios[i] == pr_customaspect) if (ratios[i] == pr_customaspect)
break; break;
modval(0,j-1,(int32_t *)&i,1,probey==io); modval(0,j-1,(int32_t *)&i,1,probey==io);
if (x == io) if (x == io)
{ {
i++; i++;
if (i >= j) if (i >= j)
i = 0; i = 0;
} }
if (i == j) if (i == j)
Bsprintf(tempbuf,"Custom"); Bsprintf(tempbuf,"Custom");
else else
{ {
if (i == 0) Bsprintf(tempbuf,"Auto"); if (i == 0) Bsprintf(tempbuf,"Auto");
else Bsprintf(tempbuf,"%.2f:1",ratios[i]); else Bsprintf(tempbuf,"%.2f:1",ratios[i]);
if (ratios[i] != pr_customaspect) if (ratios[i] != pr_customaspect)
pr_customaspect = ratios[i]; pr_customaspect = ratios[i];
} }
mgametextpal(d,yy,tempbuf, MENUHIGHLIGHT(io), 0); mgametextpal(d,yy,tempbuf, MENUHIGHLIGHT(io), 0);
} }
#endif #endif
@ -2527,19 +2527,19 @@ cheat_for_port_credits:
mgametextpal(d,yy, ud.config.useprecache ? "On" : "Off", enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0); mgametextpal(d,yy, ud.config.useprecache ? "On" : "Off", enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0);
break; break;
case 7: case 7:
{
char *s[] = { "Off", "On", "Compress" };
enabled = (glusetexcompr && usehightile);
if (enabled && x==io)
{ {
char *s[] = { "Off", "On", "Compress" }; glusetexcache++;
enabled = (glusetexcompr && usehightile); if (glusetexcache > 2)
if (enabled && x==io) glusetexcache = 0;
{
glusetexcache++;
if (glusetexcache > 2)
glusetexcache = 0;
}
if (enabled) modval(0,2,(int32_t *)&glusetexcache,1,probey==io);
mgametextpal(d,yy, s[glusetexcache], enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0);
} }
break; if (enabled) modval(0,2,(int32_t *)&glusetexcache,1,probey==io);
mgametextpal(d,yy, s[glusetexcache], enabled?MENUHIGHLIGHT(io):DISABLEDMENUSHADE, 0);
}
break;
case 8: case 8:
enabled = usehightile; enabled = usehightile;
if (enabled && x==io) r_detailmapping = !r_detailmapping; if (enabled && x==io) r_detailmapping = !r_detailmapping;

View file

@ -48,7 +48,7 @@ static const int32_t _MIDI_CommandLengths[ NUM_MIDI_CHANNELS ] =
0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 2, 0 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 1, 1, 2, 0
}; };
static int32_t (*_MIDI_RerouteFunctions[ NUM_MIDI_CHANNELS ]) ( int32_t event, int32_t c1, int32_t c2 ); static int32_t (*_MIDI_RerouteFunctions[ NUM_MIDI_CHANNELS ])(int32_t event, int32_t c1, int32_t c2);
static track *_MIDI_TrackPtr = NULL; static track *_MIDI_TrackPtr = NULL;
static int32_t _MIDI_TrackMemSize; static int32_t _MIDI_TrackMemSize;
@ -62,12 +62,12 @@ static int32_t _MIDI_Division;
static int32_t _MIDI_Tick = 0; static int32_t _MIDI_Tick = 0;
static int32_t _MIDI_Beat = 1; static int32_t _MIDI_Beat = 1;
static int32_t _MIDI_Measure = 1; static int32_t _MIDI_Measure = 1;
static unsigned _MIDI_Time; static uint32_t _MIDI_Time;
static int32_t _MIDI_BeatsPerMeasure; static int32_t _MIDI_BeatsPerMeasure;
static int32_t _MIDI_TicksPerBeat; static int32_t _MIDI_TicksPerBeat;
static int32_t _MIDI_TimeBase; static int32_t _MIDI_TimeBase;
static int32_t _MIDI_FPSecondsPerTick; static int32_t _MIDI_FPSecondsPerTick;
static unsigned _MIDI_TotalTime; static uint32_t _MIDI_TotalTime;
static int32_t _MIDI_TotalTicks; static int32_t _MIDI_TotalTicks;
static int32_t _MIDI_TotalBeats; static int32_t _MIDI_TotalBeats;
static int32_t _MIDI_TotalMeasures; static int32_t _MIDI_TotalMeasures;

View file

@ -123,7 +123,7 @@ void CALLBACK MPU_MIDICallback(HMIDIOUT handle, UINT uMsg, DWORD dwInstance, DWO
{ {
case MOM_DONE: case MOM_DONE:
midiOutUnprepareHeader((HMIDIOUT)handle, (MIDIHDR*)dwParam1, sizeof(MIDIHDR)); midiOutUnprepareHeader((HMIDIOUT)handle, (MIDIHDR*)dwParam1, sizeof(MIDIHDR));
for (i=0;i<NUMBUFFERS;i++) for (i=0; i<NUMBUFFERS; i++)
{ {
if (dwParam1 == (uint32_t)&bufferheaders[i]) if (dwParam1 == (uint32_t)&bufferheaders[i])
{ {
@ -272,7 +272,7 @@ int32_t MPU_Init
{ {
int32_t i; int32_t i;
for (i=0;i<NUMBUFFERS;i++) eventcnt[i]=0; for (i=0; i<NUMBUFFERS; i++) eventcnt[i]=0;
mididevice = addr; mididevice = addr;

View file

@ -1195,15 +1195,15 @@ static int32_t osdcmd_listplayers(const osdfuncparm_t *parm)
} }
for (currentPeer = g_netServer -> peers; for (currentPeer = g_netServer -> peers;
currentPeer < & g_netServer -> peers [g_netServer -> peerCount]; currentPeer < & g_netServer -> peers [g_netServer -> peerCount];
++ currentPeer) ++ currentPeer)
{ {
if (currentPeer -> state != ENET_PEER_STATE_CONNECTED) if (currentPeer -> state != ENET_PEER_STATE_CONNECTED)
continue; continue;
enet_address_get_host_ip(&currentPeer->address, ipaddr, sizeof(ipaddr)); enet_address_get_host_ip(&currentPeer->address, ipaddr, sizeof(ipaddr));
initprintf("%x %s %s\n", currentPeer->address.host, ipaddr, initprintf("%x %s %s\n", currentPeer->address.host, ipaddr,
g_player[(intptr_t)currentPeer->data].user_name); g_player[(intptr_t)currentPeer->data].user_name);
} }
return OSDCMD_OK; return OSDCMD_OK;
@ -1224,19 +1224,19 @@ static int32_t osdcmd_kick(const osdfuncparm_t *parm)
} }
for (currentPeer = g_netServer -> peers; for (currentPeer = g_netServer -> peers;
currentPeer < & g_netServer -> peers [g_netServer -> peerCount]; currentPeer < & g_netServer -> peers [g_netServer -> peerCount];
++ currentPeer) ++ currentPeer)
{ {
if (currentPeer -> state != ENET_PEER_STATE_CONNECTED) if (currentPeer -> state != ENET_PEER_STATE_CONNECTED)
continue; continue;
sscanf (parm->parms[0],"%" PRIxPTR "", &hexaddr); sscanf(parm->parms[0],"%" PRIxPTR "", &hexaddr);
if (currentPeer->address.host == hexaddr) if (currentPeer->address.host == hexaddr)
{ {
initprintf("Kicking %x (%s)\n", currentPeer->address.host, initprintf("Kicking %x (%s)\n", currentPeer->address.host,
g_player[(intptr_t)currentPeer->data].user_name); g_player[(intptr_t)currentPeer->data].user_name);
enet_peer_disconnect (currentPeer, DISC_KICKED); enet_peer_disconnect(currentPeer, DISC_KICKED);
return OSDCMD_OK; return OSDCMD_OK;
} }
} }
@ -1260,13 +1260,13 @@ static int32_t osdcmd_kickban(const osdfuncparm_t *parm)
} }
for (currentPeer = g_netServer -> peers; for (currentPeer = g_netServer -> peers;
currentPeer < & g_netServer -> peers [g_netServer -> peerCount]; currentPeer < & g_netServer -> peers [g_netServer -> peerCount];
++ currentPeer) ++ currentPeer)
{ {
if (currentPeer -> state != ENET_PEER_STATE_CONNECTED) if (currentPeer -> state != ENET_PEER_STATE_CONNECTED)
continue; continue;
sscanf (parm->parms[0],"%" PRIxPTR "", &hexaddr); sscanf(parm->parms[0],"%" PRIxPTR "", &hexaddr);
if (currentPeer->address.host == hexaddr) if (currentPeer->address.host == hexaddr)
{ {
@ -1275,8 +1275,8 @@ static int32_t osdcmd_kickban(const osdfuncparm_t *parm)
enet_address_get_host_ip(&currentPeer->address, ipaddr, sizeof(ipaddr)); enet_address_get_host_ip(&currentPeer->address, ipaddr, sizeof(ipaddr));
initprintf("Host %s is now banned.\n", ipaddr); initprintf("Host %s is now banned.\n", ipaddr);
initprintf("Kicking %x (%s)\n", currentPeer->address.host, initprintf("Kicking %x (%s)\n", currentPeer->address.host,
g_player[(intptr_t)currentPeer->data].user_name); g_player[(intptr_t)currentPeer->data].user_name);
enet_peer_disconnect (currentPeer, DISC_BANNED); enet_peer_disconnect(currentPeer, DISC_BANNED);
return OSDCMD_OK; return OSDCMD_OK;
} }
} }

View file

@ -3322,11 +3322,11 @@ void getinput(int32_t snum)
return; return;
} }
/* /*
if (numplayers > 1) if (numplayers > 1)
daang = myang; daang = myang;
else*/ else*/
daang = p->ang; daang = p->ang;
momx = mulscale9(vel,sintable[(daang+2560)&2047]); momx = mulscale9(vel,sintable[(daang+2560)&2047]);
momy = mulscale9(vel,sintable[(daang+2048)&2047]); momy = mulscale9(vel,sintable[(daang+2048)&2047]);
@ -3890,8 +3890,8 @@ void P_FragPlayer(int32_t snum)
if (ud.obituaries) if (ud.obituaries)
{ {
Bsprintf(tempbuf,ScriptQuotes[FIRST_OBITUARY_QUOTE+(krand()%g_numObituaries)], Bsprintf(tempbuf,ScriptQuotes[FIRST_OBITUARY_QUOTE+(krand()%g_numObituaries)],
&g_player[p->frag_ps].user_name[0], &g_player[p->frag_ps].user_name[0],
&g_player[snum].user_name[0]); &g_player[snum].user_name[0]);
G_AddUserQuote(tempbuf); G_AddUserQuote(tempbuf);
} }
else krand(); else krand();
@ -4148,7 +4148,7 @@ void P_ProcessInput(int32_t snum)
if ((numplayers < 2 || g_netServer) && p->dead_flag == 0) if ((numplayers < 2 || g_netServer) && p->dead_flag == 0)
P_FragPlayer(snum); P_FragPlayer(snum);
if (psectlotag == 2) if (psectlotag == 2)
{ {
if (p->on_warping_sector == 0) if (p->on_warping_sector == 0)
@ -5440,10 +5440,10 @@ SHOOTINCODE:
} }
j = A_InsertSprite(p->cursectnum, j = A_InsertSprite(p->cursectnum,
p->posx+(sintable[(p->ang+512)&2047]>>6), p->posx+(sintable[(p->ang+512)&2047]>>6),
p->posy+(sintable[p->ang&2047]>>6), p->posy+(sintable[p->ang&2047]>>6),
p->posz,aplWeaponShoots[p->curr_weapon][snum],-16,9,9, p->posz,aplWeaponShoots[p->curr_weapon][snum],-16,9,9,
p->ang,(k+(p->hbomb_hold_delay<<5)),i,pi,1); p->ang,(k+(p->hbomb_hold_delay<<5)),i,pi,1);
lPipeBombControl=Gv_GetVarByLabel("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, snum); lPipeBombControl=Gv_GetVarByLabel("PIPEBOMB_CONTROL", PIPEBOMB_REMOTE, -1, snum);
@ -5452,8 +5452,8 @@ SHOOTINCODE:
int32_t lGrenadeLifetime=Gv_GetVarByLabel("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, -1, snum); int32_t lGrenadeLifetime=Gv_GetVarByLabel("GRENADE_LIFETIME", NAM_GRENADE_LIFETIME, -1, snum);
int32_t lGrenadeLifetimeVar=Gv_GetVarByLabel("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, -1, snum); int32_t lGrenadeLifetimeVar=Gv_GetVarByLabel("GRENADE_LIFETIME_VAR", NAM_GRENADE_LIFETIME_VAR, -1, snum);
ActorExtra[j].temp_data[7]=lGrenadeLifetime ActorExtra[j].temp_data[7]=lGrenadeLifetime
+ mulscale(krand(),lGrenadeLifetimeVar, 14) + mulscale(krand(),lGrenadeLifetimeVar, 14)
- lGrenadeLifetimeVar; - lGrenadeLifetimeVar;
ActorExtra[j].temp_data[6]=1; ActorExtra[j].temp_data[6]=1;
} }
else else

View file

@ -1386,47 +1386,47 @@ static void resetpspritevars(char g)
if (ud.recstat != 2) if (ud.recstat != 2)
TRAVERSE_CONNECT(i) TRAVERSE_CONNECT(i)
{
aimmode[i] = g_player[i].ps->aim_mode;
autoaim[i] = g_player[i].ps->auto_aim;
weaponswitch[i] = g_player[i].ps->weaponswitch;
if ((g_netServer || ud.multimode > 1) && (GametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{ {
aimmode[i] = g_player[i].ps->aim_mode; for (j=0; j<MAX_WEAPONS; j++)
autoaim[i] = g_player[i].ps->auto_aim;
weaponswitch[i] = g_player[i].ps->weaponswitch;
if ((g_netServer || ud.multimode > 1) && (GametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{ {
for (j=0; j<MAX_WEAPONS; j++) tsbar[i].ammo_amount[j] = g_player[i].ps->ammo_amount[j];
{ tsbar[i].gotweapon[j] = g_player[i].ps->gotweapon[j];
tsbar[i].ammo_amount[j] = g_player[i].ps->ammo_amount[j];
tsbar[i].gotweapon[j] = g_player[i].ps->gotweapon[j];
}
Bmemcpy(tsbar[i].inv_amount, g_player[i].ps->inv_amount, sizeof(tsbar[i].inv_amount));
tsbar[i].curr_weapon = g_player[i].ps->curr_weapon;
tsbar[i].inven_icon = g_player[i].ps->inven_icon;
} }
Bmemcpy(tsbar[i].inv_amount, g_player[i].ps->inv_amount, sizeof(tsbar[i].inv_amount));
tsbar[i].curr_weapon = g_player[i].ps->curr_weapon;
tsbar[i].inven_icon = g_player[i].ps->inven_icon;
} }
}
P_ResetStatus(0); P_ResetStatus(0);
TRAVERSE_CONNECT(i) TRAVERSE_CONNECT(i)
if (i) Bmemcpy(g_player[i].ps,g_player[0].ps,sizeof(DukePlayer_t)); if (i) Bmemcpy(g_player[i].ps,g_player[0].ps,sizeof(DukePlayer_t));
if (ud.recstat != 2) if (ud.recstat != 2)
TRAVERSE_CONNECT(i) TRAVERSE_CONNECT(i)
{
g_player[i].ps->aim_mode = aimmode[i];
g_player[i].ps->auto_aim = autoaim[i];
g_player[i].ps->weaponswitch = weaponswitch[i];
if ((g_netServer || ud.multimode > 1) && (GametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{ {
g_player[i].ps->aim_mode = aimmode[i]; for (j=0; j<MAX_WEAPONS; j++)
g_player[i].ps->auto_aim = autoaim[i];
g_player[i].ps->weaponswitch = weaponswitch[i];
if ((g_netServer || ud.multimode > 1) && (GametypeFlags[ud.coop]&GAMETYPE_PRESERVEINVENTORYDEATH) && ud.last_level >= 0)
{ {
for (j=0; j<MAX_WEAPONS; j++) g_player[i].ps->ammo_amount[j] = tsbar[i].ammo_amount[j];
{ g_player[i].ps->gotweapon[j] = tsbar[i].gotweapon[j];
g_player[i].ps->ammo_amount[j] = tsbar[i].ammo_amount[j];
g_player[i].ps->gotweapon[j] = tsbar[i].gotweapon[j];
}
g_player[i].ps->curr_weapon = tsbar[i].curr_weapon;
g_player[i].ps->inven_icon = tsbar[i].inven_icon;
Bmemcpy(g_player[i].ps->inv_amount, tsbar[i].inv_amount, sizeof(tsbar[i].inv_amount));
} }
g_player[i].ps->curr_weapon = tsbar[i].curr_weapon;
g_player[i].ps->inven_icon = tsbar[i].inven_icon;
Bmemcpy(g_player[i].ps->inv_amount, tsbar[i].inv_amount, sizeof(tsbar[i].inv_amount));
} }
}
g_numPlayerSprites = 0; g_numPlayerSprites = 0;
circ = 2048/ud.multimode; circ = 2048/ud.multimode;

View file

@ -192,7 +192,7 @@ inline int32_t G_CheckPlayerInSector(int32_t sect)
{ {
int32_t i; int32_t i;
TRAVERSE_CONNECT(i) TRAVERSE_CONNECT(i)
if (sprite[g_player[i].ps->i].sectnum == sect) return i; if (sprite[g_player[i].ps->i].sectnum == sect) return i;
return -1; return -1;
} }
@ -3048,7 +3048,7 @@ void P_CheckSectors(int32_t snum)
return; return;
case -1: case -1:
TRAVERSE_CONNECT(i) TRAVERSE_CONNECT(i)
g_player[i].ps->gm = MODE_EOL; g_player[i].ps->gm = MODE_EOL;
sector[p->cursectnum].lotag = 0; sector[p->cursectnum].lotag = 0;
if (ud.from_bonus) if (ud.from_bonus)
{ {

View file

@ -144,7 +144,7 @@ void S_MusicStartup(void)
{ {
MUSIC_SetVolume(ud.config.MusicVolume); MUSIC_SetVolume(ud.config.MusicVolume);
} }
initprintf("S_MusicStartup(): failed initializing\n"); initprintf("S_MusicStartup(): failed initializing\n");
} }
} }
@ -296,7 +296,7 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
if (MapInfo[sel].alt_musicfn != NULL) if (MapInfo[sel].alt_musicfn != NULL)
alt = (int32_t)(fn = MapInfo[sel].alt_musicfn); alt = (int32_t)(fn = MapInfo[sel].alt_musicfn);
testfn = (char *) Bmalloc(strlen(fn) + 5); testfn = (char *) Bmalloc(strlen(fn) + 5);
strcpy(testfn, fn); strcpy(testfn, fn);
@ -356,8 +356,8 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
else else
{ {
if ((MusicVoice = FX_PlayLoopedAuto(MusicPtr, MusicLen, 0, 0, 0, ud.config.MusicVolume, if ((MusicVoice = FX_PlayLoopedAuto(MusicPtr, MusicLen, 0, 0, 0, ud.config.MusicVolume,
ud.config.MusicVolume, ud.config.MusicVolume, ud.config.MusicVolume, ud.config.MusicVolume,
FX_MUSIC_PRIORITY, MUSIC_ID)) >= FX_Ok) FX_MUSIC_PRIORITY, MUSIC_ID)) >= FX_Ok)
MusicIsWaveform = 1; MusicIsWaveform = 1;
} }
return (alt != 0); return (alt != 0);
@ -567,12 +567,12 @@ int32_t S_PlaySound3D(int32_t num, int32_t i, const vec3_t *pos)
if (g_sounds[num].num > 0) return -1; if (g_sounds[num].num > 0) return -1;
voice = FX_PlayLoopedAuto(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1, voice = FX_PlayLoopedAuto(g_sounds[num].ptr, g_sounds[num].soundsiz, 0, -1,
pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,(num * MAXSOUNDINSTANCES) + l); pitch,sndist>>6,sndist>>6,0,g_sounds[num].pr,(num * MAXSOUNDINSTANCES) + l);
} }
else else
{ {
voice = FX_PlayAuto3D(g_sounds[ num ].ptr, g_sounds[num].soundsiz, pitch,sndang>>4,sndist>>6, g_sounds[num].pr, voice = FX_PlayAuto3D(g_sounds[ num ].ptr, g_sounds[num].soundsiz, pitch,sndang>>4,sndist>>6, g_sounds[num].pr,
(num * MAXSOUNDINSTANCES) + l); (num * MAXSOUNDINSTANCES) + l);
} }
if (voice >= FX_Ok) if (voice >= FX_Ok)
@ -733,7 +733,7 @@ void S_Pan3D(void)
k--; k--;
continue; continue;
} }
Bmemcpy(&s, &sprite[i], sizeof(vec3_t)); Bmemcpy(&s, &sprite[i], sizeof(vec3_t));
if (PN == APLAYER && sprite[i].yvel == screenpeek) if (PN == APLAYER && sprite[i].yvel == screenpeek)

View file

@ -1,8 +1,8 @@
#if defined(LINKED_GTK) #if defined(LINKED_GTK)
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixdata.h> #include <gdk-pixbuf/gdk-pixdata.h>
#else #else
#include "dynamicgtk.h" #include "dynamicgtk.h"
#endif #endif
#include "duke3d.h" #include "duke3d.h"
@ -12,76 +12,79 @@
#define RDR_POLYMOST 3 // sould be defined elsewhere #define RDR_POLYMOST 3 // sould be defined elsewhere
#define RDR_POLYMER 4 // sould be defined elsewhere #define RDR_POLYMER 4 // sould be defined elsewhere
enum { enum
NONE, {
ALL, NONE,
POPULATE_VIDEO, ALL,
POPULATE_CONFIG, POPULATE_VIDEO,
POPULATE_GAME, POPULATE_CONFIG,
POPULATE_GAME,
}; };
enum { enum
TAB_CONFIG, {
TAB_GAME, TAB_CONFIG,
TAB_MESSAGES, TAB_GAME,
TAB_MESSAGES,
}; };
enum { enum
INPUT_KB, {
INPUT_MOUSE, INPUT_KB,
INPUT_JOYSTICK, INPUT_MOUSE,
INPUT_ALL, INPUT_JOYSTICK,
INPUT_ALL,
}; };
static struct static struct
{ {
GtkWidget *startwin; GtkWidget *startwin;
GtkWidget *hlayout; GtkWidget *hlayout;
GtkWidget *banner; GtkWidget *banner;
GtkWidget *vlayout; GtkWidget *vlayout;
GtkWidget *tabs; GtkWidget *tabs;
GtkWidget *configtlayout; GtkWidget *configtlayout;
GtkWidget *displayvlayout; GtkWidget *displayvlayout;
GtkWidget *vmode3dlabel; GtkWidget *vmode3dlabel;
GtkWidget *vmode3dcombo; GtkWidget *vmode3dcombo;
GtkWidget *fullscreencheck; GtkWidget *fullscreencheck;
GtkWidget *polymercheck; GtkWidget *polymercheck;
GtkWidget *inputdevlabel; GtkWidget *inputdevlabel;
GtkWidget *inputdevcombo; GtkWidget *inputdevcombo;
GtkWidget *custommodlabel; GtkWidget *custommodlabel;
GtkWidget *custommodcombo; GtkWidget *custommodcombo;
GtkWidget *emptyhlayout; GtkWidget *emptyhlayout;
GtkWidget *autoloadcheck; GtkWidget *autoloadcheck;
GtkWidget *alwaysshowcheck; GtkWidget *alwaysshowcheck;
GtkWidget *configtab; GtkWidget *configtab;
GtkWidget *gamevlayout; GtkWidget *gamevlayout;
GtkWidget *gamelabel; GtkWidget *gamelabel;
GtkWidget *gamescroll; GtkWidget *gamescroll;
GtkWidget *gamelist; GtkWidget *gamelist;
GtkWidget *gametab; GtkWidget *gametab;
GtkWidget *messagesscroll; GtkWidget *messagesscroll;
GtkWidget *messagestext; GtkWidget *messagestext;
GtkWidget *messagestab; GtkWidget *messagestab;
GtkWidget *buttons; GtkWidget *buttons;
GtkWidget *cancelbutton; GtkWidget *cancelbutton;
GtkWidget *cancelbuttonalign; GtkWidget *cancelbuttonalign;
GtkWidget *cancelbuttonlayout; GtkWidget *cancelbuttonlayout;
GtkWidget *cancelbuttonicon; GtkWidget *cancelbuttonicon;
GtkWidget *cancelbuttonlabel; GtkWidget *cancelbuttonlabel;
GtkWidget *startbutton; GtkWidget *startbutton;
GtkWidget *startbuttonalign; GtkWidget *startbuttonalign;
GtkWidget *startbuttonlayout; GtkWidget *startbuttonlayout;
GtkWidget *startbuttonicon; GtkWidget *startbuttonicon;
GtkWidget *startbuttonlabel; GtkWidget *startbuttonlabel;
} stwidgets; } stwidgets;
static struct static struct
{ {
int32_t fullscreen; int32_t fullscreen;
int32_t polymer; int32_t polymer;
int32_t xdim3d, ydim3d, bpp3d; int32_t xdim3d, ydim3d, bpp3d;
int32_t forcesetup; int32_t forcesetup;
int32_t autoload; int32_t autoload;
int32_t usemouse, usejoy; int32_t usemouse, usejoy;
int32_t game; int32_t game;
int32_t crcval; int32_t crcval;
@ -102,7 +105,7 @@ static void on_vmode3dcombo_changed(GtkComboBox *combobox, gpointer user_data)
GtkTreeIter iter; GtkTreeIter iter;
int32_t val; int32_t val;
UNREFERENCED_PARAMETER(user_data); UNREFERENCED_PARAMETER(user_data);
if (!gtk_combo_box_get_active_iter(combobox, &iter)) return; if (!gtk_combo_box_get_active_iter(combobox, &iter)) return;
if (!(data = gtk_combo_box_get_model(combobox))) return; if (!(data = gtk_combo_box_get_model(combobox))) return;
gtk_tree_model_get(data, &iter, 1, &val, -1); gtk_tree_model_get(data, &iter, 1, &val, -1);
@ -122,18 +125,18 @@ static void on_polymercheck_toggled(GtkToggleButton *togglebutton, gpointer user
UNREFERENCED_PARAMETER(user_data); UNREFERENCED_PARAMETER(user_data);
if (gtk_toggle_button_get_active(togglebutton)) if (gtk_toggle_button_get_active(togglebutton))
{ {
glrendmode = RDR_POLYMER; glrendmode = RDR_POLYMER;
settings.polymer = TRUE; settings.polymer = TRUE;
if (settings.bpp3d == 8) if (settings.bpp3d == 8)
{ {
settings.bpp3d = 32; settings.bpp3d = 32;
PopulateForm(POPULATE_VIDEO); PopulateForm(POPULATE_VIDEO);
} }
} }
else else
{ {
glrendmode = RDR_POLYMOST; glrendmode = RDR_POLYMOST;
settings.polymer = FALSE; settings.polymer = FALSE;
} }
} }
@ -141,12 +144,12 @@ static void on_inputdevcombo_changed(GtkComboBox *combobox, gpointer user_data)
{ {
UNREFERENCED_PARAMETER(user_data); UNREFERENCED_PARAMETER(user_data);
switch (gtk_combo_box_get_active(combobox)) switch (gtk_combo_box_get_active(combobox))
{ {
case 0: settings.usemouse = 0; settings.usejoy = 0; break; case 0: settings.usemouse = 0; settings.usejoy = 0; break;
case 1: settings.usemouse = 1; settings.usejoy = 0; break; case 1: settings.usemouse = 1; settings.usejoy = 0; break;
case 2: settings.usemouse = 0; settings.usejoy = 1; break; case 2: settings.usemouse = 0; settings.usejoy = 1; break;
case 3: settings.usemouse = 1; settings.usejoy = 1; break; case 3: settings.usemouse = 1; settings.usejoy = 1; break;
} }
} }
static void on_custommodcombo_changed(GtkComboBox *combobox, gpointer user_data) static void on_custommodcombo_changed(GtkComboBox *combobox, gpointer user_data)
@ -156,17 +159,17 @@ static void on_custommodcombo_changed(GtkComboBox *combobox, gpointer user_data)
GtkTreePath *path; GtkTreePath *path;
char *value; char *value;
UNREFERENCED_PARAMETER(user_data); UNREFERENCED_PARAMETER(user_data);
if (gtk_combo_box_get_active_iter (combobox, &iter)) if (gtk_combo_box_get_active_iter(combobox, &iter))
{ {
model = gtk_combo_box_get_model (combobox); model = gtk_combo_box_get_model(combobox);
gtk_tree_model_get( model, &iter, 0,&value, -1 ); gtk_tree_model_get(model, &iter, 0,&value, -1);
path = gtk_tree_model_get_path(model, &iter); path = gtk_tree_model_get_path(model, &iter);
if (*gtk_tree_path_get_indices (path) == NONE) if (*gtk_tree_path_get_indices(path) == NONE)
settings.custommoddir = NULL; settings.custommoddir = NULL;
else settings.custommoddir = value; else settings.custommoddir = value;
} }
} }
static void on_autoloadcheck_toggled(GtkToggleButton *togglebutton, gpointer user_data) static void on_autoloadcheck_toggled(GtkToggleButton *togglebutton, gpointer user_data)
@ -203,7 +206,7 @@ static void on_gamelist_selection_changed(GtkTreeSelection *selection, gpointer
GtkTreeModel *model; GtkTreeModel *model;
struct grpfile *fg; struct grpfile *fg;
UNREFERENCED_PARAMETER(user_data); UNREFERENCED_PARAMETER(user_data);
if (gtk_tree_selection_get_selected(selection, &model, &iter)) if (gtk_tree_selection_get_selected(selection, &model, &iter))
{ {
gtk_tree_model_get(model, &iter, 2, (gpointer)&fg, -1); gtk_tree_model_get(model, &iter, 2, (gpointer)&fg, -1);
@ -242,42 +245,42 @@ static void SetPage(int32_t n)
if (n == TAB_CONFIG) n = TRUE; else n = FALSE; if (n == TAB_CONFIG) n = TRUE; else n = FALSE;
gtk_widget_set_sensitive(stwidgets.startbutton, n); gtk_widget_set_sensitive(stwidgets.startbutton, n);
gtk_container_foreach(GTK_CONTAINER(stwidgets.configtlayout), gtk_container_foreach(GTK_CONTAINER(stwidgets.configtlayout),
(GtkCallback)gtk_widget_set_sensitive, (GtkCallback)gtk_widget_set_sensitive,
(gpointer)&n); (gpointer)&n);
} }
static unsigned char GetModsDirNames(GtkListStore *list) static unsigned char GetModsDirNames(GtkListStore *list)
{ {
char *homedir; char *homedir;
char pdir[BMAX_PATH]; char pdir[BMAX_PATH];
unsigned char iternumb = 0; unsigned char iternumb = 0;
CACHE1D_FIND_REC *dirs = NULL; CACHE1D_FIND_REC *dirs = NULL;
GtkTreeIter iter; GtkTreeIter iter;
pathsearchmode = 1; pathsearchmode = 1;
if ((homedir = Bgethomedir()))
{
Bsnprintf(pdir, sizeof(pdir), "%s/" ".eduke32", homedir);
dirs = klistpath(pdir, "*", CACHE1D_FIND_DIR);
for (dirs=dirs; dirs != NULL; dirs=dirs->next)
{
if ((Bstrcmp(dirs->name, "autoload") == 0) ||
(Bstrcmp(dirs->name, "..") == 0) ||
(Bstrcmp(dirs->name, ".") == 0))
continue;
else
{
gtk_list_store_append(list, &iter);
gtk_list_store_set(list, &iter, 0,dirs->name, -1);
iternumb++;
}
}
}
if ((homedir = Bgethomedir()))
{
Bsnprintf(pdir, sizeof(pdir), "%s/" ".eduke32", homedir);
dirs = klistpath(pdir, "*", CACHE1D_FIND_DIR);
for (dirs=dirs; dirs != NULL; dirs=dirs->next)
{
if ((Bstrcmp(dirs->name, "autoload") == 0) ||
(Bstrcmp(dirs->name, "..") == 0) ||
(Bstrcmp(dirs->name, ".") == 0))
continue;
else
{
gtk_list_store_append(list, &iter);
gtk_list_store_set(list, &iter, 0,dirs->name, -1);
iternumb++;
}
}
}
klistfree(dirs); klistfree(dirs);
dirs = NULL; dirs = NULL;
return iternumb; return iternumb;
} }
@ -289,12 +292,12 @@ static void PopulateForm(unsigned char pgs)
GtkListStore *modes3d; GtkListStore *modes3d;
GtkTreeIter iter; GtkTreeIter iter;
char buf[64]; char buf[64];
mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1); mode3d = checkvideomode(&settings.xdim3d, &settings.ydim3d, settings.bpp3d, settings.fullscreen, 1);
if (mode3d < 0) if (mode3d < 0)
{ {
int32_t i, cd[] = { 32, 24, 16, 15, 8, 0 }; int32_t i, cd[] = { 32, 24, 16, 15, 8, 0 };
for (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; } for (i=0; cd[i];) { if (cd[i] >= settings.bpp3d) i++; else break; }
for (; cd[i]; i++) for (; cd[i]; i++)
{ {
@ -304,7 +307,7 @@ static void PopulateForm(unsigned char pgs)
break; break;
} }
} }
modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(stwidgets.vmode3dcombo))); modes3d = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(stwidgets.vmode3dcombo)));
gtk_list_store_clear(modes3d); gtk_list_store_clear(modes3d);
@ -323,81 +326,82 @@ static void PopulateForm(unsigned char pgs)
g_signal_handlers_unblock_by_func(stwidgets.vmode3dcombo, on_vmode3dcombo_changed, NULL); g_signal_handlers_unblock_by_func(stwidgets.vmode3dcombo, on_vmode3dcombo_changed, NULL);
} }
} }
} }
if ((pgs == ALL) || (pgs == POPULATE_CONFIG)) if ((pgs == ALL) || (pgs == POPULATE_CONFIG))
{ {
GtkListStore *devlist, *modsdir; GtkListStore *devlist, *modsdir;
GtkTreeIter iter; GtkTreeIter iter;
GtkTreePath *path; GtkTreePath *path;
char *value; char *value;
unsigned char i, r = 0; unsigned char i, r = 0;
const char *availabledev[] = { const char *availabledev[] =
"Keyboard only", {
"Keyboard and mouse", "Keyboard only",
"Keyboard and joystick", "Keyboard and mouse",
"All supported devices" "Keyboard and joystick",
}; "All supported devices"
};
// populate input devices combo // populate input devices combo
devlist = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(stwidgets.inputdevcombo))); devlist = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(stwidgets.inputdevcombo)));
gtk_list_store_clear(devlist); gtk_list_store_clear(devlist);
for (i=0; i<(int32_t)G_N_ELEMENTS(availabledev); i++) for (i=0; i<(int32_t)G_N_ELEMENTS(availabledev); i++)
{ {
gtk_list_store_append(devlist, &iter); gtk_list_store_append(devlist, &iter);
gtk_list_store_set(devlist, &iter, 0,availabledev[i], -1); gtk_list_store_set(devlist, &iter, 0,availabledev[i], -1);
} }
switch (settings.usemouse) switch (settings.usemouse)
{ {
case 0: if (settings.usejoy) case 0: if (settings.usejoy)
gtk_combo_box_set_active (GTK_COMBO_BOX (stwidgets.inputdevcombo), INPUT_JOYSTICK); gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.inputdevcombo), INPUT_JOYSTICK);
else else
gtk_combo_box_set_active (GTK_COMBO_BOX (stwidgets.inputdevcombo), INPUT_KB); gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.inputdevcombo), INPUT_KB);
break; break;
case 1: if (settings.usejoy) case 1: if (settings.usejoy)
gtk_combo_box_set_active (GTK_COMBO_BOX (stwidgets.inputdevcombo), INPUT_ALL); gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.inputdevcombo), INPUT_ALL);
else else
gtk_combo_box_set_active (GTK_COMBO_BOX (stwidgets.inputdevcombo), INPUT_MOUSE); gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.inputdevcombo), INPUT_MOUSE);
break; break;
} }
// populate custom mod combo // populate custom mod combo
modsdir = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(stwidgets.custommodcombo))); modsdir = GTK_LIST_STORE(gtk_combo_box_get_model(GTK_COMBO_BOX(stwidgets.custommodcombo)));
gtk_list_store_clear(modsdir); gtk_list_store_clear(modsdir);
gtk_list_store_append(modsdir, &iter); gtk_list_store_append(modsdir, &iter);
gtk_list_store_set(modsdir, &iter, 0,"None", -1); gtk_list_store_set(modsdir, &iter, 0,"None", -1);
r = GetModsDirNames(modsdir); r = GetModsDirNames(modsdir);
for(i=0; i<=r; i++)
{
path = gtk_tree_path_new_from_indices( i, -1 );
gtk_tree_model_get_iter( GTK_TREE_MODEL(modsdir), &iter, path );
gtk_tree_model_get( GTK_TREE_MODEL(modsdir), &iter, 0,&value, -1 );
if (Bstrcmp(settings.custommoddir, "/") == 0)
{
gtk_combo_box_set_active (GTK_COMBO_BOX (stwidgets.custommodcombo), NONE);
settings.custommoddir = NULL;
break; for (i=0; i<=r; i++)
} {
if (Bstrcmp(settings.custommoddir, value) == 0) path = gtk_tree_path_new_from_indices(i, -1);
{ gtk_tree_model_get_iter(GTK_TREE_MODEL(modsdir), &iter, path);
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (stwidgets.custommodcombo), gtk_tree_model_get(GTK_TREE_MODEL(modsdir), &iter, 0,&value, -1);
&iter);
if (Bstrcmp(settings.custommoddir, "/") == 0)
{
gtk_combo_box_set_active(GTK_COMBO_BOX(stwidgets.custommodcombo), NONE);
settings.custommoddir = NULL;
break;
}
if (Bstrcmp(settings.custommoddir, value) == 0)
{
gtk_combo_box_set_active_iter(GTK_COMBO_BOX(stwidgets.custommodcombo),
&iter);
break;
}
}
break;
}
}
// populate check buttons // populate check buttons
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.fullscreencheck), settings.fullscreen); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.fullscreencheck), settings.fullscreen);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.polymercheck), settings.polymer); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.polymercheck), settings.polymer);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.autoloadcheck), settings.autoload); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.autoloadcheck), settings.autoload);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.alwaysshowcheck), settings.forcesetup); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(stwidgets.alwaysshowcheck), settings.forcesetup);
} }
if ((pgs == ALL) || (pgs == POPULATE_GAME)) if ((pgs == ALL) || (pgs == POPULATE_GAME))
{ {
@ -476,17 +480,17 @@ static GtkWidget *create_window(void)
stwidgets.tabs = gtk_notebook_new(); stwidgets.tabs = gtk_notebook_new();
gtk_box_pack_start(GTK_BOX(stwidgets.vlayout), stwidgets.tabs, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(stwidgets.vlayout), stwidgets.tabs, TRUE, TRUE, 0);
gtk_container_set_border_width(GTK_CONTAINER(stwidgets.tabs), 4); gtk_container_set_border_width(GTK_CONTAINER(stwidgets.tabs), 4);
// layout table of config page // layout table of config page
stwidgets.configtlayout = gtk_table_new(6, 3, FALSE); stwidgets.configtlayout = gtk_table_new(6, 3, FALSE);
gtk_container_add (GTK_CONTAINER (stwidgets.tabs), stwidgets.configtlayout); gtk_container_add(GTK_CONTAINER(stwidgets.tabs), stwidgets.configtlayout);
// 3D video mode LabelText // 3D video mode LabelText
stwidgets.vmode3dlabel = gtk_label_new_with_mnemonic("_Video mode:"); stwidgets.vmode3dlabel = gtk_label_new_with_mnemonic("_Video mode:");
gtk_misc_set_alignment (GTK_MISC(stwidgets.vmode3dlabel), 0.3, 0); gtk_misc_set_alignment(GTK_MISC(stwidgets.vmode3dlabel), 0.3, 0);
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 0,1, GTK_FILL, 0, 4, 0); gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dlabel, 0,1, 0,1, GTK_FILL, 0, 4, 0);
// 3D video mode combo // 3D video mode combo
{ {
GtkListStore *list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); GtkListStore *list = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
GtkCellRenderer *cell; GtkCellRenderer *cell;
@ -498,25 +502,25 @@ static GtkWidget *create_window(void)
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, FALSE); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, "text", 0, NULL); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.vmode3dcombo), cell, "text", 0, NULL);
} }
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1, GTK_EXPAND | GTK_FILL, 0, 4, 0); gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.vmode3dcombo, 1,2, 0,1, GTK_EXPAND | GTK_FILL, 0, 4, 0);
// Fullscreen checkbox // Fullscreen checkbox
stwidgets.displayvlayout = gtk_vbox_new(TRUE, 0); stwidgets.displayvlayout = gtk_vbox_new(TRUE, 0);
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.displayvlayout, 2,3, 0,1, GTK_FILL, 0, 4, 0); gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.displayvlayout, 2,3, 0,1, GTK_FILL, 0, 4, 0);
stwidgets.fullscreencheck = gtk_check_button_new_with_mnemonic("_Fullscreen"); stwidgets.fullscreencheck = gtk_check_button_new_with_mnemonic("_Fullscreen");
gtk_box_pack_start(GTK_BOX(stwidgets.displayvlayout), stwidgets.fullscreencheck, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(stwidgets.displayvlayout), stwidgets.fullscreencheck, FALSE, FALSE, 0);
// Polymer checkbox
stwidgets.polymercheck = gtk_check_button_new_with_mnemonic("_Polymer");
gtk_box_pack_start(GTK_BOX(stwidgets.displayvlayout), stwidgets.polymercheck, FALSE, FALSE, 0);
// Input devices LabelText // Polymer checkbox
stwidgets.polymercheck = gtk_check_button_new_with_mnemonic("_Polymer");
gtk_box_pack_start(GTK_BOX(stwidgets.displayvlayout), stwidgets.polymercheck, FALSE, FALSE, 0);
// Input devices LabelText
stwidgets.inputdevlabel = gtk_label_new_with_mnemonic("_Input devices:"); stwidgets.inputdevlabel = gtk_label_new_with_mnemonic("_Input devices:");
gtk_misc_set_alignment(GTK_MISC(stwidgets.inputdevlabel), 0.3, 0); gtk_misc_set_alignment(GTK_MISC(stwidgets.inputdevlabel), 0.3, 0);
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.inputdevlabel, 0,1, 1,2, GTK_FILL, 0, 4, 0); gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.inputdevlabel, 0,1, 1,2, GTK_FILL, 0, 4, 0);
// Input devices combo // Input devices combo
{ {
GtkListStore *list = gtk_list_store_new(1, G_TYPE_STRING); GtkListStore *list = gtk_list_store_new(1, G_TYPE_STRING);
GtkCellRenderer *cell; GtkCellRenderer *cell;
@ -527,15 +531,15 @@ static GtkWidget *create_window(void)
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.inputdevcombo), cell, FALSE); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.inputdevcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.inputdevcombo), cell, "text", 0, NULL); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.inputdevcombo), cell, "text", 0, NULL);
} }
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.inputdevcombo, 1,2, 1,2, GTK_EXPAND | GTK_FILL, 0, 4, 0); gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.inputdevcombo, 1,2, 1,2, GTK_EXPAND | GTK_FILL, 0, 4, 0);
// Custom mod LabelText // Custom mod LabelText
stwidgets.custommodlabel = gtk_label_new_with_mnemonic("Custom _Mod:"); stwidgets.custommodlabel = gtk_label_new_with_mnemonic("Custom _Mod:");
gtk_misc_set_alignment(GTK_MISC(stwidgets.custommodlabel), 0.3, 0); gtk_misc_set_alignment(GTK_MISC(stwidgets.custommodlabel), 0.3, 0);
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.custommodlabel, 0,1, 2,3, GTK_FILL, 0, 4, 7); gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.custommodlabel, 0,1, 2,3, GTK_FILL, 0, 4, 7);
// Custom mod combo // Custom mod combo
{ {
GtkListStore *list = gtk_list_store_new(1, G_TYPE_STRING); GtkListStore *list = gtk_list_store_new(1, G_TYPE_STRING);
GtkCellRenderer *cell; GtkCellRenderer *cell;
@ -546,19 +550,19 @@ static GtkWidget *create_window(void)
gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.custommodcombo), cell, FALSE); gtk_cell_layout_pack_start(GTK_CELL_LAYOUT(stwidgets.custommodcombo), cell, FALSE);
gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.custommodcombo), cell, "text", 0, NULL); gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(stwidgets.custommodcombo), cell, "text", 0, NULL);
} }
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.custommodcombo, 1,2, 2,3, GTK_EXPAND | GTK_FILL, 0, 4, 7); gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.custommodcombo, 1,2, 2,3, GTK_EXPAND | GTK_FILL, 0, 4, 7);
// Empty horizontal layout // Empty horizontal layout
stwidgets.emptyhlayout = gtk_hbox_new(TRUE, 0); stwidgets.emptyhlayout = gtk_hbox_new(TRUE, 0);
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,3, 3,4, 0, GTK_EXPAND | GTK_FILL, 4, 0); gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.emptyhlayout, 0,3, 3,4, 0, GTK_EXPAND | GTK_FILL, 4, 0);
// Autoload checkbox // Autoload checkbox
stwidgets.autoloadcheck = gtk_check_button_new_with_mnemonic("_Enable \"autoload\" folder"); stwidgets.autoloadcheck = gtk_check_button_new_with_mnemonic("_Enable \"autoload\" folder");
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.autoloadcheck, 0,3, 4,5, GTK_FILL, 0, 2, 2); gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.autoloadcheck, 0,3, 4,5, GTK_FILL, 0, 2, 2);
// Always show config checkbox // Always show config checkbox
stwidgets.alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show this window at startup"); stwidgets.alwaysshowcheck = gtk_check_button_new_with_mnemonic("_Always show this window at startup");
gtk_table_attach (GTK_TABLE(stwidgets.configtlayout), stwidgets.alwaysshowcheck, 0,3, 5,6, GTK_FILL, 0, 2, 2); gtk_table_attach(GTK_TABLE(stwidgets.configtlayout), stwidgets.alwaysshowcheck, 0,3, 5,6, GTK_FILL, 0, 2, 2);
// Configuration tab // Configuration tab
stwidgets.configtab = gtk_label_new("Configuration"); stwidgets.configtab = gtk_label_new("Configuration");
@ -601,7 +605,7 @@ static GtkWidget *create_window(void)
gtk_tree_view_append_column(GTK_TREE_VIEW(stwidgets.gamelist), col); gtk_tree_view_append_column(GTK_TREE_VIEW(stwidgets.gamelist), col);
} }
gtk_container_add(GTK_CONTAINER(stwidgets.gamescroll), stwidgets.gamelist); gtk_container_add(GTK_CONTAINER(stwidgets.gamescroll), stwidgets.gamelist);
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(stwidgets.gamelist), FALSE); gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(stwidgets.gamelist), FALSE);
gtk_tree_view_set_enable_search(GTK_TREE_VIEW(stwidgets.gamelist), FALSE); gtk_tree_view_set_enable_search(GTK_TREE_VIEW(stwidgets.gamelist), FALSE);
@ -668,34 +672,34 @@ static GtkWidget *create_window(void)
gtk_box_pack_start(GTK_BOX(stwidgets.startbuttonlayout), stwidgets.startbuttonlabel, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(stwidgets.startbuttonlayout), stwidgets.startbuttonlabel, FALSE, FALSE, 0);
// Wire up the signals // Wire up the signals
g_signal_connect((gpointer) stwidgets.startwin, "delete_event", g_signal_connect((gpointer) stwidgets.startwin, "delete_event",
G_CALLBACK(on_startwin_delete_event), G_CALLBACK(on_startwin_delete_event),
NULL); NULL);
g_signal_connect((gpointer) stwidgets.vmode3dcombo, "changed", g_signal_connect((gpointer) stwidgets.vmode3dcombo, "changed",
G_CALLBACK(on_vmode3dcombo_changed), G_CALLBACK(on_vmode3dcombo_changed),
NULL); NULL);
g_signal_connect((gpointer) stwidgets.fullscreencheck, "toggled", g_signal_connect((gpointer) stwidgets.fullscreencheck, "toggled",
G_CALLBACK(on_fullscreencheck_toggled), G_CALLBACK(on_fullscreencheck_toggled),
NULL); NULL);
g_signal_connect((gpointer) stwidgets.polymercheck, "toggled", g_signal_connect((gpointer) stwidgets.polymercheck, "toggled",
G_CALLBACK(on_polymercheck_toggled), G_CALLBACK(on_polymercheck_toggled),
NULL); NULL);
g_signal_connect((gpointer) stwidgets.inputdevcombo, "changed", g_signal_connect((gpointer) stwidgets.inputdevcombo, "changed",
G_CALLBACK(on_inputdevcombo_changed), G_CALLBACK(on_inputdevcombo_changed),
NULL); NULL);
g_signal_connect((gpointer) stwidgets.custommodcombo, "changed", g_signal_connect((gpointer) stwidgets.custommodcombo, "changed",
G_CALLBACK(on_custommodcombo_changed), G_CALLBACK(on_custommodcombo_changed),
NULL); NULL);
g_signal_connect((gpointer) stwidgets.autoloadcheck, "toggled", g_signal_connect((gpointer) stwidgets.autoloadcheck, "toggled",
G_CALLBACK(on_autoloadcheck_toggled), G_CALLBACK(on_autoloadcheck_toggled),
NULL); NULL);
g_signal_connect((gpointer) stwidgets.alwaysshowcheck, "toggled", g_signal_connect((gpointer) stwidgets.alwaysshowcheck, "toggled",
G_CALLBACK(on_alwaysshowcheck_toggled), G_CALLBACK(on_alwaysshowcheck_toggled),
NULL); NULL);
g_signal_connect((gpointer) stwidgets.cancelbutton, "clicked", g_signal_connect((gpointer) stwidgets.cancelbutton, "clicked",
G_CALLBACK(on_cancelbutton_clicked), G_CALLBACK(on_cancelbutton_clicked),
NULL); NULL);
g_signal_connect((gpointer) stwidgets.startbutton, "clicked", g_signal_connect((gpointer) stwidgets.startbutton, "clicked",
G_CALLBACK(on_startbutton_clicked), G_CALLBACK(on_startbutton_clicked),
NULL); NULL);
{ {
@ -834,8 +838,8 @@ int32_t startwin_run(void)
else settings.autoload = TRUE; else settings.autoload = TRUE;
if (glrendmode == RDR_POLYMER) if (glrendmode == RDR_POLYMER)
{ {
if (settings.bpp3d == 8) settings.bpp3d = 32; if (settings.bpp3d == 8) settings.bpp3d = 32;
settings.polymer = TRUE; settings.polymer = TRUE;
} }
PopulateForm(ALL); PopulateForm(ALL);
@ -845,7 +849,7 @@ int32_t startwin_run(void)
if (retval) // launch the game with these parameters if (retval) // launch the game with these parameters
{ {
int32_t i; int32_t i;
ud.config.ScreenWidth = settings.xdim3d; ud.config.ScreenWidth = settings.xdim3d;
ud.config.ScreenHeight = settings.ydim3d; ud.config.ScreenHeight = settings.ydim3d;
ud.config.ScreenBPP = settings.bpp3d; ud.config.ScreenBPP = settings.bpp3d;
@ -858,7 +862,7 @@ int32_t startwin_run(void)
if (settings.custommoddir != NULL) if (settings.custommoddir != NULL)
Bstrcpy(g_modDir, settings.custommoddir); Bstrcpy(g_modDir, settings.custommoddir);
else Bsprintf(g_modDir, "/"); else Bsprintf(g_modDir, "/");
if (settings.autoload) ud.config.NoAutoLoad = FALSE; if (settings.autoload) ud.config.NoAutoLoad = FALSE;
else ud.config.NoAutoLoad = TRUE; else ud.config.NoAutoLoad = TRUE;