Points of Required Attention™
Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,502,547
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 04-29-24 10:34 PM
Guest: Register | Login

0 users currently in SMW Hacking | 1 guest

Main - SMW Hacking - Custom Sprite Help New thread | New reply


anonymousbl00dlust
Posted on 02-09-12 11:38 PM (rev. 3 of 02-09-12 11:40 PM) Link | Quote | ID: 149829

Newcomer
Level: 7

Posts: 6/6
EXP: 984
Next: 464

Since: 01-12-12

Last post: 4462 days
Last view: 1871 days
I made this special version of the creating eating block from smw that not only allows me to choose what direction to go in but also what tile to generate. Unfortunately, I've need to generate certain tiles that aren't specified by $9C (the table of tiles that the normal generation routine can summon). The structure of it looks more or less like this:

MAP16_NUMY	    db $03,$04,$05,$06,$00,$03,$04,$05,$06
X_SPEED dcb $10,$F0,$00,$00,$00,$10,$F0,$00,$00
Y_SPEED dcb $00,$00,$10,$F0,$00,$00,$00,$10,$F0
DIRECTION dcb $00,$00,$01,$00,$02,$00,$00,$00,$03,$00,$00

stuff happens, then


LDA X_SPEED,y ; \ set x speed
STA $B6,x ; /

LDA Y_SPEED,y ; \ set y speed
STA $AA,x ; /

LDA MAP16_NUMY,y ; \ set direction-based tile-gen table
STA $185E ; / for Block1 code later (done while y is still correct)



decides weather or not to be a creating or an eating block, then

BLOCK1		;block chosen to gen already selected when sprite speed was set			

LDA $185E ;choosing tile to generate from table
STA $9C ;

LDA $E4,x ;sprite xpos low (table)
STA $9A ;blockgen xpos of contact low
LDA $14E0,x ;sprite xpos high (table)
STA $9B ;blockgen xpos of contact high
LDA $D8,x ;sprite ypos low (table)
STA $98 ;blockgen ypos of contact low
LDA $14D4,x ;sprite ypos high (table)
STA $99 ;blockgen ypos of contact high

JSL $00BEB0 ; generate Map16 tile routine
RTS

BLOCK2 LDA #$02 ; always generate a blank tile, effectively 'eating'
STA $185E ; tile from map16

LDA $185E ;choosing tile to generate from table
STA $9C ;

LDA $E4,x ;sprite xpos low (table)
STA $9A ;blockgen xpos of contact low
LDA $14E0,x ;sprite xpos high (table)
STA $9B ;blockgen xpos of contact high
LDA $D8,x ;sprite ypos low (table)
STA $98 ;blockgen ypos of contact low
LDA $14D4,x ;sprite ypos high (table)
STA $99 ;blockgen ypos of contact high

JSL $00BEB0 ; generate Map16 tile routine
RTS


so the problem is, this only lets me generate certain map16 tiles. To fix this I had to use a tile generation hijack patch, but according to the readme I have to implement the hijacked routine like so:

Posted by readme
GENERATE ARBITRARY MAP16 TILE

LDA.b #$FF
STA.b $9C
;;STORE YOUR 16-BIT BLOCK NUMBER into $0660/1
JSL $00BEB0

I don't know understand how to implement this alternate method using the same logic that I currently have set up. how can I get this to work?

Main - SMW Hacking - Custom Sprite Help New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.017 seconds. (341KB of memory used)
MySQL - queries: 37, rows: 57/58, time: 0.014 seconds.