mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Lunatic: get rid of some now unneeded set-member methods, add others.
git-svn-id: https://svn.eduke32.com/eduke32@3652 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
478544acb6
commit
fb41d91a50
6 changed files with 48 additions and 46 deletions
|
@ -526,7 +526,7 @@ local PlayerLabels = {
|
|||
ammo_amount = PL".ammo_amount[%s]" ,
|
||||
-- NOTE: no direct access for .inv_amount (but see end)
|
||||
|
||||
wackedbyactor = PL".wackedbyactor",
|
||||
wackedbyactor = { PL".wackedbyactor", PL":set_wackedbyactor(%%s)" },
|
||||
pyoff = PL".pyoff",
|
||||
opyoff = PL".opyoff",
|
||||
|
||||
|
@ -559,7 +559,7 @@ local PlayerLabels = {
|
|||
random_club_frame = PL".random_club_frame",
|
||||
one_eighty_count = PL".one_eighty_count",
|
||||
|
||||
dummyplayersprite = { PL".dummyplayersprite" },
|
||||
dummyplayersprite = { PL".dummyplayersprite", PL":set_dummyplayersprite(%%s)" },
|
||||
extra_extra8 = PL".extra_extra8",
|
||||
|
||||
actorsqu = PL".actorsqu",
|
||||
|
@ -602,7 +602,7 @@ local PlayerLabels = {
|
|||
|
||||
tipincs = PL".tipincs",
|
||||
hbomb_hold_delay = PL".hbomb_hold_delay",
|
||||
frag_ps = PL".frag_ps",
|
||||
frag_ps = { PL".frag_ps" },
|
||||
kickback_pic = PL".kickback_pic",
|
||||
|
||||
gm = PL".gm",
|
||||
|
@ -633,7 +633,7 @@ local PlayerLabels = {
|
|||
footprintshade = PL".footprintshade",
|
||||
|
||||
refresh_inventory = PL".refresh_inventory",
|
||||
last_full_weapon = PL".last_full_weapon",
|
||||
last_full_weapon = { PL".last_full_weapon" },
|
||||
|
||||
walking_snd_toggle = PL".walking_snd_toggle",
|
||||
palookup = PL".palookup",
|
||||
|
@ -649,10 +649,10 @@ local PlayerLabels = {
|
|||
loogcnt = PL".loogcnt",
|
||||
scream_voice = PL".scream_voice",
|
||||
|
||||
last_weapon = PL".last_weapon",
|
||||
last_weapon = { PL".last_weapon", PL":set_last_weapon(%%s)" },
|
||||
cheat_phase = PL".cheat_phase",
|
||||
weapon_pos = PL".weapon_pos",
|
||||
wantweaponfire = PL".wantweaponfire",
|
||||
wantweaponfire = { PL".wantweaponfire" },
|
||||
|
||||
curr_weapon = { PL".curr_weapon", PL":set_curr_weapon(%%s)" },
|
||||
|
||||
|
|
|
@ -440,15 +440,15 @@ end
|
|||
--- Helper functions (might be exported later) ---
|
||||
|
||||
local function have_ammo_at_max(ps, weap)
|
||||
return (ps:get_ammo_amount(weap) >= ps:get_max_ammo_amount(weap))
|
||||
return (ps.ammo_amount[weap] >= ps.max_ammo_amount[weap])
|
||||
end
|
||||
|
||||
local function P_AddAmmo(ps, weap, amount)
|
||||
if (not have_ammo_at_max(ps, weap)) then
|
||||
local curamount = ps:get_ammo_amount(weap)
|
||||
local maxamount = ps:get_max_ammo_amount(weap)
|
||||
local curamount = ps.ammo_amount[weap]
|
||||
local maxamount = ps.max_ammo_amount[weap]
|
||||
-- NOTE: no clamping towards the bottom
|
||||
ps:set_ammo_amount(weap, math.min(curamount+amount, maxamount))
|
||||
ps.ammo_amount[weap] = math.min(curamount+amount, maxamount)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -944,12 +944,12 @@ end
|
|||
|
||||
function _checkpinventory(ps, inv, amount, i)
|
||||
if (inv==ffiC.GET_SHIELD) then
|
||||
return ps:get_inv_amount(inv) ~= ps.max_shield_amount
|
||||
return ps.inv_amount[inv] ~= ps.max_shield_amount
|
||||
elseif (inv==ffiC.GET_ACCESS) then
|
||||
local palbit = PALBITS[sprite[i].pal]
|
||||
return palbit and (bit.band(ps.got_access, palbit)~=0)
|
||||
else
|
||||
return ps:get_inv_amount(inv) ~= amount
|
||||
return ps.inv_amount[inv] ~= amount
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -966,7 +966,7 @@ local INV_SELECTION_ORDER = {
|
|||
-- checkavailinven CON command
|
||||
function _selectnextinv(ps)
|
||||
for _,inv in ipairs(INV_SELECTION_ORDER) do
|
||||
if (ps:get_inv_amount(inv) > 0) then
|
||||
if (ps.inv_amount[inv] > 0) then
|
||||
ps.inven_icon = ICONS[inv]
|
||||
return
|
||||
end
|
||||
|
@ -1413,7 +1413,7 @@ function _ifp(flags, pli, aci)
|
|||
return true
|
||||
elseif (band(l,2048)~=0 and ps.jetpack_on) then
|
||||
return true
|
||||
elseif (band(l,4096)~=0 and ps:get_inv_amount(ffiC.GET_STEROIDS) > 0 and ps:get_inv_amount(ffiC.GET_STEROIDS) < 400) then
|
||||
elseif (band(l,4096)~=0 and ps.inv_amount.STEROIDS > 0 and ps.inv_amount.STEROIDS < 400) then
|
||||
return true
|
||||
elseif (band(l,8192)~=0 and ps.on_ground) then
|
||||
return true
|
||||
|
|
|
@ -215,7 +215,8 @@ __attribute__((packed)) struct {
|
|||
int16_x_MAX_WEAPONS max_ammo_amount;
|
||||
int16_x_MAX_WEAPONS ammo_amount;
|
||||
int16_x_GET_MAX inv_amount;
|
||||
int16_t wackedbyactor, pyoff, opyoff;
|
||||
const int16_t wackedbyactor;
|
||||
int16_t pyoff, opyoff;
|
||||
|
||||
int16_t horiz, horizoff, ohoriz, ohorizoff;
|
||||
const int16_t newowner;
|
||||
|
@ -246,7 +247,9 @@ __attribute__((packed)) struct {
|
|||
bool reloading;
|
||||
const uint8_t weapreccnt;
|
||||
uint8_t aim_mode, auto_aim, weaponswitch, movement_lock, team;
|
||||
uint8_t tipincs, hbomb_hold_delay, frag_ps, kickback_pic;
|
||||
uint8_t tipincs, hbomb_hold_delay;
|
||||
const uint8_t frag_ps;
|
||||
uint8_t kickback_pic;
|
||||
|
||||
uint8_t gm;
|
||||
bool on_warping_sector;
|
||||
|
@ -267,15 +270,17 @@ __attribute__((packed)) struct {
|
|||
|
||||
bool holster_weapon;
|
||||
uint8_t falling_counter, footprintshade;
|
||||
uint8_t refresh_inventory, last_full_weapon;
|
||||
uint8_t refresh_inventory;
|
||||
const uint8_t last_full_weapon;
|
||||
|
||||
bool toggle_key_flag;
|
||||
uint8_t knuckle_incs, knee_incs, access_incs;
|
||||
uint8_t walking_snd_toggle, palookup, hard_landing, fist_incs;
|
||||
|
||||
int8_t numloogs, loogcnt, scream_voice;
|
||||
int8_t last_weapon, cheat_phase, weapon_pos, wantweaponfire;
|
||||
const int8_t curr_weapon;
|
||||
const int8_t last_weapon;
|
||||
int8_t cheat_phase, weapon_pos;
|
||||
const int8_t wantweaponfire, curr_weapon;
|
||||
|
||||
uint8_t palette;
|
||||
palette_t _pals;
|
||||
|
@ -1003,33 +1008,16 @@ ffi.metatype("weaponaccess_t", weaponaccess_mt)
|
|||
local player_mt = {
|
||||
__index = {
|
||||
--- Getters/setters
|
||||
get_ammo_amount = function(p, weap)
|
||||
return p.ammo_amount[weap]
|
||||
end,
|
||||
|
||||
set_ammo_amount = function(p, weap, amount)
|
||||
p.ammo_amount[weap] = amount
|
||||
end,
|
||||
|
||||
get_max_ammo_amount = function(p, weap)
|
||||
return p.max_ammo_amount[weap]
|
||||
end,
|
||||
|
||||
set_max_ammo_amount = function(p, weap, amount)
|
||||
p.max_ammo_amount[weap] = amount
|
||||
end,
|
||||
|
||||
set_curr_weapon = function(p, weap)
|
||||
check_weapon_idx(weap)
|
||||
ffi.cast(player_ptr_ct, p).curr_weapon = weap
|
||||
end,
|
||||
|
||||
get_inv_amount = function(p, inv)
|
||||
return p.inv_amount[inv]
|
||||
end,
|
||||
|
||||
set_inv_amount = function(p, inv, amount)
|
||||
p.inv_amount[inv] = amount
|
||||
set_last_weapon = function(p, weap)
|
||||
if (not (weap < 0)) then
|
||||
check_weapon_idx(weap)
|
||||
end
|
||||
ffi.cast(player_ptr_ct, p).last_weapon = weap
|
||||
end,
|
||||
|
||||
set_ftq = function(p, ftq)
|
||||
|
@ -1049,6 +1037,20 @@ local player_mt = {
|
|||
ffi.cast(player_ptr_ct, p).customexitsound = soundnum
|
||||
end,
|
||||
|
||||
set_dummyplayersprite = function(p, spritenum)
|
||||
if (not (spritenum < 0)) then
|
||||
check_sprite_idx(spritenum)
|
||||
end
|
||||
ffi.cast(player_ptr_ct, p).dummyplayersprite = spritenum
|
||||
end,
|
||||
|
||||
set_wackedbyactor = function(p, spritenum)
|
||||
if (not (spritenum < 0)) then
|
||||
check_sprite_idx(spritenum)
|
||||
end
|
||||
ffi.cast(player_ptr_ct, p).wackedbyactor = spritenum
|
||||
end,
|
||||
|
||||
-- CON-like addammo/addweapon, but without the non-local control flow
|
||||
-- (returns true if weapon's ammo was at the max. instead).
|
||||
addammo = con._addammo,
|
||||
|
|
|
@ -2326,7 +2326,7 @@ local Cinner = {
|
|||
showviewunbiased = cmd(R,R,R,R,R,R,R,R,R,R) -- 10R
|
||||
/ "", -- TODO
|
||||
smaxammo = cmd(R,R)
|
||||
/ PLS":set_max_ammo_amount(%1,%2)",
|
||||
/ PLS".max_ammo_amount[%1]=%2",
|
||||
gmaxammo = cmd(R,W)
|
||||
/ ("%2="..PLS".max_ammo_amount[%1]"),
|
||||
spriteflags = cmd(R) -- also see outer
|
||||
|
@ -3207,7 +3207,7 @@ local function handle_cmdline_arg(str)
|
|||
g_warn[warnstr] = val
|
||||
ok = true
|
||||
end
|
||||
elseif (str:sub(2)=="fno") then
|
||||
elseif (str:sub(2,4)=="fno") then -- NOTE: not ":sub(2)"
|
||||
-- Disable printing code.
|
||||
if (#str >= 5 and str:sub(5)=="=onlycheck") then
|
||||
g_cgopt["no"] = "onlycheck"
|
||||
|
|
|
@ -4680,9 +4680,8 @@ void P_ProcessInput(int32_t snum)
|
|||
{
|
||||
if (p->on_ground == 1)
|
||||
{
|
||||
if (p->dummyplayersprite == -1)
|
||||
p->dummyplayersprite =
|
||||
A_Spawn(p->i,PLAYERONWATER);
|
||||
if (p->dummyplayersprite < 0)
|
||||
p->dummyplayersprite = A_Spawn(p->i,PLAYERONWATER);
|
||||
sprite[p->dummyplayersprite].pal = sprite[p->i].pal;
|
||||
sprite[p->dummyplayersprite].cstat |= 32768;
|
||||
|
||||
|
|
|
@ -161,6 +161,7 @@ typedef struct {
|
|||
// * int16_t --> int8_t
|
||||
// * char --> int8_t
|
||||
// Need to carefully think about implications!
|
||||
// TODO: rearrange this is the opportunity arises!
|
||||
// KEEPINSYNC lunatic/defs.ilua
|
||||
typedef struct {
|
||||
vec3_t pos, opos, vel, npos;
|
||||
|
|
Loading…
Reference in a new issue