Stardew Engine
Loading...
Searching...
No Matches
WfPlayer.h
Go to the documentation of this file.
1#ifndef WFPLAYER_H
2#define WFPLAYER_H
3
4#include <cglm/cglm.h>
5#include "WfEnums.h"
6#include "InputContext.h"
7
8
10struct Entity2D;
11struct Component2D;
12struct GameLayer2DData;
14
15#define NUM_ANIMATIONS NumDirections
16
21
22/* layers on top of the base */
31
32/* a set of animations that overlay the base animation in layers */
38
45
47{
53
56
57
60 /* value I set this to is NOT meters per second, TODO: fix */
62
64
66
68
70
72
73 /*
74 its shit having to have this, the position to spawn the network player when it is initialized.
75 The network player is created in two steps, first they're deserialized into a player entity then the player entity is initialized.
76 We have to call WfMakeIntoPlayerEntityBase when it is initialized, and so must serialize args for it in the deserialize stage
77 */
78 struct
79 {
83
84
86
87 /* flags section */
91};
92
94
95struct WfAnimationSet* WfGetPlayerAnimationSet(struct Entity2D* pInPlayerEnt);
96
97void WfSetPlayerAnimationSet(struct Entity2D* pInPlayerEnt, const struct WfAnimationSet* pInSet);
98
99void WfDeSerializePlayerEntity(struct BinarySerializer* bs, struct Entity2D* pOutEnt, struct GameLayer2DData* pData);
100
101void WfSerializePlayerEntity(struct BinarySerializer* bs, struct Entity2D* pInEnt, struct GameLayer2DData* pData);
102
103void WfMakeIntoPlayerEntity(struct Entity2D* pInEnt, struct GameFrameworkLayer* pLayer, vec2 spawnAtGroundPos);
104
105struct WfPlayerEntData* WfGetPlayerEntData(struct Entity2D* pInEnt);
106
108
109void WfSetPlayerOverlayAnimations(enum WfDirection dir, struct GameFrameworkLayer* pLayer, struct WfPlayerEntData* pPlayerEntData, struct Entity2D* pEnt);
110
111void WfPlayerGetGroundContactPoint(struct Entity2D* pEnt, vec2 outPos);
112
113#endif
vec2 vec2 struct Entity2DCollection struct GameFrameworkLayer * pLayer
Definition EntityQuadTree.h:38
uint32_t u32
Definition IntTypes.h:12
WfDirection
Definition WfEnums.h:14
struct Component2D * WfGetPlayerAnimationLayerComponent(struct Entity2D *pPlayer, enum WfAnimationLayerNames layer)
Definition WfPlayer.c:565
WfAnimationLayerNames
Definition WfPlayer.h:24
@ WfToolAnimationLayer
Definition WfPlayer.h:28
@ WfLegAnimationLayer
Definition WfPlayer.h:27
@ WfNumAnimationLayers
Definition WfPlayer.h:29
@ WfHairAnimationLayer
Definition WfPlayer.h:25
@ WfTorsoAnimationLayer
Definition WfPlayer.h:26
struct WfAnimationSet * WfGetPlayerAnimationSet(struct Entity2D *pInPlayerEnt)
Definition WfPlayer.c:547
void WfDeSerializePlayerEntity(struct BinarySerializer *bs, struct Entity2D *pOutEnt, struct GameLayer2DData *pData)
Definition WfPlayer.c:514
WfPlayerState
Definition WfPlayer.h:40
@ WfNumPlayerStates
Definition WfPlayer.h:43
@ WfWalking
Definition WfPlayer.h:41
@ WfAttacking
Definition WfPlayer.h:42
void WfSetPlayerOverlayAnimations(enum WfDirection dir, struct GameFrameworkLayer *pLayer, struct WfPlayerEntData *pPlayerEntData, struct Entity2D *pEnt)
Definition WfPlayer.c:144
void WfInitPlayer()
void WfMakeIntoPlayerEntity(struct Entity2D *pInEnt, struct GameFrameworkLayer *pLayer, vec2 spawnAtGroundPos)
Definition WfPlayer.c:542
void WfSerializePlayerEntity(struct BinarySerializer *bs, struct Entity2D *pInEnt, struct GameLayer2DData *pData)
Definition WfPlayer.c:497
void WfPlayerGetGroundContactPoint(struct Entity2D *pEnt, vec2 outPos)
Definition WfPlayer.c:359
void WfSetPlayerAnimationSet(struct Entity2D *pInPlayerEnt, const struct WfAnimationSet *pInSet)
Definition WfPlayer.c:553
#define NUM_ANIMATIONS
Definition WfPlayer.h:15
struct WfPlayerEntData * WfGetPlayerEntData(struct Entity2D *pInEnt)
Definition WfPlayer.c:559
Definition InputContext.h:201
Definition BinarySerializer.h:16
Definition InputContext.h:187
An entity component tagged union - there are a fixed number built into the engine.
Definition Entities.h:116
Definition Entities.h:190
Definition GameFramework.h:42
Definition Game2DLayer.h:92
Definition WfPlayer.h:18
const char * animationNames[NUM_ANIMATIONS]
Definition WfPlayer.h:19
Definition WfPlayer.h:34
struct WfAnimationSetLayer layers[WfNumAnimationLayers]
Definition WfPlayer.h:35
unsigned int layersMask
Definition WfPlayer.h:36
Definition WfPlayer.h:47
u32 bNetworkControlled
Definition WfPlayer.h:90
enum WfDirection directionFacing
Definition WfPlayer.h:69
vec2 movementVector
Definition WfPlayer.h:65
vec2 groundColliderCenter2EntTransform
Definition WfPlayer.h:48
u32 bMovingThisFrame
Definition WfPlayer.h:88
struct WfAnimationSet animationSet
Definition WfPlayer.h:67
int netPlayerSlot
Definition WfPlayer.h:81
struct ButtonBinding settingsMenuBinding
Definition WfPlayer.h:58
struct ButtonBinding moveUpBinding
Definition WfPlayer.h:49
vec2 netPlayerSpawnAtPos
Definition WfPlayer.h:80
struct ButtonBinding moveRightBinding
Definition WfPlayer.h:52
u32 bMovingLastFrame
Definition WfPlayer.h:89
int networkPlayerNum
Definition WfPlayer.h:85
struct ButtonBinding prevItemBinding
Definition WfPlayer.h:55
struct ButtonBinding moveLeftBinding
Definition WfPlayer.h:51
float metersPerSecondWalkSpeedBase
Definition WfPlayer.h:61
struct ButtonBinding nextItemBinding
Definition WfPlayer.h:54
enum WfPlayerState state
Definition WfPlayer.h:71
float speedMultiplier
Definition WfPlayer.h:63
struct ActiveInputBindingsMask playerControlsMask
Definition WfPlayer.h:59
struct ButtonBinding moveDownBinding
Definition WfPlayer.h:50
struct WfPlayerEntData::@0 createNetPlayerOnInitArgs