$80:8248: Difference between revisions

From ZAMN Hacking
Content added Content deleted
(Created page with "{{Infobox ROM address|length=0x16|type=Code|name=createPlayerEntity|description=Creates an entity for a player|args=Y+A = Entity pointer|ret_type=RTL}} This is the same as $80:825E, but with the following differences: * Searches entity slots in forward order instead of reverse. This will guarantee that the two player entities are in the first two slots. ** This was possibly meant to guarantee player entities get assigned a direct page with a zero low byte for fa...")
 
No edit summary
Line 1: Line 1:
{{Infobox ROM address|length=0x16|type=Code|name=createPlayerEntity|description=Creates an [[entity]] for a player|args=Y+A = Entity pointer|ret_type=RTL}}
{{Infobox ROM address|length=0x16|type=Code|name=createPlayerEntity|description=Creates an [[entity]] for a player|args=Y+A = [pointer32] Entity pointer<br/>Return A = [unit16] Entity ID|ret_type=RTL}}


This is the same as [[$80:825E]], but with the following differences:
This is the same as [[$80:825E]], but with the following differences:

Revision as of 16:04, 15 June 2024

ROM address data
Length 0x16
Type Code
Name createPlayerEntity
Description Creates an entity for a player
Arguments/Return value Y+A = [pointer32] Entity pointer
Return A = [unit16] Entity ID
Return type RTL

This is the same as $80:825E, but with the following differences:

  • Searches entity slots in forward order instead of reverse. This will guarantee that the two player entities are in the first two slots.
    • This was possibly meant to guarantee player entities get assigned a direct page with a zero low byte for faster RAM access, but for some reason the second player entity has 0x280 for its direct page.
  • Only searches for an empty entity in the first 0x10 slots (out of 0x18 total slots). This shouldn't matter since this is only used for up to two player entities.