#pragma once #ifndef ONI_CHARACTER_H #define ONI_CHARACTER_H #include "Oni.h" #include #include typedef struct { float X; float Y; float Z; } Vector3; //probably move to utilities... typedef struct { float X; float Y; float Z; float W; } Quaternion; typedef struct { float RotationScale[9]; Vector3 Translation; } Matrix4x3; typedef struct { Vector3 Center; float Radius; } Sphere; typedef struct { Sphere Sphere_; //fix this name int Child1; int Child2; } SphereTreeNode; typedef struct { Vector3 Min; Vector3 Max; } BoundingBox; enum { //action flags Action_Escape = 1, Action_Console = 2, Action_PauseScreen = 4, Action_Cutscene_1 = 8, Action_Cutscene_2 = 0x10, Action_F4 = 0x20, Action_F5 = 0x40, Action_F6 = 0x80, Action_F7 = 0x100, Action_F8 = 0x200, Action_StartRecord = 0x400, Action_StopRecord = 0x800, Action_PlayRecord = 0x1000, Action_F12 = 0x2000, Action_Unknown1 = 0x4000, Action_LookMode = 0x8000, Action_Screenshot = 0x10000, Action_Unknown2 = 0x20000, Action_Unknown3 = 0x40000, Action_Unknown4 = 0x80000, Action_Unknown5 = 0x100000, Action_Forward = 0x200000, Action_Backward = 0x400000, Action_TurnLeft = 0x800000, Action_TurnRight = 0x1000000, Action_StepLeft = 0x2000000, Action_StepRight = 0x4000000, Action_Jump = 0x8000000, Action_Crouch = 0x10000000, Action_Punch = 0x20000000, Action_Kick = 0x40000000, Action_Block = 0x80000000, //used in second action field Action2_Walk = 1, Action2_Action = 2, Action2_Hypo = 4, Action2_Reload = 8, Action2_Swap = 0x10, Action2_Drop = 0x20, Action2_Fire1 = 0x40, Action2_Fire2 = 0x80, Action2_Fire3 = 0x100, }; typedef struct { int32_t Actions1; int32_t Actions2; } InputAction; typedef struct { float MouseDeltaX; float MouseDeltaY; float field_8; float field_C; InputAction Current; InputAction Stopped; InputAction Start; InputAction Stop; } GameInput; typedef struct { int Type; //'CHAR' etc. int ObjectId; //not needed int Flags; //The flags of the object...not used for CHAR Vector3 Position; //Position of Object Vector3 Rotation; //Rotation of Object int EditorCallbacks; //Lets try not to mess with it for now. :P int field_28; //unknown } OSD_Header; typedef struct { int32_t Flags; int32_t Frame; int32_t field_8; int32_t field_C; int32_t field_10; int32_t field_14; int32_t field_18; int32_t field_1C; int32_t FILMInstance; } PlayingFilm; typedef enum { chr_isplayer = 1 << 0, chr_randomskin = 1 << 1, chr_notprespawned = 1 << 2, chr_noncombatant = 1 << 3, chr_multispawnable = 1 << 4, chr_unkillable = 1 << 5, chr_superammo = 1 << 6, chr_omniscient = 1 << 8, chr_haslsi = 1 << 9, chr_boss = 1 << 10, chr_upgradedifficulty = 1 << 11, chr_noautodrop = 1 << 12, chr_dontaim = 1 << 13, chr_nocollision = 1 << 17, chr_noshadow = 1 << 24, chr_invincible = 1 << 25, chr_bossshield = 1 << 30, chr_weaponimmune = 1 << 31, } chr_flags; /* enum { chr_isplayer = 0x00000001, //is player character chr_randomskin = 0x00000002, //gets random skin from ONCV chr_notprespawned = 0x00000004, //isn't spawned at level creation chr_noncombatant = 0x00000008, //doesn't fight chr_multispawnable = 0x00000010, //can spawn up to 5 without forcing chr_unknown = 0x00000020, // chr_unkillable = 0x00000040, //can only be brought to 1 hp chr_superammo = 0x00000080, //infinite ammo chr_omniscient = 0x00000100, //touchofdeath chr_haslsi = 0x00000200, //drops an lsi chr_boss = 0x00000400, //is a boss character chr_upgradedifficulty = 0x00000800, //upgrade the difficulty if you play on med\hard chr_noautodrop = 0x00001000, //uses drop fields instead of has fields on death }; // */ typedef struct { uint32_t Options; //A bitset. Someone had better define these char Class[64]; //Name of the ONCC we use. ONCCName in idb char Name[32]; //Name of the character. ie: ai2_spawn Muro char Weapon[64]; //Name of the weapon he holds. ONWCName in idb char ScriptSpawn[32]; //Script function called when char spawns char ScriptDie[32]; //Script function called when char dies char ScriptAware[32]; //Script function called when char detects something char ScriptAlarm[32]; //Script function called when char is alarmed at something char ScriptHurt[32]; //Script function called when char is hurt for the first time char ScriptDefeat[32]; //Script function called when char is at 1 HP char ScriptNoPath[32]; //Script function called when char loses path. Broken. char ScriptNoAmmo[32]; //Script function called when char is out of ammo for the first time. Char must have ammo at spawn. int32_t AdditionalHealth; //Additional Health given to the character int16_t AmmoUsed; //Ammo given for the char to use int16_t AmmoDropped; //Ammo the char drops int16_t CellsUsed; //Cells given for the char to use int16_t CellsDropped; //Cells the char drops int16_t HypoUsed; //Hypo given for the char to use int16_t HypoDropped; //Hypo the char drops int16_t ShieldUsed; //Bullet shield given for the char to use int16_t ShieldDropped; //Bullet shield the char drops int16_t CloakUsed; //Phase Cloak given for the char to use int16_t CloakDropped; //Phase Cloak the char drops int16_t NCIUsed; //Don't use this... int16_t NCIDropped; //Don't use this... int32_t TeamID; //Team ID int32_t AmmoPercent; //Percent of weapon ammo full int32_t JobID; //Job ID... //0 - none //1 - idle //2 - guard (never used in Oni) //3 - patrol //4 - teambattle (never used in Oni) int16_t PatrolID; //patrol path ID (reference to the Patrol_Path.BINA file) int16_t CombatID; //combat ID (reference to the Combat.BINA file) int16_t MeleeID; //melee ID (reference to the Melee Profile.BINA file) int16_t NeutralID; //neutral ID (reference to the Neutral.BINA file) int32_t AlarmGroups; //Bitset. http://wiki.oni2.net/CHAR int32_t InitialAlertLevel; //0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat int32_t MinimalAlertLevel; //0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat int32_t StartJobAlertLevel; //0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat int32_t InvestigatingAlertLevel;//0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat int32_t PursuitStrongLow; int32_t PursuitWeakLow; int32_t PursuitStrongHigh; int32_t PursuitWeakHigh; int32_t Pursuit5; int32_t field_1FC; } CharacterOSD; typedef struct { OSD_Header Header; CharacterOSD OSD; } CharacterObject; typedef struct { Vector3 Center; float Radius; } BoundingSphere; typedef struct { int32_t ONCP; //probably pointer int32_t field_4; //who knows? int32_t Instance; //probably link to actual particle int32_t Bone; //duh } AttachedParticle; typedef struct { //Inventory int32_t Weapons[3]; int16_t field_1A0; //10 bucks says this is the current weapon int16_t AmmoUsed; //Ammo given for the char to use int16_t HypoUsed; //Hypo given for the char to use int16_t CellsUsed; //Cells given for the char to use int16_t AmmoDropped; //Ammo the char drops int16_t HypoDropped; //Hypo the char drops int16_t CellsDropped; //Cells the char drops int16_t field_1A; //who knows? InverseHypoRegenRate? int16_t field_1C; int16_t field_1E; char hasLSI; char field_1B5; int16_t field_1B6; int16_t ShieldUsed; //Bullet shield given for the char to use int16_t CloakUsed; //Phase Cloak given for the char to use int32_t field_28; //probably bullet shield dropped int32_t DoorKeys; //Lol. We can use this later for other sorts of items. } Inventory; typedef struct { uint32_t SphereTree; Vector3 ObBox[8]; Vector3 * ObBowPtr; Vector3 Velocity; Quaternion field_74; Vector3 Position; Quaternion Rotation; float Scale; Matrix4x3 Matrix; Matrix4x3 InitMatrix; float field_104; float Gravity; float field_10C; float field_110; float Friction_1; float Friction_2; Vector3 Force; uint32_t Flags; uint32_t Type; char AnimState[0x18]; void* Callbacks; void* Owner; } PhyContext; typedef struct { //ActiveCharacter int16_t Number; int16_t field_2; //probably Number is an int32 PhyContext * PhyContext_; SphereTreeNode SphereTree1; //probably SphereTree[7]... SphereTreeNode SphereTree3[4]; SphereTreeNode SphereTree2[2]; int16_t field_B0; int16_t field_B2; int16_t field_B4; int16_t field_B6; Vector3 field_B8; Vector3 AccelerateWith; int32_t field_D0; Vector3 field_D4; int32_t field_E0; int32_t field_E4; int32_t field_E8; int32_t field_EC; float SomePhyPosY; int16_t field_F4; int16_t IsInAirTimer; Vector3 FallingVelocity; Vector3 JumpVelocity; char StartJumpPending; char field_111; int16_t field_112; Vector3 field_114; int32_t LastDamageSourceCharacter; int32_t field_11C; int32_t field_120; int32_t field_124; int32_t field_128; int32_t field_12C; BoundingSphere BoundingSphere_; //fix this name Vector3 field_140; Vector3 field_14C; int32_t field_158; int32_t field_15C; Vector3 Location; int32_t field_16C[6]; //16C-184 ??? int32_t AkiraNode; int32_t GraphNode; int32_t PelvisHeight; int32_t MovementStatePtr; int32_t ActiveWeapon; //NOTE: FIGURE OUT THIS MESS OF INVENTORY... int32_t field_198; //maybe weap 3, maybe not... int32_t InventoryWeapon; int16_t field_1A0; //unused? int16_t AmmoUsable; //Ammo given for the char to use int16_t HypoUsable; //Hypo given for the char to use int16_t CellsUsable; //Cells given for the char to use int16_t AmmoDropped; //Ammo the char drops int16_t HypoDropped; //Hypo the char drops int16_t CellsDropped; //Cells the char drops int16_t field_1AE; int16_t InverseHypoRegenRate; int16_t ShieldDropped; int16_t CloakDropped; int16_t field_1B4; int16_t field_1B6; int16_t ShieldUsable; int16_t CloakUsable; int16_t field_1BC[9]; //1BC-1E0 int32_t NotIdleStartTime; int32_t TimeToIdle; int32_t field_1E8[1315]; //1E8-1648 what the hell is all this? BoundingBox BoundingBox_; //fix this name int32_t field_1660; int32_t field_1664; int32_t ShieldPower; //Same as Boss Shield Power??? int32_t field_166C; int32_t NumberOfKills; //^_^ int32_t InflictedDamage; //^_^ int32_t field_1678[260]; //1678-1A88 more wtf int32_t field_1A88; //here starts animation junk? It was 4 bools in idb O_o int32_t Executor_AimingDirection; //possibly throw junk? int32_t field_1A98; int32_t field_1A9C; int32_t Executor_ActualMovementMode; int32_t field_1AA4; int32_t field_1AA8; int32_t field_1AAC; int32_t Executor_HasFacingOverride; //a bool... float Executor_AimingSpeed; onibool field_1AB8; //actually a bitset... onibool Executor_HasMoveOverride; int16_t field_1ABA; int32_t field_1ABC; int32_t field_1AC0; int32_t field_1AC4; int32_t Executor_FacingOverride; int32_t Executor_HasAttackOverride; //another bool :P int32_t field_1AD0; int32_t field_1AD4; int32_t field_1AD8; int32_t field_1ADC; int32_t field_1AE0; int32_t field_1AE4; int32_t Executor_HasThrowOverride; //another another bool int32_t field_1AEC; int32_t field_1AF0; int32_t field_1AF4; int32_t Animation; int16_t AnimationToState; int16_t AnimationFromState; int16_t AnimationType; int16_t NextAnimationType; int16_t field_1B04; int16_t field_1B06; int32_t Stitch; //bool float StitchHeight; int16_t InterpolationFromState; int16_t field_1B12; Vector3 StitchVelocity; int16_t InterpolationCurrentFrame; int16_t InterpolationLength; Quaternion InterpolationStartRotations[19]; int32_t field_1C54; int32_t field_1C58; int32_t field_1C5C; int32_t field_1C60; int32_t Overlay; int32_t field_1C68; int32_t field_1C6C; int32_t field_1C70; int32_t field_1C74; int32_t field_1C78; int32_t field_1C7C; int32_t field_1C80; int32_t field_1C84; int16_t Frame; int16_t SoftPause; int16_t HardPause; int16_t field1C8E; int32_t field1C90; int16_t field1C94; int16_t field1C96; int16_t Dizzy; int16_t field1C9A; int32_t field1C9C; int16_t AnimationVarient; int16_t TimeToPeace; int16_t NumAnimationAttachedParticles; int16_t field_1CA6; //spacing AttachedParticle AnimationAttachedParticles[16]; int32_t TRAMParticles; onibool FixedParticlesAttached; onibool FixedParticlesStarted; int16_t NumFixedParticles; AttachedParticle FixedParticles[16]; int16_t CurrentAnimationType; int16_t field_1EB2; //spacing int32_t field_1EB4; int32_t field_1EB8; int32_t field_1EBC; int32_t field_1EC0; int32_t field_1EC4; int32_t field_1EC8; int32_t field_1ED0; int32_t field_1ED4; int32_t field_1ED8; int32_t field_1EE0; int32_t field_1EE4; int32_t field_1EE8; Quaternion Rotations[19]; Quaternion OverlayRotations[19]; int32_t field_2150; int32_t field_2154; GameInput Input; InputAction PreviousActions; int32_t SprintTimer; int32_t field_2194; Vector3 field_2198; int32_t field_21A4; int32_t field_21A8; int32_t field_21AC; Vector3 field_21B0; float HeadFacing; float HeadPitch; int32_t field_21C4; int32_t field_21C8; int32_t field_21D0; int32_t field_21D4; onibool field_21D8; onibool field_21D9; onibool field_21DA; onibool field_21DB; onibool field_21DC; onibool field_21DD; onibool field_21DE; onibool field_21DF; onibool field_21E0; onibool HasAlternateTrigger; onibool field_21E2; onibool ReleaseTrigger; onibool ReleaseAlternateTrigger; onibool TurningLeft; onibool TurningRight; onibool field_21E7; int32_t field_21E8; int32_t field_21EC; int32_t field_21F0; PlayingFilm PlayingFilm_; //fix this name int32_t field_2218[24]; //2218-2278 Matrix4x3 BoneMatrices[19]; Matrix4x3 WeaponMatrix; int32_t field_2638[113]; //2638-27FC int16_t ShadowIndex; int16_t field_27FE; int16_t field_2780; onibool ShieldParts[19]; onibool field_2815; //padding... onibool field_2816; onibool field_2817; int32_t field_2818[8]; } ActiveCharacter; //This struct is good. typedef struct { //Character char Number; char field_2; int16_t ActiveCharacterIndex; int32_t Flags; int32_t field_8; int32_t* ONCC; //change type to ONCC when we get that far... int16_t field_10; int16_t Team; char Name[32]; float BodySize; int32_t Health; int32_t MaxHealth; int32_t ASIA_ID; //might be 16 with 2 byte padding int32_t field_44; char ScriptSpawn[32]; //Script function called when char spawns char ScriptDie[32]; //Script function called when char dies char ScriptAware[32]; //Script function called when char detects something char ScriptAlarm[32]; //Script function called when char is alarmed at something char ScriptHurt[32]; //Script function called when char is hurt for the first time char ScriptDefeat[32]; //Script function called when char is at 1 HP char ScriptNoAmmo[32]; //Script function called when char is out of ammo for the first time. Char must have ammo at spawn. char ScriptNoPath[32]; //Script function called when char loses path. Broken. Vector3 Position; Vector3 LastPosition; Vector3 Location; float Facing; float DesiredFacing; float CosmeticFacing; float field_178; float field_17C; float field_180; int32_t BNV; int32_t GraphNode; float PelvisHeight; float field_190; Inventory Inventory_; //is there a better way to do this? Vector3 Velocity; int32_t field_1D0; int32_t Recoil; int32_t field_1D8; int32_t field_1DC; int32_t LastNotIdleGameTime; int32_t IdleDelay; int32_t Type; int32_t field_1EC; int32_t CombatFlags; int32_t JobId; int32_t Goal; int32_t field_1FC; int32_t field_200; int32_t field_204; int32_t field_208[428]; //208-8B8 int32_t CombatState; //I think.... int32_t field_8BC; int32_t PatrolPathOSD[10]; //actually another struct. Not needed atm. int32_t PatrolPathPoints[5][64]; //64 of another struct int32_t field_DE8[98]; //DE8-F70 int32_t CombatStatePtr; int32_t KnowledgeState[4]; //Another struct int32_t field_F84; int32_t AlertDecayTimer; int32_t field_F8C; int32_t field_F90; int32_t InitialAlertLevel; //0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat int32_t MinimalAlertLevel; //0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat int32_t StartJobAlertLevel; //0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat int32_t InvestigatingAlertLevel;//0 - lull, 1 - low, 2 - medium, 3 - high, 4 - combat int32_t StartleTime; int32_t field_FA8; int32_t field_FAC; int32_t field_FB0; int32_t PursuitStrongLow; int32_t PursuitWeakLow; int32_t PursuitStrongHigh; int32_t PursuitWeakHigh; int32_t Pursuit5; int32_t field_FC8[4]; int32_t AlarmGroups; //a bitset int32_t field_FDC[17]; //FDC-1020 int32_t DazeTimer; int32_t field_1024[17]; //1024-1068 int32_t MeleePtr; //probably MELE. Looks somewhat important. int32_t field_106C[270]; //106C-14A4 skipping lots of junk and a little pathfinding stuff that we might want later. int32_t MovementMode; int32_t field_14A8; int32_t field_14AC; int32_t MovementModifiers; //hopefully sprinting, pistol, rifle, etc. int32_t field_14B4[101]; //14B4-1648 Glossing over a few other things we don't need having to do with AI direction. BoundingBox BoundingBox_; int32_t field_1660; int32_t BossShieldPower; //a multiplier? or just a flag? who knows int32_t field_1668[6]; int32_t CurrentConsoleActionMarker; //not sure. int32_t field_1684[7]; } Character; enum { team_konoko, team_tctf, team_syndicate, team_neutral, team_securityguard, team_rougekonoko, team_switzerland, team_syndicateaccessory, }; int16_t ONICALL ONrGameState_NewCharacter(CharacterObject* CHAR, void* AISA, void* flag, uint32_t* list_location); int32_t* ONICALL ONrGetActiveCharacter(void* CharacterPtr); //int16_t ONICALL ONrGameState_GetPlayerCharacter(); //probably need to name these better. #define char_unkillable (1 << 5) #define char_superammo (1 << 6) #define char_unstoppable (1 << 8) #define char_deathlock (1 << 10) #define char_dontaim (1 << 13) #define char_nocollision (1 << 17) #define char_noshadow (1 << 24) #define char_invincible (1 << 25) #define char_bossshield (1 << 30) #define char_weaponimmune (1 << 31) //We need a Oni_Structs #include file. typedef struct { uint32_t TimerMode; char TimerName[32]; uint32_t TimerDuration; uint32_t field_28; uint32_t field_2C; uint32_t Letterbox[3]; uint32_t field_3C; uint32_t field_40; uint32_t CutsceneSyncMark; uint32_t SomeCutsceneSyncMarkField; uint32_t field_4C; uint32_t SplashScreenMachineTime; uint32_t field_54; uint32_t field_58; uint32_t field_5C; uint32_t field_60; uint32_t field_64; uint32_t field_68; uint32_t field_6C; uint32_t field_70; uint32_t FadeStartTime; uint32_t FadeEndTime; uint32_t field_7C; uint32_t Camera; char PathFindingGraph[0x28]; struct Character *PlayerCharacter; uint32_t field_B0; uint32_t field_B4; GameInput Input; uint32_t field_E8; uint32_t field_EC; uint32_t ScreenshotEveryFrame; //bool? uint32_t field_F4; char field_F8; char field_F9; char field_FA; char field_FB; uint32_t field_FC; uint32_t field_100; uint32_t SlowMo; //bool uint32_t SlowMotion; uint32_t field_10C; uint32_t field_110; uint32_t field_114; char SplashScreenTextureName[32]; uint32_t field_138; uint32_t field_13C; uint32_t field_140; uint32_t GameTime; uint32_t field_148; uint32_t field_14C; uint32_t Level; uint32_t field_154; char MotionBlur[0x44][64]; uint32_t MotionBlurCount; uint16_t field_125C; uint16_t field_125E; Character CharacterStorage[128]; uint16_t CharacterCount; uint16_t padding_1; uint32_t field_B6264; char ActiveCharacters[0x2838][64]; //Active Character Struct isn't the proper size atm. uint16_t ActiveCharactersCount; char Shadows[32][0x804]; uint32_t field_1670EA; uint32_t ShadowCount; ActiveCharacter* ActiveCharacterList[128]; //or just Character*? Anyways, we wont need to use this. uint32_t ActiveCharacterListCount; uint32_t ActiveCharacterListLock; Character* LivingCharacterList[128]; uint32_t LivingCharacterListCount; uint32_t LivingCharacterListLock; ActiveCharacter* PresentCharacterList[128]; uint32_t PresentCharacterListCount; uint32_t PresentCharacterListLock; void* ObjectList; char DoorArray[8]; char Sky[0x290]; uint32_t field_1679A4; uint32_t Triggers; char IsGamePaused; char IsInputEnabled; char field_1679AE; char field_1679AF; uint32_t LockedActions1; uint32_t LockedActions2; uint32_t field_1679B8; uint32_t WinLose; uint32_t ConditionSoundsCount; uint32_t ConditionSounds[5]; uint16_t LevelNumber; uint16_t padding_5; uint16_t field_1679DC; } GameState; #endif