Melee Modding Library  2.0.0
A C library for modding Super Smash Bros Melee
Data Structures | Macros | Enumerations | Functions | Variables
game_state.h File Reference

Track the state of in game variables. More...

#include "gctypes.h"
#include "math.h"
#include "action_state.h"

Go to the source code of this file.

Data Structures

struct  Platform
 Platform information. More...
 
struct  Stage
 Stage Information. More...
 
struct  PlayerData
 variables contained in "player data" More...
 
struct  PlayerBlock
 variables contained in "player block" More...
 
struct  GameState
 In game variables. More...
 

Macros

#define DEFAULT_PLATFORM   {0.0, 0.0, 0.0}
 
#define DEFAULT_STAGE   {0, {0.f, 0.f}, DEFAULT_PLATFORM, DEFAULT_PLATFORM}
 
#define DEFAULT_GAMESTATE   {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, DEFAULT_STAGE}
 
#define CHAR_SELECT(x)   (*((u8*) (0x803F0DE6 + 0x24 * (x))))
 
#define STAGE_ID   (*((u16*) 0x804D6CAD))
 
#define CURRENT_FRAME   (*((u32*) 0x80479D60))
 

Enumerations

Functions

bool inGame ()
 
void updateGameState ()
 
void endGame ()
 
PlayerDataplayerData (u32 id)
 

Variables

GameState _gameState
 

Detailed Description

Track the state of in game variables.


Data Structure Documentation

struct Platform

Platform information.

Data Fields
float height

y-coordinate of character standing on platform

float left

|x-coordinate| of character at left edge

float right

|y-coordinate| of character at right edge

struct Stage

Stage Information.

Data Fields
StageName name

Name of Stage

Point ledge

coordinates of right ledge of stage

Platform side

side platform

Platform top

top platform

struct PlayerData

variables contained in "player data"

Data Fields
u32 actionState

current action state of player

float facingDirection

-1 facing left, 1 facing right

float xSpeedSelfAir
float ySpeedSelf
float zSpeedSelf
float xSpeedAttack
float ySpeedAttack
float zSpeedAttack
Point coordinates
float zPosition
Point prevCoordinates
float zPrevious
Point deltaCoordinates
float zDelta
bool inAir

true if player is in air

float xSpeedSelfGround
float walkInitialVelocity
float walkAcceleration
float walkMaximumVelocity
float slowWalkMax
float midWalkPoint
float fastWalkMin
float groundFriction
float dashInitialVelocity
float dashAccelerationA
float dashAcceleationB
float dashTerminalVelocity
float runAnimationScaling
float runAcceleration
float groundedMaxHorizontalVelocity
float jumpSquat

frames of jump squat

float jumpHorizontalInitialVelocity
float jumpVerticalInitialVelocity
float groundToAirJumpMomentum
float jumpHorizontalMaxVelocity
float hopVerticalInitialVelocity
float airJumpVerticalMultiplier
float airJumpHorizontalMultiplier
float numberOfJumps

maximum number of jumps

float gravity
float terminalVelocity
float airMobilityA
float airMobilityB
float maxHorizontalAirMobility
float horizontalAirFriction
float fastfallVelocity
float jab2inputWindow
float jab3inputWindow
float framesToChangeDirection
float weight
float modelScaling
float maxShieldSize
float shieldBreakInitialVelocity
float rapidJabWindow
float normalLandingLag
float nairLandingLag
float fairLandingLag
float bairLandingLag
float uairLandingLag
float dairLandingLag
float wallJumpHorizontalVelocity
float wallJumpVerticalVelocity
float analogStickX

used to determine tilt vs smash

float analogStickY

used to determine tilt vs smash

float prevAnalogStickX

used to determine tilt vs smash

float prevAnalogStickY

used to determine tilt vs smash

float cStickX

-1.0 to 1.0

float cStickY

-1.0 to 1.0

float analogTriggerData
u32 digitalButtonData
u32 prevDigitalButtonData
u8 analogCardinalXFrames
u8 analogCardinalYFrames
float lastPosition

last position player landed at

u8 platformID

platform character was last on

u8 stageRelationID
u8 stageTransformationID
float actionFrame

resets to 1 with each new action state

float percent

percent of player

float percentForDamageCalc

percent for damage calculation

u32 damageApplied

percentForDamageCalc cast to int

float damageDirection

-1, 1 depending on direction sent

u32 knockbackAngle

angle of knockback [0, 360], 361 = sakurai

float forceApplied
float hitlag

remaining frames of hitlag

u8 jumpsUsed

number of jumps already used

u32 bodyState

0 - normal, 1 - invulnerable, 2 - intangible

float ledgeInvincibility
float haloInvincinility
float shieldSize

size of shield

float lightshieldAmount

1 = hard shield, 0.071429 = z-shield

float breakoutCountdown

frames until breakout of grab

u8 aiType
u8 aiLevel

cpu level selected on CSS

u32 actionCounter

number of action states this match

u16 comboCount
u8 wallrideCounter
float wallLocation
u32 smashAttackState
u32 smashChargeFrame
float smashChargeFrameMax
float smashChargeStrength
u8 canWallJump
float hitstun

remaining frames of hitstun

struct PlayerBlock

variables contained in "player block"

Data Fields
u32 playerState

in game = 2, otherwise = 0

u32 playerCharacter

character external ID

u32 slotType

human = 0, cpu = 1, demo = 2

u16 transformed
u8 costumeID

false = 0, true = 1

u8 controllerIndex
u8 subcolorID
u8 teamID

red = 0, blue = 1, green = 2

u8 playerID
u32 deaths
u32 nanaDeaths
u32 p1Kills
u32 p2Kills
u32 p3Kills
u32 p4Kills
u32 p5Kills
u32 p6Kills
u8 selfDeaths
u8 stocks

remaining stocks

struct GameState

In game variables.

Data Fields
PlayerData * playerData[5]

pointer to player's data

PlayerBlock * playerBlock[5]

pointer to player's static block

Stage stage

Stage Information

Macro Definition Documentation

#define DEFAULT_PLATFORM   {0.0, 0.0, 0.0}

Default Platform Value

#define DEFAULT_STAGE   {0, {0.f, 0.f}, DEFAULT_PLATFORM, DEFAULT_PLATFORM}

Default Stage Value

#define DEFAULT_GAMESTATE   {{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0}, DEFAULT_STAGE}

Default GameState Value

#define CHAR_SELECT (   x)    (*((u8*) (0x803F0DE6 + 0x24 * (x))))

Character Selection of each player (1-4)

#define STAGE_ID   (*((u16*) 0x804D6CAD))

Stage ID

#define CURRENT_FRAME   (*((u32*) 0x80479D60))

Current Frame (32-bit)

Enumeration Type Documentation

enum StageName

Name of Stage and Internal ID

Enumerator
YOSHIS 

Yoshi's Story

FOUNTAIN 

Fountain of Dreams

STADIUM 

Pokemon Stadium

BATTLEFIELD 

Battlefield

FINAL 

Final Destination

DREAMLAND 

Dreamland

Function Documentation

bool inGame ( )

Determine if currently playing game

Returns
Returns true if game currently being played
void updateGameState ( )

Update the global GameState variable

Returns
none
void endGame ( )

Branch to this symbol when game ends, never call directly

Returns
none
PlayerData* playerData ( u32  id)

Get pointer to player's data

Parameters
id- unsigned integer in {1,2,3,4}
Returns
Pointer to PlayerData struct for this player

Variable Documentation

GameState _gameState

global GameState variable