mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-18 14:41:55 +00:00
Lunatic: getting closer to the first milestone.
On the C side, zrange, angrange and autoaimang are represented as DukePlayer_t members then. git-svn-id: https://svn.eduke32.com/eduke32@3366 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
67cdd9d883
commit
0c44056945
7 changed files with 467 additions and 291 deletions
|
@ -24,249 +24,256 @@ MAXSOUNDS = 4096
|
|||
MAXQUOTES = 16384
|
||||
MAXQUOTELEN = 128
|
||||
|
||||
local STR = {
|
||||
STR_MAPNAME = 0,
|
||||
STR_MAPFILENAME = 1,
|
||||
STR_PLAYERNAME = 2,
|
||||
STR_VERSION = 3,
|
||||
STR_GAMETYPE = 4,
|
||||
STR_VOLUMENAME = 5,
|
||||
}
|
||||
|
||||
PROJ = {
|
||||
PROJ_WORKSLIKE = 0,
|
||||
PROJ_SPAWNS = 1,
|
||||
PROJ_SXREPEAT = 2,
|
||||
PROJ_SYREPEAT = 3,
|
||||
PROJ_SOUND = 4,
|
||||
PROJ_ISOUND = 5,
|
||||
PROJ_VEL = 6,
|
||||
PROJ_EXTRA = 7,
|
||||
PROJ_DECAL = 8,
|
||||
PROJ_TRAIL = 9,
|
||||
PROJ_TXREPEAT = 10,
|
||||
PROJ_TYREPEAT = 11,
|
||||
PROJ_TOFFSET = 12,
|
||||
PROJ_TNUM = 13,
|
||||
PROJ_DROP = 14,
|
||||
PROJ_CSTAT = 15,
|
||||
PROJ_CLIPDIST = 16,
|
||||
PROJ_SHADE = 17,
|
||||
PROJ_XREPEAT = 18,
|
||||
PROJ_YREPEAT = 19,
|
||||
PROJ_PAL = 20,
|
||||
PROJ_EXTRA_RAND = 21,
|
||||
PROJ_HITRADIUS = 22,
|
||||
PROJ_VEL_MULT = 23,
|
||||
PROJ_OFFSET = 24,
|
||||
PROJ_BOUNCES = 25,
|
||||
PROJ_BSOUND = 26,
|
||||
PROJ_RANGE = 27,
|
||||
PROJ_FLASH_COLOR = 28,
|
||||
}
|
||||
|
||||
-- TODO: EVENT_INIT currently can't run since we init Lunatic state only afterwards
|
||||
EVENT = {
|
||||
EVENT_INIT = 0,
|
||||
EVENT_ENTERLEVEL = 1,
|
||||
EVENT_RESETWEAPONS = 2,
|
||||
EVENT_RESETINVENTORY = 3,
|
||||
EVENT_HOLSTER = 4,
|
||||
EVENT_LOOKLEFT = 5,
|
||||
EVENT_LOOKRIGHT = 6,
|
||||
EVENT_SOARUP = 7,
|
||||
EVENT_SOARDOWN = 8,
|
||||
EVENT_CROUCH = 9,
|
||||
EVENT_JUMP = 10,
|
||||
EVENT_RETURNTOCENTER = 11,
|
||||
EVENT_LOOKUP = 12,
|
||||
EVENT_LOOKDOWN = 13,
|
||||
EVENT_AIMUP = 14,
|
||||
EVENT_FIRE = 15,
|
||||
EVENT_CHANGEWEAPON = 16,
|
||||
EVENT_GETSHOTRANGE = 17,
|
||||
EVENT_GETAUTOAIMANGLE = 18,
|
||||
EVENT_GETLOADTILE = 19,
|
||||
EVENT_CHEATGETSTEROIDS = 20,
|
||||
EVENT_CHEATGETHEAT = 21,
|
||||
EVENT_CHEATGETBOOT = 22,
|
||||
EVENT_CHEATGETSHIELD = 23,
|
||||
EVENT_CHEATGETSCUBA = 24,
|
||||
EVENT_CHEATGETHOLODUKE = 25,
|
||||
EVENT_CHEATGETJETPACK = 26,
|
||||
EVENT_CHEATGETFIRSTAID = 27,
|
||||
EVENT_QUICKKICK = 28,
|
||||
EVENT_INVENTORY = 29,
|
||||
EVENT_USENIGHTVISION = 30,
|
||||
EVENT_USESTEROIDS = 31,
|
||||
EVENT_INVENTORYLEFT = 32,
|
||||
EVENT_INVENTORYRIGHT = 33,
|
||||
EVENT_HOLODUKEON = 34,
|
||||
EVENT_HOLODUKEOFF = 35,
|
||||
EVENT_USEMEDKIT = 36,
|
||||
EVENT_USEJETPACK = 37,
|
||||
EVENT_TURNAROUND = 38,
|
||||
EVENT_DISPLAYWEAPON = 39,
|
||||
EVENT_FIREWEAPON = 40,
|
||||
EVENT_SELECTWEAPON = 41,
|
||||
EVENT_MOVEFORWARD = 42,
|
||||
EVENT_MOVEBACKWARD = 43,
|
||||
EVENT_TURNLEFT = 44,
|
||||
EVENT_TURNRIGHT = 45,
|
||||
EVENT_STRAFELEFT = 46,
|
||||
EVENT_STRAFERIGHT = 47,
|
||||
EVENT_WEAPKEY1 = 48,
|
||||
EVENT_WEAPKEY2 = 49,
|
||||
EVENT_WEAPKEY3 = 50,
|
||||
EVENT_WEAPKEY4 = 51,
|
||||
EVENT_WEAPKEY5 = 52,
|
||||
EVENT_WEAPKEY6 = 53,
|
||||
EVENT_WEAPKEY7 = 54,
|
||||
EVENT_WEAPKEY8 = 55,
|
||||
EVENT_WEAPKEY9 = 56,
|
||||
EVENT_WEAPKEY10 = 57,
|
||||
EVENT_DRAWWEAPON = 58,
|
||||
EVENT_DISPLAYCROSSHAIR = 59,
|
||||
EVENT_DISPLAYREST = 60,
|
||||
EVENT_DISPLAYSBAR = 61,
|
||||
EVENT_RESETPLAYER = 62,
|
||||
EVENT_INCURDAMAGE = 63,
|
||||
EVENT_AIMDOWN = 64,
|
||||
EVENT_GAME = 65,
|
||||
EVENT_PREVIOUSWEAPON = 66,
|
||||
EVENT_NEXTWEAPON = 67,
|
||||
EVENT_SWIMUP = 68,
|
||||
EVENT_SWIMDOWN = 69,
|
||||
EVENT_GETMENUTILE = 70,
|
||||
EVENT_SPAWN = 71,
|
||||
EVENT_LOGO = 72,
|
||||
EVENT_EGS = 73,
|
||||
EVENT_DOFIRE = 74,
|
||||
EVENT_PRESSEDFIRE = 75,
|
||||
EVENT_USE = 76,
|
||||
EVENT_PROCESSINPUT = 77,
|
||||
EVENT_FAKEDOMOVETHINGS = 78,
|
||||
EVENT_DISPLAYROOMS = 79,
|
||||
EVENT_KILLIT = 80,
|
||||
EVENT_LOADACTOR = 81,
|
||||
EVENT_DISPLAYBONUSSCREEN = 82,
|
||||
EVENT_DISPLAYMENU = 83,
|
||||
EVENT_DISPLAYMENUREST = 84,
|
||||
EVENT_DISPLAYLOADINGSCREEN = 85,
|
||||
EVENT_ANIMATESPRITES = 86,
|
||||
EVENT_NEWGAME = 87,
|
||||
EVENT_SOUND = 88,
|
||||
EVENT_CHECKTOUCHDAMAGE = 89,
|
||||
EVENT_CHECKFLOORDAMAGE = 90,
|
||||
EVENT_LOADGAME = 91,
|
||||
EVENT_SAVEGAME = 92,
|
||||
EVENT_PREGAME = 93,
|
||||
EVENT_CHANGEMENU = 94,
|
||||
}
|
||||
|
||||
local SFLAG = {
|
||||
SFLAG_SHADOW = 0x00000001,
|
||||
SFLAG_NVG = 0x00000002,
|
||||
SFLAG_NOSHADE = 0x00000004,
|
||||
SFLAG_PROJECTILE = 0x00000008,
|
||||
SFLAG_DECAL = 0x00000010,
|
||||
SFLAG_BADGUY = 0x00000020,
|
||||
SFLAG_NOPAL = 0x00000040,
|
||||
SFLAG_NOEVENTCODE = 0x00000080,
|
||||
SFLAG_NOLIGHT = 0x00000100,
|
||||
SFLAG_USEACTIVATOR = 0x00000200,
|
||||
SFLAG_NULL = 0x00000400,
|
||||
SFLAG_NOCLIP = 0x00000800,
|
||||
SFLAG_NOFLOORSHADOW = 0x00001000,
|
||||
SFLAG_SMOOTHMOVE = 0x00002000,
|
||||
SFLAG_NOTELEPORT = 0x00004000,
|
||||
-- SFLAG_BADGUYSTAYPUT = 0x00008000,
|
||||
-- SFLAG_CACHE = 0x00010000,
|
||||
-- SFLAG_ROTFIXED = 0x00020000,
|
||||
}
|
||||
|
||||
STAT = {
|
||||
STAT_DEFAULT = 0,
|
||||
STAT_ACTOR = 1,
|
||||
STAT_ZOMBIEACTOR = 2,
|
||||
STAT_EFFECTOR = 3,
|
||||
STAT_PROJECTILE = 4,
|
||||
STAT_MISC = 5,
|
||||
STAT_STANDABLE = 6,
|
||||
STAT_LOCATOR = 7,
|
||||
STAT_ACTIVATOR = 8,
|
||||
STAT_TRANSPORT = 9,
|
||||
STAT_PLAYER = 10,
|
||||
STAT_FX = 11,
|
||||
STAT_FALLER = 12,
|
||||
STAT_DUMMYPLAYER = 13,
|
||||
STAT_LIGHT = 14,
|
||||
STAT_NETALLOC = 15,
|
||||
}
|
||||
|
||||
local GAMEFUNC = {
|
||||
GAMEFUNC_MOVE_FORWARD = 0,
|
||||
GAMEFUNC_MOVE_BACKWARD = 1,
|
||||
GAMEFUNC_TURN_LEFT = 2,
|
||||
GAMEFUNC_TURN_RIGHT = 3,
|
||||
GAMEFUNC_STRAFE = 4,
|
||||
GAMEFUNC_FIRE = 5,
|
||||
GAMEFUNC_OPEN = 6,
|
||||
GAMEFUNC_RUN = 7,
|
||||
GAMEFUNC_AUTORUN = 8,
|
||||
GAMEFUNC_JUMP = 9,
|
||||
GAMEFUNC_CROUCH = 10,
|
||||
GAMEFUNC_LOOK_UP = 11,
|
||||
GAMEFUNC_LOOK_DOWN = 12,
|
||||
GAMEFUNC_LOOK_LEFT = 13,
|
||||
GAMEFUNC_LOOK_RIGHT = 14,
|
||||
GAMEFUNC_STRAFE_LEFT = 15,
|
||||
GAMEFUNC_STRAFE_RIGHT = 16,
|
||||
GAMEFUNC_AIM_UP = 17,
|
||||
GAMEFUNC_AIM_DOWN = 18,
|
||||
GAMEFUNC_WEAPON_1 = 19,
|
||||
GAMEFUNC_WEAPON_2 = 20,
|
||||
GAMEFUNC_WEAPON_3 = 21,
|
||||
GAMEFUNC_WEAPON_4 = 22,
|
||||
GAMEFUNC_WEAPON_5 = 23,
|
||||
GAMEFUNC_WEAPON_6 = 24,
|
||||
GAMEFUNC_WEAPON_7 = 25,
|
||||
GAMEFUNC_WEAPON_8 = 26,
|
||||
GAMEFUNC_WEAPON_9 = 27,
|
||||
GAMEFUNC_WEAPON_10 = 28,
|
||||
GAMEFUNC_INVENTORY = 29,
|
||||
GAMEFUNC_INVENTORY_LEFT = 30,
|
||||
GAMEFUNC_INVENTORY_RIGHT = 31,
|
||||
GAMEFUNC_HOLO_DUKE = 32,
|
||||
GAMEFUNC_JETPACK = 33,
|
||||
GAMEFUNC_NIGHTVISION = 34,
|
||||
GAMEFUNC_MEDKIT = 35,
|
||||
GAMEFUNC_TURNAROUND = 36,
|
||||
GAMEFUNC_SENDMESSAGE = 37,
|
||||
GAMEFUNC_MAP = 38,
|
||||
GAMEFUNC_SHRINK_SCREEN = 39,
|
||||
GAMEFUNC_ENLARGE_SCREEN = 40,
|
||||
GAMEFUNC_CENTER_VIEW = 41,
|
||||
GAMEFUNC_HOLSTER_WEAPON = 42,
|
||||
GAMEFUNC_SHOW_OPPONENTS_WEAPON = 43,
|
||||
GAMEFUNC_MAP_FOLLOW_MODE = 44,
|
||||
GAMEFUNC_SEE_COOP_VIEW = 45,
|
||||
GAMEFUNC_MOUSE_AIMING = 46,
|
||||
GAMEFUNC_TOGGLE_CROSSHAIR = 47,
|
||||
GAMEFUNC_STEROIDS = 48,
|
||||
GAMEFUNC_QUICK_KICK = 49,
|
||||
GAMEFUNC_NEXT_WEAPON = 50,
|
||||
GAMEFUNC_PREVIOUS_WEAPON = 51,
|
||||
-- GAMEFUNC_SHOW_CONSOLE = 52,
|
||||
GAMEFUNC_SHOW_DUKEMATCH_SCORES = 53,
|
||||
GAMEFUNC_DPAD_SELECT = 54,
|
||||
GAMEFUNC_DPAD_AIMING = 55,
|
||||
}
|
||||
|
||||
-- KEEPINSYNC with gamedef.c:C_AddDefaultDefinitions() and the respective
|
||||
-- defines. These are exported to the ffi.C namespace and as literal defines
|
||||
-- in lunacon.lua.
|
||||
labels =
|
||||
{
|
||||
{
|
||||
STR_MAPNAME = 0,
|
||||
STR_MAPFILENAME = 1,
|
||||
STR_PLAYERNAME = 2,
|
||||
STR_VERSION = 3,
|
||||
STR_GAMETYPE = 4,
|
||||
STR_VOLUMENAME = 5,
|
||||
},
|
||||
|
||||
{
|
||||
PROJ_WORKSLIKE = 0,
|
||||
PROJ_SPAWNS = 1,
|
||||
PROJ_SXREPEAT = 2,
|
||||
PROJ_SYREPEAT = 3,
|
||||
PROJ_SOUND = 4,
|
||||
PROJ_ISOUND = 5,
|
||||
PROJ_VEL = 6,
|
||||
PROJ_EXTRA = 7,
|
||||
PROJ_DECAL = 8,
|
||||
PROJ_TRAIL = 9,
|
||||
PROJ_TXREPEAT = 10,
|
||||
PROJ_TYREPEAT = 11,
|
||||
PROJ_TOFFSET = 12,
|
||||
PROJ_TNUM = 13,
|
||||
PROJ_DROP = 14,
|
||||
PROJ_CSTAT = 15,
|
||||
PROJ_CLIPDIST = 16,
|
||||
PROJ_SHADE = 17,
|
||||
PROJ_XREPEAT = 18,
|
||||
PROJ_YREPEAT = 19,
|
||||
PROJ_PAL = 20,
|
||||
PROJ_EXTRA_RAND = 21,
|
||||
PROJ_HITRADIUS = 22,
|
||||
PROJ_VEL_MULT = 23,
|
||||
PROJ_OFFSET = 24,
|
||||
PROJ_BOUNCES = 25,
|
||||
PROJ_BSOUND = 26,
|
||||
PROJ_RANGE = 27,
|
||||
PROJ_FLASH_COLOR = 28,
|
||||
},
|
||||
|
||||
{
|
||||
EVENT_INIT = 0, -- TODO: currently can't run since we init Lunatic state only afterwards
|
||||
EVENT_ENTERLEVEL = 1,
|
||||
EVENT_RESETWEAPONS = 2,
|
||||
EVENT_RESETINVENTORY = 3,
|
||||
EVENT_HOLSTER = 4,
|
||||
EVENT_LOOKLEFT = 5,
|
||||
EVENT_LOOKRIGHT = 6,
|
||||
EVENT_SOARUP = 7,
|
||||
EVENT_SOARDOWN = 8,
|
||||
EVENT_CROUCH = 9,
|
||||
EVENT_JUMP = 10,
|
||||
EVENT_RETURNTOCENTER = 11,
|
||||
EVENT_LOOKUP = 12,
|
||||
EVENT_LOOKDOWN = 13,
|
||||
EVENT_AIMUP = 14,
|
||||
EVENT_FIRE = 15,
|
||||
EVENT_CHANGEWEAPON = 16,
|
||||
EVENT_GETSHOTRANGE = 17,
|
||||
EVENT_GETAUTOAIMANGLE = 18,
|
||||
EVENT_GETLOADTILE = 19,
|
||||
EVENT_CHEATGETSTEROIDS = 20,
|
||||
EVENT_CHEATGETHEAT = 21,
|
||||
EVENT_CHEATGETBOOT = 22,
|
||||
EVENT_CHEATGETSHIELD = 23,
|
||||
EVENT_CHEATGETSCUBA = 24,
|
||||
EVENT_CHEATGETHOLODUKE = 25,
|
||||
EVENT_CHEATGETJETPACK = 26,
|
||||
EVENT_CHEATGETFIRSTAID = 27,
|
||||
EVENT_QUICKKICK = 28,
|
||||
EVENT_INVENTORY = 29,
|
||||
EVENT_USENIGHTVISION = 30,
|
||||
EVENT_USESTEROIDS = 31,
|
||||
EVENT_INVENTORYLEFT = 32,
|
||||
EVENT_INVENTORYRIGHT = 33,
|
||||
EVENT_HOLODUKEON = 34,
|
||||
EVENT_HOLODUKEOFF = 35,
|
||||
EVENT_USEMEDKIT = 36,
|
||||
EVENT_USEJETPACK = 37,
|
||||
EVENT_TURNAROUND = 38,
|
||||
EVENT_DISPLAYWEAPON = 39,
|
||||
EVENT_FIREWEAPON = 40,
|
||||
EVENT_SELECTWEAPON = 41,
|
||||
EVENT_MOVEFORWARD = 42,
|
||||
EVENT_MOVEBACKWARD = 43,
|
||||
EVENT_TURNLEFT = 44,
|
||||
EVENT_TURNRIGHT = 45,
|
||||
EVENT_STRAFELEFT = 46,
|
||||
EVENT_STRAFERIGHT = 47,
|
||||
EVENT_WEAPKEY1 = 48,
|
||||
EVENT_WEAPKEY2 = 49,
|
||||
EVENT_WEAPKEY3 = 50,
|
||||
EVENT_WEAPKEY4 = 51,
|
||||
EVENT_WEAPKEY5 = 52,
|
||||
EVENT_WEAPKEY6 = 53,
|
||||
EVENT_WEAPKEY7 = 54,
|
||||
EVENT_WEAPKEY8 = 55,
|
||||
EVENT_WEAPKEY9 = 56,
|
||||
EVENT_WEAPKEY10 = 57,
|
||||
EVENT_DRAWWEAPON = 58,
|
||||
EVENT_DISPLAYCROSSHAIR = 59,
|
||||
EVENT_DISPLAYREST = 60,
|
||||
EVENT_DISPLAYSBAR = 61,
|
||||
EVENT_RESETPLAYER = 62,
|
||||
EVENT_INCURDAMAGE = 63,
|
||||
EVENT_AIMDOWN = 64,
|
||||
EVENT_GAME = 65,
|
||||
EVENT_PREVIOUSWEAPON = 66,
|
||||
EVENT_NEXTWEAPON = 67,
|
||||
EVENT_SWIMUP = 68,
|
||||
EVENT_SWIMDOWN = 69,
|
||||
EVENT_GETMENUTILE = 70,
|
||||
EVENT_SPAWN = 71,
|
||||
EVENT_LOGO = 72,
|
||||
EVENT_EGS = 73,
|
||||
EVENT_DOFIRE = 74,
|
||||
EVENT_PRESSEDFIRE = 75,
|
||||
EVENT_USE = 76,
|
||||
EVENT_PROCESSINPUT = 77,
|
||||
EVENT_FAKEDOMOVETHINGS = 78,
|
||||
EVENT_DISPLAYROOMS = 79,
|
||||
EVENT_KILLIT = 80,
|
||||
EVENT_LOADACTOR = 81,
|
||||
EVENT_DISPLAYBONUSSCREEN = 82,
|
||||
EVENT_DISPLAYMENU = 83,
|
||||
EVENT_DISPLAYMENUREST = 84,
|
||||
EVENT_DISPLAYLOADINGSCREEN = 85,
|
||||
EVENT_ANIMATESPRITES = 86,
|
||||
EVENT_NEWGAME = 87,
|
||||
EVENT_SOUND = 88,
|
||||
EVENT_CHECKTOUCHDAMAGE = 89,
|
||||
EVENT_CHECKFLOORDAMAGE = 90,
|
||||
EVENT_LOADGAME = 91,
|
||||
EVENT_SAVEGAME = 92,
|
||||
EVENT_PREGAME = 93,
|
||||
EVENT_CHANGEMENU = 94,
|
||||
},
|
||||
|
||||
{
|
||||
SFLAG_SHADOW = 0x00000001,
|
||||
SFLAG_NVG = 0x00000002,
|
||||
SFLAG_NOSHADE = 0x00000004,
|
||||
SFLAG_PROJECTILE = 0x00000008,
|
||||
SFLAG_DECAL = 0x00000010,
|
||||
SFLAG_BADGUY = 0x00000020,
|
||||
SFLAG_NOPAL = 0x00000040,
|
||||
SFLAG_NOEVENTCODE = 0x00000080,
|
||||
SFLAG_NOLIGHT = 0x00000100,
|
||||
SFLAG_USEACTIVATOR = 0x00000200,
|
||||
SFLAG_NULL = 0x00000400,
|
||||
SFLAG_NOCLIP = 0x00000800,
|
||||
SFLAG_NOFLOORSHADOW = 0x00001000,
|
||||
SFLAG_SMOOTHMOVE = 0x00002000,
|
||||
SFLAG_NOTELEPORT = 0x00004000,
|
||||
-- SFLAG_BADGUYSTAYPUT = 0x00008000,
|
||||
-- SFLAG_CACHE = 0x00010000,
|
||||
-- SFLAG_ROTFIXED = 0x00020000,
|
||||
},
|
||||
|
||||
{
|
||||
STAT_DEFAULT = 0,
|
||||
STAT_ACTOR = 1,
|
||||
STAT_ZOMBIEACTOR = 2,
|
||||
STAT_EFFECTOR = 3,
|
||||
STAT_PROJECTILE = 4,
|
||||
STAT_MISC = 5,
|
||||
STAT_STANDABLE = 6,
|
||||
STAT_LOCATOR = 7,
|
||||
STAT_ACTIVATOR = 8,
|
||||
STAT_TRANSPORT = 9,
|
||||
STAT_PLAYER = 10,
|
||||
STAT_FX = 11,
|
||||
STAT_FALLER = 12,
|
||||
STAT_DUMMYPLAYER = 13,
|
||||
STAT_LIGHT = 14,
|
||||
STAT_NETALLOC = 15,
|
||||
},
|
||||
|
||||
{
|
||||
GAMEFUNC_MOVE_FORWARD = 0,
|
||||
GAMEFUNC_MOVE_BACKWARD = 1,
|
||||
GAMEFUNC_TURN_LEFT = 2,
|
||||
GAMEFUNC_TURN_RIGHT = 3,
|
||||
GAMEFUNC_STRAFE = 4,
|
||||
GAMEFUNC_FIRE = 5,
|
||||
GAMEFUNC_OPEN = 6,
|
||||
GAMEFUNC_RUN = 7,
|
||||
GAMEFUNC_AUTORUN = 8,
|
||||
GAMEFUNC_JUMP = 9,
|
||||
GAMEFUNC_CROUCH = 10,
|
||||
GAMEFUNC_LOOK_UP = 11,
|
||||
GAMEFUNC_LOOK_DOWN = 12,
|
||||
GAMEFUNC_LOOK_LEFT = 13,
|
||||
GAMEFUNC_LOOK_RIGHT = 14,
|
||||
GAMEFUNC_STRAFE_LEFT = 15,
|
||||
GAMEFUNC_STRAFE_RIGHT = 16,
|
||||
GAMEFUNC_AIM_UP = 17,
|
||||
GAMEFUNC_AIM_DOWN = 18,
|
||||
GAMEFUNC_WEAPON_1 = 19,
|
||||
GAMEFUNC_WEAPON_2 = 20,
|
||||
GAMEFUNC_WEAPON_3 = 21,
|
||||
GAMEFUNC_WEAPON_4 = 22,
|
||||
GAMEFUNC_WEAPON_5 = 23,
|
||||
GAMEFUNC_WEAPON_6 = 24,
|
||||
GAMEFUNC_WEAPON_7 = 25,
|
||||
GAMEFUNC_WEAPON_8 = 26,
|
||||
GAMEFUNC_WEAPON_9 = 27,
|
||||
GAMEFUNC_WEAPON_10 = 28,
|
||||
GAMEFUNC_INVENTORY = 29,
|
||||
GAMEFUNC_INVENTORY_LEFT = 30,
|
||||
GAMEFUNC_INVENTORY_RIGHT = 31,
|
||||
GAMEFUNC_HOLO_DUKE = 32,
|
||||
GAMEFUNC_JETPACK = 33,
|
||||
GAMEFUNC_NIGHTVISION = 34,
|
||||
GAMEFUNC_MEDKIT = 35,
|
||||
GAMEFUNC_TURNAROUND = 36,
|
||||
GAMEFUNC_SENDMESSAGE = 37,
|
||||
GAMEFUNC_MAP = 38,
|
||||
GAMEFUNC_SHRINK_SCREEN = 39,
|
||||
GAMEFUNC_ENLARGE_SCREEN = 40,
|
||||
GAMEFUNC_CENTER_VIEW = 41,
|
||||
GAMEFUNC_HOLSTER_WEAPON = 42,
|
||||
GAMEFUNC_SHOW_OPPONENTS_WEAPON = 43,
|
||||
GAMEFUNC_MAP_FOLLOW_MODE = 44,
|
||||
GAMEFUNC_SEE_COOP_VIEW = 45,
|
||||
GAMEFUNC_MOUSE_AIMING = 46,
|
||||
GAMEFUNC_TOGGLE_CROSSHAIR = 47,
|
||||
GAMEFUNC_STEROIDS = 48,
|
||||
GAMEFUNC_QUICK_KICK = 49,
|
||||
GAMEFUNC_NEXT_WEAPON = 50,
|
||||
GAMEFUNC_PREVIOUS_WEAPON = 51,
|
||||
-- GAMEFUNC_SHOW_CONSOLE = 52,
|
||||
GAMEFUNC_SHOW_DUKEMATCH_SCORES = 53,
|
||||
GAMEFUNC_DPAD_SELECT = 54,
|
||||
GAMEFUNC_DPAD_AIMING = 55,
|
||||
}
|
||||
STR,
|
||||
PROJ,
|
||||
EVENT,
|
||||
SFLAG,
|
||||
STAT,
|
||||
GAMEFUNC,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ local cansee, hitscan, neartag = dc.cansee, dc.hitscan, dc.neartag
|
|||
local inside = dc.inside
|
||||
|
||||
local sector, wall, sprite = dc.sector, dc.wall, dc.sprite
|
||||
local spritesofsect = dc.spritesofsect
|
||||
local spritesofsect, spritesofstat = dc.spritesofsect, dc.spritesofstat
|
||||
|
||||
|
||||
module(...)
|
||||
|
@ -304,6 +304,7 @@ end
|
|||
local D = {
|
||||
-- TODO: dynamic tile remapping
|
||||
ACTIVATOR = 2,
|
||||
RESPAWN = 9,
|
||||
APLAYER = 1405,
|
||||
|
||||
FIRSTAID = 53,
|
||||
|
@ -314,8 +315,23 @@ local D = {
|
|||
BOOTS = 61,
|
||||
HOLODUKE = 1348,
|
||||
|
||||
STATUE = 753,
|
||||
NAKED1 = 603,
|
||||
PODFEM1 = 1294,
|
||||
FEM1 = 1312,
|
||||
FEM2 = 1317,
|
||||
FEM3 = 1321,
|
||||
FEM5 = 1323,
|
||||
FEM4 = 1325,
|
||||
FEM6 = 1334,
|
||||
FEM8 = 1336,
|
||||
FEM7 = 1395,
|
||||
FEM9 = 3450,
|
||||
FEM10 = 4864,
|
||||
|
||||
ATOMICHEALTH = 100,
|
||||
GLASSPIECES = 1031,
|
||||
TRANSPORTERSTAR = 1630,
|
||||
COMMANDER = 1920,
|
||||
JIBS2 = 2250,
|
||||
SCRAP1 = 2400,
|
||||
|
@ -713,7 +729,7 @@ end
|
|||
|
||||
function _canseetarget(spr, ps)
|
||||
-- NOTE: &41 ?
|
||||
return cansee(spr^krandand(41), spr.sectnum,
|
||||
return cansee(spr^(256*krandand(41)), spr.sectnum,
|
||||
ps.pos, sprite[ps.i].sectnum)
|
||||
end
|
||||
|
||||
|
@ -855,10 +871,55 @@ end
|
|||
|
||||
function _flash(spr, ps)
|
||||
spr.shade = -127
|
||||
ps.visibility = -127
|
||||
ps.visibility = -127 -- XXX
|
||||
ffiC.lastvisinc = ffiC.totalclock+32
|
||||
end
|
||||
|
||||
local function G_OperateRespawns(tag)
|
||||
for i in spritesofstat(ffiC.STAT_FX) do
|
||||
local spr = sprite[i]
|
||||
|
||||
if (spr.lotag==tag and spr.picnum==D.RESPAWN) then
|
||||
if (ffiC.ud.monsters_off~=0 and isenemytile(spr.hitag)) then
|
||||
return
|
||||
end
|
||||
|
||||
local j = spawn(i, D.TRANSPORTERSTAR)
|
||||
sprite[j].z = sprite[j].z - (32*256)
|
||||
|
||||
-- Just a way to killit (see G_MoveFX(): RESPAWN__STATIC)
|
||||
spr.extra = 66-12
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local RESPAWN_USE_YVEL =
|
||||
{
|
||||
[D.STATUE] = true,
|
||||
[D.NAKED1] = true,
|
||||
[D.PODFEM1] = true,
|
||||
[D.FEM1] = true,
|
||||
[D.FEM2] = true,
|
||||
[D.FEM3] = true,
|
||||
[D.FEM5] = true,
|
||||
[D.FEM4] = true,
|
||||
[D.FEM6] = true,
|
||||
[D.FEM8] = true,
|
||||
[D.FEM7] = true,
|
||||
[D.FEM9] = true,
|
||||
[D.FEM10] = true,
|
||||
}
|
||||
|
||||
function _respawnhitag(spr)
|
||||
if (RESPAWN_USE_YVEL[spr.picnum]) then
|
||||
if (spr.yvel ~= 0) then
|
||||
G_OperateRespawns(spr.yvel)
|
||||
end
|
||||
else
|
||||
G_OperateRespawns(spr.hitag)
|
||||
end
|
||||
end
|
||||
|
||||
local INVENTILE = {
|
||||
[D.FIRSTAID] = true,
|
||||
[D.STEROIDS] = true,
|
||||
|
@ -879,6 +940,48 @@ function _checkrespawn(spr)
|
|||
return (ffiC.ud.respawn_items~=0)
|
||||
end
|
||||
|
||||
-- SOUNDS
|
||||
|
||||
local function check_sound_idx(sndidx)
|
||||
if (sndidx >= con_lang.MAXSOUNDS+0ULL) then
|
||||
error("invalid sound number "..sndidx, 2)
|
||||
end
|
||||
end
|
||||
|
||||
function _ianysound(aci)
|
||||
check_sprite_idx(aci)
|
||||
return (ffiC.A_CheckAnySoundPlaying(aci)~=0)
|
||||
end
|
||||
|
||||
function _sound(aci, sndidx)
|
||||
check_sprite_idx(aci)
|
||||
ffiC.A_PlaySound(sndidx, aci)
|
||||
end
|
||||
|
||||
function _globalsound(pli, sndidx)
|
||||
-- TODO: conditional on coop, fake multimode
|
||||
if (pli==ffiC.screenpeek) then
|
||||
_sound(player[pli].i, sndidx)
|
||||
end
|
||||
end
|
||||
|
||||
function _stopsound(aci, sndidx)
|
||||
check_sprite_idx(aci)
|
||||
check_sound_idx(sndidx)
|
||||
-- XXX: This is weird: the checking is done wrt a sprite, but the sound not.
|
||||
-- NOTE: S_StopSound() stops sound <sndidx> that started playing most recently.
|
||||
if (ffiC.S_CheckSoundPlaying(aci, sndidx) ~= 0) then
|
||||
S_StopSound(sndidx)
|
||||
end
|
||||
end
|
||||
|
||||
function _soundonce(aci, sndidx)
|
||||
check_sound_idx(sndidx)
|
||||
if (ffiC.S_CheckSoundPlaying(aci, sndidx) == 0) then
|
||||
_sound(aci, sndidx)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--- Exported functions ---
|
||||
|
||||
|
|
|
@ -164,6 +164,9 @@ local DUKEPLAYER_STRUCT = [[
|
|||
|
||||
uint32_t interface_toggle_flag;
|
||||
|
||||
int32_t zrange;
|
||||
int16_t angrange, autoaimang;
|
||||
|
||||
uint16_t max_actors_killed, actors_killed;
|
||||
uint16_t gotweapon, zoom;
|
||||
|
||||
|
@ -455,6 +458,7 @@ tiledata_t g_tile[MAXTILES];
|
|||
char *ScriptQuotes[];
|
||||
|
||||
const int32_t playerswhenstarted;
|
||||
const int32_t screenpeek;
|
||||
int32_t lastvisinc;
|
||||
int16_t g_spriteDeleteQueueSize;
|
||||
int16_t BlimpSpawnSprites[15];
|
||||
|
@ -476,6 +480,11 @@ int32_t A_Spawn(int32_t j, int32_t pn);
|
|||
void A_AddToDeleteQueue(int32_t i);
|
||||
void P_DoQuote(int32_t q, DukePlayer_t *p);
|
||||
void G_ClearCameraView(DukePlayer_t *ps);
|
||||
|
||||
int32_t A_CheckAnySoundPlaying(int32_t i);
|
||||
int32_t A_PlaySound(uint32_t num, int32_t i);
|
||||
int32_t S_CheckSoundPlaying(int32_t i, int32_t num);
|
||||
void S_StopSound(int32_t num);
|
||||
]]
|
||||
|
||||
-- functions
|
||||
|
@ -792,7 +801,7 @@ local player_mt = {
|
|||
}
|
||||
ffi.metatype("DukePlayer_t", player_mt)
|
||||
|
||||
|
||||
-- Declare all con_lang.labels constants in the global FFI namespace.
|
||||
for i=1,#con_lang.labels do
|
||||
local strbuf = {"enum {"}
|
||||
|
||||
|
@ -1077,7 +1086,7 @@ local function our_gameevent(event, func)
|
|||
if (event:sub(1,6) ~= "EVENT_") then
|
||||
event = "EVENT_"..event
|
||||
end
|
||||
local eventidx = con_lang.labels[3][event] -- 3: event list
|
||||
local eventidx = con_lang.labels.EVENT[event]
|
||||
if (eventidx == nil) then
|
||||
errorf(2, "gameevent: invalid event label %q", event)
|
||||
end
|
||||
|
|
|
@ -75,6 +75,7 @@ g_tile;
|
|||
|
||||
ScriptQuotes;
|
||||
|
||||
screenpeek;
|
||||
playerswhenstarted;
|
||||
lastvisinc;
|
||||
g_spriteDeleteQueueSize;
|
||||
|
@ -108,4 +109,9 @@ A_Spawn;
|
|||
A_AddToDeleteQueue;
|
||||
P_DoQuote;
|
||||
G_ClearCameraView;
|
||||
|
||||
A_CheckAnySoundPlaying;
|
||||
A_PlaySound;
|
||||
S_CheckSoundPlaying;
|
||||
S_StopSound;
|
||||
};
|
||||
|
|
|
@ -29,7 +29,7 @@ local ffi, ffiC
|
|||
if (string.dump) then
|
||||
bit = require("bit")
|
||||
-- For Rio Lua:
|
||||
bit = { bor=function() return 0 end }
|
||||
-- bit = { bor=function() return 0 end }
|
||||
require("strict")
|
||||
else
|
||||
bit = require("bit")
|
||||
|
@ -91,8 +91,8 @@ local g_warn = { ["not-redefined"]=true, ["bad-identifier"]=true,
|
|||
|
||||
-- How many 'if' statements are following immediately each other,
|
||||
-- needed to cope with CONs dangling-else resolution
|
||||
local g_ifseqlevel = 0
|
||||
|
||||
local g_iflevel = 0
|
||||
local g_ifelselevel = 0
|
||||
|
||||
---=== Code generation ===---
|
||||
local g_have_file = {} -- [filename]=true
|
||||
|
@ -108,7 +108,8 @@ local function getlinecol(pos) end -- fwd-decl
|
|||
local function new_initial_codetab()
|
||||
return {
|
||||
"local _con, _bit, _math = require'con', require'bit', require'math';",
|
||||
"local sector, sprite, actor, player = sector, sprite, actor, player;"
|
||||
"local sector, sprite, actor, player = sector, sprite, actor, player;",
|
||||
"local gameactor=gameactor;"
|
||||
}
|
||||
end
|
||||
|
||||
|
@ -156,7 +157,7 @@ local function on_actor_end(usertype, tsamm, codetab)
|
|||
end
|
||||
|
||||
local function on_state_end(statename, codetab)
|
||||
-- TODO: mangle names, make them accessible from other translation units
|
||||
-- TODO: mangle names
|
||||
addcodef("local function %s(_aci, _pli, _dist)", statename)
|
||||
assert(type(codetab)=="table")
|
||||
addcode(codetab)
|
||||
|
@ -278,7 +279,7 @@ local function do_define_label(identifier, num)
|
|||
else
|
||||
-- conl.labels[...]: don't warn for wrong PROJ_ redefinitions
|
||||
if (g_warn["not-redefined"]) then
|
||||
if (oldval ~= num and conl.labels[2][identifier]==nil) then
|
||||
if (oldval ~= num and conl.labels.PROJ[identifier]==nil) then
|
||||
warnprintf("label \"%s\" not redefined with new value %d (old: %d)",
|
||||
identifier, num, oldval)
|
||||
end
|
||||
|
@ -796,6 +797,10 @@ local function handle_move(mv, ...)
|
|||
return format(ACS":set_move(%s,%d)", mv, (flags[1] and bit.bor(...)) or 0)
|
||||
end
|
||||
|
||||
local function handle_debug(val)
|
||||
return format("print('%s:%d: debug %d')", g_filename, getlinecol(g_lastkwpos), val)
|
||||
end
|
||||
|
||||
-- NOTE about prefixes: most is handled by all_alt_pattern(), however commands
|
||||
-- that have no arguments and that are prefixes of other commands MUST be
|
||||
-- suffixed with a "* #sp1" pattern.
|
||||
|
@ -961,13 +966,13 @@ local Ci = {
|
|||
angoff = cmd(D)
|
||||
/ "spritext[_aci].angoff=%1",
|
||||
debug = cmd(D)
|
||||
/ "", -- TODO?
|
||||
/ handle_debug,
|
||||
endofgame = cmd(D)
|
||||
/ "_con._endofgame(_pli,%1)",
|
||||
eqspawn = cmd(D),
|
||||
espawn = cmd(D),
|
||||
globalsound = cmd(D)
|
||||
/ "",
|
||||
/ "_con._globalsound(_pli,%1)",
|
||||
lotsofglass = cmd(D)
|
||||
/ "_con._A_SpawnGlass(_aci,%1)",
|
||||
mail = cmd(D)
|
||||
|
@ -984,13 +989,14 @@ local Ci = {
|
|||
save = cmd(D),
|
||||
sleeptime = cmd(D)
|
||||
/ ACS".timetosleep=%1",
|
||||
soundonce = cmd(D),
|
||||
soundonce = cmd(D)
|
||||
/ "_con._soundonce(_aci,%1)",
|
||||
sound = cmd(D)
|
||||
/ "", -- TODO: all things audio...
|
||||
/ "_con._sound(_aci,%1)",
|
||||
spawn = cmd(D)
|
||||
/ "_con.spawn(_aci, %1)",
|
||||
/ "_con.spawn(_aci,%1)",
|
||||
stopsound = cmd(D)
|
||||
/ "",
|
||||
/ "_con._stopsound(_aci,%1)",
|
||||
|
||||
eshoot = cmd(D),
|
||||
ezshoot = cmd(R,D),
|
||||
|
@ -1003,7 +1009,7 @@ local Ci = {
|
|||
fall = cmd()
|
||||
/ "_con._VM_FallSprite(_aci)",
|
||||
flash = cmd()
|
||||
/ format("_con._flash(%s,%s)", ACS"", SPS""),
|
||||
/ format("_con._flash(%s,%s)", SPS"", PLS""),
|
||||
getlastpal = cmd()
|
||||
/ "_con._getlastpal(_aci)",
|
||||
insertspriteq = cmd()
|
||||
|
@ -1011,7 +1017,7 @@ local Ci = {
|
|||
killit = cmd() -- NLCF
|
||||
/ "_con.killit()",
|
||||
mikesnd = cmd()
|
||||
/ "", -- TODO
|
||||
/ format("_con._soundonce(_aci,%s)", SPS".yvel"),
|
||||
nullop = cmd()
|
||||
/ "", -- NOTE: really generate no code
|
||||
pkick = cmd()
|
||||
|
@ -1025,7 +1031,7 @@ local Ci = {
|
|||
resetplayer = cmd() -- NLCF
|
||||
/ "if (_con._VM_ResetPlayer2(_pli,_aci)) then _con.longjmp() end",
|
||||
respawnhitag = cmd()
|
||||
/ "", -- TODO
|
||||
/ format("_con._respawnhitag(%s)", SPS""),
|
||||
tip = cmd()
|
||||
/ PLS".tipincs=26",
|
||||
tossweapon = cmd()
|
||||
|
@ -1176,13 +1182,13 @@ local Cif = {
|
|||
ifrnd = cmd(D)
|
||||
/ "_con.rnd(%1)",
|
||||
ifpdistl = cmd(D)
|
||||
/ function(val) return "_dist<"..val end, --, "_con.sleepcheck(_aci,_dist)" end,
|
||||
/ function(val) return "_dist<"..val, "", "_con._sleepcheck(_aci,_dist)" end,
|
||||
ifpdistg = cmd(D)
|
||||
/ function(val) return "_dist>"..val end, --"_con.sleepcheck(_aci,_dist)" end,
|
||||
/ function(val) return "_dist>"..val, "", "_con._sleepcheck(_aci,_dist)" end,
|
||||
ifactioncount = cmd(D)
|
||||
/ ACS":get_acount()==%1",
|
||||
/ ACS":get_acount()>=%1",
|
||||
ifcount = cmd(D)
|
||||
/ ACS":get_count()==%1",
|
||||
/ ACS":get_count()>=%1",
|
||||
ifactor = cmd(D)
|
||||
/ SPS".picnum==%1",
|
||||
ifstrength = cmd(D)
|
||||
|
@ -1246,7 +1252,7 @@ local Cif = {
|
|||
ifnotmoving = cmd()
|
||||
/ "_bit.band(actor[_aci].movflag,49152)>16384",
|
||||
ifnosounds = cmd()
|
||||
/ "false",
|
||||
/ "not _con._ianysound()",
|
||||
ifmultiplayer = cmd()
|
||||
/ "false", -- TODO?
|
||||
ifinwater = cmd()
|
||||
|
@ -1264,8 +1270,8 @@ local Cif = {
|
|||
ifclient = cmd(),
|
||||
ifcanshoottarget = cmd()
|
||||
/ "_con._canshoottarget(_dist,_aci)",
|
||||
ifcanseetarget = cmd() -- TODO: conditionally set timetosleep afterwards
|
||||
/ format("_con._canseetarget(%s,%s)", SPS"", PLS""),
|
||||
ifcanseetarget = cmd() -- XXX: 1536 is SLEEPTIME
|
||||
/ function() return format("_con._canseetarget(%s,%s)", SPS"", PLS""), ACS".timetosleep=1536" end,
|
||||
ifcansee = cmd() * #sp1
|
||||
/ format("_con._cansee(_aci,%s)", PLS""),
|
||||
ifbulletnear = cmd()
|
||||
|
@ -1396,9 +1402,12 @@ local function after_if_cmd_Cmt(subj, pos, ...)
|
|||
return nil
|
||||
end
|
||||
|
||||
if (type(capts[1])=="string" and (capts[2]==nil or type(capts[2])=="string") and capts[3]==nil) then
|
||||
assert(capts[2]==nil or capts[2]=="_con.sleepcheck(_aci,_dist)")
|
||||
return true, capts[1], capts[2]
|
||||
if (capts[1] ~= nil) then
|
||||
assert(#capts <= 3)
|
||||
for i=1,#capts do
|
||||
assert(type(capts[i]=="string"))
|
||||
end
|
||||
return true, unpack(capts, 1, #capts)
|
||||
end
|
||||
|
||||
return true
|
||||
|
@ -1516,39 +1525,60 @@ local t_good_identifier = Range("AZ", "az", "__") * Range("AZ", "az", "__", "09"
|
|||
-- This is broken in itself, so we ought to make a compatibility/modern CON switch.
|
||||
local t_broken_identifier = BadIdent(-((t_number + t_good_identifier) * (sp1 + Set("[]:"))) *
|
||||
(alphanum + Set("_/\\*?")) * (alphanum + Set("_/\\*-+?"))^0)
|
||||
local g_ifStack = {}
|
||||
|
||||
local function begin_if_fn(condstr, endifstr)
|
||||
g_ifseqlevel = g_ifseqlevel+1
|
||||
-- These two tables hold code to be inserted at a later point: either at
|
||||
-- the end of the "if" body, or the end of the whole "if [else]" block.
|
||||
-- For CON interpreter patterns like these:
|
||||
-- VM_CONDITIONAL(<condition>);
|
||||
-- <do_something_afterwards>
|
||||
-- (Still not the same if the body returns or jumps out)
|
||||
local g_endIfCode = {}
|
||||
local g_endIfElseCode = {}
|
||||
|
||||
local function add_deferred_code(tab, lev, str)
|
||||
if (str ~= nil) then
|
||||
assert(type(str)=="string")
|
||||
tab[lev] = str
|
||||
end
|
||||
end
|
||||
|
||||
local function get_deferred_code(tab, lev, code)
|
||||
if (tab[lev]) then
|
||||
code = code..tab[lev]
|
||||
tab[lev] = nil
|
||||
end
|
||||
return code
|
||||
end
|
||||
|
||||
local function begin_if_fn(condstr, endifstr, endifelsestr)
|
||||
condstr = condstr or "TODO"
|
||||
assert(type(condstr)=="string")
|
||||
|
||||
if (endifstr ~= nil) then
|
||||
assert(type(endifstr)=="string")
|
||||
g_ifStack[#g_ifStack+1] = endifstr
|
||||
end
|
||||
add_deferred_code(g_endIfCode, g_iflevel, endifstr)
|
||||
add_deferred_code(g_endIfElseCode, g_ifelselevel, endifelsestr)
|
||||
|
||||
g_iflevel = g_iflevel+1
|
||||
g_ifelselevel = g_ifelselevel+1
|
||||
|
||||
return format("if (%s) then", condstr)
|
||||
end
|
||||
|
||||
local function end_if_fn()
|
||||
local code
|
||||
if (#g_ifStack > 0) then
|
||||
code = g_ifStack[#g_ifStack]
|
||||
g_ifStack[#g_ifStack] = nil
|
||||
end
|
||||
|
||||
g_ifseqlevel = g_ifseqlevel-1
|
||||
if (code) then
|
||||
-- The condition above is significant here.
|
||||
-- (See lpeg.c: functioncap(), where a lua_call(..., LUA_MULTRET) is done)
|
||||
g_iflevel = g_iflevel-1
|
||||
local code = get_deferred_code(g_endIfCode, g_iflevel, "")
|
||||
if (code ~= "") then
|
||||
return code
|
||||
end
|
||||
end
|
||||
|
||||
local function end_if_else_fn()
|
||||
g_ifelselevel = g_ifelselevel-1
|
||||
return get_deferred_code(g_endIfElseCode, g_ifelselevel, "end ")
|
||||
end
|
||||
|
||||
local function check_else_Cmt()
|
||||
-- match an 'else' only at the outermost level
|
||||
local good = (g_ifseqlevel==0)
|
||||
local good = (g_iflevel==0)
|
||||
if (good) then
|
||||
return true, "else"
|
||||
end
|
||||
|
@ -1610,7 +1640,7 @@ local Grammar = Pat{
|
|||
if_stmt = con_if_begs/begin_if_fn * sp1
|
||||
* Var("single_stmt") * (Pat("")/end_if_fn)
|
||||
* (sp1 * lpeg.Cmt(Pat("else"), check_else_Cmt) * sp1 * Var("single_stmt"))^-1
|
||||
* lpeg.Cc("end"),
|
||||
* (Pat("")/end_if_else_fn),
|
||||
|
||||
-- TODO?: SST TC has "state ... else ends"
|
||||
while_stmt = Keyw("whilevarvarn") * sp1 * t_rvar * sp1 * t_rvar * sp1 * Var("single_stmt")
|
||||
|
@ -1687,7 +1717,8 @@ function parse(contents) -- local
|
|||
local lastkw, lastkwpos, numerrors = g_lastkw, g_lastkwpos, g_numerrors
|
||||
local newlineidxs = g_newlineidxs
|
||||
|
||||
g_ifseqlevel = 0
|
||||
g_iflevel = 0
|
||||
g_ifelselevel = 0
|
||||
g_have_file[g_filename] = true
|
||||
|
||||
-- set up new state
|
||||
|
|
|
@ -342,13 +342,21 @@ static int32_t GetAutoAimAngle(int32_t i, int32_t p, int32_t atwith,
|
|||
|
||||
Bassert((unsigned)p < MAXPLAYERS);
|
||||
|
||||
#ifdef LUNATIC
|
||||
g_player[p].ps->autoaimang = AUTO_AIM_ANGLE;
|
||||
#else
|
||||
Gv_SetVar(g_iAimAngleVarID, AUTO_AIM_ANGLE, i, p);
|
||||
#endif
|
||||
|
||||
if (G_HaveEvent(EVENT_GETAUTOAIMANGLE))
|
||||
VM_OnEvent(EVENT_GETAUTOAIMANGLE, i, p, -1, 0);
|
||||
|
||||
{
|
||||
#ifdef LUNATIC
|
||||
int32_t aimang = g_player[p].ps->autoaimang;
|
||||
#else
|
||||
int32_t aimang = Gv_GetVar(g_iAimAngleVarID, i, p);
|
||||
#endif
|
||||
if (aimang > 0)
|
||||
j = A_FindTargetSprite(&sprite[i], aimang, atwith);
|
||||
}
|
||||
|
@ -445,18 +453,27 @@ static void P_PreFireHitscan(int32_t i, int32_t p, int32_t atwith,
|
|||
int32_t zRange=256;
|
||||
|
||||
int32_t j = GetAutoAimAngle(i, p, atwith, 5<<8, 0+1, srcvect, 256, zvel, sa);
|
||||
const DukePlayer_t *const ps = g_player[p].ps;
|
||||
DukePlayer_t *const ps = g_player[p].ps;
|
||||
|
||||
#ifdef LUNATIC
|
||||
ps->angrange = angRange;
|
||||
ps->zrange = zRange;
|
||||
#else
|
||||
Gv_SetVar(g_iAngRangeVarID,angRange, i,p);
|
||||
Gv_SetVar(g_iZRangeVarID,zRange,i,p);
|
||||
#endif
|
||||
|
||||
if (G_HaveEvent(EVENT_GETSHOTRANGE))
|
||||
VM_OnEvent(EVENT_GETSHOTRANGE, i,p, -1, 0);
|
||||
#if !defined LUNATIC_ONLY
|
||||
// TODO
|
||||
|
||||
#if defined LUNATIC
|
||||
angRange = ps->angrange;
|
||||
zRange = ps->zrange;
|
||||
#else
|
||||
angRange=Gv_GetVar(g_iAngRangeVarID,i,p);
|
||||
zRange=Gv_GetVar(g_iZRangeVarID,i,p);
|
||||
#endif
|
||||
|
||||
if (accurate_autoaim_p)
|
||||
{
|
||||
if (!ps->auto_aim)
|
||||
|
|
|
@ -164,7 +164,10 @@ typedef struct {
|
|||
int32_t autostep, autostep_sbw;
|
||||
|
||||
uint32_t interface_toggle_flag;
|
||||
|
||||
#ifdef LUNATIC
|
||||
int32_t zrange;
|
||||
int16_t angrange, autoaimang;
|
||||
#endif
|
||||
uint16_t max_actors_killed, actors_killed;
|
||||
uint16_t gotweapon, zoom;
|
||||
|
||||
|
|
Loading…
Reference in a new issue