$80:8248

From ZAMN Hacking
Revision as of 18:39, 22 June 2024 by Piranhaplant (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
ROM address data
Length 0x16
Type Code
Name createPlayerEntity
Description Creates an entity for a player
Arguments/Return value Y+A = [pointer32] Entity pointer
Returns 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.