Banner
Views: 845,124,467
Time:
14 users online: algae5, Counterfeit, DPBOX, HD_DankBaron, kamekku14,  KevinM, Kori,  MarioFanGamer,  RussianMan, slopcore, Thirteen 1355, TumbleBee, xamexer, Zandro - Guests: 33 - Bots: 86 Users: 46,476 (2,734 active)
Latest: jaiydin
Tip: Only use a few different kinds of enemies per level. Overdoing it can make your level feel disjointed and clunky.Not logged in.
32x32 sprite not displaying all tiles properly
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - 32x32 sprite not displaying all tiles properly
Pages: « 1 »
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
Pages: « 1 »
Forum Index - SMW Hacking - SMW Hacking Help - ASM & Related Topics - 32x32 sprite not displaying all tiles properly

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2020 - SMW Central
Legal Information - Privacy Policy - Link To Us


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy