This commit is contained in:
Rachael Alexanderson 2017-02-23 22:07:40 -05:00
commit e35be9c0a3
13 changed files with 1723 additions and 1645 deletions

View file

@ -165,10 +165,11 @@ protected: \
_X_CONSTRUCTOR_##isabstract(cls) \
_IMP_PCLASS(cls, _X_POINTERS_##ptrs(cls), _X_ABSTRACT_##isabstract(cls))
// Taking the address of a field in an object at address 1 instead of
// Taking the address of a field in an object at address > 0 instead of
// address 0 keeps GCC from complaining about possible misuse of offsetof.
// Using 8 to avoid unaligned pointer use.
#define IMPLEMENT_POINTERS_START(cls) const size_t cls::PointerOffsets[] = {
#define IMPLEMENT_POINTER(field) (size_t)&((ThisClass*)1)->field - 1,
#define IMPLEMENT_POINTER(field) ((size_t)&((ThisClass*)8)->field) - 8,
#define IMPLEMENT_POINTERS_END ~(size_t)0 };
// Possible arguments for the IMPLEMENT_CLASS macro

View file

@ -154,8 +154,7 @@ FSerializer &Serialize(FSerializer &arc, const char *key, wbplayerstruct_t &h, w
{
if (arc.BeginObject(key))
{
arc("in", h.in)
("kills", h.skills)
arc("kills", h.skills)
("items", h.sitems)
("secrets", h.ssecret)
("time", h.stime)

View file

@ -816,7 +816,6 @@ void G_DoCompleted (void)
for (i=0 ; i<MAXPLAYERS ; i++)
{
wminfo.plyr[i].in = playeringame[i];
wminfo.plyr[i].skills = players[i].killcount;
wminfo.plyr[i].sitems = players[i].itemcount;
wminfo.plyr[i].ssecret = players[i].secretcount;

View file

@ -6522,7 +6522,7 @@ ExpEmit FxCVar::Emit(VMFunctionBuilder *build)
case CVAR_String:
build->Emit(OP_LKP, addr.RegNum, build->GetConstantAddress(&static_cast<FStringCVar *>(CVar)->Value, ATAG_GENERIC));
build->Emit(OP_LS, dest.RegNum, addr.RegNum, nul);
build->Emit(OP_LCS, dest.RegNum, addr.RegNum, nul);
break;
case CVAR_DummyBool:

View file

@ -197,6 +197,16 @@ begin:
GETADDR(PB,RC,X_READ_NIL);
reg.s[a] = *(FString *)ptr;
NEXTOP;
OP(LCS):
ASSERTS(a); ASSERTA(B); ASSERTKD(C);
GETADDR(PB,KC,X_READ_NIL);
reg.s[a] = *(const char **)ptr;
NEXTOP;
OP(LCS_R):
ASSERTS(a); ASSERTA(B); ASSERTD(C);
GETADDR(PB,RC,X_READ_NIL);
reg.s[a] = *(const char **)ptr;
NEXTOP;
OP(LO):
ASSERTA(a); ASSERTA(B); ASSERTKD(C);
GETADDR(PB,KC,X_READ_NIL);

View file

@ -52,6 +52,8 @@ xx(LV2, lv2, RVRPKI, LV2_R, 4, REGT_INT), // load vector2
xx(LV2_R, lv2, RVRPRI, NOP, 0, 0),
xx(LV3, lv3, RVRPKI, LV3_R, 4, REGT_INT), // load vector3
xx(LV3_R, lv3, RVRPRI, NOP, 0, 0),
xx(LCS, lcs, RSRPKI, LCS_R, 4, REGT_INT), // load string from char ptr.
xx(LCS_R, lcs, RSRPRI, NOP, 0, 0),
xx(LBIT, lbit, RIRPI8, NOP, 0, 0), // rA = !!(*rB & C) -- *rB is a byte

File diff suppressed because it is too large Load diff

View file

@ -231,7 +231,7 @@ public:
int me; // wbs->pnum
EState state; // specifies current state
wbstartstruct_t *wbs; // contains information passed into intermission
wbplayerstruct_t*plrs; // wbs->plyr[]
wbplayerstruct_t* Plrs[MAXPLAYERS]; // wbs->plyr[]
int cnt; // used for general timing
int bcnt; // used for timing of background animation
int cnt_kills[MAXPLAYERS];
@ -1192,12 +1192,12 @@ public:
if (playeringame[i]
&& i!=playernum)
{
frags += plrs[playernum].frags[i];
frags += Plrs[playernum]->frags[i];
}
}
// JDC hack - negative frags.
frags -= plrs[playernum].frags[playernum];
frags -= Plrs[playernum]->frags[playernum];
return frags;
}
@ -1225,9 +1225,9 @@ public:
{
for (j = 0; j < MAXPLAYERS; j++)
if (playeringame[j])
player_deaths[i] += plrs[j].frags[i];
player_deaths[i] += Plrs[j]->frags[i];
total_deaths += player_deaths[i];
total_frags += plrs[i].fragcount;
total_frags += Plrs[i]->fragcount;
}
}
}
@ -1250,7 +1250,7 @@ public:
if (!playeringame[i])
continue;
cnt_frags[i] = plrs[i].fragcount;
cnt_frags[i] = Plrs[i]->fragcount;
cnt_deaths[i] = player_deaths[i];
}
S_Sound(CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
@ -1271,8 +1271,8 @@ public:
cnt_frags[i] += 2;
if (cnt_frags[i] > plrs[i].fragcount)
cnt_frags[i] = plrs[i].fragcount;
if (cnt_frags[i] > Plrs[i]->fragcount)
cnt_frags[i] = Plrs[i]->fragcount;
else
stillticking = true;
}
@ -1443,7 +1443,7 @@ public:
// Draw game time
y += height + CleanYfac;
int seconds = Tics2Seconds(plrs[me].stime);
int seconds = Tics2Seconds(Plrs[me]->stime);
int hours = seconds / 3600;
int minutes = (seconds % 3600) / 60;
seconds = seconds % 60;
@ -1502,9 +1502,9 @@ public:
if (!playeringame[i])
continue;
cnt_kills[i] = plrs[i].skills;
cnt_items[i] = plrs[i].sitems;
cnt_secret[i] = plrs[i].ssecret;
cnt_kills[i] = Plrs[i]->skills;
cnt_items[i] = Plrs[i]->sitems;
cnt_secret[i] = Plrs[i]->ssecret;
if (dofrags)
cnt_frags[i] = WI_fragSum (i);
@ -1527,8 +1527,8 @@ public:
cnt_kills[i] += 2;
if (cnt_kills[i] > plrs[i].skills)
cnt_kills[i] = plrs[i].skills;
if (cnt_kills[i] > Plrs[i]->skills)
cnt_kills[i] = Plrs[i]->skills;
else
stillticking = true;
}
@ -1552,8 +1552,8 @@ public:
continue;
cnt_items[i] += 2;
if (cnt_items[i] > plrs[i].sitems)
cnt_items[i] = plrs[i].sitems;
if (cnt_items[i] > Plrs[i]->sitems)
cnt_items[i] = Plrs[i]->sitems;
else
stillticking = true;
}
@ -1577,8 +1577,8 @@ public:
cnt_secret[i] += 2;
if (cnt_secret[i] > plrs[i].ssecret)
cnt_secret[i] = plrs[i].ssecret;
if (cnt_secret[i] > Plrs[i]->ssecret)
cnt_secret[i] = Plrs[i]->ssecret;
else
stillticking = true;
}
@ -1794,10 +1794,10 @@ public:
sp_state = 10;
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
cnt_kills[0] = plrs[me].skills;
cnt_items[0] = plrs[me].sitems;
cnt_secret[0] = plrs[me].ssecret;
cnt_time = Tics2Seconds(plrs[me].stime);
cnt_kills[0] = Plrs[me]->skills;
cnt_items[0] = Plrs[me]->sitems;
cnt_secret[0] = Plrs[me]->ssecret;
cnt_time = Tics2Seconds(Plrs[me]->stime);
cnt_par = wbs->partime / TICRATE;
cnt_total_time = Tics2Seconds(wbs->totaltime);
}
@ -1811,9 +1811,9 @@ public:
if (!(bcnt&3))
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/tick", 1, ATTN_NONE);
}
if (!gameinfo.intermissioncounter || cnt_kills[0] >= plrs[me].skills)
if (!gameinfo.intermissioncounter || cnt_kills[0] >= Plrs[me]->skills)
{
cnt_kills[0] = plrs[me].skills;
cnt_kills[0] = Plrs[me]->skills;
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
sp_state++;
}
@ -1827,9 +1827,9 @@ public:
if (!(bcnt&3))
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/tick", 1, ATTN_NONE);
}
if (!gameinfo.intermissioncounter || cnt_items[0] >= plrs[me].sitems)
if (!gameinfo.intermissioncounter || cnt_items[0] >= Plrs[me]->sitems)
{
cnt_items[0] = plrs[me].sitems;
cnt_items[0] = Plrs[me]->sitems;
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
sp_state++;
}
@ -1843,9 +1843,9 @@ public:
if (!(bcnt&3))
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/tick", 1, ATTN_NONE);
}
if (!gameinfo.intermissioncounter || cnt_secret[0] >= plrs[me].ssecret)
if (!gameinfo.intermissioncounter || cnt_secret[0] >= Plrs[me]->ssecret)
{
cnt_secret[0] = plrs[me].ssecret;
cnt_secret[0] = Plrs[me]->ssecret;
S_Sound (CHAN_VOICE | CHAN_UI, "intermission/nextstage", 1, ATTN_NONE);
sp_state++;
}
@ -1862,7 +1862,7 @@ public:
cnt_total_time += 3;
}
int sec = Tics2Seconds(plrs[me].stime);
int sec = Tics2Seconds(Plrs[me]->stime);
if (!gameinfo.intermissioncounter || cnt_time >= sec)
cnt_time = sec;
@ -2141,7 +2141,7 @@ public:
acceleratestage = 0;
cnt = bcnt = 0;
me = wbs->pnum;
plrs = wbs->plyr;
for (int i = 0; i < 8; i++) Plrs[i] = &wbs->plyr[i];
}
void WI_Start (wbstartstruct_t *wbstartstruct)
@ -2180,3 +2180,27 @@ void WI_Start(wbstartstruct_t *wbstartstruct)
{
WI_Screen.WI_Start(wbstartstruct);
}
DEFINE_FIELD_X(WBPlayerStruct, wbplayerstruct_t, skills);
DEFINE_FIELD_X(WBPlayerStruct, wbplayerstruct_t, sitems);
DEFINE_FIELD_X(WBPlayerStruct, wbplayerstruct_t, ssecret);
DEFINE_FIELD_X(WBPlayerStruct, wbplayerstruct_t, stime);
DEFINE_FIELD_X(WBPlayerStruct, wbplayerstruct_t, frags);
DEFINE_FIELD_X(WBPlayerStruct, wbplayerstruct_t, fragcount);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, finished_ep);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, next_ep);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, current);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, next);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, LName0);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, LName1);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, maxkills);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, maxitems);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, maxsecret);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, maxfrags);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, partime);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, sucktime);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, totaltime);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, pnum);
DEFINE_FIELD_X(WBStartStruct, wbstartstruct_t, plyr);

View file

@ -32,8 +32,6 @@ class FTexture;
//
struct wbplayerstruct_t
{
bool in; // whether the player is in game
// Player stats, kills, collected items etc.
int skills;
int sitems;

View file

@ -111,8 +111,6 @@ SPIDR0, 110, 111, iwad
SPIDS0, 98, 35, iwad
SPOSH0, 14, 60, iwad
SPOSL0, 24, 15, iwad
SSWVG0, 17, 55, iwad
SSWVH0, 17, 52, iwad
SSWVI0, 18, 54, iwad
SSWVJ0, 15, 44, iwad
SSWVK0, 15, 40, iwad

View file

@ -111,8 +111,6 @@ SPIDR0, 110, 111, iwad
SPIDS0, 98, 35, iwad
SPOSH0, 14, 60, iwad
SPOSL0, 24, 15, iwad
SSWVG0, 17, 55, iwad
SSWVH0, 17, 52, iwad
SSWVI0, 18, 54, iwad
SSWVJ0, 15, 44, iwad
SSWVK0, 15, 40, iwad

View file

@ -25,6 +25,8 @@
#include "zscript/menu/readthis.txt"
#include "zscript/menu/conversationmenu.txt"
#include "zscript/statscreen/types.txt"
#include "zscript/inventory/inventory.txt"
#include "zscript/inventory/inv_misc.txt"
#include "zscript/inventory/stateprovider.txt"

View file

@ -0,0 +1,43 @@
//
// INTERMISSION
// Structure passed e.g. to WI_Start(wb)
//
struct WBPlayerStruct native
{
// Player stats, kills, collected items etc.
native int skills;
native int sitems;
native int ssecret;
native int stime;
native int frags[MAXPLAYERS];
native int fragcount; // [RH] Cumulative frags for this player
}
struct WBStartStruct native
{
native int finished_ep;
native int next_ep;
native String current; // [RH] Name of map just finished
native String next; // next level, [RH] actual map name
native TextureID LName0;
native TextureID LName1;
native int maxkills;
native int maxitems;
native int maxsecret;
native int maxfrags;
// the par time and sucktime
native int partime; // in tics
native int sucktime; // in minutes
// total time for the entire current game
native int totaltime;
// index of this player in game
native int pnum;
}