Users browsing this thread: 3 Guest(s)
Final Requests for Help

#3
Posts: 281
Threads: 18
Thanks Received: 13
Thanks Given: 8
Joined: Mar 2014
Reputation: 8
Status
None
Here's some code I wrote years ago for expanding Throwable items. You can use this to give items an effect when thrown.

Code:
; Generic non-magic Skean function
; Compares item ID to a table of IDs, then uses a jump table to jump to
; mini-functions to perform for that specific item ID

hirom
;header
!freespace = $C265A0

; The safe and sane version - no infinite loops if no match
org $C22ADC
C22ADC:     LDA $01,S               ; Item ID
            PHX                     ; Preserve X
            LDX #$0006              ; Check four entries: 0, 2 ,4, 6
.loop       CMP.l table,X           ; Compare with table of item IDs
            BEQ .jump               ; If match, jump
            DEX #2                  ; Next item
            BPL .loop               ; Loop and check next table entry
            BRA .end                ; If no matches, no action
.jump       JSR (jumptable,X)       ; If match, perform associated function
.end        PLX
print pc

; The unsafe version - assumes a match, saves 4 bytes
; Better make sure there's a matching Item ID table entry for each throwable
;org $C22ADC
;C22ADC:     LDA $01,S
;            PHX
;            LDX #$0006
;.loop       DEX #2
;            CMP.l throwables,X
;            BNE .loop
;.dostuff    JSR (jumptable,X)
;.end        PLX
;            NOP #4
;print pc

org !freespace
reset bytes
table:
print "inviz edge:", pc
dw $00AE    ; Inviz Edge
print "shadow edge:", pc
dw $00AF    ; Shadow Edge
print "smoke bomb:", pc
dw $00FC    ; Smoke Bomb
dw $0043    ; Tack Star

jumptable:
dw inviz_Edge
dw shadow_Edge
dw smoke_Bomb
dw magic_Shuriken

inviz_Edge:
LDA #$10
TSB $11AA       ; Set Clear in status attack byte 1
RTS

shadow_Edge:
LDA #$04
TSB $11AB       ; Set Image in status attack byte 2
RTS

smoke_Bomb:
LDA #$96        ; Special effect $4B (doubled to serve as index)
STA $11A9       ; Set Smoke Bomb in Special Effect
LDA #$01
STA $B5         ; Set command to Item for animation purposes, and so the Can't Run check works
RTS

magic_Shuriken:
LDA #$02
TRB $B2         ; Clear no critical and ignore True Knight
LDA #$0E        ; Special Effect $07 (doubled)
STA $11A9       ; Set MP Crits
RTS

print bytes
  Find
Quote  
[-] The following 1 user says Thank You to seibaby for this post:
  • PowerPanda (04-06-2021)



Messages In This Thread
Final Requests for Help - by PowerPanda - 04-05-2021, 11:28 PM
RE: Final Requests for Help - by Subtraction - 04-05-2021, 11:44 PM
RE: Final Requests for Help - by seibaby - 04-06-2021, 07:24 AM
RE: Final Requests for Help - by PowerPanda - 04-06-2021, 09:36 PM
RE: Final Requests for Help - by madsiur - 04-06-2021, 09:56 PM
RE: Final Requests for Help - by Lightning - 04-06-2021, 10:55 AM
RE: Final Requests for Help - by madsiur - 04-06-2021, 08:35 PM
RE: Final Requests for Help - by PowerPanda - 04-06-2021, 10:28 PM
RE: Final Requests for Help - by C-Dude - 04-07-2021, 12:04 AM
RE: Final Requests for Help - by Drakkhen - 04-07-2021, 12:11 AM
RE: Final Requests for Help - by PowerPanda - 04-07-2021, 10:40 AM
RE: Final Requests for Help - by assassin - 04-07-2021, 10:17 AM
RE: Final Requests for Help - by Drakkhen - 04-07-2021, 11:03 AM
RE: Final Requests for Help - by assassin - 04-07-2021, 01:36 PM
RE: Final Requests for Help - by assassin - 04-07-2021, 09:15 PM
RE: Final Requests for Help - by PowerPanda - 04-07-2021, 06:02 PM
RE: Final Requests for Help - by assassin - 04-07-2021, 08:15 PM
RE: Final Requests for Help - by PowerPanda - 04-07-2021, 08:49 PM
RE: Final Requests for Help - by PowerPanda - 04-07-2021, 10:48 PM
RE: Final Requests for Help - by C-Dude - 04-08-2021, 01:49 PM
RE: Final Requests for Help - by PowerPanda - 04-08-2021, 04:51 PM
RE: Final Requests for Help - by C-Dude - 04-08-2021, 11:06 PM
RE: Final Requests for Help - by PowerPanda - 04-08-2021, 11:53 PM
RE: Final Requests for Help - by C-Dude - 04-16-2021, 10:32 PM
RE: Final Requests for Help - by PowerPanda - 04-11-2021, 02:17 PM
RE: Final Requests for Help - by Everything - 04-11-2021, 03:05 PM
RE: Final Requests for Help - by PowerPanda - 04-11-2021, 04:13 PM
RE: Final Requests for Help - by Everything - 04-11-2021, 06:15 PM
RE: Final Requests for Help - by Drakkhen - 04-11-2021, 06:23 PM
RE: Final Requests for Help - by Warrax - 04-12-2021, 03:17 AM
RE: Final Requests for Help - by PowerPanda - 04-11-2021, 08:21 PM
RE: Final Requests for Help - by PowerPanda - 04-18-2021, 01:42 PM
RE: Final Requests for Help - by madsiur - 04-18-2021, 07:34 PM
RE: Final Requests for Help - by PowerPanda - 05-06-2021, 05:27 PM
RE: Final Requests for Help - by SirNewtonFig - 05-06-2021, 08:49 PM
RE: Final Requests for Help - by Lightning - 05-07-2021, 11:19 AM
RE: Final Requests for Help - by SirNewtonFig - 05-07-2021, 01:55 PM
RE: Final Requests for Help - by Lightning - 05-07-2021, 02:51 PM
RE: Final Requests for Help - by SirNewtonFig - 05-09-2021, 08:13 PM
RE: Final Requests for Help - by PowerPanda - 05-07-2021, 06:00 PM
RE: Final Requests for Help - by Subtraction - 05-08-2021, 09:45 AM
RE: Final Requests for Help - by PowerPanda - 05-08-2021, 10:56 AM
RE: Final Requests for Help - by Lightning - 05-10-2021, 01:02 AM
RE: Final Requests for Help - by Subtraction - 05-11-2021, 08:08 AM
RE: Final Requests for Help - by PowerPanda - 05-11-2021, 10:02 AM
RE: Final Requests for Help - by PowerPanda - 05-09-2021, 10:46 PM
RE: Final Requests for Help - by MysticLord - 05-10-2021, 01:36 AM
RE: Final Requests for Help - by PowerPanda - 05-10-2021, 10:05 AM
RE: Final Requests for Help - by MysticLord - 05-10-2021, 05:54 PM
RE: Final Requests for Help - by PowerPanda - 05-10-2021, 09:30 PM
RE: Final Requests for Help - by Subtraction - 05-11-2021, 11:10 PM
RE: Final Requests for Help - by PowerPanda - 05-14-2021, 12:41 PM
RE: Final Requests for Help - by Subtraction - 05-14-2021, 11:59 PM
RE: Final Requests for Help - by Slowmo - 05-15-2021, 11:18 AM
RE: Final Requests for Help - by MysticLord - 05-15-2021, 11:36 AM

Forum Jump:

Users browsing this thread: 3 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite