diff options
author | Astatin <[email protected]> | 2025-04-29 09:27:37 +0200 |
---|---|---|
committer | Astatin <[email protected]> | 2025-04-29 09:27:37 +0200 |
commit | fb689cdc68b8d1da3d988da43671bd0ddb063e88 (patch) | |
tree | 25a93ebea1809c814e3780bc9b3d8dd092522683 /entity/utils.gbasm | |
parent | a846ccc0cc20fe49b5ee07e252b370dc005b38cd (diff) |
add earcopter + freeze as learned items + fix collision after item pick up
Diffstat (limited to 'entity/utils.gbasm')
-rw-r--r-- | entity/utils.gbasm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/entity/utils.gbasm b/entity/utils.gbasm index 8394f9f..592b473 100644 --- a/entity/utils.gbasm +++ b/entity/utils.gbasm @@ -106,3 +106,42 @@ Entity_idx_to_entity_list_ptr: ; loaded idx in A, return in BC POP DE RET + +Spawn_object: ; Texture in D, XY in BC, jump table thingy in E + CALL =RNG_Step + AND $03 + CP $00 + JR NZ, =.skip_spawn_loot + PUSH HL + CALL =Find_Free_Object_slot + LD A, $80 + CP L + JR Z, =.skip_spawn_loot_pop_hl + + LD A, D + LD (HL+), A + LD A, B + LD (HL+), A + LD A, C + LD (HL+), A + CALL =Check_other_object_collision + CP $00 + JR NZ, =.skip_spawn_loot_pop_hl + LD A, L + AND $f8 + ADD $03 + LD L, A + LD (HL), E + + ; set the object load counter to the object so it doesn't take 16 frames to load it + LD A, L + SRA A + SRA A + SRA A + SUB $01 + LD $mem_object_load_counter, A + + .skip_spawn_loot_pop_hl: + POP HL + .skip_spawn_loot: + RET |