Skip to content

Commit 1106b89

Browse files
committed
Rename tryToActivateAgain entity list to activateNextFrame
`activateNextFrame` is more descriptive of what the list does than `tryToActivateAgain`.
1 parent 3056d75 commit 1106b89

File tree

8 files changed

+39
-39
lines changed

8 files changed

+39
-39
lines changed

src/entity/_variables.inc

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ namespace Entity {
131131
// A) Entities that could not be activated in the previous
132132
// frame, and
133133
// B) Newly spawned active entities.
134-
allocate(tryToActivateAgain, wram7e, 2)
135-
constant _TRY_TO_ACTIVATE_AGAIN_INDEX = tryToActivateAgain - FIRST
134+
allocate(activateNextFrame, wram7e, 2)
135+
constant _ACTIVATE_NEXT_FRAME_INDEX = activateNextFrame - FIRST
136136

137137
// Unallocated Entities
138138
allocate(free, wram7e, 2)

src/entity/allocation.inc

+7-7
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function Init {
5858

5959
// Ensure free list is the last one
6060
assert(lists.deactivated < lists.free)
61-
assert(lists.tryToActivateAgain < lists.free)
61+
assert(lists.activateNextFrame < lists.free)
6262
assert(lists.LAST < lists.free)
6363

6464
lda.w lists.free
@@ -74,16 +74,16 @@ function Init {
7474

7575

7676

77-
// Clear the TryToActivateAgain entity list
77+
// Clear the activateNextFrame entity list
7878
//
7979
// Should be called at the start of each level
8080
//
8181
// REQUIRES: 16 bit A, 16 bit Index, DB = 0x7e, DP = 0
8282
a16()
8383
i16()
8484
code()
85-
function ClearTryToActivateAgainList {
86-
lda.w lists.tryToActivateAgain
85+
function ClearActivateNextFrameList {
86+
lda.w lists.activateNextFrame
8787
beq Return
8888

8989
Loop:
@@ -98,15 +98,15 @@ function ClearTryToActivateAgainList {
9898
bne Loop
9999

100100

101-
// Move the tryToActivateAgain list into the free list
101+
// Move the activateNextFrame list into the free list
102102

103103
lda.w lists.free
104104
sta.b BaseEntity.next
105105

106-
lda.w lists.tryToActivateAgain
106+
lda.w lists.activateNextFrame
107107
sta.w lists.free
108108

109-
stz.w lists.tryToActivateAgain
109+
stz.w lists.activateNextFrame
110110

111111

112112
lda.w #0

src/entity/counters.inc

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace Entity {
1313

1414
// Counts the number of enemies of a specific Id
1515
//
16-
// This routine will also search the deactivated and tryToActivateAgain entity
16+
// This routine will also search the deactivated and activateNextFrame entity
1717
// lists.
1818
//
1919
// This routine SHOULD ONLY be called on entities that will not change its
@@ -39,7 +39,7 @@ allocateTmpWord(tmp_count)
3939
jsr _TestList
4040
ldx.w Entity.lists.deactivated
4141
jsr _TestList
42-
ldx.w Entity.lists.tryToActivateAgain
42+
ldx.w Entity.lists.activateNextFrame
4343
jsr _TestList
4444

4545
lda.w tmp_count

src/entity/gameloop.inc

+10-10
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
// * Process all active entities' Process routine
88
// * Entity Collision detection
99
// * Animate all active entities
10+
// * Activate entities in the `Entity.activateNextFrame` list
1011
// * Activate entities that enter the active window
11-
// * Activate entities in the `Entity.tryToActivateAgain` list
1212
// * Delete all entities in the `Entity.toDelete` list
1313
//
1414
//
@@ -32,7 +32,7 @@ namespace Entity {
3232

3333

3434
// Previous entity being processed
35-
// Used in TryToActivateAgain, ProcessActiveWindow and the entity loop.
35+
// Used in _ProcessActivateNextFrameList, _ProcessActiveWindow and the entity loop.
3636
// (word address)
3737
allocateTmpWord(_previousEntity)
3838

@@ -135,26 +135,26 @@ macro __ChangeEntityList_Y() {
135135
}
136136

137137

138-
// Processes the tryToActivateAgain entity list
138+
// Processes the activateNextFrame entity list
139139
//
140140
// For each entity in the list it will try to reactivate the entity and
141141
// if it succeeds move it into its designated entity list.
142142
//
143143
// REQUIRES: 16 bit A, 16 bit Index, DB = 0x7e
144144
//
145145
// MODIFIES: DP
146-
inline _ProcessTryToActivateAgainList() {
146+
inline _ProcessActivateNextFrameList() {
147147
assert16a()
148148
assert16i()
149149

150-
function ProcessTryToActivateAgainList {
151-
lda.w lists.tryToActivateAgain
150+
function ProcessActivateNextFrameList {
151+
lda.w lists.activateNextFrame
152152
beq EndLoop
153153

154154
// this allows _previousEntity variable to work on first item
155155
assert(BaseEntity.next == 0)
156156

157-
ldy.w #lists.tryToActivateAgain
157+
ldy.w #lists.activateNextFrame
158158
sty.w _previousEntity
159159

160160
Loop:
@@ -194,7 +194,7 @@ inline _ProcessTryToActivateAgainList() {
194194
__ChangeEntityList_Y()
195195
// A = next entity address
196196
// z set if there are no more entities in the current list
197-
// MUST NOT CHANGE _previousEntity as the entity is no longer in the tryToActivateAgain list
197+
// MUST NOT CHANGE _previousEntity as the entity is no longer in the activateNextFrame list
198198

199199
bne Loop
200200

@@ -254,7 +254,7 @@ inline _ProcessActiveWindow() {
254254

255255
// Could not activate the entity.
256256
// Try again in the next frame.
257-
ldy.w #lists._TRY_TO_ACTIVATE_AGAIN_INDEX
257+
ldy.w #lists._ACTIVATE_NEXT_FRAME_INDEX
258258
bra _ChangeEntityList_Y
259259

260260

@@ -418,7 +418,7 @@ code()
418418
function ProcessGameLoop {
419419
jsr _UpdateActiveWindows
420420

421-
_ProcessTryToActivateAgainList()
421+
_ProcessActivateNextFrameList()
422422

423423
_ProcessActiveWindow()
424424

src/entity/spawn.inc

+6-6
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ allocateTmpWord(yPos)
136136
SkipActiveWindowTest:
137137
// We cannot move the entity into its entity list while
138138
// the entity-loop is running.
139-
// Instead we move it to the `tryToActivateAgain` list,
139+
// Instead we move it to the `activateNextFrame` list,
140140
// where it will be activated and moved to the correct
141141
// entity list at the start of the next frame.
142142

143-
lda.w lists.tryToActivateAgain
143+
lda.w lists.activateNextFrame
144144
sta.b BaseEntity.next
145145
tdc
146-
sta.w lists.tryToActivateAgain
146+
sta.w lists.activateNextFrame
147147

148148
bra EndIf
149149

@@ -490,14 +490,14 @@ SpawnProjectile:
490490

491491
// We cannot move the entity into its entity list while the
492492
// entity-loop is running.
493-
// Instead we move it to the `tryToActivateAgain` list, where it
493+
// Instead we move it to the `activateNextFrame` list, where it
494494
// will be activated and moved to the correct entity list at the
495495
// start of the next frame.
496496

497-
lda.w lists.tryToActivateAgain
497+
lda.w lists.activateNextFrame
498498
sta.b BaseEntity.next
499499
tdc
500-
sta.w lists.tryToActivateAgain
500+
sta.w lists.activateNextFrame
501501

502502
ldx.w MetaSprite.ActionPoint.address
503503

unit_tests/src/tests/entity/_common.inc

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ function _DeactivatedListLength {
2525
}
2626

2727
// REQUIRES: 16 bit A, 16 bit Index, DB = 0x7e
28-
// OUT: A = number of entities in the tryToActivateAgain list
28+
// OUT: A = number of entities in the activateNextFrame list
2929
a16()
3030
i16()
3131
code()
32-
function _TryToActivateAgainListLength {
33-
ldx.w #Entity.lists._TRY_TO_ACTIVATE_AGAIN_INDEX
32+
function _ActivateNextFrameListLength {
33+
ldx.w #Entity.lists._ACTIVATE_NEXT_FRAME_INDEX
3434
jmp Entity._CountEntitiesInListIndexX
3535
}
3636

@@ -87,7 +87,7 @@ allocateTmpWord(tmp_count)
8787
}
8888

8989
_TestDeactivated(deactivated)
90-
_TestDeactivated(tryToActivateAgain)
90+
_TestDeactivated(activateNextFrame)
9191

9292

9393
// test all other entities are active

unit_tests/src/tests/entity/allocation.inc

+4-4
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Fail:
2828
a16()
2929
i16()
3030
code()
31-
Test.add("Entities.ClearTryToActivateAgainList")
32-
function ClearTryToActivateAgainList {
31+
Test.add("Entities.ClearActivateNextFrameList")
32+
function ClearActivateNextFrameList {
3333
constant tmp = Test.tmp
3434

3535
jsr Entity.Init
@@ -59,12 +59,12 @@ constant tmp = Test.tmp
5959
bcc Loop
6060

6161

62-
jsr _TryToActivateAgainListLength
62+
jsr _ActivateNextFrameListLength
6363
cmp.w #Entity.lists.N_LISTS
6464
bne Fail
6565

6666

67-
jsr Entity.ClearTryToActivateAgainList
67+
jsr Entity.ClearActivateNextFrameList
6868

6969

7070
jsr _FreeListLength

unit_tests/src/tests/entity/gameloop.inc

+4-4
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ Fail:
186186
a16()
187187
i16()
188188
code()
189-
Test.add("Entity.GameLoop.TryToActivateAgain")
190-
function GameLoop_TryToActivateAgain {
189+
Test.add("Entity.GameLoop.ActivateNextFrame")
190+
function GameLoop_ActivateNextFrame {
191191
constant tmp = Test.tmp
192192

193193
jsr Entity.Init
@@ -217,7 +217,7 @@ constant tmp = Test.tmp
217217
bcc Loop
218218

219219

220-
jsr _TryToActivateAgainListLength
220+
jsr _ActivateNextFrameListLength
221221
cmp.w #Entity.lists.N_LISTS
222222
bne Fail
223223

@@ -247,7 +247,7 @@ constant tmp = Test.tmp
247247

248248
jsr Entity.ProcessGameLoop
249249

250-
jsr _TryToActivateAgainListLength
250+
jsr _ActivateNextFrameListLength
251251
cmp.w #0
252252
bne Fail
253253

0 commit comments

Comments
 (0)