Users browsing this thread: 1 Guest(s)
load npc into battle asm help

#1
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Is there any way via assembly to make it so the game can load NPC sprites/palettes into battle? As it is, the game only loads up to the dog sprite id#25.
We (Angelo n I) are trying to load NPC 41 into a battle event but the sprite just comes out all garbled and I see in usme the battle palettes only go up to the dog, so I'm assuming that's how far it goes =(


We are born, live, die and then do the same thing over again.
Quote  

#2
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(12-08-2013, 04:08 PM)Gi Nattak Wrote: We (Angelo n I) are trying to load NPC 41 into a battle event ...

I'm surprise he actually wants to do something hacking related...
  Find
Quote  

#3
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
Seriously Mike from sprite 22 and above it will not work since the sprites doesn't have full sprite sheets. By trying to load sprite 41, you're doing 0x2A80 bytes * 41, and you probably fall into the data, past the sprites.

I dare you to try to put Interceptor in a battle event, it will never work.
  Find
Quote  

#4
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Ah I forgot to say that I am/I was going to expand the sprite sheet to full via Edrin's tutorial, and then hopefully that would also take care of it spilling over into other sprites data...?


We are born, live, die and then do the same thing over again.
Quote  

#5
Posts: 2,769
Threads: 88
Thanks Received: 24
Thanks Given: 87
Joined: Jun 2009
Reputation: 25
Status
None
I was telling u that I know for a fact a full sheet of gestahl will work which is why I did it you know lolz :p

but at the same time with the expanded sprites there might be a slight chance but I'm not sure how it will look once the expanded sprite data is entered


"Sometimes ninjas do wrong to each other, and in dat way the force of tha earf' comes around da moon - and at that presence, da dirt, it overshadows the grass, so you're like, I can't cut dis grass, there's no sun comin' through. So in order to enable each other the two fruits have to look each other in da eye and understand we can only be right, as da ripe is wrong, you know what I mean?"

-HNIC
Quote  

#6
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(12-09-2013, 01:28 AM)Gi Nattak Wrote: Ah I forgot to say that I am/I was going to expand the sprite sheet to full via Edrin's tutorial, and then hopefully that would also take care of it spilling over into other sprites data...?

I think it will be only good if the previous sprites IDs have full sprite sheets. As an example, if your NPC is #23 you would need full spritesheet from #0 to #22.

The reason why is because the battle sprite ID in $2EAE,X don't use the NPC pointer table that is use to load NPCs GFX. In fact I didn't find any pointer table for battle sprites, hence my assumption that the game calculate the offset of the sprite by multiplying the size of a full spritesheet by the sprite ID.
  Find
Quote  

#7
Posts: 149
Threads: 21
Thanks Received: 40
Thanks Given: 3
Joined: Dec 2013
Reputation: 9
Status
Auto-life
The following tables may be of interest:
Code:
palettes for characters (battle): address, palette value and related character:
C2/CE2B 02 Terra
C2/CE2C 01 Locke
C2/CE2D 04 Cyan
C2/CE2E 04 Shadow
C2/CE2F 00 Edgar
C2/CE30 00 Sabin
C2/CE31 00 Celes
C2/CE32 03 Strago
C2/CE33 03 Relm
C2/CE34 04 Setzer
C2/CE35 05 Mog
C2/CE36 03 Gau
C2/CE37 03 Gogo
C2/CE38 05 Umaro
C2/CE39 01 Soldier
C2/CE3A 00 Imp
C2/CE3B 00 Leo
C2/CE3C 03 Banon
C2/CE3D 06 Morphed Terra
C2/CE3E 01 Merchant (soldier portrait)
C2/CE3F 00 Ghost
C2/CE40 03 Kefka (terra portrait)(pink OAM)
C2/CE41 03 OAM: Green Officer NPC: Gesthal
C2/CE42 00

pointers for battle graphics: address, 3-byte pointer, referenced address, sprite ID, size of data
C2/CE43 00 00 D5 D50000 00 16A0
C2/CE46 A0 16 D5 D516A0 01 16A0
C2/CE49 40 2D D5 D52D40 02 16A0
C2/CE4C E0 43 D5 D543E0 03 16A0
C2/CE4F 80 5A D5 D55A80 04 16A0
C2/CE52 20 71 D5 D57120 05 16A0
C2/CE55 C0 87 D5 D587C0 06 16A0
C2/CE58 60 9E D5 D59E60 07 16A0
C2/CE5B 00 B5 D5 D5B500 08 16A0
C2/CE5E A0 CB D5 D5CBA0 09 16A0
C2/CE61 40 E2 D5 D5E240 0A 16A0
C2/CE64 E0 F8 D5 D5F8E0 0B 16A0
C2/CE67 80 0F D6 D60F80 0C 16A0
C2/CE6A 20 26 D6 D62620 0D 16A0
C2/6E6D C0 3C D6 D63CC0 0E 16A0
C2/6E70 60 53 D6 D65360 0F 16A0
C2/CE73 00 6A D6 D66A00 10 1560
C2/CE76 60 7F D6 D67F60 11 1560
C2/CE79 C0 94 D6 D694C0 12 1560
C2/CE7C 20 AA D6 D6AA20 13 1560
C2/CE7F 80 BF D6 D6BF80 14 1560
C2/CE82 E0 D4 D6 D6D4E0 15 1560
C2/CE85 40 EA D6 D6EA40 16 1560
C2/CE88 C0 3C D6 D63CC0 17 1560? (repeat 0E)

If you have valid data for the char graphics, you can change the pointers for new graphics at C2/CE43 table. As example, if you change Terra's pointers from 00 00 D5 to A0 16 D5 the game engine will load Locke's sprite for Terra. It only applies for battles. You must also check how the palette is set in the game engine for these pointers to avoid graphic and palette mismatches.

The pointers are hard coded with the sprites ID. If you want to use a sprite ID after #$17, it will bypass the table space and load garbage. You can try to expand the tables or change the code to add a special exception for your specific sprite ID. Alternatively, you can try to recycle one of the pointers for a new data. However, you probably must have to sacrifice one of the usable graphics for a specific sprite ID.
  Find
Quote  
[-] The following 2 users say Thank You to HatZen08 for this post:
  • Gi Nattak (12-09-2013), SSJ Rick (12-09-2013)

#8
Posts: 3,970
Threads: 279
Thanks Received: 236
Thanks Given: 58
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(12-09-2013, 11:39 AM)HatZen08 Wrote: If you have valid data for the char graphics, you can change the pointers for new graphics at C2/CE43 table.

Nice find. I was looking for this yesterday. My assumption were wrong then.
  Find
Quote  

#9
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
After relocalizing and expanding the pointer table, here's where it gets called:

Code:
C1/3D66:    BF45CEC2    LDA $C2CE45,X    (High byte of pointer to start of character battle graphics)
C1/3D6E:    BF43CEC2    LDA $C2CE43,X     (Pointer to start of character battle graphics)

The only real obstacle in using existing NPC sheets (assuming you just need them to show up on the screen, not actually fight) is that they dont structure their additional sprites the same way, but as far as walking around it should work. Its normally better to expand the sheet first to a full PC sheet then use that for battle.
  Find
Quote  
[-] The following 1 user says Thank You to B-Run for this post:
  • Gi Nattak (12-09-2013)

#10
Posts: 2,549
Threads: 98
Thanks Received: 147
Thanks Given: 159
Joined: Aug 2009
Reputation: 52
Status
Nattak\'d
Thanks for the info guys. When I get some time again here I shall give it a shot. =)


We are born, live, die and then do the same thing over again.
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite