mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-15 16:51:31 +00:00
- Removed some unnecessary morphing code.
- Fixed some bugs in the HIRESTEX parser. - Added floating point support and #include and #define tokens to FParseContext Not used yet. - replaced the value scanning code in FParseContext::GetToken with calls to strtol. SVN r893 (trunk)
This commit is contained in:
parent
3a14dab2e8
commit
f7a1fb3978
8 changed files with 50 additions and 45 deletions
|
@ -1,4 +1,10 @@
|
|||
April 8, 2008 (Changes by Graf Zahl)
|
||||
- Removed some unnecessary morphing code.
|
||||
- Fixed some bugs in the HIRESTEX parser.
|
||||
- Added floating point support and #include and #define tokens to
|
||||
FParseContext Not used yet.
|
||||
- replaced the value scanning code in FParseContext::GetToken with
|
||||
calls to strtol.
|
||||
- Changed XlatParseContext::FindToken to do a binary search over the
|
||||
valid token names.
|
||||
- Fixed: The check arrays for BlockThingsIterators were not properly
|
||||
|
|
|
@ -40,10 +40,6 @@ bool AArtiTomeOfPower::Use (bool pickup)
|
|||
}
|
||||
else
|
||||
{ // Succeeded
|
||||
Owner->player->morphTics = 0;
|
||||
Owner->player->MorphedPlayerClass = 0;
|
||||
Owner->player->MorphStyle = 0;
|
||||
Owner->player->MorphExitFlash = NULL;
|
||||
S_Sound (Owner, CHAN_VOICE, "*evillaugh", 1, ATTN_IDLE);
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -61,12 +61,7 @@ bool AArtiTeleport::Use (bool pickup)
|
|||
P_Teleport (Owner, destX, destY, ONFLOORZ, destAngle, true, true, false);
|
||||
if (Owner->player->morphTics && (Owner->player->MorphStyle & MORPH_UNDOBYCHAOSDEVICE))
|
||||
{ // Teleporting away will undo any morph effects (pig)
|
||||
if (P_UndoPlayerMorph (Owner->player))
|
||||
{
|
||||
Owner->player->MorphedPlayerClass = 0;
|
||||
Owner->player->MorphStyle = 0;
|
||||
Owner->player->MorphExitFlash = NULL;
|
||||
}
|
||||
P_UndoPlayerMorph (Owner->player);
|
||||
}
|
||||
// The game check is not necessary because only Heretic defines *evillaugh by default
|
||||
// However if it is there no other game can use it if it wants to.
|
||||
|
|
|
@ -103,41 +103,29 @@ loop:
|
|||
c = *sourcep++;
|
||||
if (c == 'x' || c == 'X')
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
c = *sourcep++;
|
||||
if (isdigit (c))
|
||||
{
|
||||
buildup = (buildup<<4) + c - '0';
|
||||
}
|
||||
else if (c >= 'a' && c <= 'f')
|
||||
{
|
||||
buildup = (buildup<<4) + c - 'a' + 10;
|
||||
}
|
||||
else if (c >= 'A' && c <= 'F')
|
||||
{
|
||||
buildup = (buildup<<4) + c - 'A' + 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
sourcep--;
|
||||
yylval->val = buildup;
|
||||
return TokenTrans[NUM];
|
||||
}
|
||||
}
|
||||
yylval->val = (int)strtol(sourcep, &sourcep, 16);
|
||||
return TokenTrans[NUM];
|
||||
}
|
||||
else
|
||||
{
|
||||
sourcep--;
|
||||
}
|
||||
}
|
||||
while (isdigit (c = *sourcep++))
|
||||
{
|
||||
buildup = buildup*10 + c - '0';
|
||||
}
|
||||
char *endp;
|
||||
|
||||
sourcep--;
|
||||
yylval->val = buildup;
|
||||
return TokenTrans[NUM];
|
||||
yylval->val = (int)strtol(sourcep, &endp, 10);
|
||||
if (*endp == '.')
|
||||
{
|
||||
// It's a float
|
||||
yylval->fval = strtod(sourcep, &sourcep);
|
||||
return TokenTrans[FLOATVAL];
|
||||
}
|
||||
else
|
||||
{
|
||||
sourcep = endp;
|
||||
return TokenTrans[NUM];
|
||||
}
|
||||
}
|
||||
if (isalpha (c))
|
||||
{
|
||||
|
@ -162,7 +150,8 @@ loop:
|
|||
}
|
||||
if (FindSym (token, &yylval->symval))
|
||||
{
|
||||
return TokenTrans[SYMNUM];
|
||||
yylval->val = yylval->symval->Value;
|
||||
return TokenTrans[NUM];
|
||||
}
|
||||
if ((yylval->val = P_FindLineSpecial(token)) != 0)
|
||||
{
|
||||
|
@ -173,7 +162,7 @@ loop:
|
|||
}
|
||||
if (c == '/')
|
||||
{
|
||||
c = *sourcep++;;
|
||||
c = *sourcep++;
|
||||
if (c == '*')
|
||||
{
|
||||
for (;;)
|
||||
|
@ -258,6 +247,19 @@ loop:
|
|||
c--;
|
||||
return 0;
|
||||
}
|
||||
if (c == '#')
|
||||
{
|
||||
if (!strnicmp(sourcep, "include", 7))
|
||||
{
|
||||
sourcep+=7;
|
||||
return TokenTrans[INCLUDE];
|
||||
}
|
||||
if (!strnicmp(sourcep, "define", 6))
|
||||
{
|
||||
sourcep+=6;
|
||||
return TokenTrans[DEFINE];
|
||||
}
|
||||
}
|
||||
switch (c)
|
||||
{
|
||||
case '^': return TokenTrans[XOR];
|
||||
|
|
|
@ -48,7 +48,7 @@ enum
|
|||
MULTIPLY ,
|
||||
DIVIDE ,
|
||||
NUM ,
|
||||
SYMNUM ,
|
||||
FLOATVAL ,
|
||||
LPAREN ,
|
||||
RPAREN ,
|
||||
SYM ,
|
||||
|
@ -65,6 +65,7 @@ enum
|
|||
RSHASSIGN,
|
||||
STRING ,
|
||||
INCLUDE ,
|
||||
DEFINE ,
|
||||
};
|
||||
|
||||
#define DEFINE_TOKEN_TRANS(prefix) \
|
||||
|
@ -78,7 +79,7 @@ enum
|
|||
prefix##MULTIPLY, \
|
||||
prefix##DIVIDE, \
|
||||
prefix##NUM, \
|
||||
prefix##SYMNUM, \
|
||||
prefix##FLOATVAL, \
|
||||
prefix##LPAREN, \
|
||||
prefix##RPAREN, \
|
||||
prefix##SYM, \
|
||||
|
@ -95,6 +96,7 @@ enum
|
|||
prefix##RSHASSIGN, \
|
||||
prefix##STRING, \
|
||||
prefix##INCLUDE, \
|
||||
prefix##DEFINE, \
|
||||
};
|
||||
|
||||
|
||||
|
@ -107,6 +109,7 @@ struct FParseSymbol
|
|||
union FParseToken
|
||||
{
|
||||
int val;
|
||||
double fval;
|
||||
char sym[80];
|
||||
char string[80];
|
||||
FParseSymbol *symval;
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "sc_man.h"
|
||||
#include "gi.h"
|
||||
#include "st_start.h"
|
||||
#include "cmdlib.h"
|
||||
|
||||
extern void R_InitBuildTiles();
|
||||
|
||||
|
@ -521,6 +522,8 @@ void FTextureManager::LoadHiresTex(int wadnum)
|
|||
else if (sc.Compare("sprite")) type=FTexture::TEX_Sprite, mode=0;
|
||||
else type = FTexture::TEX_Any, mode = 0;
|
||||
|
||||
if (type != FTexture::TEX_Any) sc.MustGetString();
|
||||
|
||||
sc.String[8]=0;
|
||||
|
||||
tlist.Clear();
|
||||
|
@ -577,7 +580,7 @@ void FTextureManager::LoadHiresTex(int wadnum)
|
|||
else if (sc.Compare("define")) // define a new "fake" texture
|
||||
{
|
||||
sc.GetString();
|
||||
memcpy(src, sc.String, 8);
|
||||
memcpy(src, ExtractFileBase(sc.String, false), 8);
|
||||
|
||||
int lumpnum = Wads.CheckNumForFullName(sc.String, true, ns_graphics);
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@ enum
|
|||
{
|
||||
XLAT_INCLUDE=128,
|
||||
XLAT_STRING,
|
||||
XLAT_FLOATVAL, // floats are not used by the grammar
|
||||
};
|
||||
|
||||
DEFINE_TOKEN_TRANS(XLAT_)
|
||||
|
|
|
@ -30,11 +30,10 @@ external_declaration ::= NOP.
|
|||
|
||||
%type exp {int}
|
||||
exp(A) ::= NUM(B). { A = B.val; }
|
||||
exp(A) ::= SYMNUM(B). { A = B.symval->Value; }
|
||||
exp(A) ::= exp(B) PLUS exp(C). { A = B + C; }
|
||||
exp(A) ::= exp(B) MINUS exp(C). { A = B - C; }
|
||||
exp(A) ::= exp(B) MULTIPLY exp(C). { A = B * C; }
|
||||
exp(A) ::= exp(B) DIVIDE exp(C). { A = B / C; }
|
||||
exp(A) ::= exp(B) DIVIDE exp(C). { if (C != 0) A = B / C; else context->PrintError("Division by Zero"); }
|
||||
exp(A) ::= exp(B) OR exp(C). { A = B | C; }
|
||||
exp(A) ::= exp(B) AND exp(C). { A = B & C; }
|
||||
exp(A) ::= exp(B) XOR exp(C). { A = B ^ C; }
|
||||
|
|
Loading…
Reference in a new issue