Skip to content

Commit 5641dff

Browse files
committed
Script_AniName: Apply mapping override also to effects
1 parent 6fcb715 commit 5641dff

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

source/Scripts/Script_AniName/Readme_DE.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ Dieses Skript überschreibt dieses Zuordnungsmuster für bestimmte Spezies:
77
- gESpecies_Skeleton: Skelett_....xmot
88
- gESpecies_Zombie: Zombie_....xmot
99

10+
Das gleiche Zuordnungsmuster wird auf die Effekte `eff_creature_<actor name>_stumble_01` und
11+
`eff_creature_<actor name>_die_01` angewendet:
12+
- gESpecies_Skeleton: eff_creature_skeleton_stumble_01, eff_creature_skeleton_die_01
13+
- gESpecies_Zombie: eff_creature_zombie_stumble_01, eff_creature_zombie_die_01
14+
1015
1. Installation
1116
Der Ordner 'scripts' muss ins Gothic 3 Installationverzeichnis kopiert werden.
1217
Es ist nicht notwendig ein neues Spiel zu beginnen.

source/Scripts/Script_AniName/Readme_EN.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ This Script overrides that mapping for certain species:
77
- gESpecies_Skeleton: Skeleton_....xmot
88
- gESpecies_Zombie: Zombie_....xmot
99

10+
The same mapping override is applied to the `eff_creature_<actor name>_stumble_01` and
11+
`eff_creature_<actor name>_die_01` effects.
12+
- gESpecies_Skeleton: eff_creature_skeleton_stumble_01, eff_creature_skeleton_die_01
13+
- gESpecies_Zombie: eff_creature_zombie_stumble_01, eff_creature_zombie_die_01
14+
1015
1. Installation
1116
The 'scripts' folder has to be copied into the Gothic 3 install folder.
1217
There is no need to start a new game.

source/Scripts/Script_AniName/Script_AniName.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,26 @@ namespace
2121
}
2222
}
2323
}
24+
25+
static mCFunctionHook Hook_PSAnimation_GetSkeletonName;
26+
GEBool GE_STDCALL PSAnimation_GetSkeletonName(PSAnimation const &This, bCString & o_SkeletonName)
27+
{
28+
gCNPC_PS const * NPC = This.IsValid() ? GetPropertySet<gCNPC_PS>(This->GetEntity(), eEPropertySetType_NPC) : nullptr;
29+
if (NPC)
30+
{
31+
switch (NPC->GetSpecies().GetValue())
32+
{
33+
case gESpecies_Skeleton:
34+
o_SkeletonName = "Skeleton";
35+
return GETrue;
36+
case gESpecies_Zombie:
37+
o_SkeletonName = "Zombie";
38+
return GETrue;
39+
}
40+
}
41+
42+
return Hook_PSAnimation_GetSkeletonName.GetOriginalFunction(PSAnimation_GetSkeletonName)(This, o_SkeletonName);
43+
}
2444
}
2545

2646
void ApplyHooks()
@@ -32,6 +52,10 @@ void ApplyHooks()
3252
.AddRegArg(mCRegisterBase::mERegisterType_Ebx) // eCEntity const * Actor
3353
.AddRegArg(mCRegisterBase::mERegisterType_Esi) // bCString & ActorName
3454
.InsertCall().Hook();
55+
56+
Hook_PSAnimation_GetSkeletonName
57+
.Prepare(PROC_Script("?GetSkeletonName@PSAnimation@@QBE_NAAVbCString@@@Z"), &PSAnimation_GetSkeletonName)
58+
.ThisCall().Hook();
3559
}
3660

3761

0 commit comments

Comments
 (0)