Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 22 additions & 18 deletions plugin_sa/game_sa/CAnimBlendAssociation.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,28 @@ class CAnimBlendNode;
class CAnimBlendHierarchy;
class CAnimBlendStaticAssociation;

enum eAnimationFlags
{
ANIMATION_STARTED = 0x1,
ANIMATION_LOOPED = 0x2,
ANIMATION_FREEZE_LAST_FRAME = 0x4,
ANIMATION_UNLOCK_LAST_FRAME = 0x8, // Animation will be stuck on last frame, if not set
ANIMATION_PARTIAL = 0x10,
ANIMATION_MOVEMENT = 0x20,
ANIMATION_TRANLSATE_X = 0x40,
ANIMATION_TRANLSATE_Y = 0x80,
ANIMATION_UNUSED_1 = 0x100,
ANIMATION_UNUSED_2 = 0x200,
ANIMATION_ADD_TO_BLEND = 0x400,
ANIMATION_UNUSED_3 = 0x800,
ANIMATION_UNUSED_4 = 0x1000,
ANIMATION_FREEZE_TRANSLATION = 0x2000,
ANIMATION_BLOCK_REFERENCED = 0x4000,
ANIMATION_INDESTRUCTIBLE = 0x8000
enum eAnimationFlags {
Copy link
Contributor

@MiranDMC MiranDMC Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think it is improvement. Old flags are still cleaner and easier to understand.

We do not have to blindly follow whatever guys from reversed project do.
I still did not got explanation about their policy about naming things gta-reversed/gta-reversed#1133, but seems they stick to leaked names even when these are bluntly incorrect.

Copy link
Author

@emil6strutui emil6strutui Jan 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not agree to the old flags being easier to understand.

ANIMATION_FREEZE_LAST_FRAME -> ANIMATION_IS_BLEND_AUTO_REMOVE when it clearly is being removed when blendAmount reaches 0. How is the old name saying this from its name? From the old name I would expect the animation to freeze in the last frame, not be removed.

ANIMATION_DEFAULT = 0, //0x0,
ANIMATION_IS_PLAYING = 1 << 0, //0x1,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why calculating flag then putting the value again in the comment? Just more visual noise. Plus comment message is fussed with //

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it clear to put shift operation and leave the old value as reference. What do you suggest?

ANIMATION_IS_LOOPED = 1 << 1, //0x2,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why adding IS to bit flag makes it any better?

ANIMATION_IS_BLEND_AUTO_REMOVE = 1 << 2, //!< (0x4) Automatically `delete this` once faded out (`m_BlendAmount <= 0 && m_BlendDelta <= 0`)
ANIMATION_IS_FINISH_AUTO_REMOVE = 1 << 3, //0x8, // Animation will be stuck on last frame, if not set
ANIMATION_IS_PARTIAL = 1 << 4, //0x10, // TODO: Flag name is possibly incorrect? Following the usual logic (like `ANIMATION_MOVEMENT`), it should be `ANIMATION_GET_IN_CAR` (See `RemoveGetInAnims`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So now we are adding "possibly incorrect" names into SDK?

ANIMATION_IS_SYNCRONISED = 1 << 5, //0x20,
ANIMATION_CAN_EXTRACT_VELOCITY = 1 << 6, //0x40,
ANIMATION_CAN_EXTRACT_X_VELOCITY = 1 << 7, //0x80,

// ** User defined flags **
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it mean? Does ANIMATION_WALK work in vanilla game?

ANIMATION_WALK = 1 << 8, //0x100,
ANIMATION_200 = 1 << 9, //0x200,
ANIMATION_DONT_ADD_TO_PARTIAL_BLEND = 1 << 10, //0x400, // Possibly should be renamed to ANIMATION_IDLE, see `CPed::PlayFootSteps()`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, adding TODO comments from reversing process into PSDK.

ANIMATION_IS_FRONT = 1 << 11, //0x800,
ANIMATION_SECONDARY_TASK_ANIM = 1 << 12, //0x1000,
// **

ANIMATION_IGNORE_ROOT_TRANSLATION = 1 << 13, //0x2000,
ANIMATION_REFERENCE_BLOCK = 1 << 14, //0x4000,
ANIMATION_FACIAL = 1 << 15, //0x8000 // The animation is never destroyed if this flag is set, NO MATTER WHAT
};

class PLUGIN_API CAnimBlendAssociation {
Expand Down
12 changes: 6 additions & 6 deletions plugin_sa/game_sa/CPad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ bool CPad::ExitVehicleJustDown() {
return plugin::CallMethodAndReturn<bool, 0x540120, CPad *>(this);
}

// Converted from thiscall uchar CPad::GetMeleeAttack(void) 0x540340
unsigned char CPad::GetMeleeAttack() {
return plugin::CallMethodAndReturn<unsigned char, 0x540340, CPad *>(this, 0);
//uchar __thiscall CPad::GetMeleeAttack(CPad *this, bool bCheckButtonCircleStateOnly) 0x540340
unsigned char CPad::GetMeleeAttack(bool checkButtonCircleOnly) {
return plugin::CallMethodAndReturn<unsigned char, 0x540340, CPad*, bool>(this, checkButtonCircleOnly);
}

// Converted from thiscall uchar CPad::MeleeAttackJustDown(void) 0x540390
unsigned char CPad::MeleeAttackJustDown() {
return plugin::CallMethodAndReturn<unsigned char, 0x540390, CPad *>(this);
//uchar __thiscall CPad::MeleeAttackJustDown(CPad *this, bool bCheckButtonCircleStateOnly) 0x540390
unsigned char CPad::MeleeAttackJustDown(bool checkButtonCircleOnly) {
return plugin::CallMethodAndReturn<unsigned char, 0x540390, CPad*, bool>(this, checkButtonCircleOnly);
}

// Converted from thiscall short CPad::GetAccelerate(void) 0x5403F0
Expand Down
4 changes: 2 additions & 2 deletions plugin_sa/game_sa/CPad.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ class CPad {
short GetBrake();
bool GetExitVehicle();
bool ExitVehicleJustDown();
unsigned char GetMeleeAttack();
unsigned char MeleeAttackJustDown();
unsigned char GetMeleeAttack(bool checkButtonCircleOnly);
unsigned char MeleeAttackJustDown(bool checkButtonCircleOnly);
short GetAccelerate();
bool GetAccelerateJustDown();
bool NextStationJustUp();
Expand Down
14 changes: 14 additions & 0 deletions plugin_sa/game_sa/CPed.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ enum PLUGIN_API eFightingStyle
STYLE_ELBOWS
};

enum PLUGIN_API ePedPieceTypes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not inside ePedPieceTypes.h?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The enum is related to the ped itself, didn't seem logical to have it separated in another .h file while other enums are living in CPed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You already need it in CWeapon.

{
PED_COL_SPHERE_LEG = 0,
PED_COL_SPHERE_MID = 1,
PED_COL_SPHERE_HEAD = 2,
PED_PIECE_TORSO = 3, // AKA CHEST
PED_PIECE_ASS = 4, // AKA MIDSECTION
PED_PIECE_LEFT_ARM = 5, // AKA UPPERARM_L
PED_PIECE_RIGHT_ARM = 6, // AKA UPPERARM_R
PED_PIECE_LEFT_LEG = 7, // AKA LEG_L
PED_PIECE_RIGHT_LEG = 8, // AKA LEG_R
PED_PIECE_HEAD = 9
};

class CObject;
class CVehicle;

Expand Down
2 changes: 1 addition & 1 deletion plugin_sa/game_sa/CWeapon.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "FxSystem_c.h"
#include "CVector2D.h"
#include "CColPoint.h"
#include "ePedPieceTypes.h"

enum eWeaponState : unsigned int
{
Expand All @@ -23,6 +22,7 @@ enum eWeaponState : unsigned int
};

class CPed;
enum ePedPieceTypes : int;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing the include file and defining the enum base type here? This is spaghetti code.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It needs to be forward declared due to circular dependency between CPed.h and CWeapon.h

class CVehicle;
class CColModel;

Expand Down
11 changes: 0 additions & 11 deletions plugin_sa/game_sa/ePedPieceTypes.h

This file was deleted.