summaryrefslogtreecommitdiff
path: root/src/enemy/vaatiArm.c
blob: 819decc9d7fe4a20834c4b19ff0d5cb254cbd5c2 (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
/**
 * @file vaatiArm.c
 * @ingroup Enemies
 *
 * @brief Vaati Arm enemy
 */
#include "area.h"
#include "enemy.h"
#include "functions.h"
#include "hitbox.h"
#include "object.h"
#include "roomid.h"

typedef struct {
    /*0x00*/ Entity base;
    /*0x68*/ Entity* unk_68;
    /*0x6c*/ u8 unused1[12];
    /*0x78*/ u8 unk_78;
    /*0x79*/ u8 unk_79;
    /*0x7a*/ u16 unk_7a;
    /*0x7c*/ u8 unk_7c;
    /*0x7d*/ u8 unk_7d;
    /*0x7e*/ u8 unk_7e;
    /*0x7f*/ u8 unk_7f;
} VaatiArmEntity;

typedef struct VaatiArm_HeapStruct1 {
    union SplitHWord unk00;
    u16 unk02;
    union SplitHWord unk04;
    u16 unk06;
    s16 unk08;
    s16 unk0a;
    u8 unk0c;
    u8 unk0d;
    u8 unk0e;
    u8 unk0f;
} VaatiArm_HeapStruct1;

typedef struct VaatiArm_HeapStruct {
    VaatiArmEntity* entities[5];
    Entity* parent;
    VaatiArm_HeapStruct1 s1[5];
} VaatiArm_HeapStruct;

extern void EnemyDetachFX(Entity*);

static u32 sub_080437DC(VaatiArmEntity*);
static bool32 sub_08043C98(VaatiArmEntity*);
static void VaatiArm_OnTick(VaatiArmEntity*);
static void VaatiArm_OnCollision(VaatiArmEntity*);
static void sub_080425B4(VaatiArmEntity*);
static void sub_08042818(VaatiArmEntity*);
static void sub_08042870(VaatiArmEntity*);
static void sub_08042A3C(VaatiArmEntity*);
static void sub_08042C14(VaatiArmEntity*);
static void sub_0804325C(VaatiArmEntity*);
static void sub_08043420(VaatiArmEntity*);
static void sub_08043680(VaatiArmEntity*);
static void VaatiArm_OnGrabbed(VaatiArmEntity*);
static void sub_08042654(VaatiArmEntity*);
static void sub_0804259C(VaatiArmEntity*);
static void sub_08043A10(VaatiArmEntity*);
static void sub_08043ABC(VaatiArmEntity*);
static void sub_08043BC8(VaatiArmEntity*);
static void sub_08043EB8(VaatiArmEntity*);
static void sub_08044000(VaatiArmEntity*);
static void sub_08044078(VaatiArmEntity*);
static void sub_080440CC(VaatiArmEntity*);
static void sub_08043CD4(VaatiArmEntity*);
static void sub_08042894(VaatiArmEntity*);
static void sub_080428AC(VaatiArmEntity*);
static void sub_080428FC(VaatiArmEntity*);
static void sub_08042944(VaatiArmEntity*);
static void sub_08042970(VaatiArmEntity*);
static void sub_080429D4(VaatiArmEntity*);
static void sub_080429FC(VaatiArmEntity*);
static void sub_08043BF0(VaatiArmEntity*);
static void sub_08042A6C(VaatiArmEntity*);
static void sub_08042A88(VaatiArmEntity*);
static void sub_08042AEC(VaatiArmEntity*);
static void sub_08042B20(VaatiArmEntity*);
static void sub_08043C40(VaatiArmEntity*, VaatiArm_HeapStruct1*);
static void sub_08043A78(VaatiArmEntity*);
static void sub_08042C34(VaatiArmEntity*);
static void sub_08042D24(VaatiArmEntity*);
static void sub_08042D6C(VaatiArmEntity*);
static void sub_08042E30(VaatiArmEntity*);
static void sub_08042EF4(VaatiArmEntity*);
static void sub_08042FD8(VaatiArmEntity*);
static void sub_08043048(VaatiArmEntity*);
static void sub_080430D0(VaatiArmEntity*);
static void sub_08043130(VaatiArmEntity*);
static void sub_080431E8(VaatiArmEntity*);
static void sub_08043B9C(VaatiArmEntity*);
static void sub_08043DB0(VaatiArmEntity*);
static void sub_08043B7C(VaatiArmEntity*);
static void sub_08043D08(VaatiArmEntity*);
static void sub_080432A8(VaatiArmEntity*);
static void sub_0804334C(VaatiArmEntity*);
static void sub_08043440(VaatiArmEntity*);
static void sub_08043490(VaatiArmEntity*);
static void sub_08043520(VaatiArmEntity*);
static void sub_0804355C(VaatiArmEntity*);
static void sub_08043580(VaatiArmEntity*);
static void sub_080435F4(VaatiArmEntity*);
static void sub_08043698(VaatiArmEntity*);
static void sub_080436C0(VaatiArmEntity*);
static void sub_08043700(VaatiArmEntity*);
static void sub_08043738(VaatiArmEntity*);
static void sub_08043770(VaatiArmEntity*);

void (*const VaatiArm_Functions[])(VaatiArmEntity*) = {
    VaatiArm_OnTick,
    VaatiArm_OnCollision,
    (void (*)(VaatiArmEntity*))GenericKnockback,
    (void (*)(VaatiArmEntity*))GenericDeath,
    (void (*)(VaatiArmEntity*))GenericConfused,
    VaatiArm_OnGrabbed,
};
void (*const gUnk_080D1248[])(VaatiArmEntity*) = {
    sub_0804259C, sub_08044078, sub_08044078, sub_08044078, sub_080440CC,
};
void (*const gUnk_080D125C[])(VaatiArmEntity*) = {
    sub_080425B4, sub_08042654, sub_08042818, sub_08042870, sub_08042A3C,
    sub_08042C14, sub_0804325C, sub_08043420, sub_08043680,
};

const s16 gUnk_080D1280[] = { 0x140, -0x140 };
const s8 gUnk_080D1284[] = { 0x40, -0x40 };
const u8 gUnk_080D1286[] = { 2, 3, 5, 6, 0xc, 0xb, 9, 8, 0, 0 };

void (*const gUnk_080D1290[])(VaatiArmEntity*) = {
    sub_08042894, sub_080428AC, sub_080428FC, sub_08042944, sub_08042970, sub_080429D4, sub_080429FC,
};

const s16 gUnk_080D12AC[] = { -0x200, 0x200 };
const u8 gUnk_080D12B0[] = { 8, -8 };
const u8 gUnk_080D12B2[] = { -0x50, 0x50 };
const s8 gUnk_080D12B4[] = { -0x20, 0x20 };
const u8 gUnk_080D12B6[] = { 0x70, -0x70 };

void (*const gUnk_080D12B8[])(VaatiArmEntity*) = {
    sub_08042A6C,
    sub_08042A88,
    sub_08042AEC,
    sub_08042B20,
};

const u8 gUnk_080D12C8[] = { 0x60, -0x60 };
const u16 gUnk_080D12CA[] = { 0x280, -0x280 };

void (*const gUnk_080D12D0[])(VaatiArmEntity*) = {
    sub_08042C34, sub_08042D24, sub_08042D6C, sub_08042E30, sub_08042EF4,
    sub_08042FD8, sub_08043048, sub_080430D0, sub_08043130, sub_080431E8,
};

const s8 gUnk_080D12F8[] = { -0x10, 0, 0, -0x10, 0x10, 0, 0, 0x10 };
const s16 gUnk_080D1300[] = { 0xC0, -0xC0 };
const u8 gUnk_080D1304[] = { 0, -1, -2, -3, 0, 1, 2, 3 };
const s16 gUnk_080D130C[] = { 0x5000, -0x5000 };
const s16 gUnk_080D1310[] = { 0xA0, -0xA0 };
void (*const gUnk_080D1314[])(VaatiArmEntity*) = { sub_080432A8, sub_0804334C };
const u8 gUnk_080D131C[] = { 0x70, -0x70 };
void (*const gUnk_080D1320[])(VaatiArmEntity*) = {
    sub_08043440, sub_08043490, sub_08043520, sub_0804355C, sub_08043580, sub_080435F4,
};
const s16 gUnk_080D1338[] = { 0x4000, -0x4000 };
const s16 gUnk_080D133C[] = { 0xA0, -0xA0 };
const u8 gUnk_080D1340[] = { 0, 0x12, 0x12, 0x11, 0x11, 0, 0, 0 };
void (*const gUnk_080D1348[])(VaatiArmEntity*) = {
    sub_08043698, sub_080436C0, sub_08043700, sub_08043738, sub_08043770,
};
const u16 gUnk_080D135C[] = { 0x4000, -0x4000, 0x8000 };
const u8 gUnk_080D1362[] = {
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
    3, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 1, 2, 3,
    4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
};
const u8 gUnk_080D13B2[] = { 0, 12, 9, 6, 3 };
const u8 gUnk_080D13B7[] = {
    1, 1, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12, 1, 0,
};
const Coords gUnk_080D13D8[] = { { .HALF = { -0x60, 0x80 } }, { .HALF = { 0x60, -0x80 } } };
const u8 gUnk_080D13E0[] = { 0xc, 0xe, 0x10 };
const u8 gUnk_080D13E3[] = { 8, 9, 10, 4, 4, 5 };
const s8 gUnk_080D13E9[] = { -8, 8 };
const Transition gUnk_080D13EC = {
    1, 0, 0, 0x98, 0xb8, 0, AREA_VAATIS_ARMS, ROOM_VAATIS_ARMS_FIRST, 1, 0, 0, 0
};
const u16 gUnk_080D1400[][5] = {
    { 0x8000, 0x7000, 0x6000, 0x5000, 0x4000 },
    { 0x8000, -0x7000, -0x6000, -0x5000, -0x4000 },
};
const u8 gUnk_080D1414[] = { 0, 0xc, 0xe, 0x10, 0x1c };
const u8 gUnk_080D1419[] = { 0, 0xa, 0xa, 0xa, 0x1c };

void VaatiArm(VaatiArmEntity* this) {
    VaatiArm_Functions[GetNextFunction(super)](this);
}

static void VaatiArm_OnTick(VaatiArmEntity* this) {
    gUnk_080D1248[super->type](this);
}

static void VaatiArm_OnCollision(VaatiArmEntity* this) {
    EnemyFunctionHandlerAfterCollision(super, VaatiArm_Functions);
}

static void VaatiArm_OnGrabbed(VaatiArmEntity* this) {
}

static void sub_0804259C(VaatiArmEntity* this) {
    gUnk_080D125C[super->action](this);
}

static void sub_080425B4(VaatiArmEntity* this) {
    if (sub_080437DC(this)) {
        this->unk_7c = 0;
        this->unk_7d = 0;
        if ((gRoomTransition.field_0x38 & 1) != 0) {
            if (gRoomTransition.field_0x3c == super->type2) {
                sub_08043EB8(this);
                sub_08043ABC(this);
                if ((gRoomTransition.field_0x39 >> (super->type2 + 2) & 1U) != 0) {
                    super->action = 7;
                    super->subAction = 4;
                } else {
                    super->action = 8;
                    super->subAction = 0;
                }
            } else {
                sub_08044000(this);
                sub_08043BC8(this);
                sub_08043A10(this);
            }
        } else {
            super->action = 1;
            super->subAction = gRoomTransition.field_0x38 & 1;
            ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk08 = gUnk_080D1280[super->type2];
            sub_08042654(this);
        }
    }
}

static void sub_08042654(VaatiArmEntity* this) {
    u32 uVar8;
    int index;
    VaatiArm_HeapStruct1* ptr;

    index = super->type2 * 4;
    ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
    switch (super->subAction) {
        case 0:
            super->subAction = 1;
            ptr->unk00.HALF.HI = gUnk_080D1284[super->type2];
            uVar8 = gUnk_080D1286[super->type2 * 4];
            InitAnimationForceUpdate(super, uVar8);
            SoundReq(SFX_15E);
            break;
        case 1:
            ptr->unk00.HWORD += ptr->unk08;
            if ((((VaatiArm_HeapStruct*)super->myHeap)->s1[1].unk0c += 2) < 0xc)
                break;
            super->subAction = 2;
            uVar8 = gUnk_080D1286[index + 1];
            InitAnimationForceUpdate(super, uVar8);
            SoundReq(SFX_15E);
            break;
        case 2:
            ptr->unk00.HWORD += ptr->unk08;
            if ((((VaatiArm_HeapStruct*)super->myHeap)->s1[2].unk0c += 2) < 0xe)
                break;
            super->subAction = 3;
            uVar8 = gUnk_080D1286[index + 2];
            InitAnimationForceUpdate(super, uVar8);
            SoundReq(SFX_15E);
            break;
        case 3:
            ptr->unk00.HWORD += ptr->unk08;
            if ((((VaatiArm_HeapStruct*)super->myHeap)->s1[3].unk0c += 2) < 0x10)
                break;
            super->subAction = 4;
            uVar8 = gUnk_080D1286[index + 3];
            InitAnimationForceUpdate(super, uVar8);
            SoundReq(SFX_15E);
            break;
        case 4:
            ptr->unk00.HWORD += ptr->unk08;
            if ((((VaatiArm_HeapStruct*)super->myHeap)->s1[4].unk0c += 2) < 0x1c)
                break;
            super->subAction = 5;
            super->timer = 90;
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.flags |= ENT_COLLIDE;
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.spritePriority.b0 = 4;
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base.flags |= ENT_COLLIDE;
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base.spritePriority.b0 = 4;
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[2]->base.flags |= ENT_COLLIDE;
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[2]->base.spritePriority.b0 = 4;
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base.flags |= ENT_COLLIDE;
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base.spritePriority.b0 = 4;
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.flags |= ENT_COLLIDE;
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.spritePriority.b0 = 4;
            InitAnimationForceUpdate(super, 7);
            SoundReq(SFX_15E);
            break;
        default:
            if (--super->timer == 0) {
                sub_08043BC8(this);
            }
            break;
    }
    sub_08043A10(this);
}

static void sub_08042818(VaatiArmEntity* this) {
    VaatiArm_HeapStruct1* ptr;

    sub_08043CD4(this);
    ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
    ptr->unk00.HWORD += ptr->unk08;
    if (--ptr->unk0d == 0) {
        ptr->unk0d = 0x78;
        ptr->unk08 *= -1;
    }
    ptr->unk04.HWORD += ptr->unk0a;
    if (--ptr->unk0e == 0) {
        ptr->unk0e = 0x50;
        ptr->unk0a *= -1;
    }
    sub_08043A10(this);
}

static void sub_08042870(VaatiArmEntity* this) {
    sub_08043CD4(this);
    gUnk_080D1290[super->subAction](this);
    sub_08043A10(this);
}

static void sub_08042894(VaatiArmEntity* this) {
    super->subAction = 1;
    ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk08 = gUnk_080D12AC[super->type2];
}

static void sub_080428AC(VaatiArmEntity* this) {
    u8 bVar1;
    VaatiArm_HeapStruct1* pVVar3;

    pVVar3 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
    bVar1 = pVVar3->unk04.HALF.HI;
    if (bVar1 != 0x40) {
        if (bVar1 >= 0x41) {
            pVVar3->unk04.HWORD -= 0x80;
        } else {
            pVVar3->unk04.HWORD += 0x80;
        }
    }
    if ((u32)(pVVar3->unk00.HALF.HI - gUnk_080D12B0[super->type2] + 1) > 2) {
        pVVar3->unk00.HWORD += pVVar3->unk08;
    } else {
        super->subAction = 2;
        super->timer = 30;
    }
    sub_08043BF0(this);
}

static void sub_080428FC(VaatiArmEntity* this) {
    u32 uVar2;
    VaatiArm_HeapStruct1* ptr;

    if (--super->timer == 0) {
        super->subAction = 3;
        ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
        ptr->unk08 *= -3;
        SoundReq(SFX_153);
        uVar2 = 0;
        do {
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[uVar2]->base.hitType = 0x3b;
            uVar2 = uVar2 + 1;
        } while (uVar2 < 5);
    }
}

static void sub_08042944(VaatiArmEntity* this) {
    VaatiArm_HeapStruct1* pVVar1;

    pVVar1 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
    if ((u32)(pVVar1->unk00.HALF.HI - 0x7c) >= 9) {
        pVVar1->unk00.HWORD += pVVar1->unk08;
    } else {
        super->subAction = 4;
        super->speed = pVVar1->unk08;
    }
    sub_08043BF0(this);
}

static void sub_08042970(VaatiArmEntity* this) {
    u32 uVar2;
    VaatiArm_HeapStruct1* pVVar3;

    pVVar3 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
    if ((u32)(pVVar3->unk00.HALF.HI - gUnk_080D12B2[super->type2] + 2) >= 5) {
        pVVar3->unk08 += gUnk_080D12B4[super->type2];
        pVVar3->unk00.HWORD += pVVar3->unk08;
    } else {
        super->subAction = 5;
        super->timer = 60;
        uVar2 = 0;
        do {
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[uVar2]->base.hitType = 0x39;
            uVar2 = uVar2 + 1;
        } while (uVar2 < 5);
    }
    sub_08043BF0(this);
}

static void sub_080429D4(VaatiArmEntity* this) {
    s16 sVar2;
    VaatiArm_HeapStruct1* pVVar3;

    if (--super->timer == 0) {
        super->subAction = 6;
        pVVar3 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
        sVar2 = -super->speed / 6;
        pVVar3->unk08 = sVar2;
    }
}

static void sub_080429FC(VaatiArmEntity* this) {
    VaatiArm_HeapStruct1* pVVar1;

    pVVar1 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
    if ((u32)(pVVar1->unk00.HALF.HI - gUnk_080D12B6[super->type2]) + 1 >= 3) {
        pVVar1->unk00.HWORD += pVVar1->unk08;
        sub_08043BF0(this);
    } else {
        sub_08043BC8(this);
        InitAnimationForceUpdate(super, 7);
    }
}

static void sub_08042A3C(VaatiArmEntity* this) {
    Entity* entity;

    gUnk_080D12B8[super->subAction](this);
    sub_08043A10(this);
    entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base;
    entity->z.HALF.HI += this->unk_78;
}

static void sub_08042A6C(VaatiArmEntity* this) {
    super->subAction = 1;
    this->unk_78 = 0;
    this->unk_7e = 1;
    ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk0a = 0x200;
}

static void sub_08042A88(VaatiArmEntity* this) {
    VaatiArm_HeapStruct1* pVVar4;

    pVVar4 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
    if (gUnk_080D12C8[super->type2] != pVVar4->unk00.HALF.HI) {
        if (gUnk_080D12C8[super->type2] < pVVar4->unk00.HALF.HI) {
            pVVar4->unk00.HWORD -= 0x100;
        } else {
            pVVar4->unk00.HWORD += 0x100;
        }
    }
    if (pVVar4->unk0a < pVVar4->unk04.HWORD) {
        pVVar4->unk04.HWORD -= pVVar4->unk0a;
    } else {
        pVVar4->unk04.HWORD = 0;
        pVVar4->unk08 = gUnk_080D12CA[super->type2];
        super->subAction = 2;
        super->timer = 30;
    }
}

static void sub_08042AEC(VaatiArmEntity* this) {
    if (--super->timer == 0) {
        super->subAction = 3;
        super->timer = 4;
        super->hitType = 0x3d;
        InitAnimationForceUpdate(super, 0xe);
        ((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base.hitType = 0x3d;
    }
}

static void sub_08042B20(VaatiArmEntity* this) {
    VaatiArm_HeapStruct1* ptr;
    Entity* object;
    Entity* entity;
    u32 i;

    ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
    if (ptr->unk04.HALF.HI < 0x7b) {
        ptr->unk04.HWORD += 0x500;
    } else {
        ptr->unk04.HALF.HI = 0x80;
    }
    if (0x30 < ptr->unk04.HALF.HI) {
        ptr->unk00.HWORD += ptr->unk08;
    }
    if (((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base.spriteSettings.draw) {
        sub_08043C40(this, ptr);
        for (i = 0; i < 4; i++) {
            entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base;
            if ((-0xa <= entity->z.HALF.HI) && ((entity->spriteSettings.draw) == 1)) {
                if (i == 0) {
                    object = CreateObject(VAATI3_ARM, 0, 0);
                    if (object != NULL) {
                        object->parent = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base;
                    }
                    *(Entity**)&((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->unk_68 = object;
                    object = CreateObject(VAATI3_ARM, 2, 0);
                    if (object != NULL) {
                        CopyPosition(&((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base, object);
                    }
                }
                entity->flags &= ~ENT_COLLIDE;
                entity->spriteSettings.draw = 0;
                SoundReq(SFX_161);
            }
        }
    } else {
        this->unk_78 += 2;
        if (--super->timer == 0) {
            super->action = 5;
            super->subAction = 0;
            super->timer = 30;
            super->hitType = 0x39;
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base.hitType = 0x39;
        }
    }
}

static void sub_08042C14(VaatiArmEntity* this) {
    gUnk_080D12D0[super->subAction](this);
    sub_08043A78(this);
}

static void sub_08042C34(VaatiArmEntity* this) {
    u32 random;
    int y;
    u32 i;
    Entity* entity;
    int x;
    const s8* temp;

    VaatiArm_HeapStruct1* ptr;

    if (--super->timer == 0) {
        super->timer = 60;
        super->subtimer = 3;
        super->subAction = 1;
        random = Random() & 6;
        temp = &gUnk_080D12F8[random];
        x = gPlayerEntity.base.x.HALF.HI + *temp;
        y = gPlayerEntity.base.y.HALF.HI + *(temp + 1);
        if ((gRoomControls.origin_x + 0x20) > x) {
            x = gRoomControls.origin_x + 0x20;
        }
        if (gRoomControls.origin_x + gRoomControls.width + -0x20 < x) {
            x = gRoomControls.origin_x + gRoomControls.width + -0x20;
        }
        if ((gRoomControls.origin_y + 0x20) > y) {
            y = gRoomControls.origin_y + 0x20;
        }
#if defined EU || defined JP || defined DEMO_JP
        if (gRoomControls.origin_y + gRoomControls.height + -0x20 < y) {
            y = gRoomControls.origin_y + gRoomControls.height + -0x20;
        }
#else
        if (gRoomControls.origin_y + gRoomControls.height + -0x40 < y) {
            y = gRoomControls.origin_y + gRoomControls.height + -0x40;
        }
#endif
        if (((u32)((x - gRoomControls.origin_x) - 0x90) < 0x41) && ((u32)((y - gRoomControls.origin_y) - 8) < 0x41)) {
            x = gRoomControls.origin_x + 0xb0;
            y = gRoomControls.origin_y + 0x40;
        }
        for (i = 0; i < 4; i++) {
            entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base;
            entity->x.HALF.HI = x;
            entity->y.HALF.HI = y;
            entity->z.HALF.HI = 0x32;
            entity->hitType = 0x39;
            ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i];
            ptr->unk00.HWORD = 0x80;
            ptr->unk04.HWORD = 0;
            ptr->unk0c = gUnk_080D1419[i];
            if (i != 0) {
                InitializeAnimation(entity, 0x12);
            }
        }
    }
}

static void sub_08042D24(VaatiArmEntity* this) {
    Entity* entity;

    if (--super->timer == 0) {
        super->subAction = 2;
        super->hitType = 0x3d;
        ((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base.hitType = 0x3d;
        entity = CreateObject(VAATI3_ARM, 1, 0);
        if (entity != NULL) {
            entity->parent = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base;
        }
        *(Entity**)&this->unk_68 = entity;
        InitAnimationForceUpdate(super, 0xd);
    }
}

static void sub_08042D6C(VaatiArmEntity* this) {
    Entity* object;
    Entity* entity;
    u32 i;

    for (i = 0; i < 4; i++) {
        entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base;
        if (entity->z.HALF.HI < 4) {
            if (i != 2) {
                entity->flags = entity->flags | ENT_COLLIDE;
            }
            if ((entity->spriteSettings.draw == 0u) && (object = CreateObject(VAATI3_ARM, 2, 0), object != NULL)) {
                CopyPosition(entity, object);
                SoundReq(SFX_166);
            }
            entity->spriteSettings.draw = 1;
        }
    }
    entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base;
    if (entity->z.HALF.HI <= -3) {
        entity->z.HALF.HI = -5;
        ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk08 = gUnk_080D1300[super->type2];
        ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk0a = 0xc0;
        super->subAction = 3;
        super->timer = 30;
        super->hitType = 0x39;
        this->unk_7f = 0x2d;
        InitAnimationForceUpdate(super, 0);
        ((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base.hitType = 0x39;
    } else {
        entity->z.HALF.HI -= 2;
    }
}

static void sub_08042E30(VaatiArmEntity* this) {
    short sVar3;
    u32 uVar6;
    VaatiArm_HeapStruct1* pVVar9;

    if (this->unk_7f == 0) {
        if (sub_08043C98(this)) {
            return;
        }
    } else {
        this->unk_7f--;
    }
    pVVar9 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
    if (--super->timer == 0) {
        super->subAction = 4;
        super->timer = (Random() & 0x38) + 40;
        super->speed = 0x200;
        super->direction = pVVar9->unk00.HALF.HI >> 3;
        uVar6 = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, gRoomControls.origin_x + 0x110,
                                     gRoomControls.origin_y + 0x60);
        this->unk_79 = (gUnk_080D1304[Random() & 7] + uVar6) & 0x1f;
    }
    pVVar9->unk00.HWORD += pVVar9->unk08;
    pVVar9->unk04.HWORD += pVVar9->unk0a;
    if (pVVar9->unk0a >= 1) {
        if (pVVar9->unk04.HALF.HI >= 0x19) {
            sVar3 = pVVar9->unk0a;
            pVVar9->unk0a = -sVar3;
        }
    } else {
        if (3 >= pVVar9->unk04.HALF.HI) {
            sVar3 = pVVar9->unk0a;
            pVVar9->unk0a = -sVar3;
        }
    }
    UpdateAnimationSingleFrame(super);
}

static void sub_08042EF4(VaatiArmEntity* this) {
    VaatiArm_HeapStruct1* ptr;
    Entity* entity;
    u32 temp;
    u32 x, y;

    UpdateAnimationSingleFrame(super);
    if (!sub_08043C98(this)) {
        if (--super->timer == 0) {
            if (EntityWithinDistance(super, gPlayerEntity.base.x.HALF.HI, gPlayerEntity.base.y.HALF.HI, 0x50)) {
                super->subAction = 6;
                super->timer = 40;
            } else {
                super->subAction = 5;
                InitAnimationForceUpdate(super, 0xf);
                SoundReq(SFX_19B);
            }
        }
        ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
        if (ptr->unk04.HALF.HI < 0x20) {
            ptr->unk04.HWORD += 0x100;
        }
        x = super->parent->x.HALF.HI;
        y = super->parent->y.HALF.HI - 0x10;
        if (EntityWithinDistance(super, x, y, 0x30)) {
            temp = CalculateDirectionTo(super->x.HALF.HI, super->y.HALF.HI, x, y);
            if ((this->unk_79 - temp) + 4 < 9) {
                this->unk_79 = temp ^ 0x10;
            }
        }
        if (this->unk_79 != super->direction) {
            sub_08004596(super, this->unk_79);
            ptr->unk00.HALF.HI = super->direction << 3;
        }
        entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base;
        entity->direction = super->direction;
        ProcessMovement0(entity);
    }
}

static void sub_08042FD8(VaatiArmEntity* this) {
    Entity* entity;

    UpdateAnimationSingleFrame(super);
    if (!sub_08043C98(this)) {
        if ((super->frame & 1) != 0) {
            entity = CreateProjectile(V3_HAND_PROJECTILE);
            if (entity != NULL) {
                CopyPosition(super, entity);
                entity->z.HALF.HI -= 0x18;
                super->frame = 0;
            }
        } else {
            if (super->frame & ANIM_DONE) {
                if (--super->subtimer == 0) {
                    super->subAction = 8;
                    super->timer = 60;
                } else {
                    super->subAction = 3;
                    super->timer = 60;
                    InitAnimationForceUpdate(super, 0);
                }
            }
        }
    }
}

static void sub_08043048(VaatiArmEntity* this) {
    VaatiArm_HeapStruct1* ptr;
    u32 i;

    if (!sub_08043C98(this)) {
        ptr = ((VaatiArm_HeapStruct*)super->myHeap)->s1;
        if (ptr[0].unk04.HALF.HI < 0x50) {
            ptr[0].unk04.HWORD += 0x200;
            if (0x4f < ptr[0].unk04.HALF.HI) {
                for (i = 0; i < 5; i++) {
                    ((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base.hitType = 0x3b;
                }
                SoundReq(SFX_153);
            }
        } else {
            ptr[0].unk00.HWORD += ptr[0].unk08 * 8;
            if (--super->timer == 0) {
                super->subAction = 7;
                for (i = 0; i < 5; i++) {
                    ((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base.hitType = 0x39;
                }
            }
        }
        sub_08043B9C(this);
    }
}

static void sub_080430D0(VaatiArmEntity* this) {
    VaatiArm_HeapStruct1* ptr;

    if (!sub_08043C98(this)) {
        ptr = ((VaatiArm_HeapStruct*)super->myHeap)->s1;
        ptr[0].unk00.HWORD += ptr[0].unk08;
        ptr[0].unk04.HWORD -= 0x100;
        if (ptr[0].unk04.HALF.HI < 0x18) {
            if (--super->subtimer == 0) {
                super->subAction = 8;
                super->timer = 60;
            } else {
                super->subAction = 3;
                super->timer = 60;
                ptr[0].unk0a = -0xc0;
                InitAnimationForceUpdate(super, 0);
            }
        }
    }
}

static void sub_08043130(VaatiArmEntity* this) {
    VaatiArm_HeapStruct1* ptr;
    Entity* entity;
    u32 i;

    ptr = ((VaatiArm_HeapStruct*)super->myHeap)->s1;
    if (ptr[0].unk04.HALF.HI != 0) {
        if (!sub_08043C98(this)) {
            if (--ptr[0].unk04.HALF.HI == 0) {
                InitAnimationForceUpdate(super, 0xd);
            }
        }
    } else {
        if (super->timer != 0) {
            super->timer--;
            for (i = 1; i < 4; i++) {
                ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i];
                if (ptr->unk04.HALF.HI != 0) {
                    ptr->unk04.HALF.HI--;
                }
            }
        } else {
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base.z.HALF.HI += 3;
            for (i = 0; i < 4; i++) {
                entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base;
                if (entity->z.HALF.HI > -4) {
                    entity->flags = entity->flags & ~ENT_COLLIDE;
                    if (entity->spriteSettings.draw == 1) {
                        SoundReq(SFX_161);
                    }
                    entity->spriteSettings.draw = 0;
                }
            }
            if (super->spriteSettings.draw == 0) {
                super->subAction = 9;
                super->timer = 60;
                EnemyDetachFX(super);
            }
        }
    }
}

static void sub_080431E8(VaatiArmEntity* this) {
    u32 i;
    VaatiArm_HeapStruct1* ptr;

    if (--super->timer == 0) {
        super->action = 6;
        super->subAction = 0;
        for (i = 0; i < 4; i++) {
            ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i];
            ptr->unk00.HWORD = gUnk_080D130C[super->type2];
            ptr->unk04.HWORD = 0x8000;
            ptr->unk0c = gUnk_080D1414[i];
            if (i == 3) {
                InitializeAnimation(&((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base, 0x11);
            }
        }
        ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk08 = gUnk_080D1310[super->type2];
        InitAnimationForceUpdate(super, 0xe);
    }
}

static void sub_0804325C(VaatiArmEntity* this) {
    Entity* entity;

    sub_08043CD4(this);
    gUnk_080D1314[super->subAction](this);
    sub_08043A10(this);
    if (this->unk_78 != 0) {
        if (this->unk_78 >= 3) {
            this->unk_78 -= 2;
            entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base;
            entity->z.HALF.HI += this->unk_78;
        } else {
            this->unk_78 = 0;
        }
    }
}

void sub_080432A8(VaatiArmEntity* this) {
    s32 iVar3;
    s32 i;
    VaatiArm_HeapStruct1* hs;
    Entity* entity;
    i = 3;
    iVar3 = 0;

    for (; i >= 0; i--) {
        hs = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i];
        if (hs->unk0c > 2) {
            hs->unk0c--;
            if (++iVar3 > 1) {
                break;
            }
        }
    }

    hs = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
    hs->unk04.HALF.HI -= 2;

    for (i = 0; i < 4; i++) {
        entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base;
        if (entity->z.HALF.HI < 4) {
            COLLISION_ON(entity);
            entity->spriteSettings.draw = 1;
        }
    }

    if ((((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.spriteSettings.draw == 1) &&
        (((VaatiArm_HeapStruct*)super->myHeap)->s1[1].unk0c < 3)) {
        super->subAction = 1;
        super->timer = 0x1e;
        ((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk04.HWORD = 0x4000;
        EnemyDetachFX(&((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base);
    }
}

void sub_0804334C(VaatiArmEntity* this) {
    u32 bVar1;
    Entity* entity;
    u32 i;
    VaatiArm_HeapStruct1* ptr;

    if (super->timer != 0) {
        if (--super->timer != 0) {
            return;
        }
        for (i = 0; i < 5; i++) {
            entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base;
            COLLISION_ON(entity);
            entity->spriteSettings.draw = 1;
        }
    }
    ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
    if (gUnk_080D131C[super->type2] - ptr->unk00.HALF.HI + 1 > 2u) {
        ptr->unk00.HWORD += ptr->unk08;
        bVar1 = 0;
    } else {
        bVar1 = 1;
    }
    sub_08043B9C(this);
    for (i = 0; i < 5; i++) {
        ptr = &(((VaatiArm_HeapStruct*)super->myHeap)->s1)[i];

        if (gUnk_080D1414[i] > ptr->unk0c) {
            if (gUnk_080D1414[i] == ++ptr->unk0c) {
                SoundReq(SFX_15E);
            }
            return;
        }
        if ((bVar1) && (i == 4)) {
            sub_08043BC8(this);
            InitAnimationForceUpdate(super, 7);
            if (this->unk_7e != 0) {
                this->unk_7e = 0;
                ((VaatiArm_HeapStruct*)super->myHeap)->parent->subAction = 2;
            }
        }
    }
}

static void sub_08043420(VaatiArmEntity* this) {
    gUnk_080D1320[super->subAction](this);
    sub_08043ABC(this);
}

static void sub_08043440(VaatiArmEntity* this) {
    u32 i;
    int iVar4;
    u8* ptr;
    int offset;
    int zero;

    i = 0;
    iVar4 = 0;
    zero = 0;
    offset = 0x18;
    do {
        ptr = ((u8*)super->myHeap) + offset;
        if (ptr[5] >= 0x11) {
            ptr[5] -= 0x10;
            iVar4++;
        } else {
            ((u16*)ptr)[2] = zero;
        }
        offset += 0x10;
        i++;
    } while (i < 5);
    if (iVar4 == 0) {
        i = 0;
        do {
            ((VaatiArm_HeapStruct*)super->myHeap)->s1[i].unk00.HWORD = 0x8000;
            i++;
        } while (i < 5);
        super->subAction = 1;
        InitAnimationForceUpdate(super, 0x10);
    }
}

static void sub_08043490(VaatiArmEntity* this) {
    Entity* entity;
    Entity* entity2;
    Entity* entity3;

    entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base;
    if (entity->z.HALF.HI < -4) {
        entity->zVelocity = Q_16_16(1.5);
        super->subAction = 2;
        this->unk_7e = 0;
        ((VaatiArm_HeapStruct*)super->myHeap)->parent->subAction = 2;
    } else {
        entity->z.HALF.HI -= 2;
        if (entity->z.HALF.HI < 0) {
            entity->flags = entity->flags | ENT_COLLIDE;
            entity->spriteSettings.draw = 1;
            entity->collisionFlags = entity->collisionFlags & 0xef;
            entity->hitType = 0x3a;
            entity->hitbox = (Hitbox*)&gUnk_080FD450;
            entity2 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[2]->base;
            entity2->flags = entity2->flags | ENT_COLLIDE;
            entity3 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base;
            entity3->flags = entity3->flags & ~ENT_COLLIDE;
        }
    }
    UpdateAnimationSingleFrame(super);
}

static void sub_08043520(VaatiArmEntity* this) {
    Entity* entity;

    entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base;
    GravityUpdate(entity, Q_8_8(26.0));
    if ((entity->zVelocity < 0) && (-6 < entity->z.HALF.HI)) {
        entity->z.HALF.HI = -6;
        super->subAction = 3;
        this->unk_7a = 900;
    }
}

static void sub_0804355C(VaatiArmEntity* this) {
    sub_08043DB0(this);
    if (--this->unk_7a == 0) {
        super->subAction = 4;
    }
    UpdateAnimationSingleFrame(super);
}

static void sub_08043580(VaatiArmEntity* this) {
    Entity* entity;
    u32 i;

    ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.z.HALF.HI += 3;
    for (i = 0; i < 5; i++) {
        entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base;
        if (-4 < entity->z.HALF.HI) {
            entity->flags = entity->flags & ~ENT_COLLIDE;
            entity->spriteSettings.draw = 0;
        }
    }
    if ((super->spriteSettings.draw & 3) == 0) {
        super->subAction = 5;
        super->timer = 60;
        entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base;
        entity->collisionFlags = entity->collisionFlags | 0x10;
        entity->hitType = 0x39;
        entity->hitbox = (Hitbox*)&gUnk_080FD538;
        EnemyDetachFX(super);
    }
}

static void sub_080435F4(VaatiArmEntity* this) {
    Entity* entity;
    u32 i;
    VaatiArm_HeapStruct1* ptr;

    if (--super->timer == 0) {
        super->action = 6;
        super->subAction = 1;
        super->timer = 1;
        for (i = 0; i < 5; i++) {
            ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i];
            ptr->unk00.HWORD = gUnk_080D1338[super->type2];
            ptr->unk04.HWORD = 0x4000;
            ptr->unk0c = 0;
            ptr->unk08 = gUnk_080D133C[super->type2];
            entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base;
            if (i == 0) {
                sub_08043B9C((VaatiArmEntity*)entity);
            } else {
                InitializeAnimation(entity, gUnk_080D1340[i]);
            }
        }
    }
}

static void sub_08043680(VaatiArmEntity* this) {
    gUnk_080D1348[super->subAction](this);
}

static void sub_08043698(VaatiArmEntity* this) {
    Entity* entity;
    u32 i;

    super->subAction = 1;
    super->timer = 60;
    for (i = 0; i < 5; i++) {
        entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base;
        entity->flags = entity->flags & ~ENT_COLLIDE;
    }
}

static inline void deleteThing(VaatiArmEntity* this, const u32 index) {
    if (--super->timer == 0) {
        super->timer = 20;
        super->subAction = index + 1;
        if (index == 1) {
            super->spriteSettings.draw = 0;
        }
        CreateFx(&((VaatiArm_HeapStruct*)super->myHeap)->entities[index]->base, FX_GIANT_EXPLOSION4, 0);
        ((VaatiArm_HeapStruct*)super->myHeap)->entities[index]->base.myHeap = NULL;
        DeleteEntity(&((VaatiArm_HeapStruct*)super->myHeap)->entities[index]->base);
    }
}

static void sub_080436C0(VaatiArmEntity* this) {
    deleteThing(this, 1);
}

static void sub_08043700(VaatiArmEntity* this) {
    deleteThing(this, 2);
}

static void sub_08043738(VaatiArmEntity* this) {
    deleteThing(this, 3);
}

static void sub_08043770(VaatiArmEntity* this) {
    Entity* entity;

    if (--super->timer == 0) {
        entity = ((VaatiArm_HeapStruct*)super->myHeap)->parent;
        if ((gRoomTransition.field_0x39 & 0xc) == 0) {
            entity->subAction = 2;
        }
        if (super->type2 == 0) {
            ((VaatiArm_HeapStruct*)entity->myHeap)->parent = NULL;
            gRoomTransition.field_0x39 &= 0xfe;
        } else {
            *(u32*)((VaatiArm_HeapStruct*)entity->myHeap)->s1 = 0;
            gRoomTransition.field_0x39 &= 0xfd;
        }
        ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.myHeap = NULL;
        ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.health = 0;
        (*(Entity**)&this->unk_68)->parent = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base;
        DeleteThisEntity();
    }
}

static u32 sub_080437DC(VaatiArmEntity* this) {
    u16 temp;
    VaatiArm_HeapStruct* heapStruct;
    Entity* entity;

    if (gEntCount >= 0x44)
        return 0;
    heapStruct = zMalloc(sizeof(VaatiArm_HeapStruct));
    if (heapStruct == NULL)
        return 0;
    super->spritePriority.b0 = 5;
    super->collisionFlags = super->collisionFlags | 0x10;
    super->myHeap = (u32*)heapStruct;
    heapStruct->entities[0] = this;
    entity = CreateEnemy(VAATI_ARM, 1);
    entity->spritePriority.b0 = 5;
    entity->collisionFlags = entity->collisionFlags | 0x10;
    entity->myHeap = (u32*)heapStruct;
    heapStruct->entities[1] = (VaatiArmEntity*)entity;
    CopyPosition(super, entity);
    entity = CreateEnemy(VAATI_ARM, 2);
    entity->spritePriority.b0 = 5;
    entity->collisionFlags = entity->collisionFlags | 0x10;
    entity->myHeap = (u32*)heapStruct;
    heapStruct->entities[2] = (VaatiArmEntity*)entity;
    CopyPosition(super, entity);
    entity = CreateEnemy(VAATI_ARM, 3);
    entity->spritePriority.b0 = 5;
    entity->collisionFlags = entity->collisionFlags | 0x10;
    entity->myHeap = (u32*)heapStruct;
    heapStruct->entities[3] = (VaatiArmEntity*)entity;
    CopyPosition(super, entity);
    entity = CreateEnemy(VAATI_ARM, 4);
    entity->spritePriority.b0 = 5;
    entity->collisionFlags = entity->collisionFlags | 0x10;
    entity->myHeap = (u32*)heapStruct;
    heapStruct->entities[4] = (VaatiArmEntity*)entity;
    CopyPosition(super, entity);
    heapStruct->parent = super->parent;
    temp = gUnk_080D135C[super->type2];
    heapStruct->s1[0].unk00.HWORD = temp;
    heapStruct->s1[0].unk04.HWORD = 0x4000;
    heapStruct->s1[0].unk0c = 0;
    heapStruct->s1[1].unk00.HWORD = temp;
    heapStruct->s1[1].unk04.HWORD = 0x4000;
    heapStruct->s1[1].unk0c = 0;
    heapStruct->s1[2].unk00.HWORD = temp;
    heapStruct->s1[2].unk04.HWORD = 0x4000;
    heapStruct->s1[2].unk0c = 0;
    heapStruct->s1[3].unk00.HWORD = temp;
    heapStruct->s1[3].unk04.HWORD = 0x4000;
    heapStruct->s1[3].unk0c = 0;
    heapStruct->s1[4].unk00.HWORD = temp;
    heapStruct->s1[4].unk04.HWORD = 0x4000;
    heapStruct->s1[4].unk0c = 0;
    return 1;
}

void sub_0804393C(VaatiArmEntity* this) {
    s32 uVar1;
    s32 uVar2;
    s32 uVar6;
    s32 iVar7;
    VaatiArm_HeapStruct1* hs;
    VaatiArmEntity* entity;

    entity = (VaatiArmEntity*)((VaatiArm_HeapStruct*)super->myHeap)->entities[0];
    if (entity->unk_7c != 0 && entity->unk_7d <= super->type) {
        uVar2 = gUnk_080D1362[super->type * 16 + ((entity->unk_7c >> 3) & 0xf)];
    } else {
        uVar2 = 0;
    }
    hs = &((VaatiArm_HeapStruct*)super->myHeap)->s1[super->type];
    uVar2 = (uVar2 + hs->unk0c) << 8;
    uVar1 = -gSineTable[hs->unk04.HALF.HI + 0x40] * uVar2;
    uVar2 = (gSineTable[hs->unk04.HALF.HI & 0x7f] * uVar2) / 0x100;
    uVar6 = gSineTable[hs->unk00.HALF.HI] * uVar2;
    iVar7 = -gSineTable[hs->unk00.HALF.HI + 0x40] * uVar2;
    PositionRelative(&((VaatiArm_HeapStruct*)super->myHeap)->entities[super->type + 1]->base, super, uVar6, iVar7);
    super->z.WORD += uVar1;
    super->spriteOffsetY = ((VaatiArm_HeapStruct*)super->myHeap)->entities[super->type + 1]->base.spriteOffsetY;
}

static void sub_08043A10(VaatiArmEntity* this) {
    sub_08043B7C(this);
    sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[4]);
    ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.y.HALF.HI -= 8;
    ((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base.z.HALF.HI -= 8;
    sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[3]);
    sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[2]);
    sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[1]);
    sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[0]);
    ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.y.HALF.HI++;
    ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.spriteOffsetY--;
    if (this->unk_7c != 0) {
        this->unk_7c--;
    }
}

static void sub_08043A78(VaatiArmEntity* this) {
    this->unk_7c = 0;
    sub_08043B7C(this);
    sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[2]);
    sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[1]);
    sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[0]);
    ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.y.HALF.HI++;
    ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.spriteOffsetY--;
}

static void sub_08043ABC(VaatiArmEntity* this) {
    this->unk_7c = 0;
    sub_08043B7C(this);
    sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[3]);
    sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[2]);
    sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[1]);
    sub_0804393C(((VaatiArm_HeapStruct*)super->myHeap)->entities[0]);
    ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.y.HALF.HI++;
    ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.spriteOffsetY--;
}

void sub_08043B08(VaatiArmEntity* this) {
    VaatiArm_HeapStruct1* hs1;
    VaatiArm_HeapStruct1* hs2;
    u32 bVar1;
    s32 uVar6;

    hs1 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[super->type - 1];
    hs2 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[super->type];
    bVar1 = gUnk_080D13B2[super->type];
    if (((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.type2 == 0) {
        uVar6 = (s8)((hs1->unk00.HALF.HI - hs2->unk00.HALF.HI));
        if (bVar1 < uVar6) {
            if (uVar6 <= 0) {
                hs2->unk00.HALF.HI = hs1->unk00.HALF.HI;
            } else {
                hs2->unk00.HALF.HI = hs1->unk00.HALF.HI - bVar1;
            }
        }
    } else {
        uVar6 = (s8)(hs2->unk00.HALF.HI - hs1->unk00.HALF.HI);
        if (bVar1 < uVar6) {
            if (uVar6 < 0) {
                hs2->unk00.HALF.HI = hs1->unk00.HALF.HI;
            } else {
                hs2->unk00.HALF.HI = hs1->unk00.HALF.HI + bVar1;
            }
        }
    }

    uVar6 = hs1->unk04.HALF.HI - hs2->unk04.HALF.HI;
    if ((bVar1 << 1) < uVar6 + bVar1) {
        if (uVar6 > 0) {
            hs2->unk04.HALF.HI = hs1->unk04.HALF.HI - bVar1;
        } else {
            hs2->unk04.HALF.HI = hs1->unk04.HALF.HI + bVar1;
        }
    }
}

static void sub_08043B7C(VaatiArmEntity* this) {
    sub_08043B08(((VaatiArm_HeapStruct*)super->myHeap)->entities[1]);
    sub_08043B08(((VaatiArm_HeapStruct*)super->myHeap)->entities[2]);
    sub_08043B08(((VaatiArm_HeapStruct*)super->myHeap)->entities[3]);
}

static void sub_08043B9C(VaatiArmEntity* this) {
    u32 index = ((((VaatiArm_HeapStruct*)super->myHeap)->s1[0].unk00.HALF.HI + 4) & 0xff) >> 3;
    if (gUnk_080D13B7[index] != super->frameIndex - 1) {
        InitAnimationForceUpdate(super, gUnk_080D13B7[index]);
    }
}

static void sub_08043BC8(VaatiArmEntity* this) {
    VaatiArm_HeapStruct1* pVVar2;
    const Coords* ptr;

    super->action = 2;
    ptr = &gUnk_080D13D8[super->type2];
    pVVar2 = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
    pVVar2->unk08 = ptr->HALF.x;
    pVVar2->unk0a = ptr->HALF.y;
    pVVar2->unk0d = 0x5a;
    pVVar2->unk0e = 0x28;
}

static void sub_08043BF0(VaatiArmEntity* this) {
    u8 bVar1;
    u32 uVar2;
    VaatiArm_HeapStruct1* ptr;

    ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[0];
    if (super->type2 == 0) {
        bVar1 = ptr->unk00.HALF.HI;
        uVar2 = 6;
        if (((0x2f < bVar1) && (uVar2 = 7, 0x5f < bVar1)) && (uVar2 = 9, bVar1 < 0x90)) {
            uVar2 = 8;
        }
    } else {
        bVar1 = ptr->unk00.HALF.HI;
        uVar2 = 8;
        if (((bVar1 < 0xd1) && (uVar2 = 7, bVar1 < 0xa1)) && (uVar2 = 5, 0x70 < bVar1)) {
            uVar2 = 6;
        }
    }
    if (super->animIndex != uVar2) {
        InitAnimationForceUpdate(super, uVar2);
    }
}

static void sub_08043C40(VaatiArmEntity* this, VaatiArm_HeapStruct1* heapStruct) {
    u8* iVar3;
    int offset;
    const u8* puVar6;
    u32 i;

    if (heapStruct->unk04.HALF.HI < 0x20) {
        puVar6 = gUnk_080D13E0;
    } else {
        if (heapStruct->unk04.HALF.HI < 0x30) {
            puVar6 = gUnk_080D13E3;
        } else {
            if (heapStruct->unk04.HALF.HI < 0x78) {
                puVar6 = &gUnk_080D13E0[6];
            } else {
                puVar6 = gUnk_080D13E0;
            }
        }
    }
    for (i = 0, offset = 0x28; i < 3; offset += 0x10, i++) {
        iVar3 = (u8*)(int)((VaatiArm_HeapStruct*)super->myHeap) + offset;
        if (puVar6[i] != iVar3[0xc]) {
            if (puVar6[i] < iVar3[0xc]) {
                iVar3[0xc]--;
            } else {
                iVar3[0xc]++;
            }
        }
    }
}

static bool32 sub_08043C98(VaatiArmEntity* this) {
#if defined EU || defined JP
    Entity* e1 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base;
    if ((e1->contactFlags == (CONTACT_NOW | 0x1d))) {
        sub_08043D08(this);
        return TRUE;
    } else {
        return FALSE;
    }
#else
    Entity* e1 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[2]->base;
    Entity* e2 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base;
    if ((e1->contactFlags == (CONTACT_NOW | 0x1d)) || (e2->contactFlags == (CONTACT_NOW | 0x1d))) {
        sub_08043D08(this);
        gRoomTransition.field_0x38 |= 2;
        return TRUE;
    } else {
        return FALSE;
    }
#endif
}

static void sub_08043CD4(VaatiArmEntity* this) {
    u32 i;
    for (i = 0; i < 5; i++) {
        if (((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base.contactFlags == (CONTACT_NOW | 0x1d)) {
            this->unk_7c = 0x78;
            this->unk_7d = i;
            return;
        }
    }
}

static void sub_08043D08(VaatiArmEntity* this) {
    Entity* entity;
    Entity* fx;
    u32 i;

    super->action = 7;
    super->subAction = 0;
    InitAnimationForceUpdate(super, 0xd);
    entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base;
    entity->flags &= ~ENT_COLLIDE;
    entity->spriteSettings.draw = 0;
    InitializeAnimation(entity, 0x13);
    EnemyDetachFX(entity);
    fx = CreateFx(entity, FX_GIANT_EXPLOSION4, 0);
    if (fx != NULL) {
        fx->x.HALF.HI += gUnk_080D13E9[super->type2];
        fx->y.HALF.HI -= 6;
        fx->spritePriority.b0 = 3;
    }
    CopyPosition(&((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base, entity);
    entity->z.HALF.HI += ((VaatiArm_HeapStruct*)super->myHeap)->s1[3].unk0c;
    for (i = 0; i < 5; i++) {
        ((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base.hitType = 0x39;
    }
    EnqueueSFX(SFX_HIT);
}

static void sub_08043DB0(VaatiArmEntity* this) {
    s32 cVar1;
    Entity* pEVar2;
    Entity* pEVar3;
    Entity* pEVar4;

    if (((gPlayerState.flags & PL_MINISH) != 0)) {
        pEVar3 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base;
        if (CheckPlayerInRegion(pEVar3->x.HALF.HI - gRoomControls.origin_x,
                                pEVar3->y.HALF.HI - gRoomControls.origin_y + 2, 3, 3)) {
            DoExitTransition(&gUnk_080D13EC);
            if ((gRoomTransition.field_0x39 & 3) != 3) {
                gRoomTransition.player_status.room_next = 1;
            }
            cVar1 = this->unk_7a;
            gRoomTransition.field_0x3d = 0x1e - (cVar1 / 0x3c);
            gRoomTransition.field_0x3c = super->type2;
            pEVar2 = ((VaatiArm_HeapStruct*)super->myHeap)->parent;
            gRoomTransition.field_0x40 = pEVar2->x.HALF.HI;
            gRoomTransition.field_0x42 = pEVar2->y.HALF.HI;
            pEVar4 = ((VaatiArm_HeapStruct*)pEVar2->myHeap)->parent;
            if (pEVar4 != NULL) {
                gRoomTransition.field_0x44 = pEVar4->x.HALF.HI;
                gRoomTransition.field_0x46 = pEVar4->y.HALF.HI;
            } else {
                gRoomTransition.field_0x44 = gRoomControls.origin_x + 0x110;
                gRoomTransition.field_0x46 = gRoomControls.origin_y + 0x60;
            }
            pEVar4 = (Entity*)(*(int*)((VaatiArm_HeapStruct*)pEVar2->myHeap)->s1);
            if (pEVar4 != NULL) {
                gRoomTransition.field_0x48 = pEVar4->x.HALF.HI;
                gRoomTransition.field_0x4a = pEVar4->y.HALF.HI;
            } else {
                gRoomTransition.field_0x48 = gRoomControls.origin_x + 0x110;
                gRoomTransition.field_0x4a = gRoomControls.origin_y + 0x60;
            }
        }
    }
}

static void sub_08043EB8(VaatiArmEntity* this) {
    u32 i;
    Entity* pEVar4;
    VaatiArm_HeapStruct1* ptr;

    COLLISION_ON(super);
    super->spritePriority.b0 = 4;
    InitAnimationForceUpdate(super, 0xd);
    pEVar4 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[1]->base;
    pEVar4->flags = pEVar4->flags | ENT_COLLIDE;
    pEVar4->spritePriority.b0 = 4;
    pEVar4 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[2]->base;
    pEVar4->flags = pEVar4->flags | ENT_COLLIDE;
    pEVar4->spritePriority.b0 = 4;
    pEVar4 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base;
    pEVar4->flags = pEVar4->flags & ~ENT_COLLIDE;
    pEVar4->spriteSettings.draw = 1;
    pEVar4->spritePriority.b0 = 4;
    pEVar4 = &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base;
    pEVar4->flags = pEVar4->flags | ENT_COLLIDE;
    pEVar4->spriteSettings.draw = 1;
    pEVar4->spritePriority.b0 = 4;
    pEVar4->x.HALF.HI = (super->type2 == 0) ? gRoomTransition.field_0x44 : gRoomTransition.field_0x48;
    pEVar4->y.HALF.HI = (super->type2 == 0) ? gRoomTransition.field_0x46 : gRoomTransition.field_0x4a;
    pEVar4->z.HALF.HI = 0;
    pEVar4->collisionFlags = pEVar4->collisionFlags & 0xef;
    pEVar4->hitType = 0x3a;
    pEVar4->hitbox = (Hitbox*)&gUnk_080FD450;
    pEVar4 = CreateObject(VAATI3_ARM, 0, 0);
    if (pEVar4 != NULL) {
        pEVar4->parent = &((VaatiArm_HeapStruct*)super->myHeap)->entities[3]->base;
    }
    *(Entity**)&((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->unk_68 = pEVar4;
    for (i = 0; i < 5; i++) {
        ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i];
        ptr->unk00.HWORD = 0x8000;
        ptr->unk04.HWORD = 0;
        ptr->unk0c = gUnk_080D1419[i];
    }
}

void sub_08044000(VaatiArmEntity* this) {
    Entity* entity;
    u32 i;
    VaatiArm_HeapStruct1* ptr;
    const u16* ptr2;

    ptr2 = gUnk_080D1400[super->type2];
    for (i = 0; i < 5; i++) {
        entity = &((VaatiArm_HeapStruct*)super->myHeap)->entities[i]->base;
        entity->flags = entity->flags | 0x80;
        entity->spritePriority.b0 = 4;
        ptr = &((VaatiArm_HeapStruct*)super->myHeap)->s1[i];
        ptr->unk00.HWORD = ptr2[i];
        ptr->unk04.HWORD = 0x4000;
        ptr->unk0c = gUnk_080D1414[i];
    }
    InitAnimationForceUpdate(super, 7);
    CopyPosition(((VaatiArm_HeapStruct*)super->myHeap)->parent,
                 &((VaatiArm_HeapStruct*)super->myHeap)->entities[4]->base);
}

static void sub_08044078(VaatiArmEntity* this) {
    if (super->action == 0) {
        super->action = 1;
        if (super->type != 3 ||
            !(((gRoomTransition.field_0x38 & 1) == 0 ||
               (((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.type2 != gRoomTransition.field_0x3c)))) {
            InitializeAnimation(super, 0x12);
        } else {
            InitializeAnimation(super, 0x11);
        }
    }
    GetNextFrame(super);
}

static void sub_080440CC(VaatiArmEntity* this) {
    if (super->action == 0) {
        super->action = 1;
        if ((gRoomTransition.field_0x38 & 1) != 0 &&
            ((VaatiArm_HeapStruct*)super->myHeap)->entities[0]->base.type2 == gRoomTransition.field_0x3c) {
            InitializeAnimation(super, 0x13);
        } else {
            InitializeAnimation(super, 0x11);
        }
    }
    GetNextFrame(super);
}