mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 13:11:33 +00:00
- Changed MIDI playback to not bother playing super short songs that don't
contain enough music to fill the initial output buffers. - Removed the read barrier around ADehackedPickup::RealPickup. If the real pickup is picked up, it may very well destroy itself before the dehacked wrapper's stubs that use it are called. - Reverted revision 840. For a file we don't want end users to be touching, making DEHSUPP plain text sends out mixed messages: "Don't mess with this. Oh, by the way, it's plain text now to make it easier for you to edit." Is there some reason other than a desire to do away with binary lumps to make the distributed lump text? - Added a new speakermode for Stereo + HRTF: "Headphones". This is the only way to get the HRTF low pass filter effect now. - Fixed: No more than one sector could make noise at once. - Trying out sound without varying priorities again. - Fixed: Need to use setSpeakerMix to let 2D sounds (aka streamed music) use their full volume range. SVN r842 (trunk)
This commit is contained in:
parent
a665663c15
commit
3237c6b4e8
26 changed files with 4772 additions and 579 deletions
|
@ -94,7 +94,7 @@ src/xlat/xlat_parser.c: tools/lemon/lemon src/xlat/xlat_parser.y
|
|||
$(OBJDIR):
|
||||
mkdir $(OBJDIR)
|
||||
|
||||
toolsandpk3: ccdv tools/makewad/makewad tools/lemon/lemon
|
||||
toolsandpk3: ccdv tools/makewad/makewad tools/dehsupp/dehsupp tools/lemon/lemon
|
||||
$(MAKE) -C wadsrc/
|
||||
|
||||
zdoom.pk3: toolsandpk3
|
||||
|
@ -106,6 +106,9 @@ snes_spc/libsnes_spc.a:
|
|||
tools/makewad/makewad:
|
||||
$(MAKE) -C tools/makewad/
|
||||
|
||||
tools/dehsupp/dehsupp:
|
||||
$(MAKE) -C tools/dehsupp/
|
||||
|
||||
tools/lemon/lemon:
|
||||
$(MAKE) -C tools/lemon/
|
||||
|
||||
|
@ -123,6 +126,8 @@ clean: cleanobjs
|
|||
|
||||
cleantools:
|
||||
@$(MAKE) -C tools/makewad clean
|
||||
@$(MAKE) -C tools/dehsupp clean
|
||||
@$(MAKE) -C tools/xlatcc clean
|
||||
|
||||
cleandebug:
|
||||
rm -f $(ZDOOMDEBUG) $(DEBUGOBJ)/*.o $(DEBUGOBJ)/*.d
|
||||
|
|
|
@ -23,6 +23,7 @@ basetools: ccdv.exe
|
|||
$(MAKE) -C tools/re2c
|
||||
$(MAKE) -C zlib -f Makefile.mgw
|
||||
$(MAKE) -C tools/makewad
|
||||
$(MAKE) -C tools/dehsupp
|
||||
$(MAKE) -C tools/fixrtext
|
||||
$(MAKE) -C wadsrc -f Makefile.mgw
|
||||
$(MAKE) -C jpeg-6b -f Makefile.mgw
|
||||
|
@ -34,6 +35,7 @@ cleanexe:
|
|||
clean:
|
||||
@$(MAKE) -C tools/lemon clean
|
||||
@$(MAKE) -C tools/re2c clean
|
||||
@$(MAKE) -C tools/dehsupp clean
|
||||
@$(MAKE) -C tools/makewad clean
|
||||
@$(MAKE) -C tools/fixrtext clean
|
||||
@$(MAKE) -C wadsrc -f Makefile.mgw clean
|
||||
|
|
|
@ -1,9 +1,24 @@
|
|||
March 22, 2008
|
||||
- Changed MIDI playback to not bother playing super short songs that don't
|
||||
contain enough music to fill the initial output buffers.
|
||||
- Removed the read barrier around ADehackedPickup::RealPickup. If the real
|
||||
pickup is picked up, it may very well destroy itself before the dehacked
|
||||
wrapper's stubs that use it are called.
|
||||
- Reverted revision 840. For a file we don't want end users to be touching,
|
||||
making DEHSUPP plain text sends out mixed messages: "Don't mess with this.
|
||||
Oh, by the way, it's plain text now to make it easier for you to edit."
|
||||
Is there some reason other than a desire to do away with binary lumps to
|
||||
make the distributed lump text?
|
||||
- Added a new speakermode for Stereo + HRTF: "Headphones". This is the only
|
||||
way to get the HRTF low pass filter effect now.
|
||||
- Fixed: No more than one sector could make noise at once.
|
||||
- Trying out sound without varying priorities again.
|
||||
- Fixed: Need to use setSpeakerMix to let 2D sounds (aka streamed music) use
|
||||
their full volume range.
|
||||
|
||||
March 22, 2008 (Changes by Graf Zahl)
|
||||
- Added sector type translation to xlat_parser and removed the old sectorx
|
||||
lump.
|
||||
- Changed DEHSUPP loader so that it reads the text file directly. As a result
|
||||
the DEHSUPP compiler is gone now. Unlike XLATCC I'm using FScanner though.
|
||||
A fully featured parser seems like overkill for this simple text file.
|
||||
- Added Line_SetTextureOffset special.
|
||||
- Added 'allowprotection' keyword to terrain definitions to allow damaging
|
||||
flats that don't damage players with a radiation suit.
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -163,7 +163,7 @@ static fixed_t P_AproxDistance2 (AActor *listener, fixed_t x, fixed_t y)
|
|||
void S_NoiseDebug (void)
|
||||
{
|
||||
FSoundChan *chan;
|
||||
fixed_t ox, oy;
|
||||
fixed_t ox, oy, oz;
|
||||
int y, color;
|
||||
|
||||
y = 32 * CleanYfac;
|
||||
|
@ -173,9 +173,10 @@ void S_NoiseDebug (void)
|
|||
screen->DrawText (CR_GOLD, 0, y, "name", TAG_DONE);
|
||||
screen->DrawText (CR_GOLD, 70, y, "x", TAG_DONE);
|
||||
screen->DrawText (CR_GOLD, 120, y, "y", TAG_DONE);
|
||||
screen->DrawText (CR_GOLD, 170, y, "vol", TAG_DONE);
|
||||
screen->DrawText (CR_GOLD, 200, y, "dist", TAG_DONE);
|
||||
screen->DrawText (CR_GOLD, 240, y, "chan", TAG_DONE);
|
||||
screen->DrawText (CR_GOLD, 170, y, "z", TAG_DONE);
|
||||
screen->DrawText (CR_GOLD, 220, y, "vol", TAG_DONE);
|
||||
screen->DrawText (CR_GOLD, 250, y, "dist", TAG_DONE);
|
||||
screen->DrawText (CR_GOLD, 290, y, "chan", TAG_DONE);
|
||||
y += 8;
|
||||
|
||||
if (Channels == NULL)
|
||||
|
@ -195,16 +196,19 @@ void S_NoiseDebug (void)
|
|||
{
|
||||
ox = players[consoleplayer].camera->x;
|
||||
oy = players[consoleplayer].camera->y;
|
||||
oz = players[consoleplayer].camera->z;
|
||||
}
|
||||
else if (origin)
|
||||
{
|
||||
ox = origin[0];
|
||||
oy = origin[1];
|
||||
oz = origin[2];
|
||||
}
|
||||
else
|
||||
{
|
||||
ox = chan->X;
|
||||
oy = chan->Y;
|
||||
oz = chan->Z;
|
||||
}
|
||||
color = chan->Loop ? CR_BROWN : CR_GREY;
|
||||
Wads.GetLumpName (temp, chan->SfxInfo->lumpnum);
|
||||
|
@ -214,12 +218,14 @@ void S_NoiseDebug (void)
|
|||
screen->DrawText (color, 70, y, temp, TAG_DONE);
|
||||
sprintf (temp, "%d", oy >> FRACBITS);
|
||||
screen->DrawText (color, 120, y, temp, TAG_DONE);
|
||||
sprintf (temp, "%g", chan->Volume);
|
||||
sprintf (temp, "%d", oz >> FRACBITS);
|
||||
screen->DrawText (color, 170, y, temp, TAG_DONE);
|
||||
sprintf (temp, "%g", chan->Volume);
|
||||
screen->DrawText (color, 220, y, temp, TAG_DONE);
|
||||
sprintf (temp, "%d", P_AproxDistance2 (players[consoleplayer].camera, ox, oy) / FRACUNIT);
|
||||
screen->DrawText (color, 200, y, temp, TAG_DONE);
|
||||
screen->DrawText (color, 250, y, temp, TAG_DONE);
|
||||
sprintf (temp, "%d", chan->EntChannel);
|
||||
screen->DrawText (color, 240, y, temp, TAG_DONE);
|
||||
screen->DrawText (color, 290, y, temp, TAG_DONE);
|
||||
y += 8;
|
||||
if (chan->PrevChan == &Channels)
|
||||
{
|
||||
|
@ -671,7 +677,7 @@ static void S_StartSound (fixed_t *pt, AActor *mover, int channel,
|
|||
sfx = &S_sfx[sound_id];
|
||||
|
||||
// If this is a singular sound, don't play it if it's already playing.
|
||||
if (pt != NULL && sfx->bSingular && S_CheckSingular(sound_id))
|
||||
if (sfx->bSingular && S_CheckSingular(sound_id))
|
||||
return;
|
||||
|
||||
// Resolve player sounds, random sounds, and aliases
|
||||
|
@ -715,6 +721,8 @@ static void S_StartSound (fixed_t *pt, AActor *mover, int channel,
|
|||
}
|
||||
else
|
||||
{
|
||||
basepriority = 0;
|
||||
#if 0
|
||||
switch (channel)
|
||||
{
|
||||
case CHAN_WEAPON:
|
||||
|
@ -731,7 +739,8 @@ static void S_StartSound (fixed_t *pt, AActor *mover, int channel,
|
|||
basepriority = -10;
|
||||
break;
|
||||
}
|
||||
basepriority = int(basepriority * attenuation);
|
||||
basepriority = int(basepriority / attenuation);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (mover != NULL && channel == CHAN_AUTO)
|
||||
|
@ -764,7 +773,7 @@ static void S_StartSound (fixed_t *pt, AActor *mover, int channel,
|
|||
{
|
||||
for (chan = Channels; chan != NULL; chan = chan->NextChan)
|
||||
{
|
||||
if (chan->Mover == mover && chan->EntChannel == channel)
|
||||
if (((mover != NULL && chan->Mover == mover) || (chan->Pt == pt)) && chan->EntChannel == channel)
|
||||
{
|
||||
GSnd->StopSound(chan);
|
||||
break;
|
||||
|
|
|
@ -982,32 +982,6 @@ void STACK_ARGS FScanner::ScriptError (const char *message, ...)
|
|||
AlreadyGot? AlreadyGotLine : Line, composed.GetChars());
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FScanner::ScriptError
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void STACK_ARGS FScanner::ScriptMessage (const char *message, ...)
|
||||
{
|
||||
FString composed;
|
||||
|
||||
if (message == NULL)
|
||||
{
|
||||
composed = "Bad syntax.";
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list arglist;
|
||||
va_start (arglist, message);
|
||||
composed.VFormat (message, arglist);
|
||||
va_end (arglist);
|
||||
}
|
||||
|
||||
Printf ("Script error, \"%s\" line %d:\n%s\n", ScriptName.GetChars(),
|
||||
AlreadyGot? AlreadyGotLine : Line, composed.GetChars());
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// FScanner :: CheckOpen
|
||||
|
|
|
@ -58,7 +58,6 @@ public:
|
|||
int MustMatchString(const char **strings);
|
||||
|
||||
void ScriptError(const char *message, ...);
|
||||
void ScriptMessage(const char *message, ...);
|
||||
|
||||
// Members ------------------------------------------------------
|
||||
char *String;
|
||||
|
|
|
@ -164,6 +164,8 @@ static const FEnumList SpeakerModeNames[] =
|
|||
{ "1", FMOD_SPEAKERMODE_MONO },
|
||||
{ "2", FMOD_SPEAKERMODE_STEREO },
|
||||
{ "4", FMOD_SPEAKERMODE_QUAD },
|
||||
{ "Headphones", 9001 },
|
||||
{ "HRTF", 9001 },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
|
@ -292,6 +294,7 @@ public:
|
|||
return false;
|
||||
}
|
||||
Channel->setChannelGroup(Owner->MusicGroup);
|
||||
Channel->setSpeakerMix(1, 1, 1, 1, 1, 1, 1, 1);
|
||||
Channel->setVolume(volume);
|
||||
// Ensure reverb is disabled.
|
||||
FMOD_REVERB_CHANNELPROPERTIES reverb;
|
||||
|
@ -478,7 +481,7 @@ bool FMODSoundRenderer::Init()
|
|||
{
|
||||
speakermode = FMOD_SPEAKERMODE(eval);
|
||||
}
|
||||
result = Sys->setSpeakerMode(speakermode);
|
||||
result = Sys->setSpeakerMode(speakermode < 9000 ? speakermode : FMOD_SPEAKERMODE_STEREO);
|
||||
ERRCHECK(result);
|
||||
|
||||
// Set software format
|
||||
|
@ -548,7 +551,11 @@ bool FMODSoundRenderer::Init()
|
|||
}
|
||||
|
||||
// Try to init
|
||||
initflags = FMOD_INIT_NORMAL | FMOD_INIT_SOFTWARE_HRTF;
|
||||
initflags = FMOD_INIT_NORMAL;
|
||||
if (speakermode > 9000)
|
||||
{
|
||||
initflags |= FMOD_INIT_SOFTWARE_HRTF;
|
||||
}
|
||||
if (snd_dspnet)
|
||||
{
|
||||
initflags |= FMOD_INIT_ENABLE_DSPNET;
|
||||
|
|
|
@ -205,29 +205,9 @@ void MIDIStreamer::Play (bool looping)
|
|||
}
|
||||
else if (res == SONG_DONE)
|
||||
{
|
||||
if (looping)
|
||||
{
|
||||
Restarting = true;
|
||||
if (SONG_MORE == FillBuffer(BufferNum, MAX_EVENTS, MAX_TIME))
|
||||
{
|
||||
if (0 != MIDI->StreamOut(&Buffer[BufferNum]))
|
||||
{
|
||||
Printf ("Initial midiStreamOut failed\n");
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
BufferNum ^= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EndQueued = true;
|
||||
}
|
||||
// Do not play super short songs that can't fill the initial two buffers.
|
||||
Stop();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
55
tools/dehsupp/Makefile
Normal file
55
tools/dehsupp/Makefile
Normal file
|
@ -0,0 +1,55 @@
|
|||
ifeq (Windows_NT,$(OS))
|
||||
WIN=1
|
||||
WINCMD=1
|
||||
endif
|
||||
ifeq ($(findstring msys,$(shell sh --version 2>nul)),msys)
|
||||
WIN=1
|
||||
WINCMD=0
|
||||
endif
|
||||
|
||||
ifeq (1,$(WIN))
|
||||
EXE = dehsupp.exe
|
||||
CFLAGS = $(LOC) -Os -Wall -fomit-frame-pointer
|
||||
else
|
||||
EXE = dehsupp
|
||||
CFLAGS = -Dstricmp=strcasecmp -Dstrnicmp=strncasecmp -Os -Wall -fomit-frame-pointer
|
||||
endif
|
||||
|
||||
CCDV = @../../ccdv
|
||||
CC = gcc
|
||||
LDFLAGS = -s
|
||||
|
||||
RE2C = ../re2c/re2c
|
||||
LEMON = ../lemon/lemon
|
||||
LEMONFLAGS =
|
||||
RE2CFLAGS = -s
|
||||
|
||||
OBJS = dehsupp.o parse.o scanner.o
|
||||
|
||||
all: $(EXE)
|
||||
|
||||
$(EXE): $(OBJS)
|
||||
$(CCDV) $(CC) $(LDFLAGS) -o $(EXE) $(OBJS)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
clean:
|
||||
ifeq (1,$(WINCMD))
|
||||
-del /q /f $(EXE) 2>nul
|
||||
-del /q /f *.o 2>nul
|
||||
else
|
||||
rm -f $(EXE)
|
||||
rm -f *.o
|
||||
endif
|
||||
|
||||
%.o: %.c
|
||||
$(CCDV) $(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
parse.h parse.c: parse.y
|
||||
$(CCDV) $(LEMON) $(LEMONFLAGS) $<
|
||||
|
||||
scanner.c: scanner.re
|
||||
$(CCDV) $(RE2C) $(RE2CFLAGS) -o $@ $<
|
||||
|
||||
parse.tab.c: parse.y
|
||||
$(CCDV) $(BISON) $(BISONFLAGS) -o $@ $<
|
571
tools/dehsupp/dehsupp.c
Normal file
571
tools/dehsupp/dehsupp.c
Normal file
|
@ -0,0 +1,571 @@
|
|||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include <search.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "dehsupp.h"
|
||||
|
||||
FILE *Source, *Dest;
|
||||
int SourceLine;
|
||||
int ErrorCount;
|
||||
|
||||
struct StringList *NameList, **NameListLast = &NameList;
|
||||
int NameCount;
|
||||
|
||||
name *ActionsList;
|
||||
unsigned char *HeightsArray;
|
||||
unsigned char *ActionMap;
|
||||
unsigned short *CodePMap;
|
||||
char *SpriteNames;
|
||||
struct StateMapE *StateMaps;
|
||||
name *SoundMaps;
|
||||
name *InfoNamesArray;
|
||||
struct ThingBitsE *ThingBitsMap;
|
||||
struct RenderStylesE *RenderStylesMap;
|
||||
|
||||
int ActionsListSize, MaxActionsListSize;
|
||||
int HeightsSize, MaxHeightsSize;
|
||||
int ActionMapSize, MaxActionMapSize;
|
||||
int CodePMapSize, MaxCodePMapSize;
|
||||
int SpriteNamesSize, MaxSpriteNamesSize;
|
||||
int StateMapsSize, MaxStateMapsSize;
|
||||
int SoundMapsSize, MaxSoundMapsSize;
|
||||
int InfoNamesSize, MaxInfoNamesSize;
|
||||
int ThingBitsMapSize, MaxThingBitsMapSize;
|
||||
int RenderStylesSize, MaxRenderStylesSize;
|
||||
|
||||
int main (int argc, char **argv)
|
||||
{
|
||||
if (argc != 3)
|
||||
{
|
||||
printf ("Usage: dehsupp <infile> <outfile>\n");
|
||||
return -1;
|
||||
}
|
||||
Source = fopen (argv[1], "r");
|
||||
if (Source == NULL)
|
||||
{
|
||||
printf ("Could not open %s\n", argv[1]);
|
||||
return -2;
|
||||
}
|
||||
#if !defined(NDEBUG) && 0
|
||||
ParseTrace(fopen("trace.txt", "w"), "");
|
||||
#endif
|
||||
SourceLine = 1;
|
||||
yyparse ();
|
||||
fclose (Source);
|
||||
if (ErrorCount)
|
||||
{
|
||||
printf ("There were %d errors\n", ErrorCount);
|
||||
return -3;
|
||||
}
|
||||
SortNames ();
|
||||
Dest = fopen (argv[2], "wb");
|
||||
if (Dest == NULL)
|
||||
{
|
||||
printf ("Could not open %s\n", argv[2]);
|
||||
return -4;
|
||||
}
|
||||
WriteNameTable ();
|
||||
WriteActions ();
|
||||
WriteCodePConv ();
|
||||
WriteSprites ();
|
||||
WriteSounds ();
|
||||
WriteInfoNames ();
|
||||
WriteStates ();
|
||||
WriteActionMap ();
|
||||
WriteThingBits ();
|
||||
WriteRenderStyles ();
|
||||
WriteHeights ();
|
||||
WriteLabel ("END ");
|
||||
fclose (Dest);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void fail (int code, char *err)
|
||||
{
|
||||
fclose (Dest);
|
||||
printf ("%s\n", err);
|
||||
exit (code);
|
||||
}
|
||||
|
||||
void *ParseAlloc(void *(*mallocProc)(size_t));
|
||||
void Parse(void *yyp, int yymajor, struct Token yyminor);
|
||||
void ParseFree(void *p, void (*freeProc)(void*));
|
||||
|
||||
void yyparse (void)
|
||||
{
|
||||
Scanner scanner = { Source };
|
||||
void *pParser = ParseAlloc (malloc);
|
||||
struct Token token;
|
||||
int tokentype;
|
||||
|
||||
while ((tokentype = lex(&scanner, &token)) != EOI)
|
||||
{
|
||||
SourceLine = scanner.line;
|
||||
Parse (pParser, tokentype, token);
|
||||
}
|
||||
memset (&token, 0, sizeof(token));
|
||||
Parse (pParser, 0, token);
|
||||
ParseFree (pParser, free);
|
||||
}
|
||||
|
||||
name FindName (char *name)
|
||||
{
|
||||
struct StringList *probe = NameList;
|
||||
int count = 0;
|
||||
|
||||
while (probe != NULL)
|
||||
{
|
||||
if (stricmp (probe->String, name) == 0)
|
||||
{
|
||||
return count;
|
||||
}
|
||||
count++;
|
||||
probe = probe->Next;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
name AddName (char *name)
|
||||
{
|
||||
struct StringList *newone;
|
||||
int index = FindName (name);
|
||||
|
||||
if (index != -1)
|
||||
return index;
|
||||
|
||||
newone = malloc (sizeof(*newone) + strlen(name));
|
||||
strcpy (newone->String, name);
|
||||
newone->Next = NULL;
|
||||
*NameListLast = newone;
|
||||
NameListLast = &newone->Next;
|
||||
return NameCount++;
|
||||
}
|
||||
|
||||
int FindAction (char *namei)
|
||||
{
|
||||
int name = FindName (namei);
|
||||
|
||||
if (name != -1)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < ActionsListSize; i++)
|
||||
{
|
||||
if (ActionsList[i] == name)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
printf ("Line %d: Unknown action %s\n", SourceLine, namei);
|
||||
ErrorCount++;
|
||||
return -1;
|
||||
}
|
||||
|
||||
void AddAction (char *name)
|
||||
{
|
||||
int newname = AddName (name);
|
||||
if (ActionsListSize == MaxActionsListSize)
|
||||
{
|
||||
MaxActionsListSize = MaxActionsListSize ? MaxActionsListSize * 2 : 256;
|
||||
ActionsList = realloc (ActionsList, MaxActionsListSize*sizeof(*ActionsList));
|
||||
}
|
||||
ActionsList[ActionsListSize++] = newname;
|
||||
}
|
||||
|
||||
void AddHeight (int h)
|
||||
{
|
||||
if (MaxHeightsSize == HeightsSize)
|
||||
{
|
||||
MaxHeightsSize = MaxHeightsSize ? MaxHeightsSize * 2 : 256;
|
||||
HeightsArray = realloc (HeightsArray, MaxHeightsSize);
|
||||
}
|
||||
HeightsArray[HeightsSize++] = h;
|
||||
}
|
||||
|
||||
void AddActionMap (char *name)
|
||||
{
|
||||
int index = FindAction (name);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
if (ActionMapSize == MaxActionMapSize)
|
||||
{
|
||||
MaxActionMapSize = MaxActionMapSize ? MaxActionMapSize * 2 : 256;
|
||||
ActionMap = realloc (ActionMap, MaxActionMapSize*sizeof(*ActionMap));
|
||||
}
|
||||
ActionMap[ActionMapSize++] = index;
|
||||
}
|
||||
}
|
||||
|
||||
void AddCodeP (int codep)
|
||||
{
|
||||
if (CodePMapSize == MaxCodePMapSize)
|
||||
{
|
||||
MaxCodePMapSize = MaxCodePMapSize ? MaxCodePMapSize * 2 : 256;
|
||||
CodePMap = realloc (CodePMap, MaxCodePMapSize*sizeof(*CodePMap));
|
||||
}
|
||||
CodePMap[CodePMapSize++] = codep;
|
||||
}
|
||||
|
||||
void AddSpriteName (char *name)
|
||||
{
|
||||
if (strlen (name) != 4)
|
||||
{
|
||||
printf ("Line %d: Sprite name %s must be 4 characters\n", SourceLine, name);
|
||||
ErrorCount++;
|
||||
return;
|
||||
}
|
||||
if (SpriteNamesSize == MaxSpriteNamesSize)
|
||||
{
|
||||
MaxSpriteNamesSize = MaxSpriteNamesSize ? MaxSpriteNamesSize * 2 : 256*4;
|
||||
SpriteNames = realloc (SpriteNames, MaxSpriteNamesSize*sizeof(*SpriteNames));
|
||||
}
|
||||
SpriteNames[SpriteNamesSize+0] = toupper (name[0]);
|
||||
SpriteNames[SpriteNamesSize+1] = toupper (name[1]);
|
||||
SpriteNames[SpriteNamesSize+2] = toupper (name[2]);
|
||||
SpriteNames[SpriteNamesSize+3] = toupper (name[3]);
|
||||
SpriteNamesSize += 4;
|
||||
}
|
||||
|
||||
void AddSoundMap (char *name)
|
||||
{
|
||||
if (SoundMapsSize == MaxSoundMapsSize)
|
||||
{
|
||||
MaxSoundMapsSize = MaxSoundMapsSize ? MaxSoundMapsSize * 2 : 256;
|
||||
SoundMaps = realloc (SoundMaps, MaxSoundMapsSize*sizeof(*SoundMaps));
|
||||
}
|
||||
SoundMaps[SoundMapsSize++] = AddName (name);
|
||||
}
|
||||
|
||||
void AddInfoName (char *name)
|
||||
{
|
||||
if (InfoNamesSize == MaxInfoNamesSize)
|
||||
{
|
||||
MaxInfoNamesSize = MaxInfoNamesSize ? MaxInfoNamesSize * 2 : 256;
|
||||
InfoNamesArray = realloc (InfoNamesArray, MaxInfoNamesSize*sizeof(*InfoNamesArray));
|
||||
}
|
||||
InfoNamesArray[InfoNamesSize++] = AddName (name);
|
||||
}
|
||||
|
||||
void AddStateMap (char *name, int state, int count)
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
printf ("Line %d: Count is 0. Is this right?\n", SourceLine);
|
||||
return;
|
||||
}
|
||||
if ((unsigned)count > 255)
|
||||
{
|
||||
printf ("Line %d: Count must be in the range 1-255\n", SourceLine);
|
||||
ErrorCount++;
|
||||
}
|
||||
if (StateMapsSize == MaxStateMapsSize)
|
||||
{
|
||||
MaxStateMapsSize = MaxStateMapsSize ? MaxStateMapsSize*2 : 256;
|
||||
StateMaps = realloc (StateMaps, MaxStateMapsSize*sizeof(*StateMaps));
|
||||
}
|
||||
StateMaps[StateMapsSize].Name = AddName (name);
|
||||
StateMaps[StateMapsSize].State = state;
|
||||
StateMaps[StateMapsSize].Count = count;
|
||||
StateMapsSize++;
|
||||
}
|
||||
|
||||
void AddThingBits (char *name, int bitnum, int flagnum)
|
||||
{
|
||||
if ((unsigned)bitnum > 31)
|
||||
{
|
||||
printf ("Line %d: Bit %d must be in the range 0-31\n", SourceLine, bitnum);
|
||||
ErrorCount++;
|
||||
return;
|
||||
}
|
||||
if (MaxThingBitsMapSize == ThingBitsMapSize)
|
||||
{
|
||||
MaxThingBitsMapSize = MaxThingBitsMapSize ? MaxThingBitsMapSize*2 : 128;
|
||||
ThingBitsMap = realloc (ThingBitsMap, MaxThingBitsMapSize*sizeof(*ThingBitsMap));
|
||||
}
|
||||
ThingBitsMap[ThingBitsMapSize].Name = AddName (name);
|
||||
ThingBitsMap[ThingBitsMapSize].BitNum = bitnum;
|
||||
ThingBitsMap[ThingBitsMapSize].FlagNum = flagnum;
|
||||
ThingBitsMapSize++;
|
||||
}
|
||||
|
||||
void AddRenderStyle (char *name, int stylenum)
|
||||
{
|
||||
if ((unsigned)stylenum > 255)
|
||||
{
|
||||
printf ("Line %d: %s must be in the range 0-255\n", SourceLine, name);
|
||||
ErrorCount++;
|
||||
return;
|
||||
}
|
||||
if (MaxRenderStylesSize == RenderStylesSize)
|
||||
{
|
||||
MaxRenderStylesSize = MaxRenderStylesSize ? MaxRenderStylesSize*2 : 16;
|
||||
RenderStylesMap = realloc (RenderStylesMap, MaxRenderStylesSize*sizeof(*RenderStylesMap));
|
||||
}
|
||||
RenderStylesMap[RenderStylesSize].Name = AddName (name);
|
||||
RenderStylesMap[RenderStylesSize].StyleNum = stylenum;
|
||||
RenderStylesSize++;
|
||||
}
|
||||
|
||||
int sortfunc (const void *a, const void *b)
|
||||
{
|
||||
return stricmp (((struct StringSorter *)a)->Entry->String,
|
||||
((struct StringSorter *)b)->Entry->String);
|
||||
}
|
||||
|
||||
void SortNames ()
|
||||
{
|
||||
name *remap = malloc (NameCount * sizeof(*remap));
|
||||
struct StringSorter *sorter = malloc (NameCount * sizeof(*sorter));
|
||||
struct StringList *probe, **prev;
|
||||
int i;
|
||||
|
||||
for (i = 0, probe = NameList; probe != NULL; probe = probe->Next, i++)
|
||||
{
|
||||
sorter[i].OldName = i;
|
||||
sorter[i].Entry = probe;
|
||||
}
|
||||
|
||||
// There are some warnings here, though I have no idea why.
|
||||
qsort (sorter, NameCount, sizeof(*sorter), sortfunc);
|
||||
|
||||
for (i = 0, prev = &NameList; i < NameCount; i++)
|
||||
{
|
||||
*prev = sorter[i].Entry;
|
||||
prev = &sorter[i].Entry->Next;
|
||||
}
|
||||
*prev = NULL;
|
||||
|
||||
for (i = 0; i < NameCount; i++)
|
||||
{
|
||||
remap[sorter[i].OldName] = i;
|
||||
}
|
||||
|
||||
for (i = 0; i < ActionsListSize; i++)
|
||||
{
|
||||
ActionsList[i] = remap[ActionsList[i]];
|
||||
}
|
||||
for (i = 0; i < SoundMapsSize; i++)
|
||||
{
|
||||
SoundMaps[i] = remap[SoundMaps[i]];
|
||||
}
|
||||
for (i = 0; i < InfoNamesSize; i++)
|
||||
{
|
||||
InfoNamesArray[i] = remap[InfoNamesArray[i]];
|
||||
}
|
||||
for (i = 0; i < StateMapsSize; i++)
|
||||
{
|
||||
StateMaps[i].Name = remap[StateMaps[i].Name];
|
||||
}
|
||||
for (i = 0; i < ThingBitsMapSize; i++)
|
||||
{
|
||||
ThingBitsMap[i].Name = remap[ThingBitsMap[i].Name];
|
||||
}
|
||||
for (i = 0; i < RenderStylesSize; i++)
|
||||
{
|
||||
RenderStylesMap[i].Name = remap[RenderStylesMap[i].Name];
|
||||
}
|
||||
}
|
||||
|
||||
int yyerror (char *s)
|
||||
{
|
||||
printf ("Line %d: %s\n", SourceLine, s);
|
||||
ErrorCount++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WriteWord (int word)
|
||||
{
|
||||
putc (word >> 8, Dest);
|
||||
putc (word & 255, Dest);
|
||||
}
|
||||
|
||||
void WriteLabel (char *label)
|
||||
{
|
||||
fwrite (label, 1, 4, Dest);
|
||||
}
|
||||
|
||||
void WriteWords (int count, short *array)
|
||||
{
|
||||
int i;
|
||||
|
||||
WriteWord (count);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
WriteWord (array[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void WriteBytes (int count, unsigned char *array)
|
||||
{
|
||||
WriteWord (count);
|
||||
fwrite (array, 1, count, Dest);
|
||||
}
|
||||
|
||||
void WriteNameTable ()
|
||||
{
|
||||
struct StringList *probe;
|
||||
int i, size;
|
||||
|
||||
WriteLabel ("NAME");
|
||||
// Count the length of each string, including nulls
|
||||
for (probe = NameList, size = 0; probe != NULL; probe = probe->Next)
|
||||
{
|
||||
size += (int)strlen (probe->String) + 1;
|
||||
}
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
WriteWord (2); // Size of this lump
|
||||
WriteWord (0); // Number of names
|
||||
return;
|
||||
}
|
||||
size += NameCount*2 + 2;
|
||||
if (size >= 65536)
|
||||
{
|
||||
fail (-5, "Name table is larger than 64K");
|
||||
}
|
||||
WriteWord (size); // Size of this lump
|
||||
WriteWord (NameCount); // Number of names
|
||||
|
||||
// Write each name's offset from the first name, which is stored
|
||||
// immediately after this list
|
||||
for (i = size = 0, probe = NameList; i < NameCount; i++, probe = probe->Next)
|
||||
{
|
||||
WriteWord (size);
|
||||
size += (int)strlen (probe->String) + 1;
|
||||
}
|
||||
|
||||
// Write each name's string in order now
|
||||
for (probe = NameList; probe != NULL; probe = probe->Next)
|
||||
{
|
||||
fputs (probe->String, Dest);
|
||||
putc (0, Dest);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
name Name;
|
||||
short Num;
|
||||
} NameNum;
|
||||
|
||||
int sortfunc2 (const void *a, const void *b)
|
||||
{
|
||||
return ((NameNum *)a)->Name - ((NameNum *)b)->Name;
|
||||
}
|
||||
|
||||
void WriteActions ()
|
||||
{
|
||||
NameNum *sorter = malloc (ActionsListSize * sizeof(*sorter));
|
||||
int i;
|
||||
|
||||
WriteLabel ("ACTF");
|
||||
WriteWord (ActionsListSize);
|
||||
|
||||
for (i = 0; i < ActionsListSize; i++)
|
||||
{
|
||||
sorter[i].Name = ActionsList[i];
|
||||
sorter[i].Num = i;
|
||||
}
|
||||
// warnings here. ignore.
|
||||
qsort (sorter, ActionsListSize, sizeof(*sorter), sortfunc2);
|
||||
for (i = 0; i < ActionsListSize; i++)
|
||||
{
|
||||
WriteWord (sorter[i].Name);
|
||||
WriteWord (sorter[i].Num);
|
||||
}
|
||||
free (sorter);
|
||||
}
|
||||
|
||||
void WriteActionMap ()
|
||||
{
|
||||
WriteLabel ("ACTM");
|
||||
WriteBytes (ActionMapSize, ActionMap);
|
||||
}
|
||||
|
||||
void WriteHeights ()
|
||||
{
|
||||
WriteLabel ("HIGH");
|
||||
WriteBytes (HeightsSize, HeightsArray);
|
||||
}
|
||||
|
||||
void WriteCodePConv ()
|
||||
{
|
||||
WriteLabel ("CODP");
|
||||
WriteWords (CodePMapSize, (short *)CodePMap);
|
||||
}
|
||||
|
||||
void WriteSprites ()
|
||||
{
|
||||
WriteLabel ("SPRN");
|
||||
WriteWord (SpriteNamesSize / 4);
|
||||
fwrite (SpriteNames, SpriteNamesSize, 1, Dest);
|
||||
}
|
||||
|
||||
void WriteStates ()
|
||||
{
|
||||
int i;
|
||||
|
||||
WriteLabel ("STAT");
|
||||
WriteWord (StateMapsSize);
|
||||
for (i = 0; i < StateMapsSize; i++)
|
||||
{
|
||||
WriteWord (StateMaps[i].Name);
|
||||
putc (StateMaps[i].State, Dest);
|
||||
putc (StateMaps[i].Count, Dest);
|
||||
}
|
||||
}
|
||||
|
||||
void WriteSounds ()
|
||||
{
|
||||
WriteLabel ("SND ");
|
||||
WriteWords (SoundMapsSize, SoundMaps);
|
||||
}
|
||||
|
||||
void WriteInfoNames ()
|
||||
{
|
||||
WriteLabel ("INFN");
|
||||
WriteWords (InfoNamesSize, InfoNamesArray);
|
||||
}
|
||||
|
||||
int sortfunc3 (const void *a, const void *b)
|
||||
{
|
||||
return ((struct ThingBitsE *)a)->Name - ((struct ThingBitsE *)b)->Name;
|
||||
}
|
||||
|
||||
void WriteThingBits ()
|
||||
{
|
||||
int i;
|
||||
|
||||
WriteLabel ("TBIT");
|
||||
WriteWord (ThingBitsMapSize);
|
||||
// warnings here; ignore them
|
||||
qsort (ThingBitsMap, ThingBitsMapSize, sizeof(*ThingBitsMap), sortfunc3);
|
||||
for (i = 0; i < ThingBitsMapSize; i++)
|
||||
{
|
||||
WriteWord (ThingBitsMap[i].Name);
|
||||
putc (ThingBitsMap[i].BitNum | (ThingBitsMap[i].FlagNum<<5), Dest);
|
||||
}
|
||||
}
|
||||
|
||||
int sortfunc4 (const void *a, const void *b)
|
||||
{
|
||||
return ((struct RenderStylesE *)a)->Name - ((struct RenderStylesE *)b)->Name;
|
||||
}
|
||||
|
||||
void WriteRenderStyles ()
|
||||
{
|
||||
int i;
|
||||
|
||||
WriteLabel ("REND");
|
||||
WriteWord (RenderStylesSize);
|
||||
// More warnings; ignore
|
||||
qsort (RenderStylesMap, RenderStylesSize, sizeof(*RenderStylesMap), sortfunc4);
|
||||
for (i = 0; i < RenderStylesSize; i++)
|
||||
{
|
||||
WriteWord (RenderStylesMap[i].Name);
|
||||
putc (RenderStylesMap[i].StyleNum, Dest);
|
||||
}
|
||||
}
|
124
tools/dehsupp/dehsupp.h
Normal file
124
tools/dehsupp/dehsupp.h
Normal file
|
@ -0,0 +1,124 @@
|
|||
#include <stdio.h>
|
||||
#include "parse.h"
|
||||
|
||||
typedef enum { false, true } bool;
|
||||
typedef short name;
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned int uint;
|
||||
|
||||
typedef struct Scanner {
|
||||
FILE *fd;
|
||||
uchar *bot, *tok, *ptr, *cur, *pos, *lim, *top, *eof;
|
||||
uint line;
|
||||
} Scanner;
|
||||
|
||||
struct Token
|
||||
{
|
||||
int val;
|
||||
char *string;
|
||||
};
|
||||
|
||||
int lex(Scanner *s, struct Token *tok);
|
||||
|
||||
int yyerror (char *s);
|
||||
void yyparse (void);
|
||||
|
||||
extern FILE *Source, *Dest;
|
||||
extern int SourceLine;
|
||||
extern int ErrorCount;
|
||||
|
||||
|
||||
void WriteWord (int word);
|
||||
void WriteLabel (char *label);
|
||||
void WriteWords (int count, short *array);
|
||||
void WriteBytes (int count, unsigned char *array);
|
||||
|
||||
void WriteNameTable ();
|
||||
|
||||
void WriteActions ();
|
||||
void WriteActionMap ();
|
||||
void WriteHeights ();
|
||||
void WriteCodePConv ();
|
||||
void WriteSprites ();
|
||||
void WriteStates ();
|
||||
void WriteSounds ();
|
||||
void WriteInfoNames ();
|
||||
void WriteThingBits ();
|
||||
void WriteRenderStyles ();
|
||||
|
||||
|
||||
struct StringList
|
||||
{
|
||||
struct StringList *Next;
|
||||
char String[1];
|
||||
};
|
||||
|
||||
struct StringSorter
|
||||
{
|
||||
name OldName;
|
||||
struct StringList *Entry;
|
||||
};
|
||||
|
||||
extern struct StringList *NameList, **NameListLast;
|
||||
extern int NameCount;
|
||||
|
||||
name AddName (char *name);
|
||||
name FindName (char *name);
|
||||
|
||||
void SortNames ();
|
||||
|
||||
struct StateMapE
|
||||
{
|
||||
name Name;
|
||||
unsigned char State;
|
||||
unsigned char Count;
|
||||
};
|
||||
|
||||
struct ThingBitsE
|
||||
{
|
||||
name Name;
|
||||
unsigned char BitNum;
|
||||
unsigned char FlagNum;
|
||||
};
|
||||
|
||||
struct RenderStylesE
|
||||
{
|
||||
name Name;
|
||||
unsigned char StyleNum;
|
||||
};
|
||||
|
||||
void AddAction (char *name);
|
||||
int FindAction (char *name);
|
||||
|
||||
extern name *ActionsList;
|
||||
extern unsigned char *HeightsArray;
|
||||
extern unsigned char *ActionMap;
|
||||
extern unsigned short *CodePMap;
|
||||
extern char *SpriteNames;
|
||||
extern struct StateMapE *StateMaps;
|
||||
extern name *SoundMaps;
|
||||
extern name *InfoNamesArray;
|
||||
extern struct ThingBitsE *ThingBitsMap;
|
||||
extern struct RenderStylesE *RenderStylesMap;
|
||||
|
||||
extern int ActionsListSize, MaxActionsListSize;
|
||||
extern int HeightsSize, MaxHeightsSize;
|
||||
extern int ActionMapSize, MaxActionMapSize;
|
||||
extern int CodePMapSize, MaxCodePMapSize;
|
||||
extern int SpriteNamesSize, MaxSpriteNamesSize;
|
||||
extern int StateMapsSize, MaxStateMapsSize;
|
||||
extern int SoundMapsSize, MaxSoundMapsSize;
|
||||
extern int InfoNamesSize, MaxInfoNamesSize;
|
||||
extern int ThingBitsMapSize, MaxThingBitsMapSize;
|
||||
extern int RenderStylesSize, MaxRenderStylesSize;
|
||||
|
||||
void AddHeight (int h);
|
||||
void AddActionMap (char *name);
|
||||
void AddCodeP (int codep);
|
||||
void AddSpriteName (char *name);
|
||||
void AddStateMap (char *name, int type, int count);
|
||||
void AddSoundMap (char *sound);
|
||||
void AddInfoName (char *sound);
|
||||
void AddThingBits (char *name, int bitnum, int flagnum);
|
||||
void AddRenderStyle (char *name, int stylenum);
|
||||
|
465
tools/dehsupp/dehsupp.vcproj
Normal file
465
tools/dehsupp/dehsupp.vcproj
Normal file
|
@ -0,0 +1,465 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="dehsupp"
|
||||
ProjectGUID="{AC64EE8F-F019-4A3E-BCAF-BD1FD072B9C8}"
|
||||
RootNamespace="dehsupp"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;__STDC__=0"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
DisableSpecificWarnings="4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/dehsupp.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)/dehsupp.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy "$(TargetPath)" "$(ProjectDir)\$(TargetFileName)""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/dehsupp.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile="$(OutDir)/dehsupp.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy "$(TargetPath)" "$(ProjectDir)\$(TargetFileName)""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/dehsupp.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy "$(TargetPath)" "$(ProjectDir)\$(TargetFileName)""
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="1"
|
||||
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="1"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
DisableSpecificWarnings="4996"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile="$(OutDir)/dehsupp.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="17"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
CommandLine="copy "$(TargetPath)" "$(ProjectDir)\$(TargetFileName)""
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\dehsupp.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\dehsupp.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\parse.c"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\$(InputName)1.obj"
|
||||
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\parse.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\parse.y"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Creating parse.c from parse.y"
|
||||
CommandLine="..\lemon\lemon.exe -s "$(InputFileName)"
"
|
||||
Outputs="$(InputDir)parse.c;$(InputDir)parse.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Creating parse.c from parse.y"
|
||||
CommandLine="..\lemon\lemon.exe -s "$(InputFileName)"
"
|
||||
Outputs="$(InputDir)parse.c"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Creating parse.c from parse.y"
|
||||
CommandLine="..\lemon\lemon.exe -s "$(InputFileName)"
"
|
||||
Outputs="$(InputDir)parse.c;$(InputDir)parse.h"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Creating parse.c from parse.y"
|
||||
CommandLine="..\lemon\lemon.exe -s "$(InputFileName)"
"
|
||||
Outputs="$(InputDir)parse.c"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\scanner.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\scanner.re"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Creating scanner.c from scanner.re"
|
||||
CommandLine="..\re2c\re2c -s --no-generation-date -o "scanner.c" "$(InputFileName)"
"
|
||||
Outputs="$(InputDir)scanner.c"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Creating scanner.c from scanner.re"
|
||||
CommandLine="..\re2c\re2c -s -o "scanner.c" "$(InputFileName)"
"
|
||||
Outputs="$(InputDir)scanner.c"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Creating scanner.c from scanner.re"
|
||||
CommandLine="..\re2c\re2c -s --no-generation-date -o "scanner.c" "$(InputFileName)"
"
|
||||
Outputs="$(InputDir)scanner.c"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|x64"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Creating scanner.c from scanner.re"
|
||||
CommandLine="..\re2c\re2c -s -o "scanner.c" "$(InputFileName)"
"
|
||||
Outputs="$(InputDir)scanner.c"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
1471
tools/dehsupp/parse.c
Normal file
1471
tools/dehsupp/parse.c
Normal file
File diff suppressed because it is too large
Load diff
33
tools/dehsupp/parse.h
Normal file
33
tools/dehsupp/parse.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
#define OR 1
|
||||
#define XOR 2
|
||||
#define AND 3
|
||||
#define MINUS 4
|
||||
#define PLUS 5
|
||||
#define MULTIPLY 6
|
||||
#define DIVIDE 7
|
||||
#define NEG 8
|
||||
#define EOI 9
|
||||
#define PRINT 10
|
||||
#define LPAREN 11
|
||||
#define RPAREN 12
|
||||
#define COMMA 13
|
||||
#define STRING 14
|
||||
#define ENDL 15
|
||||
#define NUM 16
|
||||
#define Actions 17
|
||||
#define LBRACE 18
|
||||
#define RBRACE 19
|
||||
#define SEMICOLON 20
|
||||
#define SYM 21
|
||||
#define OrgHeights 22
|
||||
#define ActionList 23
|
||||
#define CodePConv 24
|
||||
#define OrgSprNames 25
|
||||
#define StateMap 26
|
||||
#define FirstState 27
|
||||
#define SpawnState 28
|
||||
#define DeathState 29
|
||||
#define SoundMap 30
|
||||
#define InfoNames 31
|
||||
#define ThingBits 32
|
||||
#define RenderStyles 33
|
152
tools/dehsupp/parse.y
Normal file
152
tools/dehsupp/parse.y
Normal file
|
@ -0,0 +1,152 @@
|
|||
%include{
|
||||
#include <malloc.h>
|
||||
#include "dehsupp.h"
|
||||
}
|
||||
|
||||
%token_type {struct Token}
|
||||
|
||||
%syntax_error { yyerror("Syntax error"); }
|
||||
|
||||
%token_destructor { if ($$.string) free($$.string); }
|
||||
|
||||
%left OR.
|
||||
%left XOR.
|
||||
%left AND.
|
||||
%left MINUS PLUS.
|
||||
%left MULTIPLY DIVIDE.
|
||||
%left NEG.
|
||||
|
||||
%left EOI.
|
||||
|
||||
main ::= translation_unit.
|
||||
|
||||
translation_unit ::= . /* empty */
|
||||
translation_unit ::= translation_unit external_declaration.
|
||||
|
||||
external_declaration ::= print_statement.
|
||||
external_declaration ::= actions_def.
|
||||
external_declaration ::= org_heights_def.
|
||||
external_declaration ::= action_list_def.
|
||||
external_declaration ::= codep_conv_def.
|
||||
external_declaration ::= org_spr_names_def.
|
||||
external_declaration ::= state_map_def.
|
||||
external_declaration ::= sound_map_def.
|
||||
external_declaration ::= info_names_def.
|
||||
external_declaration ::= thing_bits_def.
|
||||
external_declaration ::= render_styles_def.
|
||||
|
||||
print_statement ::= PRINT LPAREN print_list RPAREN.
|
||||
{
|
||||
printf ("\n");
|
||||
}
|
||||
|
||||
print_list ::= . /* EMPTY */
|
||||
print_list ::= print_item.
|
||||
print_list ::= print_item COMMA print_list.
|
||||
|
||||
print_item ::= STRING(A). { printf ("%s", A.string); }
|
||||
print_item ::= exp(A). { printf ("%d", A); }
|
||||
print_item ::= ENDL. { printf ("\n"); }
|
||||
|
||||
%type exp {int}
|
||||
exp(A) ::= NUM(B). { A = B.val; }
|
||||
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) 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; }
|
||||
exp(A) ::= MINUS exp(B). [NEG] { A = -B; }
|
||||
exp(A) ::= LPAREN exp(B) RPAREN. { A = B; }
|
||||
|
||||
|
||||
actions_def ::= Actions LBRACE actions_list RBRACE SEMICOLON.
|
||||
actions_def ::= Actions LBRACE error RBRACE SEMICOLON.
|
||||
|
||||
actions_list ::= . /* empty */
|
||||
actions_list ::= SYM(A). { AddAction (A.string); }
|
||||
actions_list ::= actions_list COMMA SYM(A). { AddAction (A.string); }
|
||||
|
||||
|
||||
org_heights_def ::= OrgHeights LBRACE org_heights_list RBRACE SEMICOLON.
|
||||
org_heights_def ::= OrgHeights LBRACE error RBRACE SEMICOLON.
|
||||
|
||||
org_heights_list ::= . /* empty */
|
||||
org_heights_list ::= exp(A). { AddHeight (A); }
|
||||
org_heights_list ::= org_heights_list COMMA exp(A). { AddHeight (A); }
|
||||
|
||||
|
||||
action_list_def ::= ActionList LBRACE action_list_list RBRACE SEMICOLON.
|
||||
action_list_def ::= ActionList LBRACE error RBRACE SEMICOLON.
|
||||
|
||||
action_list_list ::= . /* empty */
|
||||
action_list_list ::= SYM(A). { AddActionMap (A.string); }
|
||||
action_list_list ::= action_list_list COMMA SYM(A). { AddActionMap (A.string); }
|
||||
|
||||
|
||||
codep_conv_def ::= CodePConv LBRACE codep_conv_list RBRACE SEMICOLON.
|
||||
codep_conv_def ::= CodePConv LBRACE error RBRACE SEMICOLON.
|
||||
|
||||
codep_conv_list ::= . /* empty */
|
||||
codep_conv_list ::= exp(A). { AddCodeP (A); }
|
||||
codep_conv_list ::= codep_conv_list COMMA exp(A). { AddCodeP (A); }
|
||||
|
||||
|
||||
org_spr_names_def ::= OrgSprNames LBRACE org_spr_names_list RBRACE SEMICOLON.
|
||||
org_spr_names_def ::= OrgSprNames LBRACE error RBRACE SEMICOLON.
|
||||
|
||||
org_spr_names_list ::= . /* empty */
|
||||
org_spr_names_list ::= SYM(A). { AddSpriteName (A.string); }
|
||||
org_spr_names_list ::= org_spr_names_list COMMA SYM(A). { AddSpriteName (A.string); }
|
||||
|
||||
|
||||
state_map_def ::= StateMap LBRACE state_map_list RBRACE SEMICOLON.
|
||||
state_map_def ::= StateMap LBRACE error RBRACE SEMICOLON.
|
||||
|
||||
state_map_list ::= . /* empty */
|
||||
state_map_list ::= state_map_entry.
|
||||
state_map_list ::= state_map_list COMMA state_map_entry.
|
||||
|
||||
state_map_entry ::= SYM(A) COMMA state_type(B) COMMA exp(C). { AddStateMap (A.string, B, C); }
|
||||
|
||||
%type state_type {int}
|
||||
state_type(A) ::= FirstState. { A = 0; }
|
||||
state_type(A) ::= SpawnState. { A = 1; }
|
||||
state_type(A) ::= DeathState. { A = 2; }
|
||||
|
||||
|
||||
sound_map_def ::= SoundMap LBRACE sound_map_list RBRACE SEMICOLON.
|
||||
sound_map_def ::= SoundMap LBRACE error RBRACE SEMICOLON.
|
||||
|
||||
sound_map_list ::= . /* empty */
|
||||
sound_map_list ::= STRING(A). { AddSoundMap (A.string); }
|
||||
sound_map_list ::= sound_map_list COMMA STRING(A). { AddSoundMap (A.string); }
|
||||
|
||||
|
||||
info_names_def ::= InfoNames LBRACE info_names_list RBRACE SEMICOLON.
|
||||
info_names_def ::= InfoNames LBRACE error RBRACE SEMICOLON.
|
||||
|
||||
info_names_list ::= . /* empty */
|
||||
info_names_list ::= SYM(A). { AddInfoName (A.string); }
|
||||
info_names_list ::= info_names_list COMMA SYM(A). { AddInfoName (A.string); }
|
||||
|
||||
|
||||
thing_bits_def ::= ThingBits LBRACE thing_bits_list RBRACE SEMICOLON.
|
||||
thing_bits_def ::= ThingBits LBRACE error RBRACE SEMICOLON.
|
||||
|
||||
thing_bits_list ::= . /* empty */
|
||||
thing_bits_list ::= thing_bits_entry.
|
||||
thing_bits_list ::= thing_bits_list COMMA thing_bits_entry.
|
||||
|
||||
thing_bits_entry ::= exp(A) COMMA exp(B) COMMA SYM(C). { AddThingBits (C.string, A, B); }
|
||||
|
||||
|
||||
render_styles_def ::= RenderStyles LBRACE render_styles_list RBRACE SEMICOLON.
|
||||
render_styles_def ::= RenderStyles LBRACE error RBRACE SEMICOLON.
|
||||
|
||||
render_styles_list ::= . /* empty */
|
||||
render_styles_list ::= render_styles_entry.
|
||||
render_styles_list ::= render_styles_list COMMA render_styles_entry.
|
||||
|
||||
render_styles_entry ::= exp(A) COMMA SYM(B). { AddRenderStyle (B.string, A); }
|
1091
tools/dehsupp/scanner.c
Normal file
1091
tools/dehsupp/scanner.c
Normal file
File diff suppressed because it is too large
Load diff
176
tools/dehsupp/scanner.re
Normal file
176
tools/dehsupp/scanner.re
Normal file
|
@ -0,0 +1,176 @@
|
|||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#include "dehsupp.h"
|
||||
|
||||
#define BSIZE 8192
|
||||
|
||||
#define YYCTYPE uchar
|
||||
#define YYCURSOR cursor
|
||||
#define YYLIMIT s->lim
|
||||
#define YYMARKER s->ptr
|
||||
#define YYFILL(n) {cursor = fill(s, cursor);}
|
||||
|
||||
#define RET(i) {s->cur = cursor; return i;}
|
||||
|
||||
uchar *fill(Scanner *s, uchar *cursor)
|
||||
{
|
||||
if(!s->eof)
|
||||
{
|
||||
ptrdiff_t cnt = s->tok - s->bot;
|
||||
if(cnt)
|
||||
{
|
||||
memcpy(s->bot, s->tok, s->lim - s->tok);
|
||||
s->tok = s->bot;
|
||||
s->ptr -= cnt;
|
||||
cursor -= cnt;
|
||||
s->pos -= cnt;
|
||||
s->lim -= cnt;
|
||||
}
|
||||
if((s->top - s->lim) < BSIZE)
|
||||
{
|
||||
uchar *buf = (uchar*) malloc(((s->lim - s->bot) + BSIZE)*sizeof(uchar));
|
||||
memcpy(buf, s->tok, s->lim - s->tok);
|
||||
s->tok = buf;
|
||||
s->ptr = &buf[s->ptr - s->bot];
|
||||
cursor = &buf[cursor - s->bot];
|
||||
s->pos = &buf[s->pos - s->bot];
|
||||
s->lim = &buf[s->lim - s->bot];
|
||||
s->top = &s->lim[BSIZE];
|
||||
free(s->bot);
|
||||
s->bot = buf;
|
||||
}
|
||||
if((cnt = fread((char*) s->lim, 1, BSIZE, s->fd)) != BSIZE)
|
||||
{
|
||||
s->eof = &s->lim[cnt]; *(s->eof)++ = '\n';
|
||||
}
|
||||
s->lim += cnt;
|
||||
}
|
||||
return cursor;
|
||||
}
|
||||
|
||||
int scan(Scanner *s)
|
||||
{
|
||||
uchar *cursor = s->cur;
|
||||
std:
|
||||
s->tok = cursor;
|
||||
/*!re2c
|
||||
any = [\000-\377];
|
||||
O = [0-7];
|
||||
D = [0-9];
|
||||
L = [a-zA-Z_];
|
||||
H = [a-fA-F0-9];
|
||||
ESC = [\\] ([abfnrtv?'"\\] | "x" H+ | O+);
|
||||
*/
|
||||
|
||||
/*!re2c
|
||||
"/*" { goto comment; } /* C comment */
|
||||
"//" (any\"\n")* "\n" /* C++ comment */
|
||||
{
|
||||
if(cursor == s->eof) RET(EOI);
|
||||
s->tok = s->pos = cursor; s->line++;
|
||||
goto std;
|
||||
}
|
||||
|
||||
"endl" { RET(ENDL); }
|
||||
"print" { RET(PRINT); }
|
||||
"Actions" { RET(Actions); }
|
||||
"OrgHeights" { RET(OrgHeights); }
|
||||
"ActionList" { RET(ActionList); }
|
||||
"CodePConv" { RET(CodePConv); }
|
||||
"OrgSprNames" { RET(OrgSprNames); }
|
||||
"StateMap" { RET(StateMap); }
|
||||
"SoundMap" { RET(SoundMap); }
|
||||
"InfoNames" { RET(InfoNames); }
|
||||
"ThingBits" { RET(ThingBits); }
|
||||
"DeathState" { RET(DeathState); }
|
||||
"SpawnState" { RET(SpawnState); }
|
||||
"FirstState" { RET(FirstState); }
|
||||
"RenderStyles" { RET(RenderStyles); }
|
||||
|
||||
L (L|D)* { RET(SYM); }
|
||||
|
||||
("0" [xX] H+) | ("0" D+) | (D+)
|
||||
{ RET(NUM); }
|
||||
|
||||
(["] (ESC|any\[\n\\"])* ["])
|
||||
{ RET(STRING); }
|
||||
|
||||
[ \t\v\f]+ { goto std; }
|
||||
|
||||
"|" { RET(OR); }
|
||||
"^" { RET(XOR); }
|
||||
"&" { RET(AND); }
|
||||
"-" { RET(MINUS); }
|
||||
"+" { RET(PLUS); }
|
||||
"*" { RET(MULTIPLY); }
|
||||
"/" { RET(DIVIDE); }
|
||||
"(" { RET(LPAREN); }
|
||||
")" { RET(RPAREN); }
|
||||
"," { RET(COMMA); }
|
||||
"{" { RET(LBRACE); }
|
||||
"}" { RET(RBRACE); }
|
||||
";" { RET(SEMICOLON); }
|
||||
|
||||
|
||||
"\n"
|
||||
{
|
||||
if(cursor == s->eof) RET(EOI);
|
||||
s->pos = cursor; s->line++;
|
||||
goto std;
|
||||
}
|
||||
|
||||
any
|
||||
{
|
||||
printf("unexpected character: %c\n", *s->tok);
|
||||
goto std;
|
||||
}
|
||||
*/
|
||||
|
||||
comment:
|
||||
/*!re2c
|
||||
"*/" { goto std; }
|
||||
"\n"
|
||||
{
|
||||
if(cursor == s->eof) RET(EOI);
|
||||
s->tok = s->pos = cursor; s->line++;
|
||||
goto comment;
|
||||
}
|
||||
any { goto comment; }
|
||||
*/
|
||||
}
|
||||
|
||||
int lex(Scanner *s, struct Token *tok)
|
||||
{
|
||||
int tokentype = scan(s);
|
||||
char *p, *q;
|
||||
|
||||
tok->val = 0;
|
||||
tok->string = NULL;
|
||||
|
||||
switch (tokentype)
|
||||
{
|
||||
case NUM:
|
||||
tok->val = strtol((char *)s->tok, NULL, 0);
|
||||
break;
|
||||
|
||||
case STRING:
|
||||
tok->string = (char *)malloc(s->cur - s->tok - 1);
|
||||
strncpy(tok->string, (char *)s->tok + 1, s->cur - s->tok - 2);
|
||||
tok->string[s->cur - s->tok - 2] = '\0';
|
||||
for (p = q = tok->string; *p; ++p, ++q)
|
||||
{
|
||||
if (p[0] == '\\' && p[1] == '\\')
|
||||
++p;
|
||||
*q = *p;
|
||||
}
|
||||
break;
|
||||
|
||||
case SYM:
|
||||
tok->string = (char *)malloc(s->cur - s->tok + 1);
|
||||
strncpy(tok->string, (char *)s->tok, s->cur - s->tok);
|
||||
tok->string[s->cur - s->tok] = '\0';
|
||||
break;
|
||||
}
|
||||
return tokentype;
|
||||
}
|
|
@ -10,15 +10,16 @@
|
|||
RM=rm -f
|
||||
SLASH=/
|
||||
MAKEWAD=..$(SLASH)tools$(SLASH)makewad$(SLASH)makewad
|
||||
DEHSUPP=..$(SLASH)tools$(SLASH)dehsupp$(SLASH)dehsupp
|
||||
|
||||
makethewad: wadmake Makefile2
|
||||
$(MAKE) $(NOLOGO) -f Makefile2
|
||||
$(MAKE) $(NOLOGO) DEHSUPP=$(DEHSUPP) -f Makefile2
|
||||
|
||||
wadmake: zdoom.lst
|
||||
$(MAKEWAD) -make wadmake zdoom.lst
|
||||
|
||||
clean:
|
||||
$(RM) wadmake zdoom.pk3
|
||||
$(RM) wadmake zdoom.pk3 dehsupp.lmp
|
||||
|
||||
# This target is for Visual C++'s Rebuild All command
|
||||
nrebuild: clean
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
MAKEWAD=../tools/makewad/makewad
|
||||
DEHSUPP=../tools/dehsupp/dehsupp
|
||||
|
||||
ifneq ($(MAKECMDGOALS),clean)
|
||||
include Makefile2
|
||||
|
@ -7,15 +8,18 @@ ifeq ($(findstring msys,$(shell sh --version 2>nul)),msys)
|
|||
export OSTYPE=msys
|
||||
endif
|
||||
|
||||
wadmake: zdoom.lst $(MAKEWAD).exe
|
||||
wadmake: zdoom.lst $(MAKEWAD).exe $(DEHSUPP).exe
|
||||
$(MAKEWAD) -make wadmake zdoom.lst
|
||||
|
||||
clean:
|
||||
ifeq ($(OSTYPE),msys)
|
||||
rm -f wadmake zdoom.pk3
|
||||
rm -f wadmake zdoom.pk3 dehsupp.lmp
|
||||
else
|
||||
del /q /f wadmake zdoom.pk3 2>nul
|
||||
del /q /f wadmake zdoom.pk3 dehsupp.lmp 2>nul
|
||||
endif
|
||||
|
||||
../tools/makewad/makewad.exe:
|
||||
$(MAKE) -C ../tools/makewad -f Makefile
|
||||
|
||||
../tools/dehsupp/dehsupp.exe:
|
||||
$(MAKE) -C ../tools/dehsupp -f Makefile
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
include wadmake
|
||||
|
||||
dehsupp.lmp: dehsupp.txt
|
||||
$(DEHSUPP) dehsupp.txt dehsupp.lmp
|
||||
|
BIN
wadsrc/dehsupp.lmp
Normal file
BIN
wadsrc/dehsupp.lmp
Normal file
Binary file not shown.
|
@ -1,3 +1,107 @@
|
|||
Actions
|
||||
{
|
||||
NULL,
|
||||
MonsterRail,
|
||||
FireRailgun,
|
||||
FireRailgunLeft,
|
||||
FireRailgunRight,
|
||||
RailWait,
|
||||
Light0,
|
||||
WeaponReady,
|
||||
Lower,
|
||||
Raise,
|
||||
Punch,
|
||||
ReFire,
|
||||
FirePistol,
|
||||
Light1,
|
||||
FireShotgun,
|
||||
Light2,
|
||||
FireShotgun2,
|
||||
CheckReload,
|
||||
OpenShotgun2,
|
||||
LoadShotgun2,
|
||||
CloseShotgun2,
|
||||
FireCGun,
|
||||
GunFlash,
|
||||
FireMissile,
|
||||
Saw,
|
||||
FirePlasma,
|
||||
BFGsound,
|
||||
FireBFG,
|
||||
BFGSpray,
|
||||
Explode,
|
||||
Pain,
|
||||
PlayerScream,
|
||||
Fall,
|
||||
XScream,
|
||||
Look,
|
||||
Chase,
|
||||
FaceTarget,
|
||||
PosAttack,
|
||||
Scream,
|
||||
SPosAttack,
|
||||
VileChase,
|
||||
VileStart,
|
||||
VileTarget,
|
||||
VileAttack,
|
||||
StartFire,
|
||||
Fire,
|
||||
FireCrackle,
|
||||
Tracer,
|
||||
SkelWhoosh,
|
||||
SkelFist,
|
||||
SkelMissile,
|
||||
FatRaise,
|
||||
FatAttack1,
|
||||
FatAttack2,
|
||||
FatAttack3,
|
||||
BossDeath,
|
||||
CPosAttack,
|
||||
CPosRefire,
|
||||
TroopAttack,
|
||||
SargAttack,
|
||||
HeadAttack,
|
||||
BruisAttack,
|
||||
SkullAttack,
|
||||
Metal,
|
||||
SpidRefire,
|
||||
BabyMetal,
|
||||
BspiAttack,
|
||||
Hoof,
|
||||
CyberAttack,
|
||||
PainAttack,
|
||||
PainDie,
|
||||
KeenDie,
|
||||
BrainPain,
|
||||
BrainScream,
|
||||
BrainDie,
|
||||
BrainAwake,
|
||||
BrainSpit,
|
||||
SpawnSound,
|
||||
SpawnFly,
|
||||
BrainExplode,
|
||||
Die,
|
||||
Detonate,
|
||||
Mushroom,
|
||||
|
||||
// Additional stuff
|
||||
SetFloorClip,
|
||||
UnSetFloorClip,
|
||||
HideThing,
|
||||
UnHideThing,
|
||||
SetInvulnerable,
|
||||
UnSetInvulnerable,
|
||||
SetReflective,
|
||||
UnSetReflective,
|
||||
SetReflectiveInvulnerable,
|
||||
UnSetReflectiveInvulnerable,
|
||||
SetShootable,
|
||||
UnSetShootable,
|
||||
NoGravity,
|
||||
Gravity,
|
||||
LowGravity
|
||||
};
|
||||
|
||||
OrgHeights
|
||||
{
|
||||
56, 56, 56, 56, 16, 56, 8, 16, 64, 8, 56, 56,
|
||||
|
@ -702,33 +806,4 @@ RenderStyles
|
|||
8, STYLE_Shaded,
|
||||
6, STYLE_Translucent,
|
||||
7, STYLE_Add
|
||||
};
|
||||
|
||||
AmmoNames
|
||||
{
|
||||
Clip,
|
||||
Shell,
|
||||
Cell,
|
||||
RocketAmmo,
|
||||
GoldWandAmmo,
|
||||
NULL,
|
||||
BlasterAmmo,
|
||||
SkullRodAmmo,
|
||||
PhoenixRodAmmo,
|
||||
MaceAmmo,
|
||||
Mana1,
|
||||
Mana2
|
||||
};
|
||||
|
||||
WeaponNames
|
||||
{
|
||||
Fist,
|
||||
Pistol,
|
||||
Shotgun,
|
||||
Chaingun,
|
||||
RocketLauncher,
|
||||
PlasmaRifle,
|
||||
BFG9000,
|
||||
Chainsaw,
|
||||
SuperShotgun
|
||||
};
|
||||
};
|
|
@ -48,8 +48,8 @@
|
|||
>
|
||||
<Tool
|
||||
Name="VCNMakeTool"
|
||||
BuildCommandLine="nmake /nologo MAKEWAD=..\tools\makewad\makewad NOLOGO=/nologo andcopy"
|
||||
ReBuildCommandLine="nmake /nologo MAKEWAD=..\tools\makewad\makewad NOLOGO=/nologo nrebuild"
|
||||
BuildCommandLine="nmake /nologo MAKEWAD=..\tools\makewad\makewad DEHSUPP=..\tools\dehsupp\dehsupp NOLOGO=/nologo andcopy"
|
||||
ReBuildCommandLine="nmake /nologo MAKEWAD=..\tools\makewad\makewad NOLOGO=/nologo DEHSUPP=..\tools\dehsupp\dehsupp nrebuild"
|
||||
CleanCommandLine="del wadmake zdoom.pk3"
|
||||
Output="zdoom.pk3"
|
||||
PreprocessorDefinitions=""
|
||||
|
@ -90,8 +90,8 @@
|
|||
>
|
||||
<Tool
|
||||
Name="VCNMakeTool"
|
||||
BuildCommandLine="nmake /nologo MAKEWAD=..\tools\makewad\makewad NOLOGO=/nologo"
|
||||
ReBuildCommandLine="nmake /nologo MAKEWAD=..\tools\makewad\makewad NOLOGO=/nologo nrebuild"
|
||||
BuildCommandLine="nmake /nologo MAKEWAD=..\tools\makewad\makewad DEHSUPP=..\tools\dehsupp\dehsupp NOLOGO=/nologo"
|
||||
ReBuildCommandLine="nmake /nologo MAKEWAD=..\tools\makewad\makewad NOLOGO=/nologo DEHSUPP=..\tools\dehsupp\dehsupp nrebuild"
|
||||
CleanCommandLine="del wadmake zdoom.pk3"
|
||||
Output="zdoom.pk3"
|
||||
PreprocessorDefinitions=""
|
||||
|
|
|
@ -76,7 +76,7 @@ xlat/defines.i xlat/defines.i
|
|||
========
|
||||
# Support lumps
|
||||
|
||||
dehsupp.txt dehsupp.txt
|
||||
dehsupp.lmp dehsupp.lmp
|
||||
|
||||
animated.lmp animated.lmp
|
||||
spaldoom.lmp spaldoom.lmp
|
||||
|
|
21
zdoom.sln
21
zdoom.sln
|
@ -5,11 +5,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zdoom", "zdoom.vcproj", "{8
|
|||
{AC3F5340-40CB-4C3A-8AA7-CB7158DB4466} = {AC3F5340-40CB-4C3A-8AA7-CB7158DB4466}
|
||||
{1D179D4B-F008-431B-8C72-111F8372584F} = {1D179D4B-F008-431B-8C72-111F8372584F}
|
||||
{DA47396F-60C1-4BDE-A977-7F7DE461CF77} = {DA47396F-60C1-4BDE-A977-7F7DE461CF77}
|
||||
{E83FD370-2E72-4D4C-9427-FF9D9DED1E88} = {E83FD370-2E72-4D4C-9427-FF9D9DED1E88}
|
||||
{0F80ACBF-460E-44F0-B28E-B3272D1774A7} = {0F80ACBF-460E-44F0-B28E-B3272D1774A7}
|
||||
{F9D9E7D4-E1A2-4866-9E85-B1B14137EE63} = {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63}
|
||||
{6077B7D6-349F-4077-B552-3BC302EF5859} = {6077B7D6-349F-4077-B552-3BC302EF5859}
|
||||
{667D2EE7-C357-49E2-9BAB-0A4A45F0F76E} = {667D2EE7-C357-49E2-9BAB-0A4A45F0F76E}
|
||||
{6077B7D6-349F-4077-B552-3BC302EF5859} = {6077B7D6-349F-4077-B552-3BC302EF5859}
|
||||
{F9D9E7D4-E1A2-4866-9E85-B1B14137EE63} = {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63}
|
||||
{E83FD370-2E72-4D4C-9427-FF9D9DED1E88} = {E83FD370-2E72-4D4C-9427-FF9D9DED1E88}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib\zlib.vcproj", "{F9D9E7D4-E1A2-4866-9E85-B1B14137EE63}"
|
||||
|
@ -20,6 +20,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "re2c", "tools\re2c\re2c.vcp
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wadsrc", "wadsrc\wadsrc.vcproj", "{1D179D4B-F008-431B-8C72-111F8372584F}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{AC64EE8F-F019-4A3E-BCAF-BD1FD072B9C8} = {AC64EE8F-F019-4A3E-BCAF-BD1FD072B9C8}
|
||||
{24A19C02-F041-4AB0-A1A1-02E1E88EDBD3} = {24A19C02-F041-4AB0-A1A1-02E1E88EDBD3}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
@ -28,6 +29,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makewad", "tools\makewad\ma
|
|||
{F9D9E7D4-E1A2-4866-9E85-B1B14137EE63} = {F9D9E7D4-E1A2-4866-9E85-B1B14137EE63}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dehsupp", "tools\dehsupp\dehsupp.vcproj", "{AC64EE8F-F019-4A3E-BCAF-BD1FD072B9C8}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{667D2EE7-C357-49E2-9BAB-0A4A45F0F76E} = {667D2EE7-C357-49E2-9BAB-0A4A45F0F76E}
|
||||
{0F80ACBF-460E-44F0-B28E-B3272D1774A7} = {0F80ACBF-460E-44F0-B28E-B3272D1774A7}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "updaterevision", "tools\updaterevision\updaterevision.vcproj", "{6077B7D6-349F-4077-B552-3BC302EF5859}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jpeg-6b", "jpeg-6b\jpeg-6b.vcproj", "{AC3F5340-40CB-4C3A-8AA7-CB7158DB4466}"
|
||||
|
@ -92,6 +99,14 @@ Global
|
|||
{24A19C02-F041-4AB0-A1A1-02E1E88EDBD3}.Release|Win32.Build.0 = Release|Win32
|
||||
{24A19C02-F041-4AB0-A1A1-02E1E88EDBD3}.Release|x64.ActiveCfg = Debug|x64
|
||||
{24A19C02-F041-4AB0-A1A1-02E1E88EDBD3}.Release|x64.Build.0 = Debug|x64
|
||||
{AC64EE8F-F019-4A3E-BCAF-BD1FD072B9C8}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{AC64EE8F-F019-4A3E-BCAF-BD1FD072B9C8}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{AC64EE8F-F019-4A3E-BCAF-BD1FD072B9C8}.Debug|x64.ActiveCfg = Release|Win32
|
||||
{AC64EE8F-F019-4A3E-BCAF-BD1FD072B9C8}.Debug|x64.Build.0 = Release|Win32
|
||||
{AC64EE8F-F019-4A3E-BCAF-BD1FD072B9C8}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{AC64EE8F-F019-4A3E-BCAF-BD1FD072B9C8}.Release|Win32.Build.0 = Release|Win32
|
||||
{AC64EE8F-F019-4A3E-BCAF-BD1FD072B9C8}.Release|x64.ActiveCfg = Release|Win32
|
||||
{AC64EE8F-F019-4A3E-BCAF-BD1FD072B9C8}.Release|x64.Build.0 = Release|Win32
|
||||
{6077B7D6-349F-4077-B552-3BC302EF5859}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6077B7D6-349F-4077-B552-3BC302EF5859}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6077B7D6-349F-4077-B552-3BC302EF5859}.Debug|x64.ActiveCfg = Debug|x64
|
||||
|
|
Loading…
Reference in a new issue