blob: 0b32dce4e890ce7c8cc8c1d91f82106acea82d73 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
/**
* @file hitSwitch.c
* @ingroup Objects
*
* @brief Hit Switch object
*/
#include "entity.h"
#include "physics.h"
void HitSwitch(Entity* this) {
Entity* parent = this->parent;
if (parent->next == NULL) {
DeleteThisEntity();
}
if (this->action == 0) {
this->action = 1;
this->field_0x76.HALF.LO = parent->animationState;
this->field_0x74.HALF.LO = this->spriteOffsetX;
this->field_0x74.HALF.HI = this->spriteOffsetY;
InitializeAnimation(this, this->animationState);
}
if (parent->animationState != this->field_0x76.HALF.LO) {
DeleteThisEntity();
}
this->spriteSettings.draw = parent->spriteSettings.draw;
CopyPositionAndSpriteOffset(parent, this);
this->spriteOffsetX += this->field_0x74.HALF.LO;
this->spriteOffsetY += this->field_0x74.HALF.HI;
if (this->animationState != 2) {
this->y.HALF.HI++;
this->spriteOffsetY--;
} else {
this->y.HALF.HI--;
this->spriteOffsetY++;
}
GetNextFrame(this);
if (this->frame & 0x80) {
DeleteThisEntity();
}
}
|