Language…
6 users online: AJ1Ayrton, masl, Nirv, Oskise, playagmes169, Tsquare07 - Guests: 239 - Bots: 256
Users: 64,795 (2,375 active)
Latest user: mathew

32x32 sprite not displaying all tiles properly

I'm helping with a community hack. I made a custom boss for it, on the request of our leader. It works good, and functions just like how he wants it. Except for one thing, which hasn't bothered him, but has been bugging the everloving fruitcake out of me. I have sought help on Discord, but with no-one having long enough of an attention span to help, I come here.

When the boss is facing/moving to the right, the upper left 16x16 tile doesn't display. And occasionally when there is no horizontal movement, the upper right tile doesn't display. The rest of the sprite is working great, but this graphical issue is infuriating.

I thought maybe it was because I had written it in the outdated compiler TRASM, so I updated it to xkas, but the problem persists.

Link to all resources zipped up (cfg, asm, exgfx, sample levels)


Link to just the asm code


If anyone could find out why the tiles do not display in these circumstances, I would appreciate it.

Oh, I should mention, this colab hack is being made for a person who may or may not be here, and who doesn't want to know any details until we are done and give it to him. So rather than posting code/comments that references what the boss might be or references the hack, could you PM me (Flabort) or FedoraFriday here or on discord?
What's the sprite header set to? Should be 00 or 10. If that doesn't fix it, install the no more sprite tile limits patch and follow its instructions.
Originally posted by Kaijyuu
What's the sprite header set to? Should be 00 or 10. If that doesn't fix it, install the no more sprite tile limits patch and follow its instructions.

Already installed.
I glanced at the code and I think the problem lies here

Code
Loop:
	PHX				
	LDA $14			;\
	AND #$10			
	BNE No_Anim		;|then add 4 to X
	TXA				
	ADC #$04			
	TAX				;|
No_Anim:				;/

	LDA $03			;\
	BNE No_Right		;|If facing left, 
	TXA				;|then add 8 to X
	ADC #$08			;|causing line 3 or 4 in the tile tables
	TAX				;|to be used instead of 1 or 2.


You aren't clearing the carry flag before adding which is causing the wrong table value to be indexed. Add a CLC before each ADC.
This should fix the problem.
Originally posted by DarkCodr
I glanced at the code and I think the problem lies here

Code
Loop:
	PHX				
	LDA $14			;\
	AND #$10			
	BNE No_Anim		;|then add 4 to X
	TXA				
	ADC #$04			
	TAX				;|
No_Anim:				;/

	LDA $03			;\
	BNE No_Right		;|If facing left, 
	TXA				;|then add 8 to X
	ADC #$08			;|causing line 3 or 4 in the tile tables
	TAX				;|to be used instead of 1 or 2.


You aren't clearing the carry flag before adding which is causing the wrong table value to be indexed. Add a CLC before each ADC.
This should fix the problem.


Keep in mind that the carry flag is used in ADC to add an additional 1, hence the “with carry”. This means for example, if the carry is set while ADC #$03, it will add by #$04. After the ADC is performed, the carry is set should “unsigned overflow” occur (when $FF goes to $00).

For subtraction, it's the opposite (subtract by additional 1 if carry is clear, and after SBC is performed, carry is clear when $00 becomes $FF).
Give thanks to RPG hacker for working on Asar.
Thanks guys! That fixed it :D