Comments (6)
@Rangi42 Your suggested changes causes a conflict with the constants being created in my PR:
error: maps.asm(255) -> data/maps/objects/LavenderTown.asm(16) -> macros/scripts/maps.asm::bg_event(69):
Expected constant expression: 'TEXT_LAVENDERTOWN_POKECENTER_SIGN' is not constant at assembly time
Could this be because the macros are being called before the constants are defined?
from pokered.
That worked and is functional with the changes in my new PR (Tested by purposely changing around some TEXT constants). I'm going to incorporate this into my PR and will push an update a bit later.
from pokered.
Since we already have def_warps_to
following the bg and object event definitions, it can be responsible for the checking:
MACRO bg_event
db \2, \1, \3
+ DEF _BG_EVENT_{d:{_NUM_BG_EVENTS}}_TEXT_ID = \3
DEF {_NUM_BG_EVENTS} += 1
ENDM
MACRO object_event
...
+ ; items and trainers don't use a typical text id
+ IF _NARG > 6
+ DEF _OBJECT_EVENT_{d:{_NUM_OBJECT_EVENTS}}_TEXT_ID = 0
+ ELSE
+ DEF _OBJECT_EVENT_{d:{_NUM_OBJECT_EVENTS}}_TEXT_ID = \6
+ ENDC
DEF {_NUM_OBJECT_EVENTS} += 1
ENDM
MACRO def_warps_to
+ ; text ID values are significant (see DisplayTextID in home/text_script.asm)
+ FOR n, {_NUM_BG_EVENTS}
+ ASSERT _BG_EVENT_{d:n}_TEXT_ID > {_NUM_OBJECT_EVENTS}, \
+ "A bg_event has text ID {d:_BG_EVENT_{d:n}_TEXT_ID} expected for an object_event ({d:{_NUM_OBJECT_EVENTS}} or below)"
+ ENDR
+ FOR n, {_NUM_OBJECT_EVENTS}
+ ASSERT _OBJECT_EVENT_{d:n}_TEXT_ID <= {_NUM_OBJECT_EVENTS}, \
+ "An object_event has text ID {d:_OBJECT_EVENT_{d:n}_TEXT_ID} expected for a bg_event (above {d:{_NUM_OBJECT_EVENTS}})"
+ ENDR
- FOR n, _NUM_WARP_EVENTS
+ FOR n, {_NUM_WARP_EVENTS}
warp_to _WARP_{d:n}_X, _WARP_{d:n}_Y, \1_WIDTH
ENDR
ENDM
This would go well with how warp_event
defines per-event _WARP_{d:{_NUM_WARP_EVENTS}}_X
and _WARP_{d:{_NUM_WARP_EVENTS}}_Y
constants which get used by def_warps_to
.
from pokered.
This should be documented as a design flaw (in the wiki since we don't yet have a definitive document worth putting in the repo), which could be fixed by editing DisplayTextID
in home/text_script.asm to check for "sprite-ness" another way. (Not sure how though.)
from pokered.
This should be documented as a design flaw (in the wiki since we don't yet have a definitive document worth putting in the repo), which could be fixed by editing
DisplayTextID
in home/text_script.asm to check for "sprite-ness" another way. (Not sure how though.)
Whatever the case, a design flaws wiki page now exists for those willing to put it in:
https://github.com/pret/pokered/wiki/Design-Flaws
from pokered.
Yeah, the problem is DEF constant = value
needs value
to be known at assembly time, but if you have bg_event 4, 5, TEXT_LAVENDERTOWN_POKECENTER_SIGN
, then the macro tries to do DEF _BG_EVENT_3_TEXT_ID = TEXT_LAVENDERTOWN_POKECENTER_SIGN
and doesn't have a value for TEXT_LAVENDERTOWN_POKECENTER_SIGN
yet (since that gets defined by the const_dw
table in its script file).
Using EQUS
might work instead:
MACRO bg_event
db \2, \1, \3
+ REDEF _BG_EVENT_{d:{_NUM_BG_EVENTS}}_TEXT_ID EQUS "\3"
DEF {_NUM_BG_EVENTS} += 1
ENDM
MACRO object_event
...
+ ; items and trainers don't use a typical text id
+ IF _NARG > 6
+ REDEF _OBJECT_EVENT_{d:{_NUM_OBJECT_EVENTS}}_TEXT_ID EQUS "0"
+ ELSE
+ REDEF _OBJECT_EVENT_{d:{_NUM_OBJECT_EVENTS}}_TEXT_ID EQUS "\6"
+ ENDC
DEF {_NUM_OBJECT_EVENTS} += 1
ENDM
MACRO def_warps_to
+ ; text ID values are significant (see DisplayTextID in home/text_script.asm)
+ FOR n, {_NUM_BG_EVENTS}
+ ASSERT {_BG_EVENT_{d:n}_TEXT_ID} > {_NUM_OBJECT_EVENTS}, \
+ "A bg_event has a text ID {_BG_EVENT_{d:n}_TEXT_ID} expected for an object_event ({d:{_NUM_OBJECT_EVENTS}} or below)"
+ ENDR
+ FOR n, {_NUM_OBJECT_EVENTS}
+ ASSERT {_OBJECT_EVENT_{d:n}_TEXT_ID} <= {_NUM_OBJECT_EVENTS}, \
+ "An object_event has a text ID {_OBJECT_EVENT_{d:n}_TEXT_ID} expected for a bg_event (above {d:{_NUM_OBJECT_EVENTS}})"
+ ENDR
- FOR n, _NUM_WARP_EVENTS
+ FOR n, {_NUM_WARP_EVENTS}
warp_to _WARP_{d:n}_X, _WARP_{d:n}_Y, \1_WIDTH
ENDR
ENDM
from pokered.
Related Issues (20)
- Use tool to publish documentation of functions such as doctest. HOT 5
- Copy pokecrystal's handling of unused types
- Copy pokecrystal's `map_const` macro
- Comment about UndergroundPathNorthSouth's dimensions
- Distinguish "meta" constants from event constants
- Add constants and table macros for the map sprite sets
- How to open 2bpp file HOT 1
- Fadas to be added HOT 1
- `TrainerDataPointers` is missing `table_width/assert_table_length` macros
- Comment the wave pattern 5 data that happens to be read from SFX HOT 4
- Inaccurate comment in `UpdateNPCSprite`
- Split `hSpriteIndexOrTextID`
- Incorrect reference
- Stadium Checksum HOT 1
- Review and revise some maps' script and text labels
- Rename `wEvosMoves` and get rid of `MAX_EVOLUTIONS` and `EVOLUTION_SIZE`
- Have palfix.py always output grayscale
- is there a way to make a romhack as a save file like https://www.youtube.com/watch?v=VxzqtNMjEPQ ? HOT 1
- ``engine/events/starter_dex.asm`` contains an error in its comment HOT 1
- UndergroundPathNorthSouth.blk doesn't work with PolishedMap HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pokered.