mirror of
https://github.com/ZDoom/acc.git
synced 2024-11-26 13:51:33 +00:00
- added ACC 64bit patch from Agent ME.
SVN r1073 (trunk)
This commit is contained in:
parent
08c9083086
commit
78184b3f56
7 changed files with 146 additions and 143 deletions
8
common.h
8
common.h
|
@ -87,14 +87,16 @@ enum
|
|||
|
||||
// TYPES -------------------------------------------------------------------
|
||||
|
||||
typedef unsigned long boolean;
|
||||
typedef unsigned int boolean;
|
||||
typedef unsigned char byte;
|
||||
typedef signed char S_BYTE;
|
||||
typedef unsigned char U_BYTE;
|
||||
typedef signed short S_WORD;
|
||||
typedef unsigned short U_WORD;
|
||||
typedef signed long S_LONG;
|
||||
typedef unsigned long U_LONG;
|
||||
typedef int S_INT;
|
||||
typedef unsigned int U_INT;
|
||||
// typedef signed long S_LONG;
|
||||
// typedef unsigned long U_LONG;
|
||||
|
||||
enum ImportModes
|
||||
{
|
||||
|
|
6
misc.c
6
misc.c
|
@ -113,13 +113,13 @@ U_WORD MS_LittleUWORD(U_WORD val)
|
|||
|
||||
//==========================================================================
|
||||
//
|
||||
// MS_LittleULONG
|
||||
// MS_LittleUINT
|
||||
//
|
||||
// Converts a host U_LONG (4 bytes) to little endian byte order.
|
||||
// Converts a host U_INT (4 bytes) to little endian byte order.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
U_LONG MS_LittleULONG(U_LONG val)
|
||||
U_INT MS_LittleUINT(U_INT val)
|
||||
{
|
||||
if(acs_BigEndianHost == NO)
|
||||
{
|
||||
|
|
3
misc.h
3
misc.h
|
@ -32,7 +32,8 @@ typedef enum
|
|||
void *MS_Alloc(size_t size, error_t error);
|
||||
void *MS_Realloc(void *base, size_t size, error_t error);
|
||||
U_WORD MS_LittleUWORD(U_WORD val);
|
||||
U_LONG MS_LittleULONG(U_LONG val);
|
||||
// U_LONG MS_LittleULONG(U_LONG val);
|
||||
U_INT MS_LittleUINT(U_INT val);
|
||||
int MS_LoadFile(char *name, char **buffer);
|
||||
boolean MS_SaveFile(char *name, void *buffer, int length);
|
||||
int MS_StrCmp(char *s1, char *s2);
|
||||
|
|
118
parse.c
118
parse.c
|
@ -1548,7 +1548,7 @@ static void LeadingLineSpecial(boolean executewait)
|
|||
PC_AppendCmd(PCD_LSPEC1+(argCount-1));
|
||||
if(pc_NoShrink)
|
||||
{
|
||||
PC_AppendLong(specialValue);
|
||||
PC_AppendInt(specialValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1561,33 +1561,33 @@ static void LeadingLineSpecial(boolean executewait)
|
|||
}
|
||||
else
|
||||
{
|
||||
boolean uselongform;
|
||||
boolean useintform;
|
||||
|
||||
if(pc_NoShrink)
|
||||
{
|
||||
PC_AppendCmd(PCD_LSPEC1DIRECT+(argCount-1));
|
||||
PC_AppendLong(specialValue);
|
||||
uselongform = YES;
|
||||
PC_AppendInt(specialValue);
|
||||
useintform = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
uselongform = NO;
|
||||
useintform = NO;
|
||||
for (i = 0; i < argCount; i++)
|
||||
{
|
||||
if ((unsigned int)argSave[i] > 255)
|
||||
if ((U_INT)argSave[i] > 255)
|
||||
{
|
||||
uselongform = YES;
|
||||
useintform = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
PC_AppendCmd((argCount-1)+(uselongform?PCD_LSPEC1DIRECT:PCD_LSPEC1DIRECTB));
|
||||
PC_AppendCmd((argCount-1)+(useintform?PCD_LSPEC1DIRECT:PCD_LSPEC1DIRECTB));
|
||||
PC_AppendByte(specialValue);
|
||||
}
|
||||
if (uselongform)
|
||||
if (useintform)
|
||||
{
|
||||
for (i = 0; i < argCount; i++)
|
||||
{
|
||||
PC_AppendLong(argSave[i]);
|
||||
PC_AppendInt(argSave[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1600,7 +1600,7 @@ static void LeadingLineSpecial(boolean executewait)
|
|||
if(executewait)
|
||||
{
|
||||
PC_AppendCmd(PCD_SCRIPTWAITDIRECT);
|
||||
PC_AppendLong(argSave[0]);
|
||||
PC_AppendInt(argSave[0]);
|
||||
}
|
||||
}
|
||||
TK_NextToken();
|
||||
|
@ -1743,7 +1743,7 @@ static void ProcessInternFunc(symbolNode_t *sym)
|
|||
}
|
||||
else
|
||||
{
|
||||
PC_AppendLong(EvalConstExpression());
|
||||
PC_AppendInt(EvalConstExpression());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1756,7 +1756,7 @@ static void ProcessInternFunc(symbolNode_t *sym)
|
|||
}
|
||||
else
|
||||
{
|
||||
PC_AppendLong(0);
|
||||
PC_AppendInt(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1788,16 +1788,16 @@ static void ProcessInternFunc(symbolNode_t *sym)
|
|||
switch (sym->type)
|
||||
{
|
||||
case SY_SCRIPTVAR:
|
||||
PC_AppendLong(sym->info.var.index | OUTVAR_SCRIPT_SPEC);
|
||||
PC_AppendInt(sym->info.var.index | OUTVAR_SCRIPT_SPEC);
|
||||
break;
|
||||
case SY_MAPVAR:
|
||||
PC_AppendLong(sym->info.var.index | OUTVAR_MAP_SPEC);
|
||||
PC_AppendInt(sym->info.var.index | OUTVAR_MAP_SPEC);
|
||||
break;
|
||||
case SY_WORLDVAR:
|
||||
PC_AppendLong(sym->info.var.index | OUTVAR_WORLD_SPEC);
|
||||
PC_AppendInt(sym->info.var.index | OUTVAR_WORLD_SPEC);
|
||||
break;
|
||||
case SY_GLOBALVAR:
|
||||
PC_AppendLong(sym->info.var.index | OUTVAR_GLOBAL_SPEC);
|
||||
PC_AppendInt(sym->info.var.index | OUTVAR_GLOBAL_SPEC);
|
||||
break;
|
||||
default:
|
||||
ERR_Error (ERR_PARM_MUST_BE_VAR, YES);
|
||||
|
@ -1838,7 +1838,7 @@ static void ProcessInternFunc(symbolNode_t *sym)
|
|||
}
|
||||
else
|
||||
{
|
||||
PC_AppendLong(0);
|
||||
PC_AppendInt(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1859,7 +1859,7 @@ static void ProcessInternFunc(symbolNode_t *sym)
|
|||
}
|
||||
else if (specialDirect)
|
||||
{
|
||||
boolean uselongform = NO;
|
||||
boolean useintform = NO;
|
||||
pcd_t shortpcd;
|
||||
|
||||
switch (sym->info.internFunc.directCommand)
|
||||
|
@ -1871,29 +1871,29 @@ static void ProcessInternFunc(symbolNode_t *sym)
|
|||
shortpcd = PCD_RANDOMDIRECTB;
|
||||
break;
|
||||
default:
|
||||
uselongform = YES;
|
||||
useintform = YES;
|
||||
shortpcd = PCD_NOP;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!uselongform)
|
||||
if (!useintform)
|
||||
{
|
||||
for (i = 0; i < argCount; i++)
|
||||
{
|
||||
if ((unsigned int)argSave[i] > 255)
|
||||
if ((U_INT)argSave[i] > 255)
|
||||
{
|
||||
uselongform = YES;
|
||||
useintform = YES;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (uselongform)
|
||||
if (useintform)
|
||||
{
|
||||
PC_AppendCmd(sym->info.internFunc.directCommand);
|
||||
for (i = 0; i < argCount; i++)
|
||||
{
|
||||
PC_AppendLong (argSave[i]);
|
||||
PC_AppendInt (argSave[i]);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2006,7 +2006,7 @@ static void ProcessScriptFunc(symbolNode_t *sym, boolean discardReturn)
|
|||
}
|
||||
if (pc_NoShrink)
|
||||
{
|
||||
PC_AppendLong(sym->info.scriptFunc.funcNumber);
|
||||
PC_AppendInt(sym->info.scriptFunc.funcNumber);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2279,7 +2279,7 @@ static void LeadingIf(void)
|
|||
TK_TokenMustBe(TK_RPAREN, ERR_MISSING_RPAREN);
|
||||
PC_AppendCmd(PCD_IFNOTGOTO);
|
||||
jumpAddrPtr1 = pc_Address;
|
||||
PC_SkipLong();
|
||||
PC_SkipInt();
|
||||
TK_NextToken();
|
||||
if(ProcessStatement(STMT_IF) == NO)
|
||||
{
|
||||
|
@ -2289,18 +2289,18 @@ static void LeadingIf(void)
|
|||
{
|
||||
PC_AppendCmd(PCD_GOTO);
|
||||
jumpAddrPtr2 = pc_Address;
|
||||
PC_SkipLong();
|
||||
PC_WriteLong(pc_Address, jumpAddrPtr1);
|
||||
PC_SkipInt();
|
||||
PC_WriteInt(pc_Address, jumpAddrPtr1);
|
||||
TK_NextToken();
|
||||
if(ProcessStatement(STMT_ELSE) == NO)
|
||||
{
|
||||
ERR_Error(ERR_INVALID_STATEMENT, YES);
|
||||
}
|
||||
PC_WriteLong(pc_Address, jumpAddrPtr2);
|
||||
PC_WriteInt(pc_Address, jumpAddrPtr2);
|
||||
}
|
||||
else
|
||||
{
|
||||
PC_WriteLong(pc_Address, jumpAddrPtr1);
|
||||
PC_WriteInt(pc_Address, jumpAddrPtr1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2330,10 +2330,10 @@ static void LeadingFor(void)
|
|||
TK_NextToken();
|
||||
PC_AppendCmd(PCD_IFGOTO);
|
||||
ifgotoAddr = pc_Address;
|
||||
PC_SkipLong();
|
||||
PC_SkipInt();
|
||||
PC_AppendCmd(PCD_GOTO);
|
||||
gotoAddr = pc_Address;
|
||||
PC_SkipLong();
|
||||
PC_SkipInt();
|
||||
incAddr = pc_Address;
|
||||
forSemicolonHack = TRUE;
|
||||
if(ProcessStatement(STMT_FOR) == NO)
|
||||
|
@ -2342,17 +2342,17 @@ static void LeadingFor(void)
|
|||
}
|
||||
forSemicolonHack = FALSE;
|
||||
PC_AppendCmd(PCD_GOTO);
|
||||
PC_AppendLong(exprAddr);
|
||||
PC_WriteLong(pc_Address,ifgotoAddr);
|
||||
PC_AppendInt(exprAddr);
|
||||
PC_WriteInt(pc_Address,ifgotoAddr);
|
||||
if(ProcessStatement(STMT_FOR) == NO)
|
||||
{
|
||||
ERR_Error(ERR_INVALID_STATEMENT, YES);
|
||||
}
|
||||
PC_AppendCmd(PCD_GOTO);
|
||||
PC_AppendLong(incAddr);
|
||||
PC_AppendInt(incAddr);
|
||||
WriteContinues(incAddr);
|
||||
WriteBreaks();
|
||||
PC_WriteLong(pc_Address,gotoAddr);
|
||||
PC_WriteInt(pc_Address,gotoAddr);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -2376,16 +2376,16 @@ static void LeadingWhileUntil(void)
|
|||
TK_TokenMustBe(TK_RPAREN, ERR_MISSING_RPAREN);
|
||||
PC_AppendCmd(stmtToken == TK_WHILE ? PCD_IFNOTGOTO : PCD_IFGOTO);
|
||||
outAddrPtr = pc_Address;
|
||||
PC_SkipLong();
|
||||
PC_SkipInt();
|
||||
TK_NextToken();
|
||||
if(ProcessStatement(STMT_WHILEUNTIL) == NO)
|
||||
{
|
||||
ERR_Error(ERR_INVALID_STATEMENT, YES);
|
||||
}
|
||||
PC_AppendCmd(PCD_GOTO);
|
||||
PC_AppendLong(topAddr);
|
||||
PC_AppendInt(topAddr);
|
||||
|
||||
PC_WriteLong(pc_Address, outAddrPtr);
|
||||
PC_WriteInt(pc_Address, outAddrPtr);
|
||||
|
||||
WriteContinues(topAddr);
|
||||
WriteBreaks();
|
||||
|
@ -2424,7 +2424,7 @@ static void LeadingDo(void)
|
|||
TK_TokenMustBe(TK_RPAREN, ERR_MISSING_RPAREN);
|
||||
TK_NextTokenMustBe(TK_SEMICOLON, ERR_MISSING_SEMICOLON);
|
||||
PC_AppendCmd(stmtToken == TK_WHILE ? PCD_IFGOTO : PCD_IFNOTGOTO);
|
||||
PC_AppendLong(topAddr);
|
||||
PC_AppendInt(topAddr);
|
||||
WriteContinues(exprAddr);
|
||||
WriteBreaks();
|
||||
TK_NextToken();
|
||||
|
@ -2452,7 +2452,7 @@ static void LeadingSwitch(void)
|
|||
|
||||
PC_AppendCmd(PCD_GOTO);
|
||||
switcherAddrPtr = pc_Address;
|
||||
PC_SkipLong();
|
||||
PC_SkipInt();
|
||||
|
||||
TK_NextToken();
|
||||
if(ProcessStatement(STMT_SWITCH) == NO)
|
||||
|
@ -2462,9 +2462,9 @@ static void LeadingSwitch(void)
|
|||
|
||||
PC_AppendCmd(PCD_GOTO);
|
||||
outAddrPtr = pc_Address;
|
||||
PC_SkipLong();
|
||||
PC_SkipInt();
|
||||
|
||||
PC_WriteLong(pc_Address, switcherAddrPtr);
|
||||
PC_WriteInt(pc_Address, switcherAddrPtr);
|
||||
defaultAddress = 0;
|
||||
|
||||
if(pc_HexenCase)
|
||||
|
@ -2477,8 +2477,8 @@ static void LeadingSwitch(void)
|
|||
continue;
|
||||
}
|
||||
PC_AppendCmd(PCD_CASEGOTO);
|
||||
PC_AppendLong(cInfo->value);
|
||||
PC_AppendLong(cInfo->address);
|
||||
PC_AppendInt(cInfo->value);
|
||||
PC_AppendInt(cInfo->address);
|
||||
}
|
||||
}
|
||||
else if(CaseIndex != 0)
|
||||
|
@ -2503,14 +2503,14 @@ static void LeadingSwitch(void)
|
|||
PC_AppendCmd(PCD_CASEGOTOSORTED);
|
||||
if(pc_Address%4 != 0)
|
||||
{ // Align to a 4-byte boundary
|
||||
U_LONG pad = 0;
|
||||
U_INT pad = 0;
|
||||
PC_Append((void *)&pad, 4-(pc_Address%4));
|
||||
}
|
||||
PC_AppendLong(maxCase - minCase);
|
||||
PC_AppendInt(maxCase - minCase);
|
||||
for(; minCase < maxCase; ++minCase)
|
||||
{
|
||||
PC_AppendLong(minCase->value);
|
||||
PC_AppendLong(minCase->address);
|
||||
PC_AppendInt(minCase->value);
|
||||
PC_AppendInt(minCase->address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2519,10 +2519,10 @@ static void LeadingSwitch(void)
|
|||
if(defaultAddress != 0)
|
||||
{
|
||||
PC_AppendCmd(PCD_GOTO);
|
||||
PC_AppendLong(defaultAddress);
|
||||
PC_AppendInt(defaultAddress);
|
||||
}
|
||||
|
||||
PC_WriteLong(pc_Address, outAddrPtr);
|
||||
PC_WriteInt(pc_Address, outAddrPtr);
|
||||
|
||||
WriteBreaks();
|
||||
}
|
||||
|
@ -2650,7 +2650,7 @@ static void LeadingBreak(void)
|
|||
TK_NextTokenMustBe(TK_SEMICOLON, ERR_MISSING_SEMICOLON);
|
||||
PC_AppendCmd(PCD_GOTO);
|
||||
PushBreak();
|
||||
PC_SkipLong();
|
||||
PC_SkipInt();
|
||||
TK_NextToken();
|
||||
}
|
||||
|
||||
|
@ -2681,7 +2681,7 @@ static void WriteBreaks(void)
|
|||
{
|
||||
while(BreakIndex && BreakInfo[BreakIndex-1].level > StatementLevel)
|
||||
{
|
||||
PC_WriteLong(pc_Address, BreakInfo[--BreakIndex].addressPtr);
|
||||
PC_WriteInt(pc_Address, BreakInfo[--BreakIndex].addressPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2720,7 +2720,7 @@ static void LeadingContinue(void)
|
|||
TK_NextTokenMustBe(TK_SEMICOLON, ERR_MISSING_SEMICOLON);
|
||||
PC_AppendCmd(PCD_GOTO);
|
||||
PushContinue();
|
||||
PC_SkipLong();
|
||||
PC_SkipInt();
|
||||
TK_NextToken();
|
||||
}
|
||||
|
||||
|
@ -2755,7 +2755,7 @@ static void WriteContinues(int address)
|
|||
}
|
||||
while(ContinueInfo[ContinueIndex-1].level > StatementLevel)
|
||||
{
|
||||
PC_WriteLong(address, ContinueInfo[--ContinueIndex].addressPtr);
|
||||
PC_WriteInt(address, ContinueInfo[--ContinueIndex].addressPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2862,7 +2862,7 @@ static void LeadingVarAssign(symbolNode_t *sym)
|
|||
PC_AppendCmd(GetIncDecPCD(tk_Token, sym->type));
|
||||
if (pc_NoShrink)
|
||||
{
|
||||
PC_AppendLong(sym->info.var.index);
|
||||
PC_AppendInt(sym->info.var.index);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3191,7 +3191,7 @@ static void ExprLineSpecial(void)
|
|||
PC_AppendCmd(PCD_LSPEC5RESULT);
|
||||
if(pc_NoShrink)
|
||||
{
|
||||
PC_AppendLong(specialValue);
|
||||
PC_AppendInt(specialValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3962,7 +3962,7 @@ static void UnspeculateFunction(symbolNode_t *sym)
|
|||
|
||||
if(pc_NoShrink)
|
||||
{
|
||||
PC_WriteLong(sym->info.scriptFunc.funcNumber, fillin->address);
|
||||
PC_WriteInt(sym->info.scriptFunc.funcNumber, fillin->address);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
116
pcode.c
116
pcode.c
|
@ -486,7 +486,7 @@ void PC_OpenObject(char *name, size_t size, int flags)
|
|||
pc_ScriptCount = 0;
|
||||
ObjectOpened = YES;
|
||||
PC_AppendString("ACS");
|
||||
PC_SkipLong(); // Script table offset
|
||||
PC_SkipInt(); // Script table offset
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -529,16 +529,16 @@ static void CloseOld(void)
|
|||
int i;
|
||||
|
||||
STR_WriteStrings();
|
||||
PC_WriteLong((U_LONG)pc_Address, 4);
|
||||
PC_AppendLong((U_LONG)pc_ScriptCount);
|
||||
PC_WriteInt((U_INT)pc_Address, 4);
|
||||
PC_AppendInt((U_INT)pc_ScriptCount);
|
||||
for(i = 0; i < pc_ScriptCount; ++i)
|
||||
{
|
||||
scriptInfo_t *info = &ScriptInfo[i];
|
||||
MS_Message(MSG_DEBUG, "Script %d, address = %d, arg count = %d\n",
|
||||
info->number, info->address, info->argCount);
|
||||
PC_AppendLong((U_LONG)(info->number + info->type * 1000));
|
||||
PC_AppendLong((U_LONG)info->address);
|
||||
PC_AppendLong((U_LONG)info->argCount);
|
||||
PC_AppendInt((U_INT)(info->number + info->type * 1000));
|
||||
PC_AppendInt((U_INT)info->address);
|
||||
PC_AppendInt((U_INT)info->argCount);
|
||||
}
|
||||
STR_WriteList();
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ static void CloseNew(void)
|
|||
if(j > 0)
|
||||
{
|
||||
PC_Append("SPTR", 4);
|
||||
PC_AppendLong(j * 8);
|
||||
PC_AppendInt(j * 8);
|
||||
for(i = 0; i < pc_ScriptCount; i++)
|
||||
{
|
||||
scriptInfo_t *info = &ScriptInfo[i];
|
||||
|
@ -591,7 +591,7 @@ static void CloseNew(void)
|
|||
PC_AppendWord(info->number);
|
||||
PC_AppendByte(info->type);
|
||||
PC_AppendByte(info->argCount);
|
||||
PC_AppendLong((U_LONG)info->address);
|
||||
PC_AppendInt((U_INT)info->address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -607,7 +607,7 @@ static void CloseNew(void)
|
|||
if(j > 0)
|
||||
{
|
||||
PC_Append("SVCT", 4);
|
||||
PC_AppendLong(j * 4);
|
||||
PC_AppendInt(j * 4);
|
||||
for(i = 0; i < pc_ScriptCount; ++i)
|
||||
{
|
||||
scriptInfo_t *info = &ScriptInfo[i];
|
||||
|
@ -632,7 +632,7 @@ static void CloseNew(void)
|
|||
if (j > 0)
|
||||
{
|
||||
PC_Append("SFLG", 4);
|
||||
PC_AppendLong(j * 4);
|
||||
PC_AppendInt(j * 4);
|
||||
for(i = 0; i < pc_ScriptCount; ++i)
|
||||
{
|
||||
scriptInfo_t *info = &ScriptInfo[i];
|
||||
|
@ -647,7 +647,7 @@ static void CloseNew(void)
|
|||
if(pc_FunctionCount > 0)
|
||||
{
|
||||
PC_Append("FUNC", 4);
|
||||
PC_AppendLong(pc_FunctionCount * 8);
|
||||
PC_AppendInt(pc_FunctionCount * 8);
|
||||
for(i = 0; i < pc_FunctionCount; ++i)
|
||||
{
|
||||
functionInfo_t *info = &FunctionInfo[i];
|
||||
|
@ -658,7 +658,7 @@ static void CloseNew(void)
|
|||
PC_AppendByte(info->localCount);
|
||||
PC_AppendByte((U_BYTE)(info->hasReturnValue?1:0));
|
||||
PC_AppendByte(0);
|
||||
PC_AppendLong((U_LONG)info->address);
|
||||
PC_AppendInt((U_INT)info->address);
|
||||
}
|
||||
STR_WriteListChunk(STRLIST_FUNCTIONS, MAKE4CC('F','N','A','M'), NO);
|
||||
}
|
||||
|
@ -695,11 +695,11 @@ static void CloseNew(void)
|
|||
if (i < j)
|
||||
{
|
||||
PC_Append("MINI", 4);
|
||||
PC_AppendLong((j-i)*4+4);
|
||||
PC_AppendLong(i); // First map var defined
|
||||
PC_AppendInt((j-i)*4+4);
|
||||
PC_AppendInt(i); // First map var defined
|
||||
for(; i < j; ++i)
|
||||
{
|
||||
PC_AppendLong(MapVariables[i].initializer);
|
||||
PC_AppendInt(MapVariables[i].initializer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -720,12 +720,12 @@ static void CloseNew(void)
|
|||
if(count > 0)
|
||||
{
|
||||
PC_Append("MSTR", 4);
|
||||
PC_AppendLong(count*4);
|
||||
PC_AppendInt(count*4);
|
||||
for(i = 0; i < pa_MapVarCount; ++i)
|
||||
{
|
||||
if(MapVariables[i].isString)
|
||||
{
|
||||
PC_AppendLong(i);
|
||||
PC_AppendInt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -741,12 +741,12 @@ static void CloseNew(void)
|
|||
if(count > 0)
|
||||
{
|
||||
PC_Append("ASTR", 4);
|
||||
PC_AppendLong(count*4);
|
||||
PC_AppendInt(count*4);
|
||||
for(i = 0; i < pa_MapVarCount; ++i)
|
||||
{
|
||||
if(ArrayOfStrings[i])
|
||||
{
|
||||
PC_AppendLong(i);
|
||||
PC_AppendInt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -781,12 +781,12 @@ static void CloseNew(void)
|
|||
if(count > 0)
|
||||
{
|
||||
PC_Append("MIMP", 4);
|
||||
PC_AppendLong(count);
|
||||
PC_AppendInt(count);
|
||||
for(i = 0; i < pa_MapVarCount; ++i)
|
||||
{
|
||||
if(MapVariables[i].imported && !ArraySizes[i])
|
||||
{
|
||||
PC_AppendLong(i);
|
||||
PC_AppendInt(i);
|
||||
PC_AppendString(MapVariables[i].name);
|
||||
}
|
||||
}
|
||||
|
@ -807,13 +807,13 @@ static void CloseNew(void)
|
|||
if(count)
|
||||
{
|
||||
PC_Append("ARAY", 4);
|
||||
PC_AppendLong(count*8);
|
||||
PC_AppendInt(count*8);
|
||||
for(i = 0; i < pa_MapVarCount; ++i)
|
||||
{
|
||||
if(ArraySizes[i] && !MapVariables[i].imported)
|
||||
{
|
||||
PC_AppendLong(i);
|
||||
PC_AppendLong(ArraySizes[i]);
|
||||
PC_AppendInt(i);
|
||||
PC_AppendInt(ArraySizes[i]);
|
||||
}
|
||||
}
|
||||
for(i = 0; i < pa_MapVarCount; ++i)
|
||||
|
@ -823,11 +823,11 @@ static void CloseNew(void)
|
|||
int j;
|
||||
|
||||
PC_Append("AINI", 4);
|
||||
PC_AppendLong(ArraySizes[i]*4+4);
|
||||
PC_AppendLong((U_LONG)i);
|
||||
PC_AppendInt(ArraySizes[i]*4+4);
|
||||
PC_AppendInt((U_INT)i);
|
||||
for(j = 0; j < ArraySizes[i]; ++j)
|
||||
{
|
||||
PC_AppendLong((U_LONG)ArrayInits[i][j]);
|
||||
PC_AppendInt((U_INT)ArrayInits[i][j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -845,14 +845,14 @@ static void CloseNew(void)
|
|||
if(count)
|
||||
{
|
||||
PC_Append("AIMP", 4);
|
||||
PC_AppendLong(count+4);
|
||||
PC_AppendLong(j);
|
||||
PC_AppendInt(count+4);
|
||||
PC_AppendInt(j);
|
||||
for(i = 0; i < pa_MapVarCount; ++i)
|
||||
{
|
||||
if(ArraySizes[i] && MapVariables[i].imported)
|
||||
{
|
||||
PC_AppendLong(i);
|
||||
PC_AppendLong(ArraySizes[i]);
|
||||
PC_AppendInt(i);
|
||||
PC_AppendInt(ArraySizes[i]);
|
||||
PC_AppendString(MapVariables[i].name);
|
||||
}
|
||||
}
|
||||
|
@ -863,7 +863,7 @@ static void CloseNew(void)
|
|||
if(ImportMode == IMPORT_Exporting)
|
||||
{
|
||||
PC_Append("ALIB", 4);
|
||||
PC_AppendLong(0);
|
||||
PC_AppendInt(0);
|
||||
}
|
||||
|
||||
// Record libraries imported by this object.
|
||||
|
@ -877,7 +877,7 @@ static void CloseNew(void)
|
|||
if(count > 0)
|
||||
{
|
||||
PC_Append("LOAD", 4);
|
||||
PC_AppendLong(count);
|
||||
PC_AppendInt(count);
|
||||
for(i = 0; i < NumImports; ++i)
|
||||
{
|
||||
PC_AppendString(Imports[i]);
|
||||
|
@ -885,7 +885,7 @@ static void CloseNew(void)
|
|||
}
|
||||
}
|
||||
|
||||
PC_AppendLong((U_LONG)chunkStart);
|
||||
PC_AppendInt((U_INT)chunkStart);
|
||||
if(pc_NoShrink)
|
||||
{
|
||||
PC_Append("ACSE", 4);
|
||||
|
@ -894,7 +894,7 @@ static void CloseNew(void)
|
|||
{
|
||||
PC_Append("ACSe", 4);
|
||||
}
|
||||
PC_WriteLong((U_LONG)pc_Address, 4);
|
||||
PC_WriteInt((U_INT)pc_Address, 4);
|
||||
|
||||
// WadAuthor compatibility when creating a library is pointless, because
|
||||
// that editor does not know anything about libraries and will never
|
||||
|
@ -905,9 +905,9 @@ static void CloseNew(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
PC_AppendLong(0);
|
||||
PC_AppendInt(0);
|
||||
}
|
||||
PC_AppendLong(0);
|
||||
PC_AppendInt(0);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -923,7 +923,7 @@ static void CreateDummyScripts(void)
|
|||
MS_Message(MSG_DEBUG, "Creating dummy scripts to make WadAuthor happy.\n");
|
||||
if(pc_Address%4 != 0)
|
||||
{ // Need to align
|
||||
U_LONG pad = 0;
|
||||
U_INT pad = 0;
|
||||
PC_Append((void *)&pad, 4-(pc_Address%4));
|
||||
}
|
||||
pc_DummyAddress = pc_Address;
|
||||
|
@ -959,7 +959,7 @@ static void RecordDummyScripts(void)
|
|||
++count;
|
||||
}
|
||||
}
|
||||
PC_AppendLong((U_LONG)count);
|
||||
PC_AppendInt((U_INT)count);
|
||||
for(i = 0; i < pc_ScriptCount; ++i)
|
||||
{
|
||||
scriptInfo_t *info = &ScriptInfo[i];
|
||||
|
@ -967,9 +967,9 @@ static void RecordDummyScripts(void)
|
|||
{
|
||||
MS_Message(MSG_DEBUG, "Dummy script %d, address = %d, arg count = %d\n",
|
||||
info->number, info->address, info->argCount);
|
||||
PC_AppendLong((U_LONG)info->number);
|
||||
PC_AppendLong((U_LONG)pc_DummyAddress + i*4);
|
||||
PC_AppendLong((U_LONG)info->argCount);
|
||||
PC_AppendInt((U_INT)info->number);
|
||||
PC_AppendInt((U_INT)pc_DummyAddress + i*4);
|
||||
PC_AppendInt((U_INT)info->argCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1037,13 +1037,13 @@ void PC_AppendWord(U_WORD val)
|
|||
}
|
||||
}
|
||||
|
||||
void PC_AppendLong(U_LONG val)
|
||||
void PC_AppendInt(U_INT val)
|
||||
{
|
||||
if (ImportMode != IMPORT_Importing)
|
||||
{
|
||||
MS_Message(MSG_DEBUG, "AL> %06d = %d\n", pc_Address, val);
|
||||
val = MS_LittleULONG(val);
|
||||
Append(&val, sizeof(U_LONG));
|
||||
val = MS_LittleUINT(val);
|
||||
Append(&val, sizeof(U_INT));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1069,8 +1069,8 @@ void PC_AppendCmd(pcd_t command)
|
|||
{
|
||||
MS_Message(MSG_DEBUG, "AC> %06d = #%d:%s\n", pc_Address,
|
||||
command, PCDNames[command]);
|
||||
command = MS_LittleULONG(command);
|
||||
Append(&command, sizeof(U_LONG));
|
||||
command = MS_LittleUINT(command);
|
||||
Append(&command, sizeof(U_INT));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1143,7 +1143,7 @@ void PC_AppendShrink(U_BYTE val)
|
|||
{
|
||||
if(pc_NoShrink)
|
||||
{
|
||||
PC_AppendLong(val);
|
||||
PC_AppendInt(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1157,12 +1157,12 @@ void PC_AppendShrink(U_BYTE val)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void PC_AppendPushVal(U_LONG val)
|
||||
void PC_AppendPushVal(U_INT val)
|
||||
{
|
||||
if(pc_NoShrink || val > 255)
|
||||
{
|
||||
PC_AppendCmd(PCD_PUSHNUMBER);
|
||||
PC_AppendLong(val);
|
||||
PC_AppendInt(val);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1216,13 +1216,13 @@ void PC_WriteWord(U_WORD val, int address)
|
|||
}
|
||||
*/
|
||||
|
||||
void PC_WriteLong(U_LONG val, int address)
|
||||
void PC_WriteInt(U_INT val, int address)
|
||||
{
|
||||
if (ImportMode != IMPORT_Importing)
|
||||
{
|
||||
MS_Message(MSG_DEBUG, "WL> %06d = %d\n", address, val);
|
||||
val = MS_LittleULONG(val);
|
||||
Write(&val, sizeof(U_LONG), address);
|
||||
val = MS_LittleUINT(val);
|
||||
Write(&val, sizeof(U_INT), address);
|
||||
}
|
||||
pc_LastAppendedCommand = PCD_NOP;
|
||||
}
|
||||
|
@ -1246,8 +1246,8 @@ void PC_WriteCmd(pcd_t command, int address)
|
|||
{
|
||||
MS_Message(MSG_DEBUG, "WC> %06d = #%d:%s\n", address,
|
||||
command, PCDNames[command]);
|
||||
command = MS_LittleULONG(command);
|
||||
Write(&command, sizeof(U_LONG), address);
|
||||
command = MS_LittleUINT(command);
|
||||
Write(&command, sizeof(U_INT), address);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1295,12 +1295,12 @@ void PC_SkipWord(void)
|
|||
}
|
||||
*/
|
||||
|
||||
void PC_SkipLong(void)
|
||||
void PC_SkipInt(void)
|
||||
{
|
||||
if (ImportMode != IMPORT_Importing)
|
||||
{
|
||||
MS_Message(MSG_DEBUG, "SL> %06d (skip long)\n", pc_Address);
|
||||
Skip(sizeof(U_LONG));
|
||||
MS_Message(MSG_DEBUG, "SL> %06d (skip int)\n", pc_Address);
|
||||
Skip(sizeof(U_INT));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
8
pcode.h
8
pcode.h
|
@ -419,21 +419,21 @@ void PC_CloseObject(void);
|
|||
void PC_Append(void *buffer, size_t size);
|
||||
void PC_AppendByte(U_BYTE val);
|
||||
void PC_AppendWord(U_WORD val);
|
||||
void PC_AppendLong(U_LONG val);
|
||||
void PC_AppendInt(U_INT val);
|
||||
void PC_AppendString(char *string);
|
||||
void PC_AppendCmd(pcd_t command);
|
||||
void PC_AppendPushVal(U_LONG val);
|
||||
void PC_AppendPushVal(U_INT val);
|
||||
void PC_AppendShrink(U_BYTE val);
|
||||
void PC_Write(void *buffer, size_t size, int address);
|
||||
void PC_WriteByte(U_BYTE val, int address);
|
||||
//void PC_WriteWord(U_WORD val, int address);
|
||||
void PC_WriteLong(U_LONG val, int address);
|
||||
void PC_WriteInt(U_INT val, int address);
|
||||
void PC_WriteString(char *string, int address);
|
||||
void PC_WriteCmd(pcd_t command, int address);
|
||||
void PC_Skip(size_t size);
|
||||
//void PC_SkipByte(void);
|
||||
//void PC_SkipWord(void);
|
||||
void PC_SkipLong(void);
|
||||
void PC_SkipInt(void);
|
||||
void PC_AddScript(int number, int argCount);
|
||||
void PC_SetScriptVarCount(int number, int varCount);
|
||||
void PC_AddFunction(struct symbolNode_s *sym);
|
||||
|
|
30
strlist.c
30
strlist.c
|
@ -274,7 +274,7 @@ int STR_ListSize(int list)
|
|||
void STR_WriteStrings(void)
|
||||
{
|
||||
int i;
|
||||
U_LONG pad;
|
||||
U_INT pad;
|
||||
|
||||
MS_Message(MSG_DEBUG, "---- STR_WriteStrings ----\n");
|
||||
for(i = 0; i < LanguageInfo[0]->list.stringCount; i++)
|
||||
|
@ -300,10 +300,10 @@ void STR_WriteList(void)
|
|||
int i;
|
||||
|
||||
MS_Message(MSG_DEBUG, "---- STR_WriteList ----\n");
|
||||
PC_AppendLong((U_LONG)LanguageInfo[0]->list.stringCount);
|
||||
PC_AppendInt((U_INT)LanguageInfo[0]->list.stringCount);
|
||||
for(i = 0; i < LanguageInfo[0]->list.stringCount; i++)
|
||||
{
|
||||
PC_AppendLong((U_LONG)LanguageInfo[0]->list.strings[i].address);
|
||||
PC_AppendInt((U_INT)LanguageInfo[0]->list.strings[i].address);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -321,10 +321,10 @@ void STR_WriteChunk(int language, boolean encrypt)
|
|||
MS_Message(MSG_DEBUG, "---- STR_WriteChunk %d ----\n", language);
|
||||
PC_Append(encrypt ? "STRE" : "STRL", 4);
|
||||
lenadr = pc_Address;
|
||||
PC_SkipLong();
|
||||
PC_SkipInt();
|
||||
PC_Append(&lang->name, 4);
|
||||
PC_AppendLong(lang->list.stringCount);
|
||||
PC_AppendLong(0); // Used in-game for stringing lists together
|
||||
PC_AppendInt(lang->list.stringCount);
|
||||
PC_AppendInt(0); // Used in-game for stringing lists together
|
||||
|
||||
DumpStrings (&lang->list, lenadr, NO, encrypt);
|
||||
}
|
||||
|
@ -343,14 +343,14 @@ void STR_WriteListChunk(int list, int id, boolean quad)
|
|||
{
|
||||
MS_Message(MSG_DEBUG, "---- STR_WriteListChunk %d %c%c%c%c----\n", list,
|
||||
id&255, (id>>8)&255, (id>>16)&255, (id>>24)&255);
|
||||
PC_AppendLong((U_LONG)id);
|
||||
PC_AppendInt((U_INT)id);
|
||||
lenadr = pc_Address;
|
||||
PC_SkipLong();
|
||||
PC_AppendLong(StringLists[list]->stringCount);
|
||||
PC_SkipInt();
|
||||
PC_AppendInt(StringLists[list]->stringCount);
|
||||
if (quad && pc_Address%8 != 0)
|
||||
{ // If writing quadword indices, align the indices to an
|
||||
// 8-byte boundary.
|
||||
U_LONG pad = 0;
|
||||
U_INT pad = 0;
|
||||
PC_Append (&pad, 4);
|
||||
}
|
||||
DumpStrings(StringLists[list], lenadr, quad, NO);
|
||||
|
@ -373,16 +373,16 @@ static void DumpStrings(stringList_t *list, int lenadr, boolean quad, boolean cr
|
|||
{
|
||||
if (list->strings[i].name != NULL)
|
||||
{
|
||||
PC_AppendLong((U_LONG)ofs);
|
||||
PC_AppendInt((U_INT)ofs);
|
||||
ofs += strlen(list->strings[i].name) + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
PC_AppendLong(0);
|
||||
PC_AppendInt(0);
|
||||
}
|
||||
if (quad)
|
||||
{
|
||||
PC_AppendLong(0);
|
||||
PC_AppendInt(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -410,11 +410,11 @@ static void DumpStrings(stringList_t *list, int lenadr, boolean quad, boolean cr
|
|||
}
|
||||
if(pc_Address%4 != 0)
|
||||
{ // Need to align
|
||||
U_LONG pad = 0;
|
||||
U_INT pad = 0;
|
||||
PC_Append((void *)&pad, 4-(pc_Address%4));
|
||||
}
|
||||
|
||||
PC_WriteLong(pc_Address - lenadr - 4, lenadr);
|
||||
PC_WriteInt(pc_Address - lenadr - 4, lenadr);
|
||||
}
|
||||
|
||||
static void Encrypt(void *data, int key, int len)
|
||||
|
|
Loading…
Reference in a new issue