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

This commit is contained in:
terminx 2009-01-05 14:43:12 +00:00
parent 0614f0b64c
commit 68ab9ebeaa
16 changed files with 135 additions and 106 deletions

View file

@ -594,25 +594,26 @@ extern int mapversion; // if loadboard() fails with -2 return, try loadoldboard(
int loadoldboard(char *filename, char fromwhere, int *daposx, int *daposy, int *daposz, short *daang, short *dacursectnum); int loadoldboard(char *filename, char fromwhere, int *daposx, int *daposy, int *daposz, short *daang, short *dacursectnum);
// Hash functions // Hash functions
struct HASH_item // size is 12/24 bits.
typedef struct _hashitem // size is 12/24 bits.
{ {
char *string; char *string;
int key; int key;
struct HASH_item *next; struct _hashitem *next;
}; } HASH_item;
struct HASH_table typedef struct
{ {
int size; int size;
struct HASH_item **items; HASH_item **items;
}; } HASH_table;
void HASH_init(struct HASH_table *t); void HASH_init(HASH_table *t);
void HASH_free(struct HASH_table *t); void HASH_free(HASH_table *t);
int HASH_findcase(struct HASH_table *t, const char *s); int HASH_findcase(HASH_table *t, const char *s);
int HASH_find(struct HASH_table *t, const char *s); int HASH_find(HASH_table *t, const char *s);
void HASH_replace(struct HASH_table *t, const char *s, int key); void HASH_replace(HASH_table *t, const char *s, int key);
void HASH_add(struct HASH_table *t, const char *s, int key); void HASH_add(HASH_table *t, const char *s, int key);
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma pack() #pragma pack()

View file

@ -61,7 +61,7 @@ extern GLuint peelprogram[2];
extern int cachefilehandle; extern int cachefilehandle;
extern FILE *cacheindexptr; extern FILE *cacheindexptr;
extern struct HASH_table cacheH; extern HASH_table cacheH;
struct cacheitem_t struct cacheitem_t
{ {

View file

@ -1621,19 +1621,16 @@ void overheadeditor(void)
int ii = xyaspect; int ii = xyaspect;
i = yxaspect; i = yxaspect;
Bmemset(show2dsector, 255, sizeof(show2dsector)); Bmemset(show2dsector, 255, sizeof(show2dsector));
setview(0, 0, xdim-1, ydim16-1); setview(0, 0, xdim-1, ydim16-1);
yxaspect = xyaspect = 65536; yxaspect = xyaspect = 65536;
j = ydim; j = ydim;
ydim -= scale((MAXYDIM/6), ydim, MAXYDIM); ydim -= scale((MAXYDIM/6), ydim, MAXYDIM);
if (graphicsmode == 2) if (graphicsmode == 2)
totalclocklock = totalclock; totalclocklock = totalclock;
drawmapview(posx, posy, zoom, 1536);
drawmapview(posx, posy, zoom, 1536);
yxaspect = i; yxaspect = i;
ydim = j; ydim = j;
xyaspect = ii; xyaspect = ii;

View file

@ -12129,15 +12129,15 @@ void setpolymost2dview(void)
#endif #endif
} }
void HASH_init(struct HASH_table *t) void HASH_init(HASH_table *t)
{ {
HASH_free(t); HASH_free(t);
t->items=Bcalloc(1, t->size * sizeof(struct HASH_item)); t->items=Bcalloc(1, t->size * sizeof(HASH_item));
} }
void HASH_free(struct HASH_table *t) void HASH_free(HASH_table *t)
{ {
struct HASH_item *cur, *tmp; HASH_item *cur, *tmp;
int i; int i;
int num; int num;
@ -12192,9 +12192,9 @@ inline unsigned int HASH_getcode(const char *s)
} }
#endif #endif
void HASH_add(struct HASH_table *t, const char *s, int key) void HASH_add(HASH_table *t, const char *s, int key)
{ {
struct HASH_item *cur, *prev=NULL; HASH_item *cur, *prev=NULL;
int code; int code;
if (!s) if (!s)
@ -12209,7 +12209,7 @@ void HASH_add(struct HASH_table *t, const char *s, int key)
if (!cur) if (!cur)
{ {
cur=Bcalloc(1,sizeof(struct HASH_item)); cur=Bcalloc(1,sizeof(HASH_item));
cur->string=Bstrdup(s); cur->string=Bstrdup(s);
cur->key=key; cur->key=key;
cur->next=NULL; cur->next=NULL;
@ -12226,16 +12226,16 @@ void HASH_add(struct HASH_table *t, const char *s, int key)
} }
while (cur); while (cur);
cur=Bcalloc(1,sizeof(struct HASH_item)); cur=Bcalloc(1,sizeof(HASH_item));
cur->string=Bstrdup(s); cur->string=Bstrdup(s);
cur->key=key; cur->key=key;
cur->next=NULL; cur->next=NULL;
prev->next=cur; prev->next=cur;
} }
void HASH_replace(struct HASH_table *t, const char *s, int key) void HASH_replace(HASH_table *t, const char *s, int key)
{ {
struct HASH_item *cur, *prev=NULL; HASH_item *cur, *prev=NULL;
int code; int code;
if (t->items==NULL) if (t->items==NULL)
@ -12248,7 +12248,7 @@ void HASH_replace(struct HASH_table *t, const char *s, int key)
if (!cur) if (!cur)
{ {
cur=Bcalloc(1,sizeof(struct HASH_item)); cur=Bcalloc(1,sizeof(HASH_item));
cur->string=Bstrdup(s); cur->string=Bstrdup(s);
cur->key=key; cur->key=key;
cur->next=NULL; cur->next=NULL;
@ -12268,16 +12268,16 @@ void HASH_replace(struct HASH_table *t, const char *s, int key)
} }
while (cur); while (cur);
cur=Bcalloc(1,sizeof(struct HASH_item)); cur=Bcalloc(1,sizeof(HASH_item));
cur->string=Bstrdup(s); cur->string=Bstrdup(s);
cur->key=key; cur->key=key;
cur->next=NULL; cur->next=NULL;
prev->next=cur; prev->next=cur;
} }
int HASH_find(struct HASH_table *t, const char *s) int HASH_find(HASH_table *t, const char *s)
{ {
struct HASH_item *cur; HASH_item *cur;
if (t->items==NULL) if (t->items==NULL)
{ {
@ -12294,9 +12294,9 @@ int HASH_find(struct HASH_table *t, const char *s)
return -1; return -1;
} }
int HASH_findcase(struct HASH_table *t, const char *s) int HASH_findcase(HASH_table *t, const char *s)
{ {
struct HASH_item *cur; HASH_item *cur;
if (t->items==NULL) if (t->items==NULL)
{ {

View file

@ -105,7 +105,7 @@ static int osdcursorpal=0; */
static symbol_t *osdsymbptrs[MAXSYMBOLS]; static symbol_t *osdsymbptrs[MAXSYMBOLS];
static int osdnumsymbols = 0; static int osdnumsymbols = 0;
static struct HASH_table osdsymbolsH = { MAXSYMBOLS<<1, NULL }; static HASH_table osdsymbolsH = { MAXSYMBOLS<<1, NULL };
// application callbacks // application callbacks
static void (*drawosdchar)(int, int, char, int, int) = _internal_drawosdchar; static void (*drawosdchar)(int, int, char, int, int) = _internal_drawosdchar;

View file

@ -339,7 +339,7 @@ void drawline2d(float x0, float y0, float x1, float y1, char col)
int cachefilehandle = -1; // texture cache file handle int cachefilehandle = -1; // texture cache file handle
FILE *cacheindexptr = NULL; FILE *cacheindexptr = NULL;
struct HASH_table cacheH = { 1024, NULL }; HASH_table cacheH = { 1024, NULL };
char TEXCACHEFILE[BMAX_PATH] = "textures"; char TEXCACHEFILE[BMAX_PATH] = "textures";

View file

@ -44,7 +44,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <shellapi.h> #include <shellapi.h>
#endif #endif
#define BUILDDATE " 20090101" #define BUILDDATE " 20090104"
#define VERSION " 1.2.0devel" #define VERSION " 1.2.0devel"
static int floor_over_floor; static int floor_over_floor;

View file

@ -51,7 +51,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
=================== ===================
*/ */
struct HASH_table gamefuncH = { NUMGAMEFUNCTIONS<<1, NULL }; HASH_table gamefuncH = { NUMGAMEFUNCTIONS<<1, NULL };
int32 CONFIG_FunctionNameToNum(char * func) int32 CONFIG_FunctionNameToNum(char * func)
{ {

View file

@ -1053,10 +1053,10 @@ extern char *mousenames[];
extern char *duke3dgrp, *duke3dgrpstring; extern char *duke3dgrp, *duke3dgrpstring;
extern char mod_dir[BMAX_PATH]; extern char mod_dir[BMAX_PATH];
extern struct HASH_table gamevarH; extern HASH_table gamevarH;
extern struct HASH_table arrayH; extern HASH_table arrayH;
extern struct HASH_table keywH; extern HASH_table keywH;
extern struct HASH_table gamefuncH; extern HASH_table gamefuncH;
enum DukePacket_t enum DukePacket_t
{ {

View file

@ -10136,8 +10136,9 @@ static void loadtmb(void)
kclose(fil); kclose(fil);
} }
void freehash(); extern void C_FreeHashes();
static void G_FreeCONMem(void)
static void G_FreeMemory(void)
{ {
int i; int i;
extern char *bitptr; extern char *bitptr;
@ -10157,19 +10158,6 @@ static void G_FreeCONMem(void)
if (ScriptQuoteRedefinitions[i] != NULL) Bfree(ScriptQuoteRedefinitions[i]); if (ScriptQuoteRedefinitions[i] != NULL) Bfree(ScriptQuoteRedefinitions[i]);
} }
for (i=g_gameVarCount-1;i>=0;i--)
{
if (aGameVars[i].szLabel != NULL) Bfree(aGameVars[i].szLabel);
if (aGameVars[i].dwFlags & (GAMEVAR_USER_MASK) && aGameVars[i].val.plValues != NULL)
Bfree(aGameVars[i].val.plValues);
}
for (i=g_gameArrayCount-1;i>=0;i--)
{
if (aGameArrays[i].szLabel != NULL) Bfree(aGameArrays[i].szLabel);
if (aGameArrays[i].plValues != NULL) Bfree(aGameArrays[i].plValues);
}
for (i=MAXPLAYERS-1;i>=0;i--) for (i=MAXPLAYERS-1;i>=0;i--)
{ {
if (g_player[i].ps != NULL) Bfree(g_player[i].ps); if (g_player[i].ps != NULL) Bfree(g_player[i].ps);
@ -10187,7 +10175,9 @@ static void G_FreeCONMem(void)
if (script != NULL) Bfree(script); if (script != NULL) Bfree(script);
if (bitptr != NULL) Bfree(bitptr); if (bitptr != NULL) Bfree(bitptr);
freehash(); // if (MusicPtr != NULL) Bfree(MusicPtr);
// C_FreeHashes();
HASH_free(&gamefuncH); HASH_free(&gamefuncH);
} }
@ -10207,7 +10197,7 @@ void G_Shutdown(void)
CONTROL_Shutdown(); CONTROL_Shutdown();
CONFIG_WriteSetup(); CONFIG_WriteSetup();
KB_Shutdown(); KB_Shutdown();
G_FreeCONMem(); G_FreeMemory();
uninitengine(); uninitengine();
} }
@ -10361,7 +10351,7 @@ static void G_Startup(void)
{ {
wm_msgbox("Build Engine Initialization Error", wm_msgbox("Build Engine Initialization Error",
"There was a problem initializing the Build engine: %s", engineerrstr); "There was a problem initializing the Build engine: %s", engineerrstr);
G_FreeCONMem(); G_FreeMemory();
exit(1); exit(1);
} }

View file

@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
int g_scriptVersion = 13; // 13 = 1.3D-style CON files, 14 = 1.4/1.5 style CON files int g_scriptVersion = 13; // 13 = 1.3D-style CON files, 14 = 1.4/1.5 style CON files
char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling char g_szScriptFileName[BMAX_PATH] = "(none)"; // file we're currently compiling
static char g_szCurrentBlockName[MAXVARLABEL] = "(none)", g_szLastBlockName[MAXVARLABEL] = "NULL"; static char g_szCurrentBlockName[256] = "(none)", g_szLastBlockName[256] = "NULL";
int g_totalLines,g_lineNumber; int g_totalLines,g_lineNumber;
static int g_checkingIfElse,g_processingState; static int g_checkingIfElse,g_processingState;
@ -935,25 +935,25 @@ const memberlabel_t InputLabels[]=
char *bitptr; // pointer to bitmap of which bytecode positions contain pointers char *bitptr; // pointer to bitmap of which bytecode positions contain pointers
#define BITPTR_POINTER 1 #define BITPTR_POINTER 1
struct HASH_table gamevarH = { MAXGAMEVARS>>1, NULL }; HASH_table gamevarH = { MAXGAMEVARS>>1, NULL };
struct HASH_table arrayH = { MAXGAMEARRAYS>>1, NULL }; HASH_table arrayH = { MAXGAMEARRAYS>>1, NULL };
struct HASH_table labelH = { 11264>>1, NULL }; HASH_table labelH = { 11264>>1, NULL };
struct HASH_table keywH = { CON_END>>1, NULL }; HASH_table keywH = { CON_END>>1, NULL };
struct HASH_table sectorH = { SECTOR_END>>1, NULL }; HASH_table sectorH = { SECTOR_END>>1, NULL };
struct HASH_table wallH = { WALL_END>>1, NULL }; HASH_table wallH = { WALL_END>>1, NULL };
struct HASH_table userdefH = { USERDEFS_END>>1, NULL }; HASH_table userdefH = { USERDEFS_END>>1, NULL };
struct HASH_table projectileH = { PROJ_END>>1, NULL }; HASH_table projectileH = { PROJ_END>>1, NULL };
struct HASH_table playerH = { PLAYER_END>>1, NULL }; HASH_table playerH = { PLAYER_END>>1, NULL };
struct HASH_table inputH = { INPUT_END>>1, NULL }; HASH_table inputH = { INPUT_END>>1, NULL };
struct HASH_table actorH = { ACTOR_END>>1, NULL }; HASH_table actorH = { ACTOR_END>>1, NULL };
struct HASH_table tspriteH = { ACTOR_END>>1, NULL }; HASH_table tspriteH = { ACTOR_END>>1, NULL };
void inithashnames(); void inithashnames();
void freehashnames(); void freehashnames();
void inithash() void C_InitHashes()
{ {
int i; int i;
@ -993,13 +993,14 @@ void inithash()
HASH_add(&tspriteH,TsprLabels[i].name,i); HASH_add(&tspriteH,TsprLabels[i].name,i);
} }
void freehash() void C_FreeHashes(void)
{ {
HASH_free(&gamevarH); HASH_free(&gamevarH);
HASH_free(&arrayH); HASH_free(&arrayH);
HASH_free(&labelH); HASH_free(&labelH);
} }
#define IFELSE_MAGIC 31337
static int g_ifElseAborted; static int g_ifElseAborted;
static int C_IncreaseScriptSize(int size) static int C_IncreaseScriptSize(int size)
@ -1413,7 +1414,7 @@ static inline int isaltok(char c)
return (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '*' || c == '-' || c == '_' || c == '.'); return (isalnum(c) || c == '{' || c == '}' || c == '/' || c == '*' || c == '-' || c == '_' || c == '.');
} }
static inline int GetLabelNameid(const memberlabel_t *pLabel, struct HASH_table *tH, const char *psz) static inline int GetLabelNameid(const memberlabel_t *pLabel, HASH_table *tH, const char *psz)
{ {
// find the label psz in the table pLabel. // find the label psz in the table pLabel.
// returns the ID for the label, or -1 // returns the ID for the label, or -1
@ -1426,7 +1427,7 @@ static inline int GetLabelNameid(const memberlabel_t *pLabel, struct HASH_table
return l; return l;
} }
static inline int C_GetLabelNameOffset(struct HASH_table *tH, const char *psz) static inline int C_GetLabelNameOffset(HASH_table *tH, const char *psz)
{ {
// find the label psz in the table pLabel. // find the label psz in the table pLabel.
// returns the offset in the array for the label, or -1 // returns the offset in the array for the label, or -1
@ -1511,7 +1512,7 @@ static int C_GetNextKeyword(void) //Returns its code #
if (i>=0) if (i>=0)
{ {
if (i == CON_LEFTBRACE || i == CON_RIGHTBRACE || i == CON_NULLOP) if (i == CON_LEFTBRACE || i == CON_RIGHTBRACE || i == CON_NULLOP)
*g_scriptPtr = i + (31337<<12); *g_scriptPtr = i + (IFELSE_MAGIC<<12);
else *g_scriptPtr = i + (g_lineNumber<<12); else *g_scriptPtr = i + (g_lineNumber<<12);
bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7)); bitptr[(g_scriptPtr-script)>>3] &= ~(1<<((g_scriptPtr-script)&7));
textptr += l; textptr += l;
@ -1802,23 +1803,24 @@ static int C_GetNextValue(int type)
static int C_CheckEmptyBranch(int tw, intptr_t lastScriptPtr) static int C_CheckEmptyBranch(int tw, intptr_t lastScriptPtr)
{ {
if (Bstrncmp(keyw[tw],"if",2) && tw != CON_ELSE) if (Bstrncmp(keyw[tw], "if", 2) && tw != CON_ELSE)
{ {
g_ifElseAborted = 0; g_ifElseAborted = 0;
return 0; return 0;
} }
if ((*(g_scriptPtr) & 0xFFF) != CON_NULLOP || *(g_scriptPtr)>>12 != 31337) if ((*(g_scriptPtr) & 0xFFF) != CON_NULLOP || *(g_scriptPtr)>>12 != IFELSE_MAGIC)
g_ifElseAborted = 0; g_ifElseAborted = 0;
if (g_ifElseAborted) if (g_ifElseAborted)
{ {
// C_ReportError(-1); C_ReportError(-1);
g_numCompilerWarnings++;
g_scriptPtr = lastScriptPtr + &script[0]; g_scriptPtr = lastScriptPtr + &script[0];
initprintf("%s:%d: removing empty '%s' branch\n",g_szScriptFileName,g_lineNumber, initprintf("%s:%d: warning: empty `%s' branch\n",g_szScriptFileName,g_lineNumber,
keyw[*(g_scriptPtr) & 0xFFF]); keyw[*(g_scriptPtr) & 0xFFF]);
if (g_ifElseAborted) if (g_ifElseAborted)
*(g_scriptPtr) = (CON_NULLOP + (31337<<12)); *(g_scriptPtr) = (CON_NULLOP + (IFELSE_MAGIC<<12));
return 1; return 1;
} }
return 0; return 0;
@ -2960,10 +2962,7 @@ static int C_ParseCommand(void)
C_ParseCommand(); C_ParseCommand();
if (C_CheckEmptyBranch(tw, lastScriptPtr)) if (C_CheckEmptyBranch(tw, lastScriptPtr))
{
// g_scriptPtr;
return 0; return 0;
}
tempscrptr = (intptr_t *)script+offset; tempscrptr = (intptr_t *)script+offset;
*tempscrptr = (intptr_t) g_scriptPtr; *tempscrptr = (intptr_t) g_scriptPtr;
@ -2972,9 +2971,24 @@ static int C_ParseCommand(void)
else else
{ {
g_scriptPtr--; g_scriptPtr--;
g_numCompilerErrors++; tempscrptr = g_scriptPtr;
g_numCompilerWarnings++;
C_ReportError(-1); C_ReportError(-1);
initprintf("%s:%d: error: found `else' with no `if'.\n",g_szScriptFileName,g_lineNumber);
initprintf("%s:%d: warning: found `else' with no `if'.\n",g_szScriptFileName,g_lineNumber);
if (C_GetKeyword() == CON_LEFTBRACE)
{
C_GetNextKeyword();
g_numBraces++;
do
done = C_ParseCommand();
while (done == 0);
}
else C_ParseCommand();
g_scriptPtr = tempscrptr;
} }
return 0; return 0;
@ -4059,7 +4073,13 @@ static int C_ParseCommand(void)
*tempscrptr = (intptr_t) g_scriptPtr; *tempscrptr = (intptr_t) g_scriptPtr;
bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7)); bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7));
if (tw != CON_WHILEVARVARN) g_checkingIfElse++; if (tw != CON_WHILEVARVARN)
{
j = C_GetKeyword();
if (j == CON_ELSE || j == CON_LEFTBRACE)
g_checkingIfElse++;
}
return 0; return 0;
} }
@ -4108,7 +4128,14 @@ static int C_ParseCommand(void)
*tempscrptr = (intptr_t) g_scriptPtr; *tempscrptr = (intptr_t) g_scriptPtr;
bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7)); bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7));
if (tw != CON_WHILEVARN) g_checkingIfElse++; if (tw != CON_WHILEVARN)
{
j = C_GetKeyword();
if (j == CON_ELSE || j == CON_LEFTBRACE)
g_checkingIfElse++;
}
return 0; return 0;
} }
case CON_ADDLOGVAR: case CON_ADDLOGVAR:
@ -4645,7 +4672,11 @@ repeatcase:
*tempscrptr = (intptr_t) g_scriptPtr; *tempscrptr = (intptr_t) g_scriptPtr;
bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7)); bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7));
g_checkingIfElse++; j = C_GetKeyword();
if (j == CON_ELSE || j == CON_LEFTBRACE)
g_checkingIfElse++;
return 0; return 0;
} }
@ -4688,7 +4719,11 @@ repeatcase:
*tempscrptr = (intptr_t) g_scriptPtr; *tempscrptr = (intptr_t) g_scriptPtr;
bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7)); bitptr[(tempscrptr-script)>>3] |= (BITPTR_POINTER<<((tempscrptr-script)&7));
g_checkingIfElse++; j = C_GetKeyword();
if (j == CON_ELSE || j == CON_LEFTBRACE)
g_checkingIfElse++;
return 0; return 0;
} }
@ -4725,17 +4760,22 @@ repeatcase:
case CON_RIGHTBRACE: case CON_RIGHTBRACE:
g_numBraces--; g_numBraces--;
if ((*(g_scriptPtr-2)>>12) == (31337) && if ((*(g_scriptPtr-2)>>12) == (IFELSE_MAGIC) &&
((*(g_scriptPtr-2) & 0xFFF) == CON_LEFTBRACE)) // rewrite "{ }" into "nullop" ((*(g_scriptPtr-2) & 0xFFF) == CON_LEFTBRACE)) // rewrite "{ }" into "nullop"
{ {
// initprintf("%s:%d: rewriting empty braces '{ }' as 'nullop' from right\n",g_szScriptFileName,g_lineNumber); // initprintf("%s:%d: rewriting empty braces '{ }' as 'nullop' from right\n",g_szScriptFileName,g_lineNumber);
*(g_scriptPtr-2) = CON_NULLOP + (31337<<12); *(g_scriptPtr-2) = CON_NULLOP + (IFELSE_MAGIC<<12);
g_scriptPtr -= 2; g_scriptPtr -= 2;
if (C_GetKeyword() != CON_ELSE && (*(g_scriptPtr-2)&0xFFF) != CON_ELSE) if (C_GetKeyword() != CON_ELSE && (*(g_scriptPtr-2)&0xFFF) != CON_ELSE)
g_ifElseAborted = 1; g_ifElseAborted = 1;
else g_ifElseAborted = 0; else g_ifElseAborted = 0;
j = C_GetKeyword();
if (g_checkingIfElse && j != CON_ELSE)
g_checkingIfElse--;
return 1; return 1;
} }
@ -4750,6 +4790,9 @@ repeatcase:
initprintf("%s:%d: error: found more `}' than `{'.\n",g_szScriptFileName,g_lineNumber); initprintf("%s:%d: error: found more `}' than `{'.\n",g_szScriptFileName,g_lineNumber);
g_numCompilerErrors++; g_numCompilerErrors++;
} }
if (g_checkingIfElse && j != CON_ELSE)
g_checkingIfElse--;
return 1; return 1;
case CON_BETANAME: case CON_BETANAME:
@ -5370,7 +5413,8 @@ repeatcase:
if (C_GetKeyword() != CON_ELSE) if (C_GetKeyword() != CON_ELSE)
{ {
C_ReportError(-1); C_ReportError(-1);
initprintf("%s:%d: removing 'nullop' found without 'else'\n",g_szScriptFileName,g_lineNumber); g_numCompilerWarnings++;
initprintf("%s:%d: warning: `nullop' found without `else'\n",g_szScriptFileName,g_lineNumber);
g_scriptPtr--; g_scriptPtr--;
g_ifElseAborted = 1; g_ifElseAborted = 1;
} }
@ -5694,7 +5738,7 @@ void C_Compile(const char *filenam)
clearbuf(apScriptGameEvent,MAXGAMEEVENTS,0L); clearbuf(apScriptGameEvent,MAXGAMEEVENTS,0L);
inithash(); C_InitHashes();
Gv_Init(); Gv_Init();
C_InitProjectiles(); C_InitProjectiles();

View file

@ -4195,14 +4195,9 @@ static int X_DoExecute(void)
break; break;
default: default:
/* OSD_Printf("fatal error: default processing: previous five values: %d, %d, %d, %d, %d, "
"current opcode: %d, next five values: %d, %d, %d, %d, %d\ncurrent actor: %d (%d)\n",
*(insptr-5),*(insptr-4),*(insptr-3),*(insptr-2),*(insptr-1),*insptr,*(insptr+1),
*(insptr+2),*(insptr+3),*(insptr+4),*(insptr+5),g_i,g_sp->picnum);
OSD_Printf("g_errorLineNum: %d, g_tw: %d\n",g_errorLineNum,g_tw);*/
X_ScriptInfo(); X_ScriptInfo();
G_GameExit("An error has occurred in the EDuke32 CON executor.\n\n" G_GameExit("An error has occurred in the EDuke32 virtual machine.\n\n"
"If you are an end user, please e-mail the file eduke32.log\n" "If you are an end user, please e-mail the file eduke32.log\n"
"along with links to any mods you're using to terminx@gmail.com.\n\n" "along with links to any mods you're using to terminx@gmail.com.\n\n"
"If you are a mod developer, please attach all of your CON files\n" "If you are a mod developer, please attach all of your CON files\n"

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 = "20090101"; const char *s_buildDate = "20090104";
char *MusicPtr = NULL; char *MusicPtr = NULL;
int g_musicSize; int g_musicSize;

View file

@ -35,7 +35,7 @@ struct dynitem
short vstat; short vstat;
short val; short val;
}; };
struct HASH_table dynnamesH = {512, NULL}; HASH_table dynnamesH = {512, NULL};
struct dynitem list[]= struct dynitem list[]=
{ {

View file

@ -4483,7 +4483,7 @@ void P_ProcessInput(int snum)
} }
} }
else if (p->walking_snd_toggle > 0) else if (p->walking_snd_toggle > 0)
p->walking_snd_toggle --; p->walking_snd_toggle--;
if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400) if (p->jetpack_on == 0 && p->steroids_amount > 0 && p->steroids_amount < 400)
doubvel <<= 1; doubvel <<= 1;

View file

@ -207,8 +207,10 @@ void _playmusic(const char *fn)
l = kfilelength(fp); l = kfilelength(fp);
MUSIC_StopSong(); MUSIC_StopSong();
if (!MusicPtr) MusicPtr=Bcalloc(1,l * sizeof(char));
else MusicPtr=Brealloc(MusicPtr,l * sizeof(char)); if (!MusicPtr) MusicPtr = Bcalloc(1, l);
else MusicPtr = Brealloc(MusicPtr, l);
g_musicSize=l; g_musicSize=l;
kread(fp, (unsigned char *)MusicPtr, l); kread(fp, (unsigned char *)MusicPtr, l);