- tabification of new sources and replacement of the CON instruction symbols.

# Conflicts:
#	source/games/duke/src/zz_gamedef.cpp
This commit is contained in:
Christoph Oelckers 2020-05-12 13:43:24 +02:00
parent deef1b5936
commit 358d1a460f
16 changed files with 6687 additions and 6497 deletions

View file

@ -5,6 +5,7 @@ set( PCH_SOURCES
src/actors_d.cpp
src/actors_lava.cpp
src/bowling.cpp
src/gamedef.cpp
src/zz_actors.cpp
src/sectors.cpp
src/sectors_d.cpp

View file

@ -0,0 +1,19 @@
#pragma once
struct sprite_type;
BEGIN_DUKE_NS
#define cmd(a) concmd_ ## a,
#define cmdx(a, b) concmd_ ## a,
#define cmda(a,b)
enum EConCommands
{
#include "condef.h"
};
#undef cmd
#undef cmdx
#undef cmda
END_DUKE_NS

View file

@ -0,0 +1,176 @@
cmd(definelevelname) // 0
cmd(actor) // 1
cmd(addammo) // 2
cmd(ifrnd) // 3
cmd(enda) // 4
cmd(ifcansee) // 5
cmd(ifhitweapon) // 6
cmd(action) // 7
cmd(ifpdistl) // 8
cmd(ifpdistg) // 9
cmd(else) // 10
cmd(strength) // 11
cmd(break) // 12
cmd(shoot) // 13
cmd(palfrom) // 14
cmd(sound) // 15
cmd(fall) // 16
cmd(state) // 17
cmd(ends) // 18
cmd(define) // 19
cmdx(comment, "//") // 20
cmd(ifai) // 21
cmd(killit) // 22
cmd(addweapon) // 23
cmd(ai) // 24
cmd(addphealth) // 25
cmd(ifdead) // 26
cmd(ifsquished) // 27
cmd(sizeto) // 28
cmdx(leftbrace, "{") // 29
cmdx(rightbrace, "}") // 30
cmd(spawn) // 31
cmd(move) // 32
cmd(ifwasweapon) // 33
cmd(ifaction) // 34
cmd(ifactioncount) // 35
cmd(resetactioncount) // 36
cmd(debris) // 37
cmd(pstomp) // 38
cmdx(blockcomment, "/*") // 39
cmd(cstat) // 40
cmd(ifmove) // 41
cmd(resetplayer) // 42
cmd(ifonwater) // 43
cmd(ifinwater) // 44
cmd(ifcanshoottarget) // 45
cmd(ifcount) // 46
cmd(resetcount) // 47
cmd(addinventory) // 48
cmd(ifactornotstayput) // 49
cmd(hitradius) // 50
cmd(ifp) // 51
cmd(count) // 52
cmd(ifactor) // 53
cmd(music) // 54
cmd(include) // 55
cmd(ifstrength) // 56
cmd(definesound) // 57
cmd(guts) // 58
cmd(ifspawnedby) // 59
cmd(gamestartup) // 60
cmd(wackplayer) // 61
cmd(ifgapzl) // 62
cmd(ifhitspace) // 63
cmd(ifoutside) // 64
cmd(ifmultiplayer) // 65
cmd(operate) // 66
cmd(ifinspace) // 67
cmd(debug) // 68
cmd(endofgame) // 69
cmd(ifbulletnear) // 70
cmd(ifrespawn) // 71
cmd(iffloordistl) // 72
cmd(ifceilingdistl) // 73
cmd(spritepal) // 74
cmd(ifpinventory) // 75
cmd(betaname) // 76
cmd(cactor) // 77
cmd(ifphealthl) // 78
cmd(definequote) // 79
cmd(quote) // 80
cmd(ifinouterspace) // 81
cmd(ifnotmoving) // 82
cmd(respawnhitag) // 83
cmd(tip) // 84
cmd(ifspritepal) // 85
cmd(money) // 86
cmda(feathers, money) // RR alias
cmd(soundonce) // 87
cmd(addkills) // 88
cmd(stopsound) // 89
cmd(ifawayfromwall) // 90
cmd(ifcanseetarget) // 91
cmd(globalsound) // 92
cmd(lotsofglass) // 93
cmd(ifgotweaponce) // 94
cmd(getlastpal) // 95
cmd(pkick) // 96
cmd(mikesnd) // 97
cmd(useractor) // 98
cmd(sizeat) // 99
cmd(addstrength) // 100
cmd(cstator) // 101
cmd(mail) // 102
cmd(paper) // 103
cmd(tossweapon) // 104
cmd(sleeptime) // 105
cmd(nullop) // 106
cmd(definevolumename) // 107
cmd(defineskillname) // 108
cmd(ifnosounds) // 109
cmd(clipdist) // 110
cmd(ifangdiffl) // 111
cmd(ifplaybackon) // World Tour 112
// WW2GI
cmd(gamevar) // 112
cmd(ifvarl) // 113
cmd(ifvarg) // 114
cmd(setvarvar) // 115
cmd(setvar) // 116
cmd(addvarvar) // 117
cmd(addvar) // 118
cmd(ifvarvarl) // 119
cmd(ifvarvarg) // 120
cmd(addlogvar) // 121
cmd(addlog) // 122
cmd(onevent) // 123
cmd(endevent) // 124
cmd(ifvare) // 125
cmd(ifvarvare) // 126
// RR
cmd(ifnocover) // 110
cmd(ifhittruck) // 111
cmd(iftipcow) // 112
cmd(isdrunk) // 113
cmd(iseat) // 114
cmd(destroyit) // 115
cmd(larrybird) // 116
cmd(strafeleft) // 117
cmd(straferight) // 118
cmd(ifactorhealthg) // 119
cmd(ifactorhealthl) // 120
cmd(slapplayer) // 121
cmd(ifpdrunk) // 122
cmd(tearitup) // 123
cmd(smackbubba) // 124
cmd(soundtagonce) // 125
cmd(soundtag) // 126
cmd(ifsoundid) // 127
cmd(ifsounddist) // 128
cmd(ifonmud) // 129
cmd(ifcoop) // 130
// RRRA
cmd(ifmotofast) // 131
cmd(ifwind) // 132
cmd(smacksprite) // 133
cmd(ifonmoto) // 134
cmd(ifonboat) // 135
cmd(fakebubba) // 136
cmd(mamatrigger) // 137
cmd(mamaspawn) // 138
cmd(mamaquake) // 139
cmd(mamaend) // 141
cmd(newpic) // 142
cmd(garybanjo) // 143
cmd(motoloopsnd) // 144
cmd(ifsizedown) // 145
cmd(rndmove) // 146
// RR Deer Huntin'. These are merely here for reference because the game is not supported.
// cmd(iffindnewspot)
// cmd(ifpupwind)

View file

@ -0,0 +1,166 @@
//-------------------------------------------------------------------------
/*
Copyright (C) 1996, 2003 - 3D Realms Entertainment
This file is part of Enhanced Duke Nukem 3D version 1.5 - Atomic Edition
Duke Nukem 3D is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Original Source: 1996 - Todd Replogle
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
EDuke enhancements integrated: 04/13/2003 - Matt Saettler
Note: This source file IS NOT USED in EDuke source. It has been split
into many sub-files.
*/
//-------------------------------------------------------------------------
#include "ns.h"
#include <string.h>
#include "concmd.h"
#include "cmdlib.h"
BEGIN_DUKE_NS
// parser state: todo: turn into a class
char* textptr;
int32_t line_count;
//---------------------------------------------------------------------------
//
// synthesize the instruction list
//
//---------------------------------------------------------------------------
#define cmd(a) { #a, concmd_ ## a },
#define cmdx(a, b) { b, concmd_ ## a },
#define cmda(a,b) { #a, concmd_ ## b },
struct ConCommand
{
char cmd[20]; // the longest instruction name is 'ifactornotstayput' at 17 characters so if this changes this field must be enlarged.
int instr;
};
static ConCommand cmdList[] =
{
#include "condef.h"
};
#undef cmd
#undef cmdx
#undef cmda
static int cmdCmp(const void *a, const void *b)
{
auto A = (ConCommand*)a;
auto B = (ConCommand*)b;
return strcmp(A->cmd, B->cmd);
}
void SortCommands()
{
qsort(cmdList, countof(cmdList), sizeof(ConCommand), cmdCmp);
}
//---------------------------------------------------------------------------
//
// binary search for keyword
//
//---------------------------------------------------------------------------
int getkeyword(const char* text)
{
ptrdiff_t min = 0;
ptrdiff_t max = countof(cmdList) - 1;
while (min <= max)
{
int mid = (min + max) >> 1;
const int comp = strcmp(text, cmdList[mid].cmd);
if (comp == 0)
{
return cmdList[mid].instr;
}
else if (comp > 0)
{
min = mid + 1;
}
else
{
max = mid - 1;
}
}
return -1;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void skiptoendofline()
{
while (*textptr != 0x0a && *textptr != 0x0d && *textptr != 0)
textptr++;
}
void skipwhitespace()
{
while (*textptr == ' ' || *textptr == '\t' || *textptr == '\r' || *textptr == '\n')
{
if (*textptr == '\n') line_count++;
textptr++;
}
}
void skipblockcomment()
{
while (*textptr != '*' && textptr[1] != '/')
{
if (*textptr == '\n') line_count++;
if (*textptr == 0) return; // reached the end of the file
textptr++;
}
}
bool skipcomments()
{
while (true)
{
skipwhitespace();
if (*textptr == '/' && textptr[1] == '/')
{
skiptoendofline();
continue;
}
if (*textptr == '/' && textptr[1] == '*')
{
skipblockcomment();
continue;
}
// stop if we got something else
break;
}
return *textptr != 0;
}
END_DUKE_NS

View file

@ -55,7 +55,7 @@ enum
do \
{ \
C_ReportError(-1); \
Printf("%s:%d: error: " Text "\n", g_scriptFileName, g_lineNumber, ##__VA_ARGS__); \
Printf("%s:%d: error: " Text "\n", g_scriptFileName, line_count, ##__VA_ARGS__); \
g_errorCnt++; \
} while (0)
@ -63,7 +63,7 @@ enum
do \
{ \
C_ReportError(-1); \
Printf("%s:%d: warning: " Text "\n", g_scriptFileName, g_lineNumber, ##__VA_ARGS__); \
Printf("%s:%d: warning: " Text "\n", g_scriptFileName, line_count, ##__VA_ARGS__); \
g_warningCnt++; \
} while (0)
@ -91,7 +91,7 @@ extern const uint32_t CheatFunctionFlags[];
extern const uint8_t CheatFunctionIDs[];
extern int32_t g_errorCnt;
extern int32_t g_lineNumber;
extern int32_t line_count;
extern int32_t g_scriptVersion;
extern int32_t g_totalLines;
extern int32_t g_warningCnt;
@ -177,8 +177,19 @@ enum ScriptError_t
WARNING_DUPLICATEDEFINITION,
WARNING_LABELSONLY,
WARNING_VARMASKSKEYWORD,
ERROR_COULDNOTFIND,
ERROR_NOTAGAMEDEF,
ERROR_NOENDSWITCH
};
enum
{
};
#include "concmd.h"
enum ScriptKeywords_t
{
CON_ELSE, // 0

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -275,7 +275,7 @@ void Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
{
g_errorCnt++;
C_ReportError(-1);
Printf("%s:%d: error: too many gamevars!\n",g_scriptFileName,g_lineNumber);
Printf("%s:%d: error: too many gamevars!\n",g_scriptFileName,line_count);
return;
}
@ -283,7 +283,7 @@ void Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
{
g_errorCnt++;
C_ReportError(-1);
Printf("%s:%d: error: variable name `%s' exceeds limit of %d characters.\n",g_scriptFileName,g_lineNumber,pszLabel, MAXVARLABEL);
Printf("%s:%d: error: variable name `%s' exceeds limit of %d characters.\n",g_scriptFileName,line_count,pszLabel, MAXVARLABEL);
return;
}
@ -295,7 +295,7 @@ void Gv_NewVar(const char *pszLabel, intptr_t lValue, uint32_t dwFlags)
if (EDUKE32_PREDICT_FALSE(aGameVars[gV].flags & (GAMEVAR_PTR_MASK)))
{
C_ReportError(-1);
Printf("%s:%d: warning: cannot redefine internal gamevar `%s'.\n",g_scriptFileName,g_lineNumber,label+(g_labelCnt<<6));
Printf("%s:%d: warning: cannot redefine internal gamevar `%s'.\n",g_scriptFileName,line_count,label+(g_labelCnt<<6));
return;
}
else if (EDUKE32_PREDICT_FALSE(!(aGameVars[gV].flags & GAMEVAR_SYSTEM)))