~ares-developers/ares/gd03

« back to all changes in this revision

Viewing changes to Ext/Infantry/Hooks.MakeInf.cpp

  • Committer: Renegade
  • Date: 2010-05-29 08:12:17 UTC
  • Revision ID: git-v1:0a1bb6321f04d723afe64d1b843dc87b4da783ec
Creating /trunk/src.

git-svn-id: svn://svn.renegadeprojects.com/ares/trunk@622 859b54a9-7a54-0410-aeb3-f8d2f1fa40fd

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include <InfantryClass.h>
2
 
#include <HouseTypeClass.h>
3
 
#include <HouseClass.h>
4
 
#include <TActionClass.h>
5
 
#include "Body.h"
6
 
#include "../WarheadType/Body.h"
7
 
#include "../AnimType/Body.h"
8
 
 
9
 
#include <SpecificStructures.h>
10
 
 
11
 
/* #188 - InfDeaths */
12
 
 
13
 
DEFINE_HOOK(5185C8, InfantryClass_ReceiveDamage_InfDeath, 6)
14
 
{
15
 
        GET(InfantryClass *, I, ESI);
16
 
        LEA_STACK(args_ReceiveDamage *, Arguments, 0xD4);
17
 
        GET(DWORD, InfDeath, EDI);
18
 
        --InfDeath;
19
 
        R->EDI(InfDeath);
20
 
 
21
 
        bool Handled = false;
22
 
 
23
 
        if(!I->Type->NotHuman) {
24
 
                if(I->GetHeight() < 10) {
25
 
                        WarheadTypeExt::ExtData *pWHData = WarheadTypeExt::ExtMap.Find(Arguments->WH);
26
 
                        if(AnimTypeClass *deathAnim = pWHData->InfDeathAnim) {
27
 
                                AnimClass *Anim = NULL;
28
 
                                GAME_ALLOC(AnimClass, Anim, deathAnim, &I->Location);
29
 
 
30
 
                                HouseClass *Invoker = (Arguments->Attacker)
31
 
                                        ? Arguments->Attacker->Owner
32
 
                                        : Arguments->SourceHouse
33
 
                                ;
34
 
 
35
 
                                AnimTypeExt::SetMakeInfOwner(Anim, Invoker, I->Owner, Invoker);
36
 
 
37
 
                                Handled = true;
38
 
                        }
39
 
                }
40
 
        }
41
 
 
42
 
        return (Handled || InfDeath >= 10)
43
 
                ? 0x5185F1
44
 
                : 0x5185CE
45
 
        ;
46
 
}
47
 
 
48
 
DEFINE_HOOK(51849A, InfantryClass_ReceiveDamage_DeathAnim, 5)
49
 
{
50
 
        GET(InfantryClass *, I, ESI);
51
 
        LEA_STACK(args_ReceiveDamage *, Arguments, 0xD4);
52
 
        GET(DWORD, InfDeath, EDI);
53
 
 
54
 
        // if you got here, a valid DeathAnim for this InfDeath has been defined, and the game has already checked the preconditions
55
 
        // just allocate the anim and set its owner/remap
56
 
 
57
 
        AnimClass *Anim = NULL;
58
 
        GAME_ALLOC(AnimClass, Anim, I->Type->DeathAnims[InfDeath], &I->Location);
59
 
 
60
 
        AnimTypeExt::SetMakeInfOwner(Anim, I->Owner, I->Owner, Arguments->Attacker->Owner);
61
 
 
62
 
        R->EAX<AnimClass *>(Anim);
63
 
        return 0x5184F2;
64
 
}
65
 
 
66
 
DEFINE_HOOK(6E232E, ActionClass_PlayAnimAt, 5)
67
 
{
68
 
        GET(TActionClass *, pAction, ESI);
69
 
        GET_STACK(HouseClass *, pHouse, 0x1C);
70
 
        LEA_STACK(CoordStruct *, pCoords, 0xC);
71
 
 
72
 
        AnimClass *Anim = NULL;
73
 
        AnimTypeClass *AnimType = AnimTypeClass::Array->GetItem(pAction->arg_90);
74
 
 
75
 
        GAME_ALLOC(AnimClass, Anim, AnimType, pCoords);
76
 
 
77
 
        if(AnimType->MakeInfantry > -1) {
78
 
                AnimTypeExt::SetMakeInfOwner(Anim, pHouse, pHouse, pHouse);
79
 
        }
80
 
 
81
 
        R->EAX<AnimClass *>(Anim);
82
 
 
83
 
        return 0x6E2368;
84
 
}