Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision

Target

Select target project
  • STJr/SRB2
  • Sryder/SRB2
  • wolfy852/SRB2
  • Alpha2244/SRB2
  • Inuyasha/SRB2
  • yoshibot/SRB2
  • TehRealSalt/SRB2
  • PrisimaTF/SRB2
  • Hatninja/SRB2
  • SteelT/SRB2
  • james/SRB2
  • ShaderWraith/SRB2
  • SinnamonLat/SRB2
  • mazmazz_/SRB2
  • filpAM/SRB2
  • chaoloveicemdboy/SRB2
  • Whooa21/SRB2
  • Machturne/SRB2
  • Golden/SRB2
  • Tatsuru/SRB2
  • Snu/SRB2
  • Zwip-Zwap_Zapony/SRB2
  • fickleheart/SRB2
  • alphaRexJames/SRB2
  • JJK/SRB2
  • diskpoppy/SRB2
  • Hannu_Hanhi/SRB2
  • ZipperQR/SRB2
  • kays/SRB2
  • spherallic/SRB2
  • Zippy_Zolton/SRB2
  • namiishere/SRB2
  • Ors/SRB2
  • SMS_Alfredo/SRB2
  • sonic_edge/SRB2
  • lavla/SRB2
  • ashi/SRB2
  • X.organic/SRB2
  • Fafabis/SRB2
  • Meziu/SRB2
  • v-rob/SRB2
  • tertu/SRB2
  • bitten2up/SRB2
  • flarn2006/SRB2
  • Krabs/SRB2
  • clairebun/SRB2
  • Lactozilla/SRB2
  • thehackstack/SRB2
  • Spice/SRB2
  • win8linux/SRB2
  • JohnFrostFox/SRB2
  • talktoneon726/SRB2
  • Wane/SRB2
  • Lamibe/SRB2
  • spectrumuk2/srb-2
  • nerdyminer18/srb-2
  • 256nil/SRB2
  • ARJr/SRB2
  • Alam/SRB2
  • Zenya/srb-2-marathon-demos
  • Acelite/srb-2-archivedmodifications
  • MIDIMan/SRB2
  • Lach/SRB2
  • Frostiikin/bounce-tweaks
  • Jaden/SRB2
  • Tyron/SRB2
  • Astronight/SRB2
  • Mari0shi06/SRB2
  • aiire/SRB2
  • Galactice/SRB2
  • srb2-ports/srb2-dreamcast
  • sdasdas/SRB2
  • chreas/srb-2-vr
  • StarManiaKG/the-story-of-sinically-rocketing-and-botching-the-2nd
  • LoganAir/SRB2
  • NepDisk/srb-2
  • alufolie91/SRB2
  • Felicia.iso/SRB2
  • twi/SRB2
  • BarrelsOFun/SRB2
  • Speed2411/SRB2
  • Leather_Realms/SRB2
  • Ayemar/SRB2
  • Acelite/SRB2
  • VladDoc/SRB2
  • kaldrum/model-features
  • strawberryfox417/SRB2
  • Lugent/SRB2
  • Jisk/SRB2
  • Rem/SRB2
  • Refrag/SRB2
  • Henry_3230/srb-3230
  • TehPuertoRicanSpartan2/tprs-srb2
  • Leminn/srb-2-marathon-stuff
  • chromaticpipe2/SRB2
  • MiguelGustavo15/SRB2
  • Maru/srb-2-tests
  • SilicDev/SRB2
  • UnmatchedBracket/SRB2
  • HybridDog/SRB2
  • xordspar0/SRB2
  • jsjhbewfhh/SRB2
  • Fancy2209/SRB2
  • Lorsoen/SRB2
  • shindoukin/SRB2
  • GamerOfDays/SRB2
  • Craftyawesome/SRB2
  • tenshi-tensai-tennoji/SRB2
  • Scarfdudebalder/SRB2
  • luigi-budd/srb-2-fix-interplag-lockon
  • mskluesner/SRB2
  • johnpetersa19/SRB2
  • Pheazant/SRB2
  • chromaticpipe2/srb2classic
  • romoney5/SRB2
  • PAS/SRB2Classic
  • BlueStaggo/SRB2
117 results
Select Git revision
Show changes
Commits on Source (3)
...@@ -74,14 +74,14 @@ typedef struct ...@@ -74,14 +74,14 @@ typedef struct
INT16 textureoffset, rowoffset; INT16 textureoffset, rowoffset;
char toptexture[8], bottomtexture[8], midtexture[8]; char toptexture[8], bottomtexture[8], midtexture[8];
// Front sector, towards viewer. // Front sector, towards viewer.
INT16 sector; UINT16 sector;
} ATTRPACK mapsidedef_t; } ATTRPACK mapsidedef_t;
// A LineDef, as used for editing, and as input // A LineDef, as used for editing, and as input
// to the BSP builder. // to the BSP builder.
typedef struct typedef struct
{ {
INT16 v1, v2; UINT16 v1, v2;
INT16 flags; INT16 flags;
INT16 special; INT16 special;
INT16 tag; INT16 tag;
...@@ -163,9 +163,9 @@ typedef struct ...@@ -163,9 +163,9 @@ typedef struct
// using partition lines selected by BSP builder. // using partition lines selected by BSP builder.
typedef struct typedef struct
{ {
INT16 v1, v2; UINT16 v1, v2;
INT16 angle; INT16 angle;
INT16 linedef; UINT16 linedef;
INT16 side; INT16 side;
INT16 offset; INT16 offset;
} ATTRPACK mapseg_t; } ATTRPACK mapseg_t;
......
...@@ -3872,7 +3872,7 @@ void G_GhostAddColor(ghostcolor_t color) ...@@ -3872,7 +3872,7 @@ void G_GhostAddColor(ghostcolor_t color)
ghostext.color = (UINT8)color; ghostext.color = (UINT8)color;
} }
void G_GhostAddScale(UINT16 scale) void G_GhostAddScale(fixed_t scale)
{ {
if (!demorecording || !(demoflags & DF_GHOST)) if (!demorecording || !(demoflags & DF_GHOST))
return; return;
......
...@@ -139,7 +139,7 @@ void G_GhostAddSpin(void); ...@@ -139,7 +139,7 @@ void G_GhostAddSpin(void);
void G_GhostAddRev(void); void G_GhostAddRev(void);
void G_GhostAddColor(ghostcolor_t color); void G_GhostAddColor(ghostcolor_t color);
void G_GhostAddFlip(void); void G_GhostAddFlip(void);
void G_GhostAddScale(UINT16 scale); void G_GhostAddScale(fixed_t scale);
void G_GhostAddHit(mobj_t *victim); void G_GhostAddHit(mobj_t *victim);
void G_WriteGhostTic(mobj_t *ghost); void G_WriteGhostTic(mobj_t *ghost);
void G_ConsGhostTic(void); void G_ConsGhostTic(void);
......
...@@ -16,84 +16,118 @@ ...@@ -16,84 +16,118 @@
#include "lua_script.h" #include "lua_script.h"
#include "lua_libs.h" #include "lua_libs.h"
#define META_ITERATIONSTATE "iteration state"
static const char *const iter_opt[] = { static const char *const iter_opt[] = {
"all", "all",
"mobj", "mobj",
NULL}; NULL};
static int lib_iterateThinkers(lua_State *L) static const actionf_p1 iter_funcs[] = {
{ NULL,
int state = luaL_checkoption(L, 1, "mobj", iter_opt); (actionf_p1)P_MobjThinker
};
thinker_t *th = NULL; struct iterationState {
actionf_p1 searchFunc; actionf_p1 filter;
const char *searchMeta; int next;
};
lua_settop(L, 2); static int iterationState_gc(lua_State *L)
lua_remove(L, 1); // remove state now. {
struct iterationState *it = luaL_checkudata(L, -1, META_ITERATIONSTATE);
switch(state) if (it->next != LUA_REFNIL)
{ {
case 0: luaL_unref(L, LUA_REGISTRYINDEX, it->next);
searchFunc = NULL; it->next = LUA_REFNIL;
searchMeta = NULL;
break;
case 1:
default:
searchFunc = (actionf_p1)P_MobjThinker;
searchMeta = META_MOBJ;
break;
} }
return 0;
}
if (!lua_isnil(L, 1)) { #define push_thinker(th) {\
if (lua_islightuserdata(L, 1)) if ((th)->function.acp1 == (actionf_p1)P_MobjThinker) \
th = (thinker_t *)lua_touserdata(L, 1); LUA_PushUserdata(L, (th), META_MOBJ); \
else if (searchMeta) else \
th = *((thinker_t **)luaL_checkudata(L, 1, searchMeta)); lua_pushlightuserdata(L, (th)); \
else }
th = *((thinker_t **)lua_touserdata(L, 1));
} else
th = &thinkercap;
if (!th) // something got our userdata invalidated! static int lib_iterateThinkers(lua_State *L)
return 0; {
thinker_t *th = NULL, *next = NULL;
struct iterationState *it = luaL_checkudata(L, 1, META_ITERATIONSTATE);
lua_settop(L, 2);
if (searchFunc == NULL) if (lua_isnil(L, 2))
th = &thinkercap;
else if (lua_isuserdata(L, 2))
{ {
if ((th = th->next) != &thinkercap) if (lua_islightuserdata(L, 2))
th = lua_touserdata(L, 2);
else
{ {
if (th->function.acp1 == (actionf_p1)P_MobjThinker) th = *(thinker_t **)lua_touserdata(L, -1);
LUA_PushUserdata(L, th, META_MOBJ); if (!th)
else {
lua_pushlightuserdata(L, th); if (it->next == LUA_REFNIL)
return 1; return 0;
lua_rawgeti(L, LUA_REGISTRYINDEX, it->next);
if (lua_islightuserdata(L, -1))
next = lua_touserdata(L, -1);
else
next = *(thinker_t **)lua_touserdata(L, -1);
}
} }
return 0;
} }
for (th = th->next; th != &thinkercap; th = th->next) luaL_unref(L, LUA_REGISTRYINDEX, it->next);
{ it->next = LUA_REFNIL;
if (th->function.acp1 != searchFunc)
continue;
LUA_PushUserdata(L, th, searchMeta); if (th && !next)
return 1; next = th->next;
} if (!next)
return luaL_error(L, "next thinker invalidated during iteration");
for (; next != &thinkercap; next = next->next)
if (!it->filter || next->function.acp1 == it->filter)
{
push_thinker(next);
if (next->next != &thinkercap)
{
push_thinker(next->next);
it->next = luaL_ref(L, LUA_REGISTRYINDEX);
}
return 1;
}
return 0; return 0;
} }
static int lib_startIterate(lua_State *L) static int lib_startIterate(lua_State *L)
{ {
luaL_checkoption(L, 1, iter_opt[0], iter_opt); struct iterationState *it;
lua_pushcfunction(L, lib_iterateThinkers);
lua_pushvalue(L, 1); lua_pushvalue(L, lua_upvalueindex(1));
it = lua_newuserdata(L, sizeof(struct iterationState));
luaL_getmetatable(L, META_ITERATIONSTATE);
lua_setmetatable(L, -2);
it->filter = iter_funcs[luaL_checkoption(L, 1, "mobj", iter_opt)];
it->next = LUA_REFNIL;
return 2; return 2;
} }
#undef push_thinker
int LUA_ThinkerLib(lua_State *L) int LUA_ThinkerLib(lua_State *L)
{ {
luaL_newmetatable(L, META_ITERATIONSTATE);
lua_pushcfunction(L, iterationState_gc);
lua_setfield(L, -2, "__gc");
lua_pop(L, 1);
lua_createtable(L, 0, 1); lua_createtable(L, 0, 1);
lua_pushcfunction(L, lib_startIterate); lua_pushcfunction(L, lib_iterateThinkers);
lua_pushcclosure(L, lib_startIterate, 1);
lua_setfield(L, -2, "iterate"); lua_setfield(L, -2, "iterate");
lua_setglobal(L, "thinkers"); lua_setglobal(L, "thinkers");
return 0; return 0;
......
...@@ -425,7 +425,8 @@ static void P_LoadSegs(lumpnum_t lumpnum) ...@@ -425,7 +425,8 @@ static void P_LoadSegs(lumpnum_t lumpnum)
{ {
UINT8 *data; UINT8 *data;
size_t i; size_t i;
INT32 linedef, side; UINT16 linedef;
INT32 side;
mapseg_t *ml; mapseg_t *ml;
seg_t *li; seg_t *li;
line_t *ldef; line_t *ldef;
...@@ -440,8 +441,8 @@ static void P_LoadSegs(lumpnum_t lumpnum) ...@@ -440,8 +441,8 @@ static void P_LoadSegs(lumpnum_t lumpnum)
li = segs; li = segs;
for (i = 0; i < numsegs; i++, li++, ml++) for (i = 0; i < numsegs; i++, li++, ml++)
{ {
li->v1 = &vertexes[SHORT(ml->v1)]; li->v1 = &vertexes[(UINT16)SHORT(ml->v1)];
li->v2 = &vertexes[SHORT(ml->v2)]; li->v2 = &vertexes[(UINT16)SHORT(ml->v2)];
#ifdef HWRENDER // not win32 only 19990829 by Kin #ifdef HWRENDER // not win32 only 19990829 by Kin
// used for the hardware render // used for the hardware render
...@@ -455,7 +456,7 @@ static void P_LoadSegs(lumpnum_t lumpnum) ...@@ -455,7 +456,7 @@ static void P_LoadSegs(lumpnum_t lumpnum)
li->angle = (SHORT(ml->angle))<<FRACBITS; li->angle = (SHORT(ml->angle))<<FRACBITS;
li->offset = (SHORT(ml->offset))<<FRACBITS; li->offset = (SHORT(ml->offset))<<FRACBITS;
linedef = SHORT(ml->linedef); linedef = (UINT16)SHORT(ml->linedef);
ldef = &lines[linedef]; ldef = &lines[linedef];
li->linedef = ldef; li->linedef = ldef;
li->side = side = SHORT(ml->side); li->side = side = SHORT(ml->side);
...@@ -496,8 +497,8 @@ static inline void P_LoadSubsectors(lumpnum_t lumpnum) ...@@ -496,8 +497,8 @@ static inline void P_LoadSubsectors(lumpnum_t lumpnum)
for (i = 0; i < numsubsectors; i++, ss++, ms++) for (i = 0; i < numsubsectors; i++, ss++, ms++)
{ {
ss->sector = NULL; ss->sector = NULL;
ss->numlines = SHORT(ms->numsegs); ss->numlines = (UINT16)SHORT(ms->numsegs);
ss->firstline = SHORT(ms->firstseg); ss->firstline = (UINT16)SHORT(ms->firstseg);
#ifdef FLOORSPLATS #ifdef FLOORSPLATS
ss->splats = NULL; ss->splats = NULL;
#endif #endif
...@@ -775,7 +776,7 @@ static void P_LoadNodes(lumpnum_t lumpnum) ...@@ -775,7 +776,7 @@ static void P_LoadNodes(lumpnum_t lumpnum)
no->dy = SHORT(mn->dy)<<FRACBITS; no->dy = SHORT(mn->dy)<<FRACBITS;
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
{ {
no->children[j] = SHORT(mn->children[j]); no->children[j] = (UINT16)SHORT(mn->children[j]);
for (k = 0; k < 4; k++) for (k = 0; k < 4; k++)
no->bbox[j][k] = SHORT(mn->bbox[j][k])<<FRACBITS; no->bbox[j][k] = SHORT(mn->bbox[j][k])<<FRACBITS;
} }
...@@ -1163,8 +1164,8 @@ static void P_LoadLineDefs(lumpnum_t lumpnum) ...@@ -1163,8 +1164,8 @@ static void P_LoadLineDefs(lumpnum_t lumpnum)
ld->flags = SHORT(mld->flags); ld->flags = SHORT(mld->flags);
ld->special = SHORT(mld->special); ld->special = SHORT(mld->special);
ld->tag = SHORT(mld->tag); ld->tag = SHORT(mld->tag);
v1 = ld->v1 = &vertexes[SHORT(mld->v1)]; v1 = ld->v1 = &vertexes[(UINT16)SHORT(mld->v1)];
v2 = ld->v2 = &vertexes[SHORT(mld->v2)]; v2 = ld->v2 = &vertexes[(UINT16)SHORT(mld->v2)];
ld->dx = v2->x - v1->x; ld->dx = v2->x - v1->x;
ld->dy = v2->y - v1->y; ld->dy = v2->y - v1->y;
...@@ -1203,8 +1204,8 @@ static void P_LoadLineDefs(lumpnum_t lumpnum) ...@@ -1203,8 +1204,8 @@ static void P_LoadLineDefs(lumpnum_t lumpnum)
ld->bbox[BOXTOP] = v1->y; ld->bbox[BOXTOP] = v1->y;
} }
ld->sidenum[0] = SHORT(mld->sidenum[0]); ld->sidenum[0] = (UINT16)SHORT(mld->sidenum[0]);
ld->sidenum[1] = SHORT(mld->sidenum[1]); ld->sidenum[1] = (UINT16)SHORT(mld->sidenum[1]);
{ {
// cph 2006/09/30 - fix sidedef errors right away. // cph 2006/09/30 - fix sidedef errors right away.
...@@ -1381,7 +1382,7 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum) ...@@ -1381,7 +1382,7 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
sd->rowoffset = SHORT(msd->rowoffset)<<FRACBITS; sd->rowoffset = SHORT(msd->rowoffset)<<FRACBITS;
{ /* cph 2006/09/30 - catch out-of-range sector numbers; use sector 0 instead */ { /* cph 2006/09/30 - catch out-of-range sector numbers; use sector 0 instead */
UINT16 sector_num = SHORT(msd->sector); UINT16 sector_num = (UINT16)SHORT(msd->sector);
if (sector_num >= numsectors) if (sector_num >= numsectors)
{ {
...@@ -1394,7 +1395,7 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum) ...@@ -1394,7 +1395,7 @@ static void P_LoadSideDefs2(lumpnum_t lumpnum)
// refined to allow colormaps to work as wall textures if invalid as colormaps // refined to allow colormaps to work as wall textures if invalid as colormaps
// but valid as textures. // but valid as textures.
sd->sector = sec = &sectors[SHORT(msd->sector)]; sd->sector = sec = &sectors[(UINT16)SHORT(msd->sector)];
// Colormaps! // Colormaps!
switch (sd->special) switch (sd->special)
......