2014-03-15 16:59:03 +00:00
|
|
|
// SONIC ROBO BLAST 2
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
// Copyright (C) 1993-1996 by id Software, Inc.
|
|
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
2021-05-07 15:45:56 +00:00
|
|
|
// Copyright (C) 1999-2021 by Sonic Team Junior.
|
2014-03-15 16:59:03 +00:00
|
|
|
//
|
|
|
|
// This program is free software distributed under the
|
|
|
|
// terms of the GNU General Public License, version 2.
|
|
|
|
// See the 'LICENSE' file for more details.
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
/// \file d_player.h
|
|
|
|
/// \brief player data structures
|
|
|
|
|
|
|
|
#ifndef __D_PLAYER__
|
|
|
|
#define __D_PLAYER__
|
|
|
|
|
|
|
|
// The player data structure depends on a number
|
|
|
|
// of other structs: items (internal inventory),
|
|
|
|
// animation states (closely tied to the sprites
|
|
|
|
// used to represent them, unfortunately).
|
|
|
|
#include "p_pspr.h"
|
|
|
|
|
|
|
|
// In addition, the player is just a special
|
|
|
|
// case of the generic moving object/actor.
|
|
|
|
#include "p_mobj.h"
|
|
|
|
|
|
|
|
// Finally, for odd reasons, the player input
|
|
|
|
// is buffered within the player data struct,
|
|
|
|
// as commands per game tick.
|
|
|
|
#include "d_ticcmd.h"
|
|
|
|
|
|
|
|
// Extra abilities/settings for skins (combinable stuff)
|
|
|
|
typedef enum
|
|
|
|
{
|
2017-03-11 02:09:01 +00:00
|
|
|
SF_SUPER = 1, // Can turn super in singleplayer/co-op mode?
|
|
|
|
SF_NOSUPERSPIN = 1<<1, // Should spin frames be played while super?
|
|
|
|
SF_NOSPINDASHDUST = 1<<2, // Spawn dust particles when charging a spindash?
|
|
|
|
SF_HIRES = 1<<3, // Draw the sprite at different size?
|
2014-03-15 16:59:03 +00:00
|
|
|
SF_NOSKID = 1<<4, // No skid particles etc
|
|
|
|
SF_NOSPEEDADJUST = 1<<5, // Skin-specific version of disablespeedadjust
|
2014-07-05 08:15:35 +00:00
|
|
|
SF_RUNONWATER = 1<<6, // Run on top of water FOFs?
|
2017-03-11 02:09:01 +00:00
|
|
|
SF_NOJUMPSPIN = 1<<7, // SPR2_JUMP defaults to SPR2_SPRG instead of SPR2_ROLL, falling states used, and player height is full when jumping?
|
A thorough reimplementation of Nojumpspin for the SPR2_ age.
* SF_NOJUMPSPIN - Player's height is full whilst jumping, SPR2_JUMP defaults to SPR2_SPNG instead of SPR2_SPIN, and the player goes into fall frames if they start moving downwards or use their ability.
* PA_JUMP - for jumping (upwards in the case of SF_NOJUMPSPIN.
* SF_NOJUMPDAMAGE - Ala rosy.wad, don't damage enemies, etc when jumping into them.
* SF_STOMPDAMAGE - Just for fun. Ala in Mario, always damage enemies when you land on top of them (your gravity reference, not theirs).
* SF_MARIODAMAGE - SF_NOJUMPDAMAGE|SF_STOMPDAMAGE is reasonably accurate to the Mario games, and might as well be surfaced as such.
Also, a minor change:
* Instead of not spawning the revitem if your SPR2_ is SPR2_DASH, don't spawn it if it's set to 0. This requires the player.dta I uploaded a couple days ago to behave as it was previously.
* Don't get stuck in spindash frames if your maxdash is 0, and don't flash rolling frames if you're on goop.
2016-07-10 17:41:38 +00:00
|
|
|
SF_NOJUMPDAMAGE = 1<<8, // Don't damage enemies, etc whilst jumping?
|
|
|
|
SF_STOMPDAMAGE = 1<<9, // Always damage enemies, etc by landing on them, no matter your vunerability?
|
|
|
|
SF_MARIODAMAGE = SF_NOJUMPDAMAGE|SF_STOMPDAMAGE, // The Mario method of being able to damage enemies, etc.
|
2016-07-16 21:43:49 +00:00
|
|
|
SF_MACHINE = 1<<10, // Beep boop. Are you a robot?
|
2017-03-11 02:09:01 +00:00
|
|
|
SF_DASHMODE = 1<<11, // Sonic Advance 2 style top speed increase?
|
2017-03-22 18:51:30 +00:00
|
|
|
SF_FASTEDGE = 1<<12, // Faster edge teeter?
|
2017-03-27 14:03:21 +00:00
|
|
|
SF_MULTIABILITY = 1<<13, // Revenge of Final Demo.
|
2019-11-14 15:27:22 +00:00
|
|
|
SF_NONIGHTSROTATION = 1<<14, // Disable sprite rotation for NiGHTS
|
2020-02-13 02:03:39 +00:00
|
|
|
SF_NONIGHTSSUPER = 1<<15, // Disable super colors for NiGHTS (if you have SF_SUPER)
|
2020-06-16 20:53:42 +00:00
|
|
|
SF_NOSUPERSPRITES = 1<<16, // Don't use super sprites while super
|
2020-07-04 10:53:26 +00:00
|
|
|
SF_NOSUPERJUMPBOOST = 1<<17, // Disable the jump boost given while super (i.e. Knuckles)
|
2020-12-14 09:01:50 +00:00
|
|
|
SF_CANBUSTWALLS = 1<<18, // Can naturally bust walls on contact? (i.e. Knuckles)
|
|
|
|
SF_NOSHIELDABILITY = 1<<19, // Disable shield abilities
|
2020-12-14 11:32:51 +00:00
|
|
|
|
2016-09-23 22:48:48 +00:00
|
|
|
// free up to and including 1<<31
|
2014-03-15 16:59:03 +00:00
|
|
|
} skinflags_t;
|
|
|
|
|
|
|
|
//Primary and secondary skin abilities
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
CA_NONE=0,
|
|
|
|
CA_THOK,
|
|
|
|
CA_FLY,
|
|
|
|
CA_GLIDEANDCLIMB,
|
|
|
|
CA_HOMINGTHOK,
|
|
|
|
CA_SWIM,
|
|
|
|
CA_DOUBLEJUMP,
|
|
|
|
CA_FLOAT,
|
|
|
|
CA_SLOWFALL,
|
|
|
|
CA_TELEKINESIS,
|
|
|
|
CA_FALLSWITCH,
|
|
|
|
CA_JUMPBOOST,
|
2014-07-05 07:08:39 +00:00
|
|
|
CA_AIRDRILL,
|
2016-07-16 12:55:12 +00:00
|
|
|
CA_JUMPTHOK,
|
2016-12-23 17:31:07 +00:00
|
|
|
CA_BOUNCE,
|
2016-07-16 12:55:12 +00:00
|
|
|
CA_TWINSPIN
|
2014-03-15 16:59:03 +00:00
|
|
|
} charability_t;
|
|
|
|
|
|
|
|
//Secondary skin abilities
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
CA2_NONE=0,
|
|
|
|
CA2_SPINDASH,
|
2017-03-21 00:54:47 +00:00
|
|
|
CA2_GUNSLINGER,
|
2016-07-17 20:31:15 +00:00
|
|
|
CA2_MELEE
|
2014-03-15 16:59:03 +00:00
|
|
|
} charability2_t;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Player states.
|
|
|
|
//
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
// Playing or camping.
|
|
|
|
PST_LIVE,
|
|
|
|
// Dead on the ground, view follows killer.
|
|
|
|
PST_DEAD,
|
|
|
|
// Ready to restart/respawn???
|
|
|
|
PST_REBORN
|
|
|
|
} playerstate_t;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Player internal flags
|
|
|
|
//
|
|
|
|
typedef enum
|
|
|
|
{
|
2017-09-15 19:34:46 +00:00
|
|
|
// Cvars
|
|
|
|
PF_FLIPCAM = 1, // Flip camera angle with gravity flip prefrence.
|
|
|
|
PF_ANALOGMODE = 1<<1, // Analog mode?
|
|
|
|
PF_DIRECTIONCHAR = 1<<2, // Directional character sprites?
|
|
|
|
PF_AUTOBRAKE = 1<<3, // Autobrake?
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Cheats
|
2017-09-15 19:34:46 +00:00
|
|
|
PF_GODMODE = 1<<4,
|
|
|
|
PF_NOCLIP = 1<<5,
|
|
|
|
PF_INVIS = 1<<6,
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// True if button down last tic.
|
2017-09-15 19:34:46 +00:00
|
|
|
PF_ATTACKDOWN = 1<<7,
|
2020-06-06 11:16:28 +00:00
|
|
|
PF_SPINDOWN = 1<<8,
|
2017-09-15 19:34:46 +00:00
|
|
|
PF_JUMPDOWN = 1<<9,
|
|
|
|
PF_WPNDOWN = 1<<10,
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Unmoving states
|
2017-09-15 19:34:46 +00:00
|
|
|
PF_STASIS = 1<<11, // Player is not allowed to move
|
|
|
|
PF_JUMPSTASIS = 1<<12, // and that includes jumping.
|
2014-03-15 16:59:03 +00:00
|
|
|
PF_FULLSTASIS = PF_STASIS|PF_JUMPSTASIS,
|
|
|
|
|
2017-09-15 19:34:46 +00:00
|
|
|
// Applying autobrake?
|
|
|
|
PF_APPLYAUTOBRAKE = 1<<13,
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Character action status
|
2017-09-15 19:34:46 +00:00
|
|
|
PF_STARTJUMP = 1<<14,
|
|
|
|
PF_JUMPED = 1<<15,
|
|
|
|
PF_NOJUMPDAMAGE = 1<<16,
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2017-09-15 19:34:46 +00:00
|
|
|
PF_SPINNING = 1<<17,
|
|
|
|
PF_STARTDASH = 1<<18,
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2017-09-15 19:34:46 +00:00
|
|
|
PF_THOKKED = 1<<19,
|
|
|
|
PF_SHIELDABILITY = 1<<20,
|
|
|
|
PF_GLIDING = 1<<21,
|
|
|
|
PF_BOUNCING = 1<<22,
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2017-09-15 19:34:46 +00:00
|
|
|
// Sliding (usually in water) like Labyrinth/Oil Ocean
|
|
|
|
PF_SLIDING = 1<<23,
|
2017-03-14 18:11:17 +00:00
|
|
|
|
2017-09-15 19:34:46 +00:00
|
|
|
// NiGHTS stuff
|
|
|
|
PF_TRANSFERTOCLOSEST = 1<<24,
|
|
|
|
PF_DRILLING = 1<<25,
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2017-09-15 19:34:46 +00:00
|
|
|
// Gametype-specific stuff
|
|
|
|
PF_GAMETYPEOVER = 1<<26, // Race time over, or H&S out-of-game
|
|
|
|
PF_TAGIT = 1<<27, // The player is it! For Tag Mode
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2014-08-04 03:49:33 +00:00
|
|
|
/*** misc ***/
|
2017-09-15 19:34:46 +00:00
|
|
|
PF_FORCESTRAFE = 1<<28, // Turning inputs are translated into strafing inputs
|
|
|
|
PF_CANCARRY = 1<<29, // Can carry another player?
|
2019-11-15 14:35:28 +00:00
|
|
|
PF_FINISHED = 1<<30, // The player finished the level. NOT the same as exiting
|
2016-09-24 12:18:08 +00:00
|
|
|
|
2017-03-22 18:51:30 +00:00
|
|
|
// up to 1<<31 is free
|
2014-03-15 16:59:03 +00:00
|
|
|
} pflags_t;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
// Are animation frames playing?
|
|
|
|
PA_ETC=0,
|
|
|
|
PA_IDLE,
|
2015-06-18 15:36:08 +00:00
|
|
|
PA_EDGE,
|
2014-03-15 16:59:03 +00:00
|
|
|
PA_WALK,
|
|
|
|
PA_RUN,
|
2017-03-11 02:09:01 +00:00
|
|
|
PA_DASH,
|
2015-05-29 18:57:53 +00:00
|
|
|
PA_PAIN,
|
2014-03-15 16:59:03 +00:00
|
|
|
PA_ROLL,
|
A thorough reimplementation of Nojumpspin for the SPR2_ age.
* SF_NOJUMPSPIN - Player's height is full whilst jumping, SPR2_JUMP defaults to SPR2_SPNG instead of SPR2_SPIN, and the player goes into fall frames if they start moving downwards or use their ability.
* PA_JUMP - for jumping (upwards in the case of SF_NOJUMPSPIN.
* SF_NOJUMPDAMAGE - Ala rosy.wad, don't damage enemies, etc when jumping into them.
* SF_STOMPDAMAGE - Just for fun. Ala in Mario, always damage enemies when you land on top of them (your gravity reference, not theirs).
* SF_MARIODAMAGE - SF_NOJUMPDAMAGE|SF_STOMPDAMAGE is reasonably accurate to the Mario games, and might as well be surfaced as such.
Also, a minor change:
* Instead of not spawning the revitem if your SPR2_ is SPR2_DASH, don't spawn it if it's set to 0. This requires the player.dta I uploaded a couple days ago to behave as it was previously.
* Don't get stuck in spindash frames if your maxdash is 0, and don't flash rolling frames if you're on goop.
2016-07-10 17:41:38 +00:00
|
|
|
PA_JUMP,
|
2016-01-14 14:35:10 +00:00
|
|
|
PA_SPRING,
|
2014-03-15 16:59:03 +00:00
|
|
|
PA_FALL,
|
2015-05-29 05:48:56 +00:00
|
|
|
PA_ABILITY,
|
2016-07-17 20:31:15 +00:00
|
|
|
PA_ABILITY2,
|
2015-05-29 05:48:56 +00:00
|
|
|
PA_RIDE
|
2014-03-15 16:59:03 +00:00
|
|
|
} panim_t;
|
|
|
|
|
2017-08-09 19:56:31 +00:00
|
|
|
//
|
|
|
|
// All of the base srb2 shields are either a single constant,
|
|
|
|
// or use damagetype-protecting flags applied to a constant,
|
|
|
|
// or are the force shield (which does everything weirdly).
|
|
|
|
//
|
|
|
|
// Base flags by themselves aren't used so modders can make
|
|
|
|
// abstract, ability-less shields should they so choose.
|
|
|
|
//
|
2014-03-15 16:59:03 +00:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
SH_NONE = 0,
|
2016-10-13 14:13:33 +00:00
|
|
|
|
|
|
|
// Shield flags
|
|
|
|
SH_PROTECTFIRE = 0x400,
|
|
|
|
SH_PROTECTWATER = 0x800,
|
2016-10-13 14:13:33 +00:00
|
|
|
SH_PROTECTELECTRIC = 0x1000,
|
2017-08-09 19:56:31 +00:00
|
|
|
SH_PROTECTSPIKE = 0x2000, // cactus shield one day? thanks, subarashii
|
|
|
|
//SH_PROTECTNUKE = 0x4000, // intentionally no hardcoded defense against nukes
|
2016-10-13 14:13:33 +00:00
|
|
|
|
|
|
|
// Indivisible shields
|
2016-10-19 23:33:12 +00:00
|
|
|
SH_PITY = 1, // the world's most basic shield ever, given to players who suck at Match
|
2016-10-13 14:13:33 +00:00
|
|
|
SH_WHIRLWIND,
|
|
|
|
SH_ARMAGEDDON,
|
2019-06-19 22:20:24 +00:00
|
|
|
SH_PINK, // PITY IN PINK!
|
2016-10-13 14:13:33 +00:00
|
|
|
|
2017-08-09 19:56:31 +00:00
|
|
|
// Normal shields that use flags
|
|
|
|
SH_ATTRACT = SH_PITY|SH_PROTECTELECTRIC,
|
|
|
|
SH_ELEMENTAL = SH_PITY|SH_PROTECTFIRE|SH_PROTECTWATER,
|
2016-10-13 14:13:33 +00:00
|
|
|
|
|
|
|
// Sonic 3 shields
|
2017-08-09 19:56:31 +00:00
|
|
|
SH_FLAMEAURA = SH_PITY|SH_PROTECTFIRE,
|
|
|
|
SH_BUBBLEWRAP = SH_PITY|SH_PROTECTWATER,
|
2016-10-13 14:13:33 +00:00
|
|
|
SH_THUNDERCOIN = SH_WHIRLWIND|SH_PROTECTELECTRIC,
|
2016-10-13 14:13:33 +00:00
|
|
|
|
2016-10-11 22:35:31 +00:00
|
|
|
// The force shield uses the lower 8 bits to count how many extra hits are left.
|
|
|
|
SH_FORCE = 0x100,
|
2016-09-30 11:15:22 +00:00
|
|
|
SH_FORCEHP = 0xFF, // to be used as a bitmask only
|
2016-10-13 14:13:33 +00:00
|
|
|
|
|
|
|
// Mostly for use with Mario mode.
|
2016-10-24 11:35:40 +00:00
|
|
|
SH_FIREFLOWER = 0x200,
|
2016-10-13 14:13:33 +00:00
|
|
|
|
2016-10-24 11:35:40 +00:00
|
|
|
SH_STACK = SH_FIREFLOWER, // second-layer shields
|
2014-03-15 16:59:03 +00:00
|
|
|
SH_NOSTACK = ~SH_STACK
|
2016-09-23 22:48:48 +00:00
|
|
|
} shieldtype_t; // pw_shield
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
CR_NONE = 0,
|
|
|
|
// The generic case is suitable for most objects.
|
|
|
|
CR_GENERIC,
|
|
|
|
// Tails carry.
|
|
|
|
CR_PLAYER,
|
2017-03-14 18:11:17 +00:00
|
|
|
// NiGHTS mode. Not technically a CARRYING, but doesn't stack with any of the others, so might as well go here.
|
|
|
|
CR_NIGHTSMODE,
|
2017-09-15 19:34:46 +00:00
|
|
|
CR_NIGHTSFALL,
|
2017-03-15 21:51:35 +00:00
|
|
|
// Old Brak sucks hard, but this gimmick could be used for something better, so we might as well continue supporting it.
|
|
|
|
CR_BRAKGOOP,
|
2016-09-23 22:48:48 +00:00
|
|
|
// Specific level gimmicks.
|
|
|
|
CR_ZOOMTUBE,
|
|
|
|
CR_ROPEHANG,
|
2019-06-12 19:20:14 +00:00
|
|
|
CR_MACESPIN,
|
2019-09-29 16:42:17 +00:00
|
|
|
CR_MINECART,
|
2019-09-29 16:49:53 +00:00
|
|
|
CR_ROLLOUT,
|
2020-04-21 21:59:12 +00:00
|
|
|
CR_PTERABYTE,
|
|
|
|
CR_DUSTDEVIL
|
2016-09-23 22:48:48 +00:00
|
|
|
} carrytype_t; // pw_carry
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Player powers. (don't edit this comment)
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
pw_invulnerability,
|
|
|
|
pw_sneakers,
|
|
|
|
pw_flashing,
|
|
|
|
pw_shield,
|
2016-09-23 22:48:48 +00:00
|
|
|
pw_carry,
|
2014-03-15 16:59:03 +00:00
|
|
|
pw_tailsfly, // tails flying
|
|
|
|
pw_underwater, // underwater timer
|
|
|
|
pw_spacetime, // In space, no one can hear you spin!
|
|
|
|
pw_extralife, // Extra Life timer
|
2017-02-06 20:36:21 +00:00
|
|
|
pw_pushing,
|
* New object types!
* Red and yellow Boost panels!
* Added because SUBARASHII and KIMOKAWAIII had several levels using them, and I wanted to make them look better.
* https://cdn.discordapp.com/attachments/359091121789468672/634486669202161674/srb20015.gif
* Uses the mapthingnums of Glaber's SOC resource boosters, but absolutely nothing else - not even the magnitudes.
* Apply MF_AMBUSH to force the player into a spin - even if they don't have a spin ability!
* Banpyura!
* A Crushstacean with a spring instead of a crushclaw.
* https://cdn.discordapp.com/attachments/428262628893261828/634432099306176512/srb20019.gif
* Wanted this for a while, finally added it.
* Improved springs.
* Add pw_noautobrake to disable autobrake for half a second when touching yellow horizontal springs, and a second when touching red ones, even on the ground.
* Add pw_justsprung to disable directionchar for a few tics while touching any springs with a horizontal component to their velocity.
* Add the diagonal spring flag options Red and Yellow Diagonal Springs have to the Blue Diagonal Spring as well.
* Started but decided against a tip of the hat to the CD spring spin, hidden behind #define SPRINGSPIN.
* Make directionchar "lag behind" a little bit in waterslides.
* Improved flame jets.
* They now use new sprites for having their flames move upwards and sideways, instead of having them always face downwards like in 2.1!
* Fixed a mixed declaration and code error in A_RolloutRock. (Sorry Lach!)
* Make the Amy Cameo only spawn in SP, Record Attack, or Co-op unless it's the Clone Mode.
* Improved ZB config.
* Add above new types.
* Add Blue Diagonal Spring, which existed in the source but not the config.
* Re-order enemies in ZB config by zone (but keep them in the Enemies section only).
2019-10-17 20:50:26 +00:00
|
|
|
pw_justsprung,
|
|
|
|
pw_noautobrake,
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
pw_super, // Are you super?
|
|
|
|
pw_gravityboots, // gravity boots
|
|
|
|
|
|
|
|
// Weapon ammunition
|
|
|
|
pw_infinityring,
|
|
|
|
pw_automaticring,
|
|
|
|
pw_bouncering,
|
|
|
|
pw_scatterring,
|
|
|
|
pw_grenadering,
|
|
|
|
pw_explosionring,
|
|
|
|
pw_railring,
|
|
|
|
|
|
|
|
// Power Stones
|
|
|
|
pw_emeralds, // stored like global 'emeralds' variable
|
|
|
|
|
|
|
|
// NiGHTS powerups
|
|
|
|
pw_nights_superloop,
|
|
|
|
pw_nights_helper,
|
|
|
|
pw_nights_linkfreeze,
|
|
|
|
|
2017-03-15 21:51:35 +00:00
|
|
|
pw_nocontrol, //for linedef exec 427
|
2020-02-19 20:46:18 +00:00
|
|
|
|
2020-01-11 23:40:57 +00:00
|
|
|
pw_dye, // for dyes
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2020-02-02 02:02:14 +00:00
|
|
|
pw_justlaunched, // Launched off a slope this tic (0=none, 1=standard launch, 2=half-pipe launch)
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2020-06-18 21:09:29 +00:00
|
|
|
pw_ignorelatch, // Don't grab onto CR_GENERIC, add 32768 (powers[pw_ignorelatch] & 1<<15) to avoid ALL not-NiGHTS CR_ types
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
NUMPOWERS
|
|
|
|
} powertype_t;
|
|
|
|
|
|
|
|
#define WEP_AUTO 1
|
|
|
|
#define WEP_BOUNCE 2
|
|
|
|
#define WEP_SCATTER 3
|
|
|
|
#define WEP_GRENADE 4
|
|
|
|
#define WEP_EXPLODE 5
|
|
|
|
#define WEP_RAIL 6
|
|
|
|
#define NUM_WEAPONS 7
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
RW_AUTO = 1,
|
|
|
|
RW_BOUNCE = 2,
|
|
|
|
RW_SCATTER = 4,
|
|
|
|
RW_GRENADE = 8,
|
|
|
|
RW_EXPLODE = 16,
|
|
|
|
RW_RAIL = 32
|
|
|
|
} ringweapons_t;
|
|
|
|
|
2021-01-23 15:30:07 +00:00
|
|
|
//Bot types
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
BOT_NONE = 0,
|
|
|
|
BOT_2PAI,
|
|
|
|
BOT_2PHUMAN,
|
|
|
|
BOT_MPAI
|
|
|
|
} bottype_t;
|
|
|
|
|
|
|
|
//AI states
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
AI_STANDBY = 0,
|
|
|
|
AI_FOLLOW,
|
|
|
|
AI_CATCHUP,
|
|
|
|
AI_THINKFLY,
|
|
|
|
AI_FLYSTANDBY,
|
|
|
|
AI_FLYCARRY,
|
|
|
|
AI_SPINFOLLOW
|
|
|
|
} aistatetype_t;
|
|
|
|
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
// ========================================================================
|
|
|
|
// PLAYER STRUCTURE
|
|
|
|
// ========================================================================
|
2021-01-23 15:30:07 +00:00
|
|
|
|
|
|
|
//Bot memory struct
|
|
|
|
typedef struct botmem_s
|
|
|
|
{
|
|
|
|
boolean lastForward;
|
|
|
|
boolean lastBlocked;
|
|
|
|
boolean blocked;
|
|
|
|
UINT8 catchup_tics;
|
|
|
|
UINT8 thinkstate;
|
|
|
|
} botmem_t;
|
|
|
|
|
|
|
|
//Main struct
|
2014-03-15 16:59:03 +00:00
|
|
|
typedef struct player_s
|
|
|
|
{
|
|
|
|
mobj_t *mo;
|
|
|
|
|
|
|
|
// Caveat: ticcmd_t is ATTRPACK! Be careful what precedes it.
|
|
|
|
ticcmd_t cmd;
|
|
|
|
|
|
|
|
playerstate_t playerstate;
|
|
|
|
|
|
|
|
// Determine POV, including viewpoint bobbing during movement.
|
2016-09-25 17:21:52 +00:00
|
|
|
fixed_t camerascale;
|
|
|
|
fixed_t shieldscale;
|
2014-03-15 16:59:03 +00:00
|
|
|
// Focal origin above r.z
|
|
|
|
fixed_t viewz;
|
|
|
|
// Base height above floor for viewz.
|
|
|
|
fixed_t viewheight;
|
|
|
|
// Bob/squat speed.
|
|
|
|
fixed_t deltaviewheight;
|
|
|
|
// bounded/scaled total momentum.
|
|
|
|
fixed_t bob;
|
|
|
|
|
2020-01-15 05:29:56 +00:00
|
|
|
angle_t viewrollangle;
|
|
|
|
|
2020-05-28 09:03:35 +00:00
|
|
|
INT16 angleturn;
|
|
|
|
INT16 oldrelangleturn;
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
// Mouse aiming, where the guy is looking at!
|
|
|
|
// It is updated with cmd->aiming.
|
|
|
|
angle_t aiming;
|
|
|
|
|
2017-02-05 18:15:20 +00:00
|
|
|
// fun thing for player sprite
|
|
|
|
angle_t drawangle;
|
|
|
|
|
2015-08-15 20:07:16 +00:00
|
|
|
// player's ring count
|
2018-06-03 21:41:54 +00:00
|
|
|
INT16 rings;
|
|
|
|
INT16 spheres;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
SINT8 pity; // i pity the fool.
|
|
|
|
INT32 currentweapon; // current weapon selected.
|
|
|
|
INT32 ringweapons; // weapons currently obtained.
|
|
|
|
|
2019-08-26 23:07:17 +00:00
|
|
|
UINT16 ammoremoval; // amount of ammo removed for the current weapon.
|
|
|
|
tic_t ammoremovaltimer; // flashing counter for ammo used.
|
|
|
|
INT32 ammoremovalweapon; // weapon from which the ammo was removed.
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
// Power ups. invinc and invis are tic counters.
|
|
|
|
UINT16 powers[NUMPOWERS];
|
|
|
|
|
|
|
|
// Bit flags.
|
|
|
|
// See pflags_t, above.
|
|
|
|
pflags_t pflags;
|
|
|
|
|
|
|
|
// playing animation.
|
|
|
|
panim_t panim;
|
|
|
|
|
|
|
|
// For screen flashing (bright).
|
|
|
|
UINT16 flashcount;
|
|
|
|
UINT16 flashpal;
|
|
|
|
|
|
|
|
// Player skin colorshift, 0-15 for which color to draw player.
|
2020-05-24 00:29:07 +00:00
|
|
|
UINT16 skincolor;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
INT32 skin;
|
2017-03-16 18:57:42 +00:00
|
|
|
UINT32 availabilities;
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
UINT32 score; // player score
|
|
|
|
fixed_t dashspeed; // dashing speed
|
|
|
|
|
|
|
|
fixed_t normalspeed; // Normal ground
|
|
|
|
fixed_t runspeed; // Speed you break into the run animation
|
|
|
|
UINT8 thrustfactor; // Thrust = thrustfactor * acceleration
|
|
|
|
UINT8 accelstart; // Starting acceleration if speed = 0.
|
|
|
|
UINT8 acceleration; // Acceleration
|
|
|
|
|
|
|
|
// See charability_t and charability2_t for more information.
|
|
|
|
UINT8 charability; // Ability definition
|
|
|
|
UINT8 charability2; // Secondary ability definition
|
|
|
|
|
|
|
|
UINT32 charflags; // Extra abilities/settings for skins (combinable stuff)
|
|
|
|
// See SF_ flags
|
|
|
|
|
|
|
|
mobjtype_t thokitem; // Object # to spawn for the thok
|
|
|
|
mobjtype_t spinitem; // Object # to spawn for spindash/spinning
|
|
|
|
mobjtype_t revitem; // Object # to spawn for spindash/spinning
|
2017-10-02 13:08:58 +00:00
|
|
|
mobjtype_t followitem; // Object # to spawn for Smiles
|
|
|
|
mobj_t *followmobj; // Smiles all around
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
fixed_t actionspd; // Speed of thok/glide/fly
|
|
|
|
fixed_t mindash; // Minimum spindash speed
|
|
|
|
fixed_t maxdash; // Maximum spindash speed
|
|
|
|
|
|
|
|
fixed_t jumpfactor; // How high can the player jump?
|
|
|
|
|
2016-09-25 17:21:52 +00:00
|
|
|
fixed_t height; // Bounding box changes.
|
|
|
|
fixed_t spinheight;
|
|
|
|
|
2018-08-23 19:09:39 +00:00
|
|
|
SINT8 lives; // number of lives - if == INFLIVES, the player has infinite lives
|
2014-03-21 18:42:55 +00:00
|
|
|
SINT8 continues; // continues that player has acquired
|
2014-03-15 16:59:03 +00:00
|
|
|
|
2014-03-21 18:42:55 +00:00
|
|
|
SINT8 xtralife; // Ring Extra Life counter
|
2014-03-15 16:59:03 +00:00
|
|
|
UINT8 gotcontinue; // Got continue from this stage?
|
|
|
|
|
|
|
|
fixed_t speed; // Player's speed (distance formula of MOMX and MOMY values)
|
2016-10-19 23:33:12 +00:00
|
|
|
UINT8 secondjump; // Jump counter
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
UINT8 fly1; // Tails flying
|
|
|
|
UINT8 scoreadd; // Used for multiple enemy attack bonus
|
|
|
|
tic_t glidetime; // Glide counter for thrust
|
|
|
|
UINT8 climbing; // Climbing on the wall
|
|
|
|
INT32 deadtimer; // End game if game over lasts too long
|
|
|
|
tic_t exiting; // Exitlevel timer
|
|
|
|
|
|
|
|
UINT8 homing; // Are you homing?
|
2016-01-25 11:47:33 +00:00
|
|
|
tic_t dashmode; // counter for dashmode ability
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
tic_t skidtime; // Skid timer
|
|
|
|
|
|
|
|
////////////////////////////
|
|
|
|
// Conveyor Belt Movement //
|
|
|
|
////////////////////////////
|
|
|
|
fixed_t cmomx; // Conveyor momx
|
|
|
|
fixed_t cmomy; // Conveyor momy
|
|
|
|
fixed_t rmomx; // "Real" momx (momx - cmomx)
|
|
|
|
fixed_t rmomy; // "Real" momy (momy - cmomy)
|
|
|
|
|
|
|
|
/////////////////////
|
|
|
|
// Race Mode Stuff //
|
|
|
|
/////////////////////
|
2014-03-21 18:42:55 +00:00
|
|
|
INT16 numboxes; // Number of item boxes obtained for Race Mode
|
|
|
|
INT16 totalring; // Total number of rings obtained for Race Mode
|
2014-03-15 16:59:03 +00:00
|
|
|
tic_t realtime; // integer replacement for leveltime
|
2014-03-21 18:42:55 +00:00
|
|
|
UINT8 laps; // Number of laps (optional)
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
////////////////////
|
|
|
|
// CTF Mode Stuff //
|
|
|
|
////////////////////
|
|
|
|
INT32 ctfteam; // 0 == Spectator, 1 == Red, 2 == Blue
|
|
|
|
UINT16 gotflag; // 1 == Red, 2 == Blue Do you have the flag?
|
|
|
|
|
|
|
|
INT32 weapondelay; // Delay (if any) to fire the weapon again
|
|
|
|
INT32 tossdelay; // Delay (if any) to toss a flag/emeralds again
|
|
|
|
|
|
|
|
// Starpost information
|
|
|
|
INT16 starpostx;
|
|
|
|
INT16 starposty;
|
|
|
|
INT16 starpostz;
|
|
|
|
INT32 starpostnum; // The number of the last starpost you hit
|
|
|
|
tic_t starposttime; // Your time when you hit the starpost
|
|
|
|
angle_t starpostangle; // Angle that the starpost is facing - you respawn facing this way
|
2019-09-07 21:11:33 +00:00
|
|
|
fixed_t starpostscale; // Scale of the player; if negative, player is gravflipped
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
/////////////////
|
|
|
|
// NiGHTS Stuff//
|
|
|
|
/////////////////
|
|
|
|
angle_t angle_pos;
|
|
|
|
angle_t old_angle_pos;
|
|
|
|
|
|
|
|
mobj_t *axis1;
|
|
|
|
mobj_t *axis2;
|
|
|
|
tic_t bumpertime; // Currently being bounced by MT_NIGHTSBUMPER
|
|
|
|
INT32 flyangle;
|
|
|
|
tic_t drilltimer;
|
|
|
|
INT32 linkcount;
|
|
|
|
tic_t linktimer;
|
|
|
|
INT32 anotherflyangle;
|
|
|
|
tic_t nightstime; // How long you can fly as NiGHTS.
|
|
|
|
INT32 drillmeter;
|
|
|
|
UINT8 drilldelay;
|
|
|
|
boolean bonustime; // Capsule destroyed, now it's bonus time!
|
|
|
|
mobj_t *capsule; // Go inside the capsule
|
2018-08-10 23:25:49 +00:00
|
|
|
mobj_t *drone; // Move center to the drone
|
2018-08-11 04:49:28 +00:00
|
|
|
fixed_t oldscale; // Pre-Nightserize scale
|
2014-03-15 16:59:03 +00:00
|
|
|
UINT8 mare; // Current mare
|
2018-03-30 18:36:49 +00:00
|
|
|
UINT8 marelap; // Current mare lap
|
|
|
|
UINT8 marebonuslap; // Current mare lap starting from bonus time
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
// Statistical purposes.
|
|
|
|
tic_t marebegunat; // Leveltime when mare begun
|
|
|
|
tic_t startedtime; // Time which you started this mare with.
|
|
|
|
tic_t finishedtime; // Time it took you to finish the mare (used for display)
|
2018-08-10 21:12:26 +00:00
|
|
|
tic_t lapbegunat; // Leveltime when lap begun
|
|
|
|
tic_t lapstartedtime; // Time which you started this lap with.
|
2018-06-03 21:41:54 +00:00
|
|
|
INT16 finishedspheres; // The spheres you had left upon finishing the mare
|
2018-08-10 08:05:20 +00:00
|
|
|
INT16 finishedrings; // The rings/stars you had left upon finishing the mare
|
2014-03-15 16:59:03 +00:00
|
|
|
UINT32 marescore; // score for this nights stage
|
|
|
|
UINT32 lastmarescore; // score for the last mare
|
2018-08-12 23:59:34 +00:00
|
|
|
UINT32 totalmarescore; // score for all mares
|
2014-03-15 16:59:03 +00:00
|
|
|
UINT8 lastmare; // previous mare
|
2018-08-10 20:30:49 +00:00
|
|
|
UINT8 lastmarelap; // previous mare lap
|
|
|
|
UINT8 lastmarebonuslap; // previous mare bonus lap
|
2018-08-12 23:57:33 +00:00
|
|
|
UINT8 totalmarelap; // total mare lap
|
|
|
|
UINT8 totalmarebonuslap; // total mare bonus lap
|
2014-03-15 16:59:03 +00:00
|
|
|
INT32 maxlink; // maximum link obtained
|
|
|
|
UINT8 texttimer; // nights_texttime should not be local
|
|
|
|
UINT8 textvar; // which line of NiGHTS text to show -- let's not use cheap hacks
|
|
|
|
|
|
|
|
INT16 lastsidehit, lastlinehit;
|
|
|
|
|
|
|
|
tic_t losstime;
|
|
|
|
UINT8 timeshit; // That's TIMES HIT, not TIME SHIT, you doofus!
|
|
|
|
|
|
|
|
INT32 onconveyor; // You are on a conveyor belt if nonzero
|
|
|
|
|
|
|
|
mobj_t *awayviewmobj;
|
|
|
|
INT32 awayviewtics;
|
2014-03-21 18:42:55 +00:00
|
|
|
angle_t awayviewaiming; // Used for cut-away view
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
boolean spectator;
|
2017-07-03 14:43:29 +00:00
|
|
|
boolean outofcoop;
|
2021-07-15 22:04:24 +00:00
|
|
|
boolean removing;
|
2014-03-15 16:59:03 +00:00
|
|
|
UINT8 bot;
|
2021-01-23 15:30:07 +00:00
|
|
|
struct player_s *botleader;
|
|
|
|
UINT16 lastbuttons;
|
|
|
|
botmem_t botmem;
|
|
|
|
boolean blocked;
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
tic_t jointime; // Timer when player joins game to change skin/color
|
2020-01-22 02:05:08 +00:00
|
|
|
tic_t quittime; // Time elapsed since user disconnected, zero if connected
|
2014-03-15 16:59:03 +00:00
|
|
|
#ifdef HWRENDER
|
|
|
|
fixed_t fovadd; // adjust FOV for hw rendering
|
|
|
|
#endif
|
|
|
|
} player_t;
|
|
|
|
|
2019-10-23 05:41:32 +00:00
|
|
|
// Values for dashmode
|
|
|
|
#define DASHMODE_THRESHOLD (3*TICRATE)
|
|
|
|
#define DASHMODE_MAX (DASHMODE_THRESHOLD + 3)
|
|
|
|
|
2018-08-23 19:09:39 +00:00
|
|
|
// Value for infinite lives
|
|
|
|
#define INFLIVES 0x7F
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
#endif
|