[ARCHIVED] Design Flaws - pret/pokered GitHub Wiki

NOTICE: This document has not been vetted by the maintainers of the project and will be deleted in the future.


Design Flaws

These are parts of the code that do not work incorrectly, like bugs and glitches, but that clearly exist just to work around a problem. In other words, with a slightly different design, the code would not need to exist at all. Design flaws may be exceptions to a usual rule, or an inefficient way to do something the standard does 'better'. These usually are subjective improvements.

Contents

_JumpMoveEffect overflows after 128 or more move effects

This design flaw prevents you from using more than 128 move effects.

Fix: Edit _JumpMoveEffect in engine/battle/effects.asm:

 _JumpMoveEffect:
     ldh a, [hWhoseTurn]
     and a
     ld a, [wPlayerMoveEffect]
     jr z, .next1
     ld a, [wEnemyMoveEffect]
 .next1
     dec a
-    add a
-    ld hl, MoveEffectPointerTable
-    ld b, 0
-    ld c, a
+    ld bc, MoveEffectPointerTable
+    ld h, 0
+    ld l, a
+    add hl, hl
     add hl, bc
     ld a, [hli]
     ld h, [hl]
     ld l, a
     jp hl

Object events and BG events use the same event list

The same event list defines both object and BG events, with object events defined at the lower end and BG events defined at the higher end. Due to this, it's impossible to have BG events and object events sharing the same ID.

Fix: Edit DisplayTextID in home/text_script.asm to check for these IDs in a fashion that uses one list for BG events and another list for object events.

Three copies of the audio engine exist

Three identical copies of the audio engine exist (at audio/engine_1.asm, audio/engine_2.asm, and audio/engine_3.asm respectively) and are used in different banks. This is an inefficient way to handle your audio engine code.

Fix: Delete the other two copies and call to just one of them everywhere the other two are used.

To-do list

  • Moves and animations using the same constant (limitation)