Merge branch 'master' into tilemap-docs

This commit is contained in:
octorock
2023-12-31 02:12:41 +01:00
549 changed files with 15821 additions and 15437 deletions
+19 -17
View File
@@ -1,6 +1,8 @@
.ifndef GUARD_ASM_MACROS_ENTITY_INC
.set GUARD_ASM_MACROS_ENTITY_INC, 1
.set DEFAULT_POOL, 0xF
.set ENTITY_TYPE_ENEMY, 0x3
.set ENTITY_TYPE_SIGN, 0x5
.set ENTITY_TYPE_OBJECT, 0x6
@@ -14,7 +16,7 @@
.macro object_minish_lilypad x, y, room_property, collision=0
.byte ENTITY_TYPE_OBJECT | ((\collision) << 4)
.byte 0x0F
.byte DEFAULT_POOL
.byte OBJECT_MINISH_LILYPAD
.byte 0x00
.byte \room_property
@@ -25,7 +27,7 @@
.macro object_item x, y, item, flag, collision=0
.byte ENTITY_TYPE_OBJECT | ((\collision) << 4)
.byte 0x0F
.byte DEFAULT_POOL
.byte OBJECT_ITEM
.byte \item
.byte 0x00
@@ -37,7 +39,7 @@
.macro enemy_octorok x, y, bound_x, bound_y, bound_tile_width, bound_tile_height, collision=0
.byte ENTITY_TYPE_ENEMY | ((\collision) << 4)
.byte 0x0F
.byte DEFAULT_POOL
.byte ENEMY_OCTOROK
.byte 0x00, 0x00, 0x00
.byte \bound_tile_width, \bound_tile_height
@@ -47,7 +49,7 @@
.macro enemy_chuchu x, y, bound_x, bound_y, bound_tile_width, bound_tile_height, collision=0
.byte ENTITY_TYPE_ENEMY | ((\collision) << 4)
.byte 0x0F
.byte DEFAULT_POOL
.byte ENEMY_CHUCHU
.byte 0x00, 0x00, 0x00
.byte \bound_tile_width, \bound_tile_height
@@ -57,16 +59,16 @@
.macro enemy_tree_item x, y, unknown, collision=0
.byte ENTITY_TYPE_ENEMY | ((\collision) << 4)
.byte 0x0F
.byte DEFAULT_POOL
.byte ENEMY_TREE_ITEM
.byte \unknown, 0x00, 0x00, 0x00, 0x00
.2byte \x, \y
.2byte 0x00, 0x00
.endm
.macro entity_raw type:req, subtype:req, collision=0, unknown:req, paramA=0, paramB=0, x=0, y=0, paramC=0
.macro entity_raw type:req, subtype:req, collision=0, pool:req, paramA=0, paramB=0, x=0, y=0, paramC=0
.byte \type | ((\collision) << 4)
.byte \unknown
.byte \pool
.byte \subtype
.byte \paramA
.4byte \paramB
@@ -91,24 +93,24 @@
.2byte \flag2
.endm
.macro manager subtype:req, collision=0, unknown=0xf, paramA=0, paramB=0, x=0, y=0, paramC=0
entity_raw type=9, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
.macro manager subtype:req, collision=0, pool=DEFAULT_POOL, paramA=0, paramB=0, x=0, y=0, paramC=0
entity_raw type=9, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
.endm
.macro object_raw subtype:req, collision=0, unknown=0xf, paramA=0, paramB=0, x=0, y=0, paramC=0
entity_raw type=6, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
.macro object_raw subtype:req, collision=0, pool=DEFAULT_POOL, paramA=0, paramB=0, x=0, y=0, paramC=0
entity_raw type=6, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
.endm
.macro enemy_raw subtype:req, collision=0, unknown=0xf, paramA=0, paramB=0, x=0, y=0, paramC=0
entity_raw type=3, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
.macro enemy_raw subtype:req, collision=0, pool=DEFAULT_POOL, paramA=0, paramB=0, x=0, y=0, paramC=0
entity_raw type=3, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
.endm
.macro npc_raw subtype:req, collision=0, unknown=0x4f, paramA=0, paramB=0, x=0, y=0, script:req
entity_raw type=7, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\script
.macro npc_raw subtype:req, collision=0, pool=0x4f, paramA=0, paramB=0, x=0, y=0, script:req
entity_raw type=7, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\script
.endm
.macro projectile_raw subtype:req, collision=0, unknown=0xf, paramA=0, paramB=0, x=0, y=0, paramC=0
entity_raw type=4, subtype=\subtype, collision=\collision, unknown=\unknown, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
.macro projectile_raw subtype:req, collision=0, pool=DEFAULT_POOL, paramA=0, paramB=0, x=0, y=0, paramC=0
entity_raw type=4, subtype=\subtype, collision=\collision, pool=\pool, paramA=\paramA, paramB=\paramB, x=\x, y=\y, paramC=\paramC
.endm
.macro entity_list_end
+25 -23
View File
@@ -10,41 +10,43 @@ CheckBits: @ 0x08000F10
ldr r3, _08000F50 @ =ram_CheckBits
bx r3
thumb_func_start sub_08000F14
sub_08000F14: @ 0x08000F14
// sum 3 drop probability vectors
thumb_func_start SumDropProbabilities
SumDropProbabilities: @ 0x08000F14
push {r4, r5, r6}
movs r4, #0x1e
movs r4, #30 // vector addition for 16 shorts in reverse
_08000F18:
ldrsh r5, [r1, r4]
ldrsh r6, [r2, r4]
adds r5, r5, r6
ldrsh r6, [r3, r4]
adds r5, r5, r6
strh r5, [r0, r4]
ldrsh r5, [r1, r4] // row 1
ldrsh r6, [r2, r4] // + row 2
adds r5, r6
ldrsh r6, [r3, r4] // + row 3
adds r5, r6
strh r5, [r0, r4] // store in output
subs r4, #2
bpl _08000F18
pop {r4, r5, r6}
bx lr
thumb_func_start sub_08000F2C
sub_08000F2C: @ 0x08000F2C
// sum 3 drop probabilities, clamp to 0, return scalar sum
thumb_func_start SumDropProbabilities2
SumDropProbabilities2: @ 0x08000F2C
push {r4, r5, r6, r7}
movs r4, #0x1e
movs r7, #0
movs r4, #30
movs r7, #0 // sum
_08000F32:
ldrsh r5, [r1, r4]
ldrsh r6, [r2, r4]
adds r5, r5, r6
ldrsh r6, [r3, r4]
adds r5, r5, r6
bpl _08000F40
ldrsh r5, [r1, r4] // row 1
ldrsh r6, [r2, r4] // + row 2
adds r5, r6
ldrsh r6, [r3, r4] // + row 3
adds r5, r6
bpl positive_drop_chance // clamp to 0
movs r5, #0
_08000F40:
strh r5, [r0, r4]
adds r7, r7, r5
positive_drop_chance:
strh r5, [r0, r4] // store in output
adds r7, r5
subs r4, #2
bpl _08000F32
adds r0, r7, #0
adds r0, r7, #0 // return sum
pop {r4, r5, r6, r7}
bx lr
.align 2, 0
+1 -1
View File
@@ -18,7 +18,7 @@ EnemyUpdate: @ 0x080011C4
bne _080011EA
bl DeleteThisEntity
_080011DC:
bl EntityIsDeleted
bl EntityDisabled
cmp r0, #0
bne _0800120A
adds r0, r4, #0
+1 -1
View File
@@ -18,7 +18,7 @@ ProjectileUpdate: @ 0x08016AE4
bne _08016B0A
bl DeleteThisEntity
_08016AFC:
bl EntityIsDeleted
bl EntityDisabled
cmp r0, #0
bne _08016B22
adds r0, r4, #0