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
  • 21-installer-nodd
  • 2210-pre1
  • 2210-pre2
  • 2210-rc1
  • 2210-rc2
  • 2210-rc3
  • 2211-pre1
  • 2211-pre2
  • 2211-rc1
  • 2212-pre1
  • 2212-pre2
  • 2212-pre3
  • 2212-rc1
  • 2213
  • 2_2_12
  • 64-gl-log
  • COM_ImmedExecute-lua
  • DJGPP
  • accel-momentum
  • action-args
  • alpha-fixes
  • animated-textures-question-mark
  • animated-textures-with-model-features
  • any-resolution
  • appveyor
  • better-player-states
  • blend-locking
  • blentran
  • blua-unary-not-fix
  • boost-tickrate
  • bustablesoundz
  • cleanup-opengl
  • cleanupmusic
  • cmake-valgrind
  • crawlacommander-sprites
  • custom-map-names
  • custom-teams
  • cutscene-cleanup
  • dd-music-bypass
  • dd-music-fix
  • delfile2
  • deprecate-lua-dedicated-server
  • dpl-2
  • dropshadows-spawning
  • dynabsp
  • emblem-drawing
  • exchndl-xp-fix
  • few-kart-lua-changes
  • ffloorclip
  • fix-1215
  • fix-167
  • fix-cvar-conflicts
  • fix-equation-slopes-near-edges
  • fix-opengl-shear-roll
  • flipfuncpointers
  • fof-lightlist-fixes
  • font-FUCK
  • frictionrefactor
  • fuck-macros-1
  • gamepad-luakeydown
  • gamepad-morefixes
  • gamepad_experiments
  • gametype-refactor
  • gametype-refactor-1
  • gametype-refactor-player-spawns
  • ghost-networking
  • gif-splitting
  • gitlab-ci
  • grr-lj
  • hitboxviewer
  • hwr-texture-cache-refactor
  • hwrender2
  • improve-439
  • increase-packet-tics
  • input-display
  • input-display-translucency
  • io
  • joystick-juggling-maz
  • keycodes-only
  • ksf-wadfiles
  • ld413-mp-fix
  • levelstruct
  • libpng-version-support
  • linedef-actions
  • lj-test
  • lol-states
  • loopedsounds
  • lower-unpegged-fix
  • lua-change-gametype
  • lua-command-netids
  • lua-debug-library
  • lua-gfx-2
  • lua-gfx-sprites
  • lua-local
  • makefile-auto-mingw-gcc
  • makefile-tinkering
  • map-components-signedness-fixes
  • master
  • menu-edits
  • mobj-dispoffset
  • SRB2_release_2.1
  • SRB2_release_2.1.1
  • SRB2_release_2.1.10
  • SRB2_release_2.1.11
  • SRB2_release_2.1.12
  • SRB2_release_2.1.14
  • SRB2_release_2.1.15
  • SRB2_release_2.1.16
  • SRB2_release_2.1.16a
  • SRB2_release_2.1.17
  • SRB2_release_2.1.18
  • SRB2_release_2.1.19
  • SRB2_release_2.1.2
  • SRB2_release_2.1.20
  • SRB2_release_2.1.21
  • SRB2_release_2.1.22
  • SRB2_release_2.1.23
  • SRB2_release_2.1.24
  • SRB2_release_2.1.25
  • SRB2_release_2.1.3
  • SRB2_release_2.1.4
  • SRB2_release_2.1.5
  • SRB2_release_2.1.6
  • SRB2_release_2.1.7
  • SRB2_release_2.1.8
  • SRB2_release_2.1.9
  • SRB2_release_2.2.0
  • SRB2_release_2.2.1
  • SRB2_release_2.2.10
  • SRB2_release_2.2.11
  • SRB2_release_2.2.12
  • SRB2_release_2.2.13
  • SRB2_release_2.2.2
  • SRB2_release_2.2.3
  • SRB2_release_2.2.4
  • SRB2_release_2.2.5
  • SRB2_release_2.2.6
  • SRB2_release_2.2.7
  • SRB2_release_2.2.8
  • SRB2_release_2.2.9
  • td-release-v1.0.0
141 results

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
  • 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
  • BlueStaggo/SRB2
  • Jisk/srb-2-beef-jerky
  • voltybystorm/SRB2
  • ZenithNeko/srb-2-xp
  • Nep2Disk/SRB2
  • Cloudeon/SRB2
  • mushe/srb-2-ps-b
  • GlassCanonLover77/SRB2
  • PAS/SRB2
123 results
Select Git revision
Loading items
Show changes
Showing with 1081 additions and 1304 deletions
......@@ -231,34 +231,52 @@ static void F_DoWipe(fademask_t *fademask)
maskx = masky = 0;
do
{
// pointer to transtable that this mask would use
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
// (ignore that it goes out of bounds if *mask is 0 or 10 --
// it wouldn't be used in those cases anyway)
draw_rowstart = scrxpos[maskx];
draw_rowend = scrxpos[maskx + 1];
draw_linestart = scrypos[masky];
draw_lineend = scrypos[masky + 1];
// DRAWING LOOP
relativepos = (draw_linestart * vid.width) + draw_rowstart;
draw_linestogo = draw_lineend - draw_linestart;
if (*mask == 0)
{
// shortcut - memcpy source to work
while (draw_linestogo--)
{
M_Memcpy(w_base+relativepos, s_base+relativepos, draw_rowend-draw_rowstart);
relativepos += vid.width;
}
}
else if (*mask == 10)
{
// shortcut - memcpy target to work
while (draw_linestogo--)
{
M_Memcpy(w_base+relativepos, e_base+relativepos, draw_rowend-draw_rowstart);
relativepos += vid.width;
}
}
else
{
// pointer to transtable that this mask would use
transtbl = transtables + ((9 - *mask)<<FF_TRANSSHIFT);
// DRAWING LOOP
while (draw_linestogo--)
{
w = w_base + relativepos;
s = s_base + relativepos;
e = e_base + relativepos;
draw_rowstogo = draw_rowend - draw_rowstart;
while (draw_rowstogo--)
{
if (*s != *e)
*w = ((*mask == 0) ? *s : (*mask == 10) ? *e : transtbl[(*e<<8) + *s]);
++w, ++s, ++e;
}
*w++ = transtbl[ ( *e++ << 8 ) + *s++ ];
relativepos += vid.width;
}
// END DRAWING LOOP
}
if (++maskx >= fademask->width)
++masky, maskx = 0;
......
......@@ -297,9 +297,6 @@ static CV_PossibleValue_t joyaxis_cons_t[] = {{0, "None"},
#if JOYAXISSET > 3
{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"},
#endif
#if JOYAXISSET > 3
{7, "Pitch"}, {8, "Roll"}, {-7, "Pitch-"}, {-8, "Roll-"},
#endif
#if JOYAXISSET > 4
{7, "Yaw"}, {8, "Dummy"}, {-7, "Yaw-"}, {-8, "Dummy-"},
#endif
......@@ -2180,8 +2177,7 @@ void G_PlayerReborn(INT32 player)
p->health = 1; // 0 rings
p->panim = PA_IDLE; // standing animation
if ((netgame || multiplayer) && !p->spectator
&& gametype != GT_RACE)
if ((netgame || multiplayer) && !p->spectator)
p->powers[pw_flashing] = flashingtics-1; // Babysitting deterrent
if (p-players == consoleplayer)
......@@ -4330,20 +4326,10 @@ void G_GhostTicker(void)
switch(g->color)
{
case GHC_SUPER: // Super Sonic (P_DoSuperStuff)
// Yousa yellow now!
g->mo->color = SKINCOLOR_SUPER1 + (leveltime/2) % 5;
if (g->mo->skin)
switch (((skin_t*)g->mo->skin)-skins)
{
case 1: // Golden orange supertails.
g->mo->color = SKINCOLOR_TSUPER1 + (leveltime/2) % 5;
break;
case 2: // Pink superknux.
g->mo->color = SKINCOLOR_KSUPER1 + (leveltime/2) % 5;
break;
default:
break;
}
if (leveltime % 9 < 5)
g->mo->color = SKINCOLOR_SUPER1 + leveltime % 9;
else
g->mo->color = SKINCOLOR_SUPER1 + 9 - leveltime % 9;
break;
case GHC_INVINCIBLE: // Mario invincibility (P_CheckInvincibilityTimer)
g->mo->color = (UINT8)(leveltime % MAXSKINCOLORS);
......
......@@ -1041,13 +1041,13 @@ INT32 G_KeyStringtoNum(const char *keystr)
if (!keystr[1] && keystr[0] > ' ' && keystr[0] <= 'z')
return keystr[0];
if (!strncmp(keystr, "KEY", 3) && keystr[3] >= '0' && keystr[3] <= '9')
return atoi(&keystr[3]);
for (j = 0; j < NUMKEYNAMES; j++)
if (!stricmp(keynames[j].name, keystr))
return keynames[j].keynum;
if (strlen(keystr) > 3)
return atoi(&keystr[3]);
return 0;
}
......
......@@ -79,6 +79,7 @@ typedef struct gr_vissprite_s
boolean vflip;
//Hurdler: 25/04/2000: now support colormap in hardware mode
UINT8 *colormap;
INT32 dispoffset; // copy of info->dispoffset, affects ordering but not drawing
} gr_vissprite_t;
// --------
......
......@@ -3505,119 +3505,11 @@ static boolean HWR_DoCulling(line_t *cullheight, line_t *viewcullheight, float v
return false;
}
// -----------------+
// HWR_DrawSprite : Draw flat sprites
// : (monsters, bonuses, weapons, lights, ...)
// Returns :
// -----------------+
static void HWR_DrawSprite(gr_vissprite_t *spr)
static void HWR_DrawSpriteShadow(gr_vissprite_t *spr, GLPatch_t *gpatch, float this_scale)
{
UINT8 i;
float tr_x, tr_y, this_scale = 1.0f;
FOutVector wallVerts[4];
float tr_x, tr_y;
FOutVector *wv;
GLPatch_t *gpatch; // sprite patch converted to hardware
FSurfaceInfo Surf;
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES);
if (spr->mobj)
this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
if (hires)
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)spr->mobj->skin)->highresscale);
if (!spr->mobj)
return;
if (!spr->mobj->subsector)
return;
// cache sprite graphics
//12/12/99: Hurdler:
// OK, I don't change anything for MD2 support because I want to be
// sure to do it the right way. So actually, we keep normal sprite
// in memory and we add the md2 model if it exists for that sprite
gpatch = W_CachePatchNum(spr->patchlumpnum, PU_CACHE);
#ifdef ALAM_LIGHTING
if (!(spr->mobj->flags2 & MF2_DEBRIS) && (spr->mobj->sprite != SPR_PLAY ||
(spr->mobj->player && spr->mobj->player->powers[pw_super])))
HWR_DL_AddLight(spr, gpatch);
#endif
// create the sprite billboard
//
// 3--2
// | /|
// |/ |
// 0--1
// these were already scaled in HWR_ProjectSprite
wallVerts[0].x = wallVerts[3].x = spr->x1;
wallVerts[2].x = wallVerts[1].x = spr->x2;
wallVerts[2].y = wallVerts[3].y = spr->ty;
if (spr->mobj && this_scale != 1.0f)
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height * this_scale;
else
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height;
// make a wall polygon (with 2 triangles), using the floor/ceiling heights,
// and the 2d map coords of start/end vertices
wallVerts[0].z = wallVerts[1].z = wallVerts[2].z = wallVerts[3].z = spr->tz;
// transform
wv = wallVerts;
for (i = 0; i < 4; i++,wv++)
{
//look up/down ----TOTAL SUCKS!!!--- do the 2 in one!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
tr_x = wv->z;
tr_y = wv->y;
wv->y = (tr_x * gr_viewludcos) + (tr_y * gr_viewludsin);
wv->z = (tr_x * gr_viewludsin) - (tr_y * gr_viewludcos);
// ---------------------- mega lame test ----------------------------------
//scale y before frustum so that frustum can be scaled to screen height
wv->y *= ORIGINAL_ASPECT * gr_fovlud;
wv->x *= gr_fovlud;
}
if (spr->flip)
{
wallVerts[0].sow = wallVerts[3].sow = gpatch->max_s;
wallVerts[2].sow = wallVerts[1].sow = 0;
}else{
wallVerts[0].sow = wallVerts[3].sow = 0;
wallVerts[2].sow = wallVerts[1].sow = gpatch->max_s;
}
// flip the texture coords (look familiar?)
if (spr->vflip)
{
wallVerts[3].tow = wallVerts[2].tow = gpatch->max_t;
wallVerts[0].tow = wallVerts[1].tow = 0;
}else{
wallVerts[3].tow = wallVerts[2].tow = 0;
wallVerts[0].tow = wallVerts[1].tow = gpatch->max_t;
}
// cache the patch in the graphics card memory
//12/12/99: Hurdler: same comment as above (for md2)
//Hurdler: 25/04/2000: now support colormap in hardware mode
HWR_GetMappedPatch(gpatch, spr->colormap);
// Draw shadow BEFORE sprite
if (cv_shadow.value // Shadows enabled
&& !(spr->mobj->flags & MF_SCENERY && spr->mobj->flags & MF_SPAWNCEILING && spr->mobj->flags & MF_NOGRAVITY) // Ceiling scenery have no shadow.
&& !(spr->mobj->flags2 & MF2_DEBRIS) // Debris have no corona or shadow.
#ifdef ALAM_LIGHTING
&& !(t_lspr[spr->mobj->sprite]->type // Things with dynamic lights have no shadow.
&& (!spr->mobj->player || spr->mobj->player->powers[pw_super])) // Except for non-super players.
#endif
&& (spr->mobj->z >= spr->mobj->floorz)) // Without this, your shadow shows on the floor, even after you die and fall through the ground.
{
////////////////////
// SHADOW SPRITE! //
////////////////////
FOutVector swallVerts[4];
FSurfaceInfo sSurf;
fixed_t floorheight, mobjfloor;
......@@ -3644,7 +3536,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
// The shadow is falling ABOVE it's mobj?
// Don't draw it, then!
if (spr->mobj->z < floorheight)
goto noshadow;
return;
else
{
fixed_t floorz;
......@@ -3655,7 +3547,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
// The shadow would be falling on a wall? Don't draw it, then.
// Would draw midair otherwise.
if (floorz < floorheight)
goto noshadow;
return;
}
floorheight = FixedInt(spr->mobj->z - floorheight);
......@@ -3744,7 +3636,7 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
/*if (spr->mobj->frame & FF_TRANSMASK || spr->mobj->flags2 & MF2_SHADOW)
{
sector_t *sector = spr->mobj->subsector->sector;
UINT8 lightlevel = sector->lightlevel;
UINT8 lightlevel = 255;
extracolormap_t *colormap = sector->extra_colormap;
if (sector->numlights)
......@@ -3753,8 +3645,6 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *sector->lightlist[light].lightlevel;
else
lightlevel = 255;
if (sector->lightlist[light].extra_colormap)
colormap = sector->lightlist[light].extra_colormap;
......@@ -3774,8 +3664,8 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
}*/
// shadow is always half as translucent as the sprite itself
if (!cv_translucency.value)
; // translucency disabled
if (!cv_translucency.value) // use default translucency (main sprite won't have any translucency)
sSurf.FlatColor.s.alpha = 0x80; // default
else if (spr->mobj->flags2 & MF2_SHADOW)
sSurf.FlatColor.s.alpha = 0x20;
else if (spr->mobj->frame & FF_TRANSMASK)
......@@ -3786,18 +3676,128 @@ static void HWR_DrawSprite(gr_vissprite_t *spr)
else
sSurf.FlatColor.s.alpha = 0x80; // default
/// \todo do the test earlier
if (!cv_grmd2.value || (md2_models[spr->mobj->sprite].scale < 0.0f) || (md2_models[spr->mobj->sprite].notfound = true) || (md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f) || (md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound = true))
{
if (sSurf.FlatColor.s.alpha > floorheight/4)
{
sSurf.FlatColor.s.alpha = (UINT8)(sSurf.FlatColor.s.alpha - floorheight/4);
HWD.pfnDrawPolygon(&sSurf, swallVerts, 4, PF_Translucent|PF_Modulated|PF_Clip);
}
}
// -----------------+
// HWR_DrawSprite : Draw flat sprites
// : (monsters, bonuses, weapons, lights, ...)
// Returns :
// -----------------+
static void HWR_DrawSprite(gr_vissprite_t *spr)
{
UINT8 i;
float tr_x, tr_y, this_scale = 1.0f;
FOutVector wallVerts[4];
FOutVector *wv;
GLPatch_t *gpatch; // sprite patch converted to hardware
FSurfaceInfo Surf;
const boolean hires = (spr->mobj && spr->mobj->skin && ((skin_t *)spr->mobj->skin)->flags & SF_HIRES);
if (spr->mobj)
this_scale = FIXED_TO_FLOAT(spr->mobj->scale);
if (hires)
this_scale = this_scale * FIXED_TO_FLOAT(((skin_t *)spr->mobj->skin)->highresscale);
if (!spr->mobj)
return;
if (!spr->mobj->subsector)
return;
// cache sprite graphics
//12/12/99: Hurdler:
// OK, I don't change anything for MD2 support because I want to be
// sure to do it the right way. So actually, we keep normal sprite
// in memory and we add the md2 model if it exists for that sprite
gpatch = W_CachePatchNum(spr->patchlumpnum, PU_CACHE);
#ifdef ALAM_LIGHTING
if (!(spr->mobj->flags2 & MF2_DEBRIS) && (spr->mobj->sprite != SPR_PLAY ||
(spr->mobj->player && spr->mobj->player->powers[pw_super])))
HWR_DL_AddLight(spr, gpatch);
#endif
// create the sprite billboard
//
// 3--2
// | /|
// |/ |
// 0--1
// these were already scaled in HWR_ProjectSprite
wallVerts[0].x = wallVerts[3].x = spr->x1;
wallVerts[2].x = wallVerts[1].x = spr->x2;
wallVerts[2].y = wallVerts[3].y = spr->ty;
if (spr->mobj && this_scale != 1.0f)
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height * this_scale;
else
wallVerts[0].y = wallVerts[1].y = spr->ty - gpatch->height;
// make a wall polygon (with 2 triangles), using the floor/ceiling heights,
// and the 2d map coords of start/end vertices
wallVerts[0].z = wallVerts[1].z = wallVerts[2].z = wallVerts[3].z = spr->tz;
// transform
wv = wallVerts;
for (i = 0; i < 4; i++,wv++)
{
//look up/down ----TOTAL SUCKS!!!--- do the 2 in one!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
tr_x = wv->z;
tr_y = wv->y;
wv->y = (tr_x * gr_viewludcos) + (tr_y * gr_viewludsin);
wv->z = (tr_x * gr_viewludsin) - (tr_y * gr_viewludcos);
// ---------------------- mega lame test ----------------------------------
//scale y before frustum so that frustum can be scaled to screen height
wv->y *= ORIGINAL_ASPECT * gr_fovlud;
wv->x *= gr_fovlud;
}
if (spr->flip)
{
wallVerts[0].sow = wallVerts[3].sow = gpatch->max_s;
wallVerts[2].sow = wallVerts[1].sow = 0;
}else{
wallVerts[0].sow = wallVerts[3].sow = 0;
wallVerts[2].sow = wallVerts[1].sow = gpatch->max_s;
}
// flip the texture coords (look familiar?)
if (spr->vflip)
{
wallVerts[3].tow = wallVerts[2].tow = gpatch->max_t;
wallVerts[0].tow = wallVerts[1].tow = 0;
}else{
wallVerts[3].tow = wallVerts[2].tow = 0;
wallVerts[0].tow = wallVerts[1].tow = gpatch->max_t;
}
noshadow:
// cache the patch in the graphics card memory
//12/12/99: Hurdler: same comment as above (for md2)
//Hurdler: 25/04/2000: now support colormap in hardware mode
HWR_GetMappedPatch(gpatch, spr->colormap);
// Draw shadow BEFORE sprite
if (cv_shadow.value // Shadows enabled
&& (spr->mobj->flags & (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY)) != (MF_SCENERY|MF_SPAWNCEILING|MF_NOGRAVITY) // Ceiling scenery have no shadow.
&& !(spr->mobj->flags2 & MF2_DEBRIS) // Debris have no corona or shadow.
#ifdef ALAM_LIGHTING
&& !(t_lspr[spr->mobj->sprite]->type // Things with dynamic lights have no shadow.
&& (!spr->mobj->player || spr->mobj->player->powers[pw_super])) // Except for non-super players.
#endif
&& (spr->mobj->z >= spr->mobj->floorz)) // Without this, your shadow shows on the floor, even after you die and fall through the ground.
{
////////////////////
// SHADOW SPRITE! //
////////////////////
HWR_DrawSpriteShadow(spr, gpatch, this_scale);
}
// This needs to be AFTER the shadows so that the regular sprites aren't drawn completely black.
// sprite lighting by modulating the RGB components
......@@ -3806,7 +3806,7 @@ noshadow:
// colormap test
{
sector_t *sector = spr->mobj->subsector->sector;
UINT8 lightlevel = sector->lightlevel;
UINT8 lightlevel = 255;
extracolormap_t *colormap = sector->extra_colormap;
if (sector->numlights)
......@@ -3817,8 +3817,6 @@ noshadow:
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *sector->lightlist[light].lightlevel;
else
lightlevel = 255;
if (sector->lightlist[light].extra_colormap)
colormap = sector->lightlist[light].extra_colormap;
......@@ -3827,27 +3825,25 @@ noshadow:
{
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = sector->lightlevel;
else
lightlevel = 255;
if (sector->extra_colormap)
colormap = sector->extra_colormap;
}
if (spr->mobj->frame & FF_FULLBRIGHT)
lightlevel = 255;
if (colormap)
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
else
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
}
/// \todo do the test earlier
if (!cv_grmd2.value || (md2_models[spr->mobj->sprite].scale < 0.0f))
{
FBITFIELD blend = 0;
if (spr->mobj->flags2 & MF2_SHADOW)
if (!cv_translucency.value) // translucency disabled
{
Surf.FlatColor.s.alpha = 0xFF;
blend = PF_Translucent|PF_Occlude;
}
else if (spr->mobj->flags2 & MF2_SHADOW)
{
Surf.FlatColor.s.alpha = 0x40;
blend = PF_Translucent;
......@@ -3980,6 +3976,7 @@ static void HWR_SortVisSprites(void)
gr_vissprite_t *best = NULL;
gr_vissprite_t unsorted;
float bestdist;
INT32 bestdispoffset;
if (!gr_visspritecount)
return;
......@@ -4007,11 +4004,19 @@ static void HWR_SortVisSprites(void)
for (i = 0; i < gr_visspritecount; i++)
{
bestdist = ZCLIP_PLANE-1;
bestdispoffset = INT32_MAX;
for (ds = unsorted.next; ds != &unsorted; ds = ds->next)
{
if (ds->tz > bestdist)
{
bestdist = ds->tz;
bestdispoffset = ds->dispoffset;
best = ds;
}
// order visprites of same scale by dispoffset, smallest first
else if (ds->tz == bestdist && ds->dispoffset < bestdispoffset)
{
bestdispoffset = ds->dispoffset;
best = ds;
}
}
......@@ -4368,10 +4373,10 @@ static void HWR_DrawSprites(void)
#endif
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
{
if (!cv_grmd2.value || (cv_grmd2.value && md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound == true))
if (!cv_grmd2.value || md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound || md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale < 0.0f)
HWR_DrawSprite(spr);
}
else if (!cv_grmd2.value || (cv_grmd2.value && md2_models[spr->mobj->sprite].notfound == true))
else if (!cv_grmd2.value || md2_models[spr->mobj->sprite].notfound || md2_models[spr->mobj->sprite].scale < 0.0f)
HWR_DrawSprite(spr);
}
}
......@@ -4397,7 +4402,7 @@ static void HWR_DrawMD2S(void)
#endif
if (spr->mobj && spr->mobj->skin && spr->mobj->sprite == SPR_PLAY)
{
if ((md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound == false) && (md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale > 0.0f))
if (md2_playermodels[(skin_t*)spr->mobj->skin-skins].notfound == false && md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale > 0.0f)
HWR_DrawMD2(spr);
}
else if (md2_models[spr->mobj->sprite].notfound == false && md2_models[spr->mobj->sprite].scale > 0.0f)
......@@ -4439,23 +4444,12 @@ static void HWR_AddSprites(sector_t *sec)
// If a limit exists, handle things a tiny bit different.
if ((limit_dist = (fixed_t)((maptol & TOL_NIGHTS) ? cv_drawdist_nights.value : cv_drawdist.value) << FRACBITS))
{
if (!players[displayplayer].mo)
return; // Draw nothing if no player.
// todo: is this really the best option for this situation?
for (thing = sec->thinglist; thing; thing = thing->snext)
{
if (thing->sprite == SPR_NULL || thing->flags2 & MF2_DONTDRAW)
continue;
approx_dist = P_AproxDistance(
players[displayplayer].mo->x - thing->x,
players[displayplayer].mo->y - thing->y);
if (splitscreen && approx_dist > limit_dist && players[secondarydisplayplayer].mo)
approx_dist = P_AproxDistance(
players[secondarydisplayplayer].mo->x - thing->x,
players[secondarydisplayplayer].mo->y - thing->y);
approx_dist = P_AproxDistance(viewx-thing->x, viewy-thing->y);
if (approx_dist <= limit_dist)
HWR_ProjectSprite(thing);
......@@ -4473,23 +4467,12 @@ static void HWR_AddSprites(sector_t *sec)
// Someone seriously wants infinite draw distance for precipitation?
if ((limit_dist = (fixed_t)cv_drawdist_precip.value << FRACBITS))
{
if (!players[displayplayer].mo)
return; // Draw nothing if no player.
// todo: is this really the best option for this situation?
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
{
if (precipthing->invisible)
if (precipthing->precipflags & PCF_INVISIBLE)
continue;
approx_dist = P_AproxDistance(
players[displayplayer].mo->x - precipthing->x,
players[displayplayer].mo->y - precipthing->y);
if (splitscreen && approx_dist > limit_dist && players[secondarydisplayplayer].mo)
approx_dist = P_AproxDistance(
players[secondarydisplayplayer].mo->x - precipthing->x,
players[secondarydisplayplayer].mo->y - precipthing->y);
approx_dist = P_AproxDistance(viewx-precipthing->x, viewy-precipthing->y);
if (approx_dist <= limit_dist)
HWR_ProjectPrecipitationSprite(precipthing);
......@@ -4499,7 +4482,7 @@ static void HWR_AddSprites(sector_t *sec)
{
// Draw everything in sector, no checks
for (precipthing = sec->preciplist; precipthing; precipthing = precipthing->snext)
if (!precipthing->invisible)
if (!(precipthing->precipflags & PCF_INVISIBLE))
HWR_ProjectPrecipitationSprite(precipthing);
}
#endif
......@@ -4560,10 +4543,11 @@ static void HWR_ProjectSprite(mobj_t *thing)
if (rot >= sprdef->numframes)
{
CONS_Alert(CONS_ERROR, M_GetText("R_ProjectSprite: invalid sprite frame %s/%s for %s\n"),
CONS_Alert(CONS_ERROR, M_GetText("HWR_ProjectSprite: invalid sprite frame %s/%s for %s\n"),
sizeu1(rot), sizeu2(sprdef->numframes), sprnames[thing->sprite]);
thing->sprite = states[S_UNKNOWN].sprite;
thing->frame = states[S_UNKNOWN].frame;
sprdef = &sprites[thing->sprite];
rot = thing->frame&FF_FRAMEMASK;
thing->state->sprite = thing->sprite;
thing->state->frame = thing->frame;
......@@ -4656,6 +4640,7 @@ static void HWR_ProjectSprite(mobj_t *thing)
#endif
vis->x2 = tx;
vis->tz = tz;
vis->dispoffset = thing->info->dispoffset; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
vis->patchlumpnum = sprframe->lumppat[rot];
vis->flip = flip;
vis->mobj = thing;
......@@ -4772,6 +4757,7 @@ static void HWR_ProjectPrecipitationSprite(precipmobj_t *thing)
vis->x1 = x1;
vis->x2 = tx;
vis->tz = tz;
vis->dispoffset = 0; // Monster Iestyn: 23/11/15: HARDWARE SUPPORT AT LAST
vis->patchlumpnum = sprframe->lumppat[rot];
vis->flip = flip;
vis->mobj = (mobj_t *)thing;
......
......@@ -975,24 +975,25 @@ void HWR_InitMD2(void)
}
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
{
if (stricmp(name, "PLAY") == 0)
{
CONS_Printf("MD2 for sprite PLAY detected in md2.dat, use a player skin instead!\n");
continue;
}
for (i = 0; i < NUMSPRITES; i++)
{
if (stricmp(name, sprnames[i]) == 0)
{
if (stricmp(name, "PLAY") == 0)
continue;
//if (stricmp(name, "PLAY") == 0)
//continue;
//CONS_Debug(DBG_RENDER, " Found: %s %s %f %f\n", name, filename, scale, offset);
md2_models[i].scale = scale;
md2_models[i].offset = offset;
md2_models[i].notfound = false;
strcpy(md2_models[i].filename, filename);
break;
}
if (i == NUMSPRITES)
{
CONS_Printf("MD2 for sprite %s not found\n", name);
md2_models[i].notfound = true;
goto md2found;
}
}
......@@ -1006,15 +1007,14 @@ void HWR_InitMD2(void)
md2_playermodels[s].offset = offset;
md2_playermodels[s].notfound = false;
strcpy(md2_playermodels[s].filename, filename);
break;
}
if (s == MAXSKINS-1)
{
CONS_Printf("MD2 for player skin %s not found\n", name);
md2_playermodels[s].notfound = true;
goto md2found;
}
}
// no sprite/player skin name found?!?
CONS_Printf("Unknown sprite/player skin %s detected in md2.dat\n", name);
md2found:
// move on to next line...
continue;
}
fclose(f);
}
......@@ -1050,17 +1050,14 @@ void HWR_AddPlayerMD2(int skin) // For MD2's that were added after startup
md2_playermodels[skin].offset = offset;
md2_playermodels[skin].notfound = false;
strcpy(md2_playermodels[skin].filename, filename);
break;
}
if (skin == MAXSKINS-1)
{
CONS_Printf("MD2 for player skin %s not found\n", name);
md2_playermodels[skin].notfound = true;
goto playermd2found;
}
}
//CONS_Printf("MD2 for player skin %s not found\n", skins[skin].name);
md2_playermodels[skin].notfound = true;
playermd2found:
fclose(f);
}
......@@ -1075,6 +1072,9 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
if (nomd2s)
return;
if (spritenum == SPR_PLAY) // Handled already NEWMD2: Per sprite, per-skin check
return;
// Read the md2.dat file
f = fopen("md2.dat", "rt");
......@@ -1087,28 +1087,20 @@ void HWR_AddSpriteMD2(size_t spritenum) // For MD2s that were added after startu
// Check for any MD2s that match the names of player skins!
while (fscanf(f, "%19s %31s %f %f", name, filename, &scale, &offset) == 4)
{
{
if (stricmp(name, sprnames[spritenum]) == 0)
{
if (stricmp(name, "PLAY") == 0) // Handled already NEWMD2: Per sprite, per-skin check
continue;
md2_models[spritenum].scale = scale;
md2_models[spritenum].offset = offset;
md2_models[spritenum].notfound = false;
strcpy(md2_models[spritenum].filename, filename);
break;
}
if (spritenum == NUMSPRITES-1)
{
CONS_Printf("MD2 for sprite %s not found\n", name);
md2_models[spritenum].notfound = true;
}
goto spritemd2found;
}
}
//CONS_Printf("MD2 for sprite %s not found\n", sprnames[spritenum]);
md2_models[spritenum].notfound = true;
spritemd2found:
fclose(f);
}
......@@ -1386,11 +1378,17 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
md2_t *md2;
UINT8 color[4];
if (!cv_grmd2.value)
return;
if (spr->precip)
return;
// MD2 colormap fix
// colormap test
{
sector_t *sector = spr->mobj->subsector->sector;
UINT8 lightlevel = sector->lightlevel;
UINT8 lightlevel = 255;
extracolormap_t *colormap = sector->extra_colormap;
if (sector->numlights)
......@@ -1401,8 +1399,6 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = *sector->lightlist[light].lightlevel;
else
lightlevel = 255;
if (sector->lightlist[light].extra_colormap)
colormap = sector->lightlist[light].extra_colormap;
......@@ -1411,24 +1407,18 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
{
if (!(spr->mobj->frame & FF_FULLBRIGHT))
lightlevel = sector->lightlevel;
else
lightlevel = 255;
if (sector->extra_colormap)
colormap = sector->extra_colormap;
}
if (spr->mobj->frame & FF_FULLBRIGHT)
lightlevel = 255;
if (colormap)
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, colormap->rgba, colormap->fadergba, false, false);
else
Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false);
}
// Look at HWR_ProjetctSprite for more
if (cv_grmd2.value && ((md2_models[spr->mobj->sprite].scale > 0.0f) || (md2_playermodels[(skin_t*)spr->mobj->skin-skins].scale > 0.0f)) && !spr->precip)
// Look at HWR_ProjectSprite for more
{
GLPatch_t *gpatch;
INT32 *buff;
......@@ -1445,15 +1435,11 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
//durs = tics;
if (spr->mobj->flags2 & MF2_SHADOW)
{
Surf.FlatColor.s.alpha = 0x40;
}
else if (spr->mobj->frame & FF_TRANSMASK)
HWR_TranstableToAlpha((spr->mobj->frame & FF_TRANSMASK)>>FF_TRANSSHIFT, &Surf);
else
{
Surf.FlatColor.s.alpha = 0xFF;
}
// dont forget to enabled the depth test because we can't do this like
// before: polygons models are not sorted
......@@ -1571,8 +1557,6 @@ void HWR_DrawMD2(gr_vissprite_t *spr)
p.flip = false;
HWD.pfnDrawMD2i(buff, curr, durs, tics, next, &p, finalscale, flip, color);
}
}
......
......@@ -1910,6 +1910,13 @@ EXPORT void HWRAPI(DrawMD2i) (INT32 *gl_cmd_buffer, md2_frame_t *frame, UINT32 d
pglRotatef(pos->anglex, -1.0f, 0.0f, 0.0f);
//pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
// Remove depth mask when the model is transparent so it doesn't cut thorugh sprites // SRB2CBTODO: For all stuff too?!
if (color[3] < 255)
{
pglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // alpha = level of transparency
pglDepthMask(GL_FALSE);
}
val = *gl_cmd_buffer++;
while (val != 0)
......
......@@ -150,8 +150,7 @@ state_t states[NUMSTATES] =
{SPR_PLAY, 34, 1, {NULL}, 0, 24, S_PLAY_SIGN}, // S_PLAY_SIGN
 
// Blue Crawla
{SPR_POSS, 0, 5, {A_Look}, 0, 0, S_POSS_STND2}, // S_POSS_STND
{SPR_POSS, 0, 5, {A_Look}, 0, 0, S_POSS_STND}, // S_POSS_STND2
{SPR_POSS, 0, 5, {A_Look}, 0, 0, S_POSS_STND}, // S_POSS_STND
{SPR_POSS, 0, 3, {A_Chase}, 0, 0, S_POSS_RUN2}, // S_POSS_RUN1
{SPR_POSS, 1, 3, {A_Chase}, 0, 0, S_POSS_RUN3}, // S_POSS_RUN2
{SPR_POSS, 2, 3, {A_Chase}, 0, 0, S_POSS_RUN4}, // S_POSS_RUN3
......@@ -160,8 +159,7 @@ state_t states[NUMSTATES] =
{SPR_POSS, 5, 3, {A_Chase}, 0, 0, S_POSS_RUN1}, // S_POSS_RUN6
 
// Red Crawla
{SPR_SPOS, 0, 5, {A_Look}, 0, 0, S_SPOS_STND2}, // S_SPOS_STND
{SPR_SPOS, 0, 5, {A_Look}, 0, 0, S_SPOS_STND}, // S_SPOS_STND2
{SPR_SPOS, 0, 5, {A_Look}, 0, 0, S_SPOS_STND}, // S_SPOS_STND
{SPR_SPOS, 0, 1, {A_Chase}, 0, 0, S_SPOS_RUN2}, // S_SPOS_RUN1
{SPR_SPOS, 1, 1, {A_Chase}, 0, 0, S_SPOS_RUN3}, // S_SPOS_RUN2
{SPR_SPOS, 2, 1, {A_Chase}, 0, 0, S_SPOS_RUN4}, // S_SPOS_RUN3
......
......@@ -663,7 +663,6 @@ typedef enum state
// Blue Crawla
S_POSS_STND,
S_POSS_STND2,
S_POSS_RUN1,
S_POSS_RUN2,
S_POSS_RUN3,
......@@ -673,7 +672,6 @@ typedef enum state
// Red Crawla
S_SPOS_STND,
S_SPOS_STND2,
S_SPOS_RUN1,
S_SPOS_RUN2,
S_SPOS_RUN3,
......
......@@ -85,13 +85,6 @@ static int lib_print(lua_State *L)
return 0;
}
static int lib_evalMath(lua_State *L)
{
const char *word = luaL_checkstring(L, 1);
lua_pushinteger(L, LUA_EvalMath(word));
return 1;
}
// M_RANDOM
//////////////
......@@ -138,25 +131,25 @@ static int lib_pRandomRange(lua_State *L)
static int lib_pAproxDistance(lua_State *L)
{
fixed_t dx = (fixed_t)luaL_checkinteger(L, 1);
fixed_t dy = (fixed_t)luaL_checkinteger(L, 2);
fixed_t dx = luaL_checkfixed(L, 1);
fixed_t dy = luaL_checkfixed(L, 2);
//HUDSAFE
lua_pushinteger(L, P_AproxDistance(dx, dy));
lua_pushfixed(L, P_AproxDistance(dx, dy));
return 1;
}
static int lib_pClosestPointOnLine(lua_State *L)
{
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = luaL_checkfixed(L, 2);
line_t *line = *((line_t **)luaL_checkudata(L, 3, META_LINE));
vertex_t result;
//HUDSAFE
if (!line)
return LUA_ErrInvalid(L, "line_t");
P_ClosestPointOnLine(x, y, line, &result);
lua_pushinteger(L, result.x);
lua_pushinteger(L, result.y);
lua_pushfixed(L, result.x);
lua_pushfixed(L, result.y);
return 2;
}
......@@ -241,9 +234,9 @@ static int lib_pLookForPlayers(lua_State *L)
static int lib_pSpawnMobj(lua_State *L)
{
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
fixed_t z = (fixed_t)luaL_checkinteger(L, 3);
fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = luaL_checkfixed(L, 2);
fixed_t z = luaL_checkfixed(L, 3);
mobjtype_t type = luaL_checkinteger(L, 4);
NOHUD
if (type > MT_LASTFREESLOT)
......@@ -283,9 +276,9 @@ static int lib_pSpawnXYZMissile(lua_State *L)
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *dest = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
mobjtype_t type = luaL_checkinteger(L, 3);
fixed_t x = (fixed_t)luaL_checkinteger(L, 4);
fixed_t y = (fixed_t)luaL_checkinteger(L, 5);
fixed_t z = (fixed_t)luaL_checkinteger(L, 6);
fixed_t x = luaL_checkfixed(L, 4);
fixed_t y = luaL_checkfixed(L, 5);
fixed_t z = luaL_checkfixed(L, 6);
NOHUD
if (!source || !dest)
return LUA_ErrInvalid(L, "mobj_t");
......@@ -298,13 +291,13 @@ static int lib_pSpawnXYZMissile(lua_State *L)
static int lib_pSpawnPointMissile(lua_State *L)
{
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t xa = (fixed_t)luaL_checkinteger(L, 2);
fixed_t ya = (fixed_t)luaL_checkinteger(L, 3);
fixed_t za = (fixed_t)luaL_checkinteger(L, 4);
fixed_t xa = luaL_checkfixed(L, 2);
fixed_t ya = luaL_checkfixed(L, 3);
fixed_t za = luaL_checkfixed(L, 4);
mobjtype_t type = luaL_checkinteger(L, 5);
fixed_t x = (fixed_t)luaL_checkinteger(L, 6);
fixed_t y = (fixed_t)luaL_checkinteger(L, 7);
fixed_t z = (fixed_t)luaL_checkinteger(L, 8);
fixed_t x = luaL_checkfixed(L, 6);
fixed_t y = luaL_checkfixed(L, 7);
fixed_t z = luaL_checkfixed(L, 8);
NOHUD
if (!source)
return LUA_ErrInvalid(L, "mobj_t");
......@@ -318,9 +311,9 @@ static int lib_pSpawnAlteredDirectionMissile(lua_State *L)
{
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobjtype_t type = luaL_checkinteger(L, 2);
fixed_t x = (fixed_t)luaL_checkinteger(L, 3);
fixed_t y = (fixed_t)luaL_checkinteger(L, 4);
fixed_t z = (fixed_t)luaL_checkinteger(L, 5);
fixed_t x = luaL_checkfixed(L, 3);
fixed_t y = luaL_checkfixed(L, 4);
fixed_t z = luaL_checkfixed(L, 5);
INT32 shiftingAngle = (INT32)luaL_checkinteger(L, 5);
NOHUD
if (!source)
......@@ -348,7 +341,7 @@ static int lib_pSPMAngle(lua_State *L)
{
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobjtype_t type = luaL_checkinteger(L, 2);
angle_t angle = (angle_t)luaL_checkinteger(L, 3);
angle_t angle = luaL_checkangle(L, 3);
UINT8 allowaim = (UINT8)luaL_optinteger(L, 4, 0);
UINT32 flags2 = (UINT32)luaL_optinteger(L, 5, 0);
NOHUD
......@@ -418,13 +411,13 @@ static int lib_pGetClosestAxis(lua_State *L)
static int lib_pSpawnParaloop(lua_State *L)
{
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
fixed_t z = (fixed_t)luaL_checkinteger(L, 3);
fixed_t radius = (fixed_t)luaL_checkinteger(L, 4);
fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = luaL_checkfixed(L, 2);
fixed_t z = luaL_checkfixed(L, 3);
fixed_t radius = luaL_checkfixed(L, 4);
INT32 number = (INT32)luaL_checkinteger(L, 5);
mobjtype_t type = luaL_checkinteger(L, 6);
angle_t rotangle = (angle_t)luaL_checkinteger(L, 7);
angle_t rotangle = luaL_checkangle(L, 7);
statenum_t nstate = luaL_optinteger(L, 8, S_NULL);
boolean spawncenter = lua_optboolean(L, 9);
NOHUD
......@@ -458,7 +451,7 @@ static int lib_pSupermanLook4Players(lua_State *L)
static int lib_pSetScale(lua_State *L)
{
mobj_t *mobj = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t newscale = (fixed_t)luaL_checkinteger(L, 2);
fixed_t newscale = luaL_checkfixed(L, 2);
NOHUD
if (!mobj)
return LUA_ErrInvalid(L, "mobj_t");
......@@ -526,7 +519,7 @@ static int lib_pGetPlayerHeight(lua_State *L)
//HUDSAFE
if (!player)
return LUA_ErrInvalid(L, "player_t");
lua_pushinteger(L, P_GetPlayerHeight(player));
lua_pushfixed(L, P_GetPlayerHeight(player));
return 1;
}
......@@ -536,7 +529,7 @@ static int lib_pGetPlayerSpinHeight(lua_State *L)
//HUDSAFE
if (!player)
return LUA_ErrInvalid(L, "player_t");
lua_pushinteger(L, P_GetPlayerSpinHeight(player));
lua_pushfixed(L, P_GetPlayerSpinHeight(player));
return 1;
}
......@@ -639,7 +632,7 @@ static int lib_pInQuicksand(lua_State *L)
static int lib_pSetObjectMomZ(lua_State *L)
{
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t value = (fixed_t)luaL_checkinteger(L, 2);
fixed_t value = luaL_checkfixed(L, 2);
boolean relative = lua_optboolean(L, 3);
NOHUD
if (!mo)
......@@ -753,8 +746,8 @@ static int lib_pDoPlayerExit(lua_State *L)
static int lib_pInstaThrust(lua_State *L)
{
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
angle_t angle = (angle_t)luaL_checkinteger(L, 2);
fixed_t move = (fixed_t)luaL_checkinteger(L, 3);
angle_t angle = luaL_checkangle(L, 2);
fixed_t move = luaL_checkfixed(L, 3);
NOHUD
if (!mo)
return LUA_ErrInvalid(L, "mobj_t");
......@@ -768,10 +761,10 @@ static int lib_pReturnThrustX(lua_State *L)
fixed_t move;
if (lua_isnil(L, 1) || lua_isuserdata(L, 1))
lua_remove(L, 1); // ignore mobj as arg1
angle = (angle_t)luaL_checkinteger(L, 1);
move = (fixed_t)luaL_checkinteger(L, 2);
angle = luaL_checkangle(L, 1);
move = luaL_checkfixed(L, 2);
//HUDSAFE
lua_pushinteger(L, P_ReturnThrustX(NULL, angle, move));
lua_pushfixed(L, P_ReturnThrustX(NULL, angle, move));
return 1;
}
......@@ -781,10 +774,10 @@ static int lib_pReturnThrustY(lua_State *L)
fixed_t move;
if (lua_isnil(L, 1) || lua_isuserdata(L, 1))
lua_remove(L, 1); // ignore mobj as arg1
angle = (angle_t)luaL_checkinteger(L, 1);
move = (fixed_t)luaL_checkinteger(L, 2);
angle = luaL_checkangle(L, 1);
move = luaL_checkfixed(L, 2);
//HUDSAFE
lua_pushinteger(L, P_ReturnThrustY(NULL, angle, move));
lua_pushfixed(L, P_ReturnThrustY(NULL, angle, move));
return 1;
}
......@@ -802,7 +795,7 @@ static int lib_pNukeEnemies(lua_State *L)
{
mobj_t *inflictor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
fixed_t radius = (fixed_t)luaL_checkinteger(L, 3);
fixed_t radius = luaL_checkfixed(L, 3);
NOHUD
if (!inflictor || !source)
return LUA_ErrInvalid(L, "mobj_t");
......@@ -868,8 +861,8 @@ static int lib_pSpawnSpinMobj(lua_State *L)
static int lib_pTelekinesis(lua_State *L)
{
player_t *player = *((player_t **)luaL_checkudata(L, 1, META_PLAYER));
fixed_t thrust = (fixed_t)luaL_checkinteger(L, 2);
fixed_t range = (fixed_t)luaL_checkinteger(L, 3);
fixed_t thrust = luaL_checkfixed(L, 2);
fixed_t range = luaL_checkfixed(L, 3);
NOHUD
if (!player)
return LUA_ErrInvalid(L, "player_t");
......@@ -884,8 +877,8 @@ static int lib_pCheckPosition(lua_State *L)
{
mobj_t *ptmthing = tmthing;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = (fixed_t)luaL_checkinteger(L, 2);
fixed_t y = (fixed_t)luaL_checkinteger(L, 3);
fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3);
NOHUD
if (!thing)
return LUA_ErrInvalid(L, "mobj_t");
......@@ -899,8 +892,8 @@ static int lib_pTryMove(lua_State *L)
{
mobj_t *ptmthing = tmthing;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = (fixed_t)luaL_checkinteger(L, 2);
fixed_t y = (fixed_t)luaL_checkinteger(L, 3);
fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3);
boolean allowdropoff = lua_optboolean(L, 4);
NOHUD
if (!thing)
......@@ -915,7 +908,7 @@ static int lib_pMove(lua_State *L)
{
mobj_t *ptmthing = tmthing;
mobj_t *actor = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t speed = (fixed_t)luaL_checkinteger(L, 2);
fixed_t speed = luaL_checkfixed(L, 2);
NOHUD
if (!actor)
return LUA_ErrInvalid(L, "mobj_t");
......@@ -929,9 +922,9 @@ static int lib_pTeleportMove(lua_State *L)
{
mobj_t *ptmthing = tmthing;
mobj_t *thing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = (fixed_t)luaL_checkinteger(L, 2);
fixed_t y = (fixed_t)luaL_checkinteger(L, 3);
fixed_t z = (fixed_t)luaL_checkinteger(L, 4);
fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3);
fixed_t z = luaL_checkfixed(L, 4);
NOHUD
if (!thing)
return LUA_ErrInvalid(L, "mobj_t");
......@@ -975,10 +968,10 @@ static int lib_pCheckSight(lua_State *L)
static int lib_pCheckHoopPosition(lua_State *L)
{
mobj_t *hoopthing = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
fixed_t x = (fixed_t)luaL_checkinteger(L, 2);
fixed_t y = (fixed_t)luaL_checkinteger(L, 3);
fixed_t z = (fixed_t)luaL_checkinteger(L, 4);
fixed_t radius = (fixed_t)luaL_checkinteger(L, 5);
fixed_t x = luaL_checkfixed(L, 2);
fixed_t y = luaL_checkfixed(L, 3);
fixed_t z = luaL_checkfixed(L, 4);
fixed_t radius = luaL_checkfixed(L, 5);
NOHUD
if (!hoopthing)
return LUA_ErrInvalid(L, "mobj_t");
......@@ -990,7 +983,7 @@ static int lib_pRadiusAttack(lua_State *L)
{
mobj_t *spot = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
mobj_t *source = *((mobj_t **)luaL_checkudata(L, 2, META_MOBJ));
fixed_t damagedist = (fixed_t)luaL_checkinteger(L, 3);
fixed_t damagedist = luaL_checkfixed(L, 3);
NOHUD
if (!spot || !source)
return LUA_ErrInvalid(L, "mobj_t");
......@@ -1000,12 +993,12 @@ static int lib_pRadiusAttack(lua_State *L)
static int lib_pFloorzAtPos(lua_State *L)
{
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
fixed_t z = (fixed_t)luaL_checkinteger(L, 3);
fixed_t height = (fixed_t)luaL_checkinteger(L, 4);
fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = luaL_checkfixed(L, 2);
fixed_t z = luaL_checkfixed(L, 3);
fixed_t height = luaL_checkfixed(L, 4);
//HUDSAFE
lua_pushinteger(L, P_FloorzAtPos(x, y, z, height));
lua_pushfixed(L, P_FloorzAtPos(x, y, z, height));
return 1;
}
......@@ -1016,8 +1009,8 @@ static int lib_pDoSpring(lua_State *L)
NOHUD
if (!spring || !object)
return LUA_ErrInvalid(L, "mobj_t");
P_DoSpring(spring, object);
return 0;
lua_pushboolean(L, P_DoSpring(spring, object));
return 1;
}
// P_INTER
......@@ -1209,8 +1202,8 @@ static int lib_pDoNightsScore(lua_State *L)
static int lib_pThrust(lua_State *L)
{
mobj_t *mo = *((mobj_t **)luaL_checkudata(L, 1, META_MOBJ));
angle_t angle = (angle_t)luaL_checkinteger(L, 2);
fixed_t move = (fixed_t)luaL_checkinteger(L, 3);
angle_t angle = luaL_checkangle(L, 2);
fixed_t move = luaL_checkfixed(L, 3);
NOHUD
if (!mo)
return LUA_ErrInvalid(L, "mobj_t");
......@@ -1485,48 +1478,48 @@ static int lib_evCrumbleChain(lua_State *L)
static int lib_rPointToAngle(lua_State *L)
{
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = luaL_checkfixed(L, 2);
//HUDSAFE
lua_pushinteger(L, R_PointToAngle(x, y));
lua_pushangle(L, R_PointToAngle(x, y));
return 1;
}
static int lib_rPointToAngle2(lua_State *L)
{
fixed_t px2 = (fixed_t)luaL_checkinteger(L, 1);
fixed_t py2 = (fixed_t)luaL_checkinteger(L, 2);
fixed_t px1 = (fixed_t)luaL_checkinteger(L, 3);
fixed_t py1 = (fixed_t)luaL_checkinteger(L, 4);
fixed_t px2 = luaL_checkfixed(L, 1);
fixed_t py2 = luaL_checkfixed(L, 2);
fixed_t px1 = luaL_checkfixed(L, 3);
fixed_t py1 = luaL_checkfixed(L, 4);
//HUDSAFE
lua_pushinteger(L, R_PointToAngle2(px2, py2, px1, py1));
lua_pushangle(L, R_PointToAngle2(px2, py2, px1, py1));
return 1;
}
static int lib_rPointToDist(lua_State *L)
{
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = luaL_checkfixed(L, 2);
//HUDSAFE
lua_pushinteger(L, R_PointToDist(x, y));
lua_pushfixed(L, R_PointToDist(x, y));
return 1;
}
static int lib_rPointToDist2(lua_State *L)
{
fixed_t px2 = (fixed_t)luaL_checkinteger(L, 1);
fixed_t py2 = (fixed_t)luaL_checkinteger(L, 2);
fixed_t px1 = (fixed_t)luaL_checkinteger(L, 3);
fixed_t py1 = (fixed_t)luaL_checkinteger(L, 4);
fixed_t px2 = luaL_checkfixed(L, 1);
fixed_t py2 = luaL_checkfixed(L, 2);
fixed_t px1 = luaL_checkfixed(L, 3);
fixed_t py1 = luaL_checkfixed(L, 4);
//HUDSAFE
lua_pushinteger(L, R_PointToDist2(px2, py2, px1, py1));
lua_pushfixed(L, R_PointToDist2(px2, py2, px1, py1));
return 1;
}
static int lib_rPointInSubsector(lua_State *L)
{
fixed_t x = (fixed_t)luaL_checkinteger(L, 1);
fixed_t y = (fixed_t)luaL_checkinteger(L, 2);
fixed_t x = luaL_checkfixed(L, 1);
fixed_t y = luaL_checkfixed(L, 2);
//HUDSAFE
LUA_PushUserdata(L, R_PointInSubsector(x, y), META_SUBSECTOR);
return 1;
......@@ -1660,7 +1653,7 @@ static int lib_sChangeMusic(lua_State *L)
static int lib_sSpeedMusic(lua_State *L)
{
fixed_t fixedspeed = (fixed_t)luaL_checkinteger(L, 1);
fixed_t fixedspeed = luaL_checkfixed(L, 1);
float speed = FIXED_TO_FLOAT(fixedspeed);
player_t *player = NULL;
NOHUD
......@@ -1861,7 +1854,6 @@ static int lib_gTicsToMilliseconds(lua_State *L)
static luaL_Reg lib[] = {
{"print", lib_print},
{"EvalMath", lib_evalMath},
// m_random
{"P_Random",lib_pRandom},
......
......@@ -41,7 +41,7 @@ enum hook {
hook_BotAI,
hook_LinedefExecute,
hook_PlayerMsg,
hook_DeathMsg,
hook_HurtMsg,
hook_MAX // last hook
};
......@@ -54,8 +54,9 @@ void LUAh_ThinkFrame(void); // Hook for frame (after mobj and player thinkers)
boolean LUAh_MobjHook(mobj_t *mo, enum hook which);
boolean LUAh_PlayerHook(player_t *plr, enum hook which);
#define LUAh_MobjSpawn(mo) LUAh_MobjHook(mo, hook_MobjSpawn) // Hook for P_SpawnMobj by mobj type
UINT8 LUAh_MobjCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (thing) mobj type
UINT8 LUAh_MobjMoveCollide(mobj_t *thing1, mobj_t *thing2); // Hook for PIT_CheckThing by (tmthing) mobj type
UINT8 LUAh_MobjCollideHook(mobj_t *thing1, mobj_t *thing2, enum hook which);
#define LUAh_MobjCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjCollide) // Hook for PIT_CheckThing by (thing) mobj type
#define LUAh_MobjMoveCollide(thing1, thing2) LUAh_MobjCollideHook(thing1, thing2, hook_MobjMoveCollide) // Hook for PIT_CheckThing by (tmthing) mobj type
boolean LUAh_TouchSpecial(mobj_t *special, mobj_t *toucher); // Hook for P_TouchSpecialThing by mobj type
#define LUAh_MobjFuse(mo) LUAh_MobjHook(mo, hook_MobjFuse) // Hook for mobj->fuse == 0 by mobj type
#define LUAh_MobjThinker(mo) LUAh_MobjHook(mo, hook_MobjThinker) // Hook for P_MobjThinker or P_SceneryThinker by mobj type
......@@ -73,6 +74,6 @@ boolean LUAh_BotTiccmd(player_t *bot, ticcmd_t *cmd); // Hook for B_BuildTiccmd
boolean LUAh_BotAI(mobj_t *sonic, mobj_t *tails, ticcmd_t *cmd); // Hook for B_BuildTailsTiccmd by skin name
boolean LUAh_LinedefExecute(line_t *line, mobj_t *mo, sector_t *sector); // Hook for linedef executors
boolean LUAh_PlayerMsg(int source, int target, int flags, char *msg); // Hook for chat messages
boolean LUAh_DeathMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
boolean LUAh_HurtMsg(player_t *player, mobj_t *inflictor, mobj_t *source); // Hook for hurt messages
#endif
This diff is collapsed.
......@@ -126,8 +126,6 @@ static const char *const widtht_opt[] = {
enum cameraf {
camera_chase = 0,
camera_aiming,
camera_viewheight,
camera_startangle,
camera_x,
camera_y,
camera_z,
......@@ -137,7 +135,6 @@ enum cameraf {
camera_ceilingz,
camera_radius,
camera_height,
camera_relativex,
camera_momx,
camera_momy,
camera_momz
......@@ -147,8 +144,6 @@ enum cameraf {
static const char *const camera_opt[] = {
"chase",
"aiming",
"viewheight",
"startangle",
"x",
"y",
"z",
......@@ -158,7 +153,6 @@ static const char *const camera_opt[] = {
"ceilingz",
"radius",
"height",
"relativex",
"momx",
"momy",
"momz",
......@@ -279,12 +273,6 @@ static int camera_get(lua_State *L)
case camera_aiming:
lua_pushinteger(L, cam->aiming);
break;
case camera_viewheight:
lua_pushinteger(L, cam->viewheight);
break;
case camera_startangle:
lua_pushinteger(L, cam->startangle);
break;
case camera_x:
lua_pushinteger(L, cam->x);
break;
......@@ -312,9 +300,6 @@ static int camera_get(lua_State *L)
case camera_height:
lua_pushinteger(L, cam->height);
break;
case camera_relativex:
lua_pushinteger(L, cam->relativex);
break;
case camera_momx:
lua_pushinteger(L, cam->momx);
break;
......@@ -689,8 +674,6 @@ void LUAh_GameHUD(player_t *stplayr)
LUA_Call(gL, 3);
}
lua_pop(gL, -1);
lua_gc(gL, LUA_GCCOLLECT, 0);
hud_running = false;
}
......@@ -716,8 +699,6 @@ void LUAh_ScoresHUD(void)
LUA_Call(gL, 1);
}
lua_pop(gL, -1);
lua_gc(gL, LUA_GCCOLLECT, 0);
hud_running = false;
}
......
......@@ -137,8 +137,6 @@ static void A_Lua(mobj_t *actor)
--superstack;
superactions[superstack] = NULL;
}
lua_gc(gL, LUA_GCSTEP, 1);
}
// Arbitrary states[] table index -> state_t *
......@@ -510,11 +508,11 @@ static int lib_setMobjInfo(lua_State *L)
else if (i == 15 || (str && fastcmp(str,"deathsound")))
info->deathsound = luaL_checkinteger(L, 3);
else if (i == 16 || (str && fastcmp(str,"speed")))
info->speed = (fixed_t)luaL_checkinteger(L, 3);
info->speed = luaL_checkfixed(L, 3);
else if (i == 17 || (str && fastcmp(str,"radius")))
info->radius = (fixed_t)luaL_checkinteger(L, 3);
info->radius = luaL_checkfixed(L, 3);
else if (i == 18 || (str && fastcmp(str,"height")))
info->height = (fixed_t)luaL_checkinteger(L, 3);
info->height = luaL_checkfixed(L, 3);
else if (i == 19 || (str && fastcmp(str,"dispoffset")))
info->dispoffset = (INT32)luaL_checkinteger(L, 3);
else if (i == 20 || (str && fastcmp(str,"mass")))
......@@ -580,11 +578,11 @@ static int mobjinfo_get(lua_State *L)
else if (fastcmp(field,"deathsound"))
lua_pushinteger(L, info->deathsound);
else if (fastcmp(field,"speed"))
lua_pushinteger(L, info->speed);
lua_pushinteger(L, info->speed); // sometimes it's fixed_t, sometimes it's not...
else if (fastcmp(field,"radius"))
lua_pushinteger(L, info->radius);
lua_pushfixed(L, info->radius);
else if (fastcmp(field,"height"))
lua_pushinteger(L, info->height);
lua_pushfixed(L, info->height);
else if (fastcmp(field,"dispoffset"))
lua_pushinteger(L, info->dispoffset);
else if (fastcmp(field,"mass"))
......@@ -656,11 +654,11 @@ static int mobjinfo_set(lua_State *L)
else if (fastcmp(field,"deathsound"))
info->deathsound = luaL_checkinteger(L, 3);
else if (fastcmp(field,"speed"))
info->speed = (fixed_t)luaL_checkinteger(L, 3);
info->speed = luaL_checkfixed(L, 3);
else if (fastcmp(field,"radius"))
info->radius = (fixed_t)luaL_checkinteger(L, 3);
info->radius = luaL_checkfixed(L, 3);
else if (fastcmp(field,"height"))
info->height = (fixed_t)luaL_checkinteger(L, 3);
info->height = luaL_checkfixed(L, 3);
else if (fastcmp(field,"dispoffset"))
info->dispoffset = (INT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"mass"))
......
......@@ -60,7 +60,6 @@ enum subsector_e {
subsector_sector,
subsector_numlines,
subsector_firstline,
subsector_validcount
};
static const char *const subsector_opt[] = {
......@@ -68,7 +67,6 @@ static const char *const subsector_opt[] = {
"sector",
"numlines",
"firstline",
"validcount",
NULL};
enum line_e {
......@@ -86,7 +84,6 @@ enum line_e {
line_slopetype,
line_frontsector,
line_backsector,
line_validcount,
line_firsttag,
line_nexttag,
line_text,
......@@ -108,7 +105,6 @@ static const char *const line_opt[] = {
"slopetype",
"frontsector",
"backsector",
"validcount",
"firsttag",
"nexttag",
"text",
......@@ -284,10 +280,10 @@ static int sector_get(lua_State *L)
lua_pushboolean(L, 1);
return 1;
case sector_floorheight:
lua_pushinteger(L, sector->floorheight);
lua_pushfixed(L, sector->floorheight);
return 1;
case sector_ceilingheight:
lua_pushinteger(L, sector->ceilingheight);
lua_pushfixed(L, sector->ceilingheight);
return 1;
case sector_floorpic: { // floorpic
levelflat_t *levelflat;
......@@ -400,26 +396,30 @@ static int sector_set(lua_State *L)
return luaL_error(L, "sector_t field " LUA_QS " cannot be set.", sector_opt[field]);
case sector_floorheight: { // floorheight
boolean flag;
mobj_t *ptmthing = tmthing;
fixed_t lastpos = sector->floorheight;
sector->floorheight = (fixed_t)luaL_checkinteger(L, 3);
sector->floorheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true);
if (flag && sector->numattached)
{
sector->floorheight = lastpos;
P_CheckSector(sector, true);
}
P_SetTarget(&tmthing, ptmthing);
break;
}
case sector_ceilingheight: { // ceilingheight
boolean flag;
mobj_t *ptmthing = tmthing;
fixed_t lastpos = sector->ceilingheight;
sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3);
sector->ceilingheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true);
if (flag && sector->numattached)
{
sector->ceilingheight = lastpos;
P_CheckSector(sector, true);
}
P_SetTarget(&tmthing, ptmthing);
break;
}
case sector_floorpic:
......@@ -476,9 +476,6 @@ static int subsector_get(lua_State *L)
case subsector_firstline:
lua_pushinteger(L, subsector->firstline);
return 1;
case subsector_validcount:
lua_pushinteger(L, subsector->validcount);
return 1;
}
return 0;
}
......@@ -516,10 +513,10 @@ static int line_get(lua_State *L)
LUA_PushUserdata(L, line->v2, META_VERTEX);
return 1;
case line_dx:
lua_pushinteger(L, line->dx);
lua_pushfixed(L, line->dx);
return 1;
case line_dy:
lua_pushinteger(L, line->dy);
lua_pushfixed(L, line->dy);
return 1;
case line_flags:
lua_pushinteger(L, line->flags);
......@@ -564,9 +561,6 @@ static int line_get(lua_State *L)
case line_backsector:
LUA_PushUserdata(L, line->backsector, META_SECTOR);
return 1;
case line_validcount:
lua_pushinteger(L, line->validcount);
return 1;
case line_firsttag:
lua_pushinteger(L, line->firsttag);
return 1;
......@@ -638,10 +632,10 @@ static int side_get(lua_State *L)
lua_pushboolean(L, 1);
return 1;
case side_textureoffset:
lua_pushinteger(L, side->textureoffset);
lua_pushfixed(L, side->textureoffset);
return 1;
case side_rowoffset:
lua_pushinteger(L, side->rowoffset);
lua_pushfixed(L, side->rowoffset);
return 1;
case side_toptexture:
lua_pushinteger(L, side->toptexture);
......@@ -668,6 +662,50 @@ static int side_get(lua_State *L)
return 0;
}
static int side_set(lua_State *L)
{
side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE));
enum side_e field = luaL_checkoption(L, 2, side_opt[0], side_opt);
if (!side)
{
if (field == side_valid) {
lua_pushboolean(L, 0);
return 1;
}
return luaL_error(L, "accessed side_t doesn't exist anymore.");
}
switch(field)
{
case side_valid: // valid
case side_sector:
case side_special:
case side_text:
default:
return luaL_error(L, "side_t field " LUA_QS " cannot be set.", side_opt[field]);
case side_textureoffset:
side->textureoffset = luaL_checkfixed(L, 3);
break;
case side_rowoffset:
side->rowoffset = luaL_checkfixed(L, 3);
break;
case side_toptexture:
side->toptexture = luaL_checkinteger(L, 3);
break;
case side_bottomtexture:
side->bottomtexture = luaL_checkinteger(L, 3);
break;
case side_midtexture:
side->midtexture = luaL_checkinteger(L, 3);
break;
case side_repeatcnt:
side->repeatcnt = luaL_checkinteger(L, 3);
break;
}
return 0;
}
static int side_num(lua_State *L)
{
side_t *side = *((side_t **)luaL_checkudata(L, 1, META_SIDE));
......@@ -695,13 +733,13 @@ static int vertex_get(lua_State *L)
lua_pushboolean(L, 1);
return 1;
case vertex_x:
lua_pushinteger(L, vertex->x);
lua_pushfixed(L, vertex->x);
return 1;
case vertex_y:
lua_pushinteger(L, vertex->y);
lua_pushfixed(L, vertex->y);
return 1;
case vertex_z:
lua_pushinteger(L, vertex->z);
lua_pushfixed(L, vertex->z);
return 1;
}
return 0;
......@@ -964,7 +1002,7 @@ static int ffloor_get(lua_State *L)
lua_pushboolean(L, 1);
return 1;
case ffloor_topheight:
lua_pushinteger(L, *ffloor->topheight);
lua_pushfixed(L, *ffloor->topheight);
return 1;
case ffloor_toppic: { // toppic
levelflat_t *levelflat;
......@@ -978,7 +1016,7 @@ static int ffloor_get(lua_State *L)
lua_pushinteger(L, *ffloor->toplightlevel);
return 1;
case ffloor_bottomheight:
lua_pushinteger(L, *ffloor->bottomheight);
lua_pushfixed(L, *ffloor->bottomheight);
return 1;
case ffloor_bottompic: { // bottompic
levelflat_t *levelflat;
......@@ -1037,14 +1075,16 @@ static int ffloor_set(lua_State *L)
case ffloor_topheight: { // topheight
boolean flag;
fixed_t lastpos = *ffloor->topheight;
mobj_t *ptmthing = tmthing;
sector_t *sector = &sectors[ffloor->secnum];
sector->ceilingheight = (fixed_t)luaL_checkinteger(L, 3);
sector->ceilingheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true);
if (flag && sector->numattached)
{
*ffloor->topheight = lastpos;
P_CheckSector(sector, true);
}
P_SetTarget(&tmthing, ptmthing);
break;
}
case ffloor_toppic:
......@@ -1056,14 +1096,16 @@ static int ffloor_set(lua_State *L)
case ffloor_bottomheight: { // bottomheight
boolean flag;
fixed_t lastpos = *ffloor->bottomheight;
mobj_t *ptmthing = tmthing;
sector_t *sector = &sectors[ffloor->secnum];
sector->floorheight = (fixed_t)luaL_checkinteger(L, 3);
sector->floorheight = luaL_checkfixed(L, 3);
flag = P_CheckSector(sector, true);
if (flag && sector->numattached)
{
*ffloor->bottomheight = lastpos;
P_CheckSector(sector, true);
}
P_SetTarget(&tmthing, ptmthing);
break;
}
case ffloor_bottompic:
......@@ -1115,14 +1157,11 @@ static int mapheaderinfo_get(lua_State *L)
{
mapheader_t *header = *((mapheader_t **)luaL_checkudata(L, 1, META_MAPHEADER));
const char *field = luaL_checkstring(L, 2);
//INT16 i;
if (fastcmp(field,"lvlttl")) {
//for (i = 0; i < 21; i++)
// if (!header->lvlttl[i])
// break;
lua_pushlstring(L, header->lvlttl, 21);
} else if (fastcmp(field,"subttl"))
lua_pushlstring(L, header->subttl, 32);
INT16 i;
if (fastcmp(field,"lvlttl"))
lua_pushstring(L, header->lvlttl);
else if (fastcmp(field,"subttl"))
lua_pushstring(L, header->subttl);
else if (fastcmp(field,"actnum"))
lua_pushinteger(L, header->actnum);
else if (fastcmp(field,"typeoflevel"))
......@@ -1134,7 +1173,7 @@ static int mapheaderinfo_get(lua_State *L)
else if (fastcmp(field,"musicslottrack"))
lua_pushinteger(L, header->musicslottrack);
else if (fastcmp(field,"forcecharacter"))
lua_pushlstring(L, header->forcecharacter, 16);
lua_pushstring(L, header->forcecharacter);
else if (fastcmp(field,"weather"))
lua_pushinteger(L, header->weather);
else if (fastcmp(field,"skynum"))
......@@ -1145,12 +1184,15 @@ static int mapheaderinfo_get(lua_State *L)
lua_pushinteger(L, header->skybox_scaley);
else if (fastcmp(field,"skybox_scalez"))
lua_pushinteger(L, header->skybox_scalez);
else if (fastcmp(field,"interscreen"))
lua_pushlstring(L, header->interscreen, 8);
else if (fastcmp(field,"runsoc"))
lua_pushlstring(L, header->runsoc, 32);
else if (fastcmp(field,"interscreen")) {
for (i = 0; i < 8; i++)
if (!header->interscreen[i])
break;
lua_pushlstring(L, header->interscreen, i);
} else if (fastcmp(field,"runsoc"))
lua_pushstring(L, header->runsoc);
else if (fastcmp(field,"scriptname"))
lua_pushlstring(L, header->scriptname, 32);
lua_pushstring(L, header->scriptname);
else if (fastcmp(field,"precutscenenum"))
lua_pushinteger(L, header->precutscenenum);
else if (fastcmp(field,"cutscenenum"))
......@@ -1175,11 +1217,11 @@ static int mapheaderinfo_get(lua_State *L)
else {
// Read custom vars now
// (note: don't include the "LUA." in your lua scripts!)
UINT8 i = 0;
for (;i < header->numCustomOptions && !fastcmp(field, header->customopts[i].option); ++i);
UINT8 j = 0;
for (;j < header->numCustomOptions && !fastcmp(field, header->customopts[j].option); ++j);
if(i < header->numCustomOptions)
lua_pushlstring(L, header->customopts[i].value, 255);
if(j < header->numCustomOptions)
lua_pushstring(L, header->customopts[j].value);
else
lua_pushnil(L);
}
......@@ -1224,6 +1266,9 @@ int LUA_MapLib(lua_State *L)
lua_pushcfunction(L, side_get);
lua_setfield(L, -2, "__index");
lua_pushcfunction(L, side_set);
lua_setfield(L, -2, "__newindex");
lua_pushcfunction(L, side_num);
lua_setfield(L, -2, "__len");
lua_pop(L, 1);
......
......@@ -47,37 +47,39 @@ static int lib_max(lua_State *L)
static int lib_fixedangle(lua_State *L)
{
lua_pushinteger(L, FixedAngle((fixed_t)luaL_checkinteger(L, 1)));
lua_pushangle(L, FixedAngle(luaL_checkfixed(L, 1)));
return 1;
}
static int lib_anglefixed(lua_State *L)
{
lua_pushinteger(L, AngleFixed((angle_t)luaL_checkinteger(L, 1)));
lua_pushfixed(L, AngleFixed(luaL_checkangle(L, 1)));
return 1;
}
static int lib_invangle(lua_State *L)
{
lua_pushinteger(L, InvAngle((angle_t)luaL_checkinteger(L, 1)));
lua_pushangle(L, InvAngle(luaL_checkangle(L, 1)));
return 1;
}
static int lib_finesine(lua_State *L)
{
lua_pushinteger(L, FINESINE((luaL_checkinteger(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
lua_pushfixed(L, FINESINE((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
return 1;
}
static int lib_finecosine(lua_State *L)
{
lua_pushinteger(L, FINECOSINE((luaL_checkinteger(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
lua_pushfixed(L, FINECOSINE((luaL_checkangle(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
return 1;
}
static int lib_finetangent(lua_State *L)
{
lua_pushinteger(L, FINETANGENT((luaL_checkinteger(L, 1)>>ANGLETOFINESHIFT) & FINEMASK));
// HACK: add ANGLE_90 to make tan() in Lua start at 0 like it should
// use & 4095 instead of & FINEMASK (8191), so it doesn't go out of the array's bounds
lua_pushfixed(L, FINETANGENT(((luaL_checkangle(L, 1)+ANGLE_90)>>ANGLETOFINESHIFT) & 4095));
return 1;
}
......@@ -86,61 +88,61 @@ static int lib_finetangent(lua_State *L)
static int lib_fixedmul(lua_State *L)
{
lua_pushinteger(L, FixedMul((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2)));
lua_pushfixed(L, FixedMul(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
return 1;
}
static int lib_fixedint(lua_State *L)
{
lua_pushinteger(L, FixedInt((fixed_t)luaL_checkinteger(L, 1)));
lua_pushinteger(L, FixedInt(luaL_checkfixed(L, 1)));
return 1;
}
static int lib_fixeddiv(lua_State *L)
{
lua_pushinteger(L, FixedDiv((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2)));
lua_pushfixed(L, FixedDiv(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
return 1;
}
static int lib_fixedrem(lua_State *L)
{
lua_pushinteger(L, FixedRem((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2)));
lua_pushfixed(L, FixedRem(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
return 1;
}
static int lib_fixedsqrt(lua_State *L)
{
lua_pushinteger(L, FixedSqrt((fixed_t)luaL_checkinteger(L, 1)));
lua_pushfixed(L, FixedSqrt(luaL_checkfixed(L, 1)));
return 1;
}
static int lib_fixedhypot(lua_State *L)
{
lua_pushinteger(L, FixedHypot((fixed_t)luaL_checkinteger(L, 1), (fixed_t)luaL_checkinteger(L, 2)));
lua_pushfixed(L, FixedHypot(luaL_checkfixed(L, 1), luaL_checkfixed(L, 2)));
return 1;
}
static int lib_fixedfloor(lua_State *L)
{
lua_pushinteger(L, FixedFloor((fixed_t)luaL_checkinteger(L, 1)));
lua_pushfixed(L, FixedFloor(luaL_checkfixed(L, 1)));
return 1;
}
static int lib_fixedtrunc(lua_State *L)
{
lua_pushinteger(L, FixedTrunc((fixed_t)luaL_checkinteger(L, 1)));
lua_pushfixed(L, FixedTrunc(luaL_checkfixed(L, 1)));
return 1;
}
static int lib_fixedceil(lua_State *L)
{
lua_pushinteger(L, FixedCeil((fixed_t)luaL_checkinteger(L, 1)));
lua_pushfixed(L, FixedCeil(luaL_checkfixed(L, 1)));
return 1;
}
static int lib_fixedround(lua_State *L)
{
lua_pushinteger(L, FixedRound((fixed_t)luaL_checkinteger(L, 1)));
lua_pushfixed(L, FixedRound(luaL_checkfixed(L, 1)));
return 1;
}
......@@ -156,7 +158,7 @@ static int lib_getsecspecial(lua_State *L)
static int lib_all7emeralds(lua_State *L)
{
lua_pushinteger(L, ALL7EMERALDS(luaL_checkinteger(L, 1)));
lua_pushboolean(L, ALL7EMERALDS(luaL_checkinteger(L, 1)));
return 1;
}
......@@ -164,7 +166,7 @@ static int lib_all7emeralds(lua_State *L)
// Returns both color and frame numbers!
static int lib_coloropposite(lua_State *L)
{
int colornum = ((int)luaL_checkinteger(L, 1)) & MAXSKINCOLORS;
int colornum = ((int)luaL_checkinteger(L, 1)) % MAXSKINCOLORS;
lua_pushinteger(L, Color_Opposite[colornum*2]); // push color
lua_pushinteger(L, Color_Opposite[colornum*2+1]); // push frame
return 2;
......
......@@ -162,13 +162,13 @@ static int mobj_get(lua_State *L)
lua_pushboolean(L, 1);
break;
case mobj_x:
lua_pushinteger(L, mo->x);
lua_pushfixed(L, mo->x);
break;
case mobj_y:
lua_pushinteger(L, mo->y);
lua_pushfixed(L, mo->y);
break;
case mobj_z:
lua_pushinteger(L, mo->z);
lua_pushfixed(L, mo->z);
break;
case mobj_snext:
LUA_PushUserdata(L, mo->snext, META_MOBJ);
......@@ -179,7 +179,7 @@ static int mobj_get(lua_State *L)
// i.e. it will always ultimately point to THIS mobj -- so that's actually not useful to Lua and won't be included.
return UNIMPLEMENTED;
case mobj_angle:
lua_pushinteger(L, mo->angle);
lua_pushangle(L, mo->angle);
break;
case mobj_sprite:
lua_pushinteger(L, mo->sprite);
......@@ -193,28 +193,28 @@ static int mobj_get(lua_State *L)
LUA_PushUserdata(L, mo->subsector, META_SUBSECTOR);
break;
case mobj_floorz:
lua_pushinteger(L, mo->floorz);
lua_pushfixed(L, mo->floorz);
break;
case mobj_ceilingz:
lua_pushinteger(L, mo->ceilingz);
lua_pushfixed(L, mo->ceilingz);
break;
case mobj_radius:
lua_pushinteger(L, mo->radius);
lua_pushfixed(L, mo->radius);
break;
case mobj_height:
lua_pushinteger(L, mo->height);
lua_pushfixed(L, mo->height);
break;
case mobj_momx:
lua_pushinteger(L, mo->momx);
lua_pushfixed(L, mo->momx);
break;
case mobj_momy:
lua_pushinteger(L, mo->momy);
lua_pushfixed(L, mo->momy);
break;
case mobj_momz:
lua_pushinteger(L, mo->momz);
lua_pushfixed(L, mo->momz);
break;
case mobj_pmomz:
lua_pushinteger(L, mo->pmomz);
lua_pushfixed(L, mo->pmomz);
break;
case mobj_tics:
lua_pushinteger(L, mo->tics);
......@@ -299,32 +299,32 @@ static int mobj_get(lua_State *L)
LUA_PushUserdata(L, mo->tracer, META_MOBJ);
break;
case mobj_friction:
lua_pushinteger(L, mo->friction);
lua_pushfixed(L, mo->friction);
break;
case mobj_movefactor:
lua_pushinteger(L, mo->movefactor);
lua_pushfixed(L, mo->movefactor);
break;
case mobj_fuse:
lua_pushinteger(L, mo->fuse);
break;
case mobj_watertop:
lua_pushinteger(L, mo->watertop);
lua_pushfixed(L, mo->watertop);
break;
case mobj_waterbottom:
lua_pushinteger(L, mo->waterbottom);
lua_pushfixed(L, mo->waterbottom);
break;
case mobj_mobjnum:
// mobjnum is a networking thing generated for $$$.sav
// and therefore shouldn't be used by Lua.
return UNIMPLEMENTED;
case mobj_scale:
lua_pushinteger(L, mo->scale);
lua_pushfixed(L, mo->scale);
break;
case mobj_destscale:
lua_pushinteger(L, mo->destscale);
lua_pushfixed(L, mo->destscale);
break;
case mobj_scalespeed:
lua_pushinteger(L, mo->scalespeed);
lua_pushfixed(L, mo->scalespeed);
break;
case mobj_extravalue1:
lua_pushinteger(L, mo->extravalue1);
......@@ -382,7 +382,7 @@ static int mobj_set(lua_State *L)
{
// z doesn't cross sector bounds so it's okay.
mobj_t *ptmthing = tmthing;
mo->z = (fixed_t)luaL_checkinteger(L, 3);
mo->z = luaL_checkfixed(L, 3);
P_CheckPosition(mo, mo->x, mo->y);
mo->floorz = tmfloorz;
mo->ceilingz = tmceilingz;
......@@ -394,7 +394,7 @@ static int mobj_set(lua_State *L)
case mobj_sprev:
return UNIMPLEMENTED;
case mobj_angle:
mo->angle = (angle_t)luaL_checkinteger(L, 3);
mo->angle = luaL_checkangle(L, 3);
if (mo->player == &players[consoleplayer])
localangle = mo->angle;
else if (mo->player == &players[secondarydisplayplayer])
......@@ -417,7 +417,7 @@ static int mobj_set(lua_State *L)
case mobj_radius:
{
mobj_t *ptmthing = tmthing;
mo->radius = (fixed_t)luaL_checkinteger(L, 3);
mo->radius = luaL_checkfixed(L, 3);
if (mo->radius < 0)
mo->radius = 0;
P_CheckPosition(mo, mo->x, mo->y);
......@@ -429,7 +429,7 @@ static int mobj_set(lua_State *L)
case mobj_height:
{
mobj_t *ptmthing = tmthing;
mo->height = (fixed_t)luaL_checkinteger(L, 3);
mo->height = luaL_checkfixed(L, 3);
if (mo->height < 0)
mo->height = 0;
P_CheckPosition(mo, mo->x, mo->y);
......@@ -439,16 +439,17 @@ static int mobj_set(lua_State *L)
break;
}
case mobj_momx:
mo->momx = (fixed_t)luaL_checkinteger(L, 3);
mo->momx = luaL_checkfixed(L, 3);
break;
case mobj_momy:
mo->momy = (fixed_t)luaL_checkinteger(L, 3);
mo->momy = luaL_checkfixed(L, 3);
break;
case mobj_momz:
mo->momz = (fixed_t)luaL_checkinteger(L, 3);
mo->momz = luaL_checkfixed(L, 3);
break;
case mobj_pmomz:
mo->pmomz = (fixed_t)luaL_checkinteger(L, 3);
mo->pmomz = luaL_checkfixed(L, 3);
mo->eflags |= MFE_APPLYPMOMZ;
break;
case mobj_tics:
mo->tics = luaL_checkinteger(L, 3);
......@@ -500,7 +501,7 @@ static int mobj_set(lua_State *L)
return luaL_error(L, "mobj.skin '%s' not found!", skin);
}
case mobj_color:
mo->color = ((UINT8)luaL_checkinteger(L, 3)) % MAXSKINCOLORS;
mo->color = ((UINT8)luaL_checkinteger(L, 3)) % MAXTRANSLATIONS;
break;
case mobj_bnext:
return NOSETPOS;
......@@ -572,25 +573,25 @@ static int mobj_set(lua_State *L)
}
break;
case mobj_friction:
mo->friction = (fixed_t)luaL_checkinteger(L, 3);
mo->friction = luaL_checkfixed(L, 3);
break;
case mobj_movefactor:
mo->movefactor = (fixed_t)luaL_checkinteger(L, 3);
mo->movefactor = luaL_checkfixed(L, 3);
break;
case mobj_fuse:
mo->fuse = luaL_checkinteger(L, 3);
break;
case mobj_watertop:
mo->watertop = (fixed_t)luaL_checkinteger(L, 3);
mo->watertop = luaL_checkfixed(L, 3);
break;
case mobj_waterbottom:
mo->waterbottom = (fixed_t)luaL_checkinteger(L, 3);
mo->waterbottom = luaL_checkfixed(L, 3);
break;
case mobj_mobjnum:
return UNIMPLEMENTED;
case mobj_scale:
{
fixed_t scale = (fixed_t)luaL_checkinteger(L, 3);
fixed_t scale = luaL_checkfixed(L, 3);
if (scale < FRACUNIT/100)
scale = FRACUNIT/100;
mo->destscale = scale;
......@@ -599,14 +600,14 @@ static int mobj_set(lua_State *L)
}
case mobj_destscale:
{
fixed_t scale = (fixed_t)luaL_checkinteger(L, 3);
fixed_t scale = luaL_checkfixed(L, 3);
if (scale < FRACUNIT/100)
scale = FRACUNIT/100;
mo->destscale = scale;
break;
}
case mobj_scalespeed:
mo->scalespeed = (fixed_t)luaL_checkinteger(L, 3);
mo->scalespeed = luaL_checkfixed(L, 3);
break;
case mobj_extravalue1:
mo->extravalue1 = luaL_checkinteger(L, 3);
......
......@@ -109,15 +109,15 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"playerstate"))
lua_pushinteger(L, plr->playerstate);
else if (fastcmp(field,"viewz"))
lua_pushinteger(L, plr->viewz);
lua_pushfixed(L, plr->viewz);
else if (fastcmp(field,"viewheight"))
lua_pushinteger(L, plr->viewheight);
lua_pushfixed(L, plr->viewheight);
else if (fastcmp(field,"deltaviewheight"))
lua_pushinteger(L, plr->deltaviewheight);
lua_pushfixed(L, plr->deltaviewheight);
else if (fastcmp(field,"bob"))
lua_pushinteger(L, plr->bob);
lua_pushfixed(L, plr->bob);
else if (fastcmp(field,"aiming"))
lua_pushinteger(L, plr->aiming);
lua_pushangle(L, plr->aiming);
else if (fastcmp(field,"health"))
lua_pushinteger(L, plr->health);
else if (fastcmp(field,"pity"))
......@@ -141,13 +141,13 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"score"))
lua_pushinteger(L, plr->score);
else if (fastcmp(field,"dashspeed"))
lua_pushinteger(L, plr->dashspeed);
lua_pushfixed(L, plr->dashspeed);
else if (fastcmp(field,"dashtime"))
lua_pushinteger(L, plr->dashtime);
else if (fastcmp(field,"normalspeed"))
lua_pushinteger(L, plr->normalspeed);
lua_pushfixed(L, plr->normalspeed);
else if (fastcmp(field,"runspeed"))
lua_pushinteger(L, plr->runspeed);
lua_pushfixed(L, plr->runspeed);
else if (fastcmp(field,"thrustfactor"))
lua_pushinteger(L, plr->thrustfactor);
else if (fastcmp(field,"accelstart"))
......@@ -167,13 +167,13 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"revitem"))
lua_pushinteger(L, plr->revitem);
else if (fastcmp(field,"actionspd"))
lua_pushinteger(L, plr->actionspd);
lua_pushfixed(L, plr->actionspd);
else if (fastcmp(field,"mindash"))
lua_pushinteger(L, plr->mindash);
lua_pushfixed(L, plr->mindash);
else if (fastcmp(field,"maxdash"))
lua_pushinteger(L, plr->maxdash);
lua_pushfixed(L, plr->maxdash);
else if (fastcmp(field,"jumpfactor"))
lua_pushinteger(L, plr->jumpfactor);
lua_pushfixed(L, plr->jumpfactor);
else if (fastcmp(field,"lives"))
lua_pushinteger(L, plr->lives);
else if (fastcmp(field,"continues"))
......@@ -183,7 +183,7 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"gotcontinue"))
lua_pushinteger(L, plr->gotcontinue);
else if (fastcmp(field,"speed"))
lua_pushinteger(L, plr->speed);
lua_pushfixed(L, plr->speed);
else if (fastcmp(field,"jumping"))
lua_pushboolean(L, plr->jumping);
else if (fastcmp(field,"secondjump"))
......@@ -205,13 +205,13 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"skidtime"))
lua_pushinteger(L, plr->skidtime);
else if (fastcmp(field,"cmomx"))
lua_pushinteger(L, plr->cmomx);
lua_pushfixed(L, plr->cmomx);
else if (fastcmp(field,"cmomy"))
lua_pushinteger(L, plr->cmomy);
lua_pushfixed(L, plr->cmomy);
else if (fastcmp(field,"rmomx"))
lua_pushinteger(L, plr->rmomx);
lua_pushfixed(L, plr->rmomx);
else if (fastcmp(field,"rmomy"))
lua_pushinteger(L, plr->rmomy);
lua_pushfixed(L, plr->rmomy);
else if (fastcmp(field,"numboxes"))
lua_pushinteger(L, plr->numboxes);
else if (fastcmp(field,"totalring"))
......@@ -239,11 +239,11 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"starposttime"))
lua_pushinteger(L, plr->starposttime);
else if (fastcmp(field,"starpostangle"))
lua_pushinteger(L, plr->starpostangle);
lua_pushangle(L, plr->starpostangle);
else if (fastcmp(field,"angle_pos"))
lua_pushinteger(L, plr->angle_pos);
lua_pushangle(L, plr->angle_pos);
else if (fastcmp(field,"old_angle_pos"))
lua_pushinteger(L, plr->old_angle_pos);
lua_pushangle(L, plr->old_angle_pos);
else if (fastcmp(field,"axis1"))
LUA_PushUserdata(L, plr->axis1, META_MOBJ);
else if (fastcmp(field,"axis2"))
......@@ -305,16 +305,16 @@ static int player_get(lua_State *L)
else if (fastcmp(field,"awayviewtics"))
lua_pushinteger(L, plr->awayviewtics);
else if (fastcmp(field,"awayviewaiming"))
lua_pushinteger(L, plr->awayviewaiming);
lua_pushangle(L, plr->awayviewaiming);
else if (fastcmp(field,"spectator"))
lua_pushinteger(L, plr->spectator);
lua_pushboolean(L, plr->spectator);
else if (fastcmp(field,"bot"))
lua_pushinteger(L, plr->bot);
else if (fastcmp(field,"jointime"))
lua_pushinteger(L, plr->jointime);
#ifdef HWRENDER
else if (fastcmp(field,"fovadd"))
lua_pushinteger(L, plr->fovadd);
lua_pushfixed(L, plr->fovadd);
#endif
else {
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
......@@ -354,15 +354,15 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"playerstate"))
plr->playerstate = luaL_checkinteger(L, 3);
else if (fastcmp(field,"viewz"))
plr->viewz = (fixed_t)luaL_checkinteger(L, 3);
plr->viewz = luaL_checkfixed(L, 3);
else if (fastcmp(field,"viewheight"))
plr->viewheight = (fixed_t)luaL_checkinteger(L, 3);
plr->viewheight = luaL_checkfixed(L, 3);
else if (fastcmp(field,"deltaviewheight"))
plr->deltaviewheight = (fixed_t)luaL_checkinteger(L, 3);
plr->deltaviewheight = luaL_checkfixed(L, 3);
else if (fastcmp(field,"bob"))
plr->bob = (fixed_t)luaL_checkinteger(L, 3);
plr->bob = luaL_checkfixed(L, 3);
else if (fastcmp(field,"aiming")) {
plr->aiming = (angle_t)luaL_checkinteger(L, 3);
plr->aiming = luaL_checkangle(L, 3);
if (plr == &players[consoleplayer])
localaiming = plr->aiming;
else if (plr == &players[secondarydisplayplayer])
......@@ -391,13 +391,13 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"score"))
plr->score = (UINT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"dashspeed"))
plr->dashspeed = (fixed_t)luaL_checkinteger(L, 3);
plr->dashspeed = luaL_checkfixed(L, 3);
else if (fastcmp(field,"dashtime"))
plr->dashtime = (INT32)luaL_checkinteger(L, 3);
else if (fastcmp(field,"normalspeed"))
plr->normalspeed = (fixed_t)luaL_checkinteger(L, 3);
plr->normalspeed = luaL_checkfixed(L, 3);
else if (fastcmp(field,"runspeed"))
plr->runspeed = (fixed_t)luaL_checkinteger(L, 3);
plr->runspeed = luaL_checkfixed(L, 3);
else if (fastcmp(field,"thrustfactor"))
plr->thrustfactor = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"accelstart"))
......@@ -433,7 +433,7 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"gotcontinue"))
plr->gotcontinue = (UINT8)luaL_checkinteger(L, 3);
else if (fastcmp(field,"speed"))
plr->speed = (fixed_t)luaL_checkinteger(L, 3);
plr->speed = luaL_checkfixed(L, 3);
else if (fastcmp(field,"jumping"))
plr->jumping = luaL_checkboolean(L, 3);
else if (fastcmp(field,"secondjump"))
......@@ -455,13 +455,13 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"skidtime"))
plr->skidtime = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"cmomx"))
plr->cmomx = (fixed_t)luaL_checkinteger(L, 3);
plr->cmomx = luaL_checkfixed(L, 3);
else if (fastcmp(field,"cmomy"))
plr->cmomy = (fixed_t)luaL_checkinteger(L, 3);
plr->cmomy = luaL_checkfixed(L, 3);
else if (fastcmp(field,"rmomx"))
plr->rmomx = (fixed_t)luaL_checkinteger(L, 3);
plr->rmomx = luaL_checkfixed(L, 3);
else if (fastcmp(field,"rmomy"))
plr->rmomy = (fixed_t)luaL_checkinteger(L, 3);
plr->rmomy = luaL_checkfixed(L, 3);
else if (fastcmp(field,"numboxes"))
plr->numboxes = (INT16)luaL_checkinteger(L, 3);
else if (fastcmp(field,"totalring"))
......@@ -489,11 +489,11 @@ static int player_set(lua_State *L)
else if (fastcmp(field,"starposttime"))
plr->starposttime = (tic_t)luaL_checkinteger(L, 3);
else if (fastcmp(field,"starpostangle"))
plr->starpostangle = (angle_t)luaL_checkinteger(L, 3);
plr->starpostangle = luaL_checkangle(L, 3);
else if (fastcmp(field,"angle_pos"))
plr->angle_pos = (angle_t)luaL_checkinteger(L, 3);
plr->angle_pos = luaL_checkangle(L, 3);
else if (fastcmp(field,"old_angle_pos"))
plr->old_angle_pos = (angle_t)luaL_checkinteger(L, 3);
plr->old_angle_pos = luaL_checkangle(L, 3);
else if (fastcmp(field,"axis1"))
P_SetTarget(&plr->axis1, *((mobj_t **)luaL_checkudata(L, 3, META_MOBJ)));
else if (fastcmp(field,"axis2"))
......@@ -569,7 +569,7 @@ static int player_set(lua_State *L)
P_SetTarget(&plr->awayviewmobj, plr->mo); // but since the script might set awayviewmobj immediately AFTER setting awayviewtics, use player mobj as filler for now.
}
else if (fastcmp(field,"awayviewaiming"))
plr->awayviewaiming = (angle_t)luaL_checkinteger(L, 3);
plr->awayviewaiming = luaL_checkangle(L, 3);
else if (fastcmp(field,"spectator"))
plr->spectator = lua_toboolean(L, 3);
else if (fastcmp(field,"bot"))
......@@ -578,7 +578,7 @@ static int player_set(lua_State *L)
plr->jointime = (tic_t)luaL_checkinteger(L, 3);
#ifdef HWRENDER
else if (fastcmp(field,"fovadd"))
plr->fovadd = (fixed_t)luaL_checkinteger(L, 3);
plr->fovadd = luaL_checkfixed(L, 3);
#endif
else {
lua_getfield(L, LUA_REGISTRYINDEX, LREG_EXTVARS);
......
This diff is collapsed.
This diff is collapsed.