Skip to content

Commit

Permalink
Add thwimp
Browse files Browse the repository at this point in the history
  • Loading branch information
TheJoeSmo committed Jun 1, 2024
1 parent 4bb660f commit ca8ce1c
Show file tree
Hide file tree
Showing 8 changed files with 241 additions and 13 deletions.
Binary file added CHR/fortress.chr
Binary file not shown.
98 changes: 98 additions & 0 deletions PRG/enemies/thwimp.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Attribution
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; This enemy was originally created by RussianMan with
; help from AwesomeZack. Additional edits were done by
; Joe Smo for the purpose of compatibility.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Thwimp_XSpeed:
db $10,$F0

ObjNorm_Thwimp:
CrossJumpToA000 #3, Object_ShakeAndDrawMirrored
JSR Object_DeleteOffScreen

LDA Player_HaltGame
BNE @Re
CrossJumpToA000 #3, Player_HitEnemy
; Apply diff gravity when grounded
JSR Object_ApplyYVel
CrossJumpToA000 #3, Object_ApplyXVel
CrossJumpToA000 #3, Object_WorldDetect4

LDA Objects_DetStat,X
AND #$0C
BEQ @Gravity
LDY #$10
AND #$08
BNE @AlmostStore

JSR Object_HitGround

; Grounded
LDA #$01
STA Objects_Frame,X

; Reset y-speed and x-speed
LDA #$00
STA Objects_XVel,X
STA Objects_YVel,X
LDY Objects_Timer,X
BEQ @RestoreTimer
DEY
BNE @Re
INC Objects_Var1,X
LDA Objects_Var1,X
AND #$01
TAY
LDA Thwimp_XSpeed,Y
STA Objects_XVel,X
LDA #Thwimp_JumpSpeed
BNE @Store
RTS

@AlmostStore
; Change animation
LDA #$00
STA Objects_Frame,X
TYA
BNE @Store
@Gravity
; Change animation
LDA #$00
STA Objects_Frame,X

LDA Objects_YVel,X
BMI @LessGravity
CMP #Thwimp_MaxFallSpeed
BCS @Store
ADC #$05
@LessGravity
CLC
ADC #$03

@Store
STA Objects_YVel,X
@Re
RTS
@RestoreTimer
LDA #Thwimp_WaitTime
STA Objects_Timer,X

LDA Sound_QPlayer
ORA #SND_PLAYERBUMP
STA Sound_QPlayer
RTS
4 changes: 3 additions & 1 deletion PRG/levels/Fortress.asm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ W5T1L: .include "PRG/levels/Fortress/W5Tower1.asm" ; World 5 Tower Part 1
W5T3L: .include "PRG/levels/Fortress/W5Tower3.asm" ; World 5 Tower Part 3
W4F2L: .include "PRG/levels/Fortress/4-F2.asm" ; World 4 second fortress
W4F1L: .include "PRG/levels/Fortress/4-F1.asm" ; World 4 first fortress
Unused5L: .include "PRG/levels/Fortress/Unused5.asm" ; "Unused Level 5" (TCRF)
.if KEEP_USED_LEVELS != 0
Unused5L: .include "PRG/levels/Fortress/Unused5.asm" ; "Unused Level 5" (TCRF)
.endif
W80FL: .include "PRG/levels/Fortress/8-F.asm" ; World 8 Fortress "blue" part
W80F_AltL: .include "PRG/levels/Fortress/8-FA.asm" ; World 8 Fortress "grey" part
W8BCL: .include "PRG/levels/Fortress/Bowser.asm" ; Bowser's Castle
Expand Down
63 changes: 63 additions & 0 deletions PRG/levels/custom/thwimp_test.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
; Original address was $A95D
; Level 1-Fortress's layout data
.byte $2A, $AA ; Next Area Layout Offset
.byte $51, $D3 ; Next Area Enemy & Item Offset
.byte $09 ; Level Size Index | Y-Start Index
.byte $04 ; BG Pal | Enemy Pal | X-Start Index | Unused
.byte $C2 ; Pipe Ends Level | VScroll Index | Vertical Flag | Next Area Object Set
.byte $02 ; Level Entry Action | Graphic Set
.byte $03 ; Time Index | Unused | Music Index

.byte $6E, $00, $3C, $9F ; Blank Background (used to block out stuff) @ (0, 14)
.byte $00, $00, $EF, $9F ; Horizontally oriented X-blocks @ (0, 0)
.byte $10, $00, $E5, $09 ; Horizontally oriented X-blocks @ (0, 16)
.byte $10, $0A, $E4, $00 ; Horizontally oriented X-blocks @ (10, 16)
.byte $10, $0B, $E3, $00 ; Horizontally oriented X-blocks @ (11, 16)
.byte $10, $0C, $E2, $00 ; Horizontally oriented X-blocks @ (12, 16)
.byte $16, $0E, $E0, $02 ; Horizontally oriented X-blocks @ (14, 22)
.byte $17, $0D, $E0, $03 ; Horizontally oriented X-blocks @ (13, 23)
.byte $18, $0C, $E0, $04 ; Horizontally oriented X-blocks @ (12, 24)
.byte $19, $00, $E1, $10 ; Horizontally oriented X-blocks @ (0, 25)
.byte $79, $11, $31, $18 ; Blank Background (used to block out stuff) @ (17, 25)
.byte $7A, $11, $40, $18 ; Lava @ (17, 26)
.byte $15, $14, $E5, $03 ; Horizontally oriented X-blocks @ (20, 21)
.byte $19, $11, $E1, $0C ; Horizontally oriented X-blocks @ (17, 25)
.byte $18, $1C, $E0, $00 ; Horizontally oriented X-blocks @ (28, 24)
.byte $16, $1D, $E2, $00 ; Horizontally oriented X-blocks @ (29, 22)
.byte $18, $21, $E0, $04 ; Horizontally oriented X-blocks @ (33, 24)
.byte $16, $2A, $E2, $02 ; Horizontally oriented X-blocks @ (42, 22)
.byte $17, $2D, $E1, $00 ; Horizontally oriented X-blocks @ (45, 23)
.byte $18, $2E, $E0, $00 ; Horizontally oriented X-blocks @ (46, 24)
.byte $19, $2A, $E1, $26 ; Horizontally oriented X-blocks @ (42, 25)
.byte $34, $24, $00 ; '?' with flower @ (36, 20)
.byte $10, $2F, $E5, $0F ; Horizontally oriented X-blocks @ (47, 16)
.byte $15, $38, $02 ; Rotodisc block @ (56, 21)
.byte $16, $43, $E0, $0A ; Horizontally oriented X-blocks @ (67, 22)
.byte $17, $42, $E0, $0C ; Horizontally oriented X-blocks @ (66, 23)
.byte $18, $41, $E0, $0F ; Horizontally oriented X-blocks @ (65, 24)
.byte $16, $47, $02 ; Rotodisc block @ (71, 22)
.byte $12, $4A, $61 ; Dungeon windows @ (74, 18)
.byte $7A, $51, $40, $0E ; Lava @ (81, 26)
.byte $18, $55, $E2, $01 ; Horizontally oriented X-blocks @ (85, 24)
.byte $17, $5A, $E3, $02 ; Horizontally oriented X-blocks @ (90, 23)
.byte $17, $5B, $02 ; Rotodisc block @ (91, 23)
.byte $64, $51, $3B, $11 ; Blank Background (used to block out stuff) @ (81, 4)
.byte $18, $60, $E0, $00 ; Horizontally oriented X-blocks @ (96, 24)
.byte $19, $60, $E1, $3F ; Horizontally oriented X-blocks @ (96, 25)
.byte $10, $63, $E0, $2C ; Horizontally oriented X-blocks @ (99, 16)
.byte $36, $62, $01 ; '?' with leaf @ (98, 22)
.byte $11, $64, $E0, $2B ; Horizontally oriented X-blocks @ (100, 17)
.byte $12, $66, $E0, $29 ; Horizontally oriented X-blocks @ (102, 18)
.byte $13, $68, $E0, $27 ; Horizontally oriented X-blocks @ (104, 19)
.byte $14, $6B, $E0, $24 ; Horizontally oriented X-blocks @ (107, 20)
.byte $15, $6F, $E3, $0A ; Horizontally oriented X-blocks @ (111, 21)
.byte $15, $61, $62 ; Dungeon windows @ (97, 21)
.byte $17, $6D, $00 ; Door @ (109, 23)
.byte $64, $63, $32, $0F ; Blank Background (used to block out stuff) @ (99, 4)
.byte $16, $7E, $64 ; Dungeon windows @ (126, 22)
.byte $05, $72, $00 ; Door @ (114, 5)
.byte $12, $93, $62 ; Dungeon windows @ (147, 18)
.byte $10, $9F, $E8, $00 ; Horizontally oriented X-blocks @ (159, 16)
.byte $E7, $48, $54 ; Jump object @ (0, 0)
.byte $E6, $68, $10 ; Jump object @ (0, 0)
.byte $FF ; delimiter
62 changes: 54 additions & 8 deletions PRG/prg003.asm
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ ObjectGroup02_InitJumpTable:
.word ObjInit_BoomBoomQBall ; Object $4A - OBJ_BOOMBOOMQBALL
.word ObjInit_BoomBoom ; Object $4B - OBJ_BOOMBOOMJUMP
.word ObjInit_BoomBoom ; Object $4C - OBJ_BOOMBOOMFLY
.if INCLUDE_THWIMP == 0
.word ObjInit_DoNothing ; Object $4D
.else
.word ObjInit_Thwimp ; Object $4D - OBJ_THWIMP
.endif
.word ObjInit_DoNothing ; Object $4E
.word ObjInit_DoNothing ; Object $4F - OBJ_CHAINCHOMPFREE
.word ObjInit_BobOmbExplode ; Object $50 - OBJ_BOBOMBEXPLODE
Expand Down Expand Up @@ -71,7 +75,11 @@ ObjectGroup02_NormalJumpTable:
.word ObjNorm_BoomBoomQBall ; Object $4A - OBJ_BOOMBOOMQBALL
.word ObjNorm_BoomBoom ; Object $4B - OBJ_BOOMBOOMJUMP
.word ObjNorm_BoomBoom ; Object $4C - OBJ_BOOMBOOMFLY
.if INCLUDE_THWIMP == 0
.word ObjNorm_DoNothing ; Object $4D
.else
.word ObjNorm_Thwimp3 ; Object $4D - OBJ_THWIMP
.endif
.word ObjNorm_DoNothing ; Object $4E
.word ObjNorm_ChainChompFree ; Object $4F - OBJ_CHAINCHOMPFREE
.word ObjNorm_BobOmb ; Object $50 - OBJ_BOBOMBEXPLODE
Expand Down Expand Up @@ -114,7 +122,11 @@ ObjectGroup02_CollideJumpTable:
.word ObjHit_DoNothing ; Object $4A - OBJ_BOOMBOOMQBALL
.word ObjHit_DoNothing ; Object $4B - OBJ_BOOMBOOMJUMP
.word ObjHit_DoNothing ; Object $4C - OBJ_BOOMBOOMFLY
.if INCLUDE_THWIMP == 0
.word ObjHit_DoNothing ; Object $4D
.else
.word ObjHit_DoNothing ; Object $4D - OBJ_THWIMP
.endif
.word ObjHit_DoNothing ; Object $4E
.word ObjHit_DoNothing ; Object $4F - OBJ_CHAINCHOMPFREE
.word ObjHit_DoNothing ; Object $50 - OBJ_BOBOMBEXPLODE
Expand Down Expand Up @@ -156,7 +168,11 @@ ObjectGroup02_Attributes:
.byte OA1_PAL1 | OA1_HEIGHT16 | OA1_WIDTH16 ; Object $4A - OBJ_BOOMBOOMQBALL
.byte OA1_PAL3 | OA1_HEIGHT32 | OA1_WIDTH32 ; Object $4B - OBJ_BOOMBOOMJUMP
.byte OA1_PAL3 | OA1_HEIGHT32 | OA1_WIDTH32 ; Object $4C - OBJ_BOOMBOOMFLY
.if INCLUDE_THWIMP == 0
.byte OA1_PAL0 | OA1_HEIGHT16 | OA1_WIDTH8 ; Object $4D
.else
.byte OA1_PAL2 | OA1_HEIGHT16 | OA1_WIDTH16 ; Object $4D - OBJ_THWIMP
.endif
.byte OA1_PAL0 | OA1_HEIGHT16 | OA1_WIDTH8 ; Object $4E
.byte OA1_PAL1 | OA1_HEIGHT16 | OA1_WIDTH16 ; Object $4F - OBJ_CHAINCHOMPFREE
.byte OA1_PAL3 | OA1_HEIGHT16 | OA1_WIDTH16 ; Object $50 - OBJ_BOBOMBEXPLODE
Expand Down Expand Up @@ -197,7 +213,11 @@ ObjectGroup02_Attributes2:
.byte OA2_NOSHELLORSQUASH | OA2_TDOGRP1 ; Object $4A - OBJ_BOOMBOOMQBALL
.byte OA2_STOMPDONTCARE | OA2_TDOGRP2 ; Object $4B - OBJ_BOOMBOOMJUMP
.byte OA2_STOMPDONTCARE | OA2_TDOGRP2 ; Object $4C - OBJ_BOOMBOOMFLY
.byte OA2_TDOGRP0 ; Object $4D
.if INCLUDE_THWIMP == 0
.byte OA2_TDOGRP0 ; Object $4D
.else
.byte OA2_TDOGRP1 | OA2_GNDPLAYERMOD ; Object $4D - OBJ_THWIMP
.endif
.byte OA2_TDOGRP0 ; Object $4E
.byte OA2_NOSHELLORSQUASH | OA2_TDOGRP1 ; Object $4F - OBJ_CHAINCHOMPFREE
.byte OA2_STOMPDONTCARE | OA2_TDOGRP1 ; Object $50 - OBJ_BOBOMBEXPLODE
Expand Down Expand Up @@ -239,7 +259,11 @@ ObjectGroup02_Attributes3:
.byte OA3_HALT_NORMALONLY | OA3_TAILATKIMMUNE ; Object $4A - OBJ_BOOMBOOMQBALL
.byte OA3_HALT_NORMALONLY | OA3_TAILATKIMMUNE ; Object $4B - OBJ_BOOMBOOMJUMP
.byte OA3_HALT_NORMALONLY | OA3_TAILATKIMMUNE ; Object $4C - OBJ_BOOMBOOMFLY
.byte OA3_HALT_HOTFOOTSPECIAL ; Object $4D
.if INCLUDE_THWIMP == 0
.byte OA3_HALT_HOTFOOTSPECIAL ; Object $4D
.else
.byte OA3_HALT_NORMALONLY | OA3_NOTSTOMPABLE | OA3_TAILATKIMMUNE ; Object $4D - OBJ_THWIMP
.endif
.byte OA3_HALT_HOTFOOTSPECIAL ; Object $4E
.byte OA3_HALT_NORMALONLY | OA3_NOTSTOMPABLE ; Object $4F - OBJ_CHAINCHOMPFREE
.byte OA3_HALT_NORMALONLY ; Object $50 - OBJ_BOBOMBEXPLODE
Expand Down Expand Up @@ -281,7 +305,11 @@ ObjectGroup02_PatTableSel:
.byte OPTS_SETPT5 | $13 ; Object $4A - OBJ_BOOMBOOMQBALL
.byte OPTS_SETPT6 | $33 ; Object $4B - OBJ_BOOMBOOMJUMP
.byte OPTS_SETPT6 | $33 ; Object $4C - OBJ_BOOMBOOMFLY
.byte OPTS_NOCHANGE ; Object $4D
.if INCLUDE_THWIMP == 0
.byte OPTS_NOCHANGE ; Object $4D
.else
.byte OPTS_NOCHANGE ; Object $4D - OBJ_THWIMP
.endif
.byte OPTS_NOCHANGE ; Object $4E
.byte OPTS_SETPT5 | $0A ; Object $4F - OBJ_CHAINCHOMPFREE
.byte OPTS_SETPT5 | $36 ; Object $50 - OBJ_BOBOMBEXPLODE
Expand Down Expand Up @@ -326,7 +354,11 @@ ObjectGroup02_KillAction:
.byte KILLACT_STANDARD ; Object $4A - OBJ_BOOMBOOMQBALL
.byte KILLACT_NORMALANDKILLED ; Object $4B - OBJ_BOOMBOOMJUMP
.byte KILLACT_NORMALANDKILLED ; Object $4C - OBJ_BOOMBOOMFLY
.byte KILLACT_STANDARD ; Object $4D
.if INCLUDE_THWIMP == 0
.byte KILLACT_STANDARD ; Object $4D
.else
.byte KILLACT_STANDARD ; Object $4D - OBJ_THWIMP
.endif
.byte KILLACT_STANDARD ; Object $4E
.byte KILLACT_NORMALANDKILLED ; Object $4F - OBJ_CHAINCHOMPFREE
.byte KILLACT_JUSTDRAW16X16 ; Object $50 - OBJ_BOBOMBEXPLODE
Expand Down Expand Up @@ -393,7 +425,9 @@ ObjectGroup02_PatternSets:
; (End restricted alignment space)

ObjP49:
ObjP4D:
.if INCLUDE_THWIMP == 0
ObjP4D:
.endif
ObjP4E:
ObjP4F:
ObjP5D:
Expand Down Expand Up @@ -449,7 +483,10 @@ ObjP63:
.byte $81, $83, $8D, $A1, $81, $83, $87, $89, $81, $83, $87, $89
ObjP64:
.byte $E7, $E9, $E7, $EF, $E7, $EF

.if INCLUDE_THWIMP != 0
ObjP4D:
.byte $F5,$F5, $F7, $F7
.endif

ObjNorm_IceBlock:

Expand Down Expand Up @@ -6337,5 +6374,14 @@ PRG003_BFAE:

JMP Object_ShakeAndDraw ; Draw Rotodisc and don't come back!

; Rest of ROM bank was empty

.if INCLUDE_THWIMP == 1
ObjNorm_Thwimp3:
CrossJumpToA000 #30, ObjNorm_Thwimp
RTS

ObjInit_Thwimp:
; Define the patterns to be used
LDA #THWIMP_CHR_BANK
STA PatTable_BankSel+5
RTS
.endif
4 changes: 4 additions & 0 deletions PRG/prg030.asm
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
.if INCLUDE_BUMPTY == 1
.include "PRG/enemies/bumpty.asm"
.endif

.if INCLUDE_THWIMP == 1
.include "PRG/enemies/thwimp.asm"
.endif
15 changes: 11 additions & 4 deletions config.asm
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
; Enemy Definitions
INCLUDE_REX = 1
INCLUDE_BUMPTY = 1
INCLUDE_THWIMP = 1

; Levels
INCLUDE_TEST_LEVELS = 0
INCLUDE_DEMO_LEVELS = 0

;----------------------
; Properties
IS_EXPANDED_ROM = 0 || INCLUDE_REX || INCLUDE_BUMPTY
NUMBER_OF_PRG_BANKS = 16 + (16 * IS_EXPANDED_ROM)
NUMBER_OF_CHR_BANKS = 16 + (16 * IS_EXPANDED_ROM)
UNUSED_EXTENDED_CHR_BANKS = 128 - (INCLUDE_REX != 0) - (INCLUDE_BUMPTY != 0)
IS_EXPANDED_ROM = 0 || INCLUDE_REX || INCLUDE_BUMPTY || INCLUDE_THWIMP
NUMBER_OF_PRG_BANKS = 32 ;16 + (16 * IS_EXPANDED_ROM)
NUMBER_OF_CHR_BANKS = 32 ;16 + (16 * IS_EXPANDED_ROM)
UNUSED_EXTENDED_CHR_BANKS = 128 - (INCLUDE_REX != 0) - (INCLUDE_BUMPTY != 0) - (INCLUDE_THWIMP != 0)
KEEP_USED_LEVELS = !(INCLUDE_TEST_LEVELS || INCLUDE_DEMO_LEVELS)

;----------------------
; Enemy options
Thwimp_MaxFallSpeed = $40
Thwimp_JumpSpeed = $A0
Thwimp_WaitTime = $40
8 changes: 8 additions & 0 deletions smb3.asm
Original file line number Diff line number Diff line change
Expand Up @@ -3374,6 +3374,7 @@ OBJ_FLOATINGBGCLOUD = $49 ; Floating background cloud
OBJ_BOOMBOOMQBALL = $4A ; Boom Boom (?) end-level ball
OBJ_BOOMBOOMJUMP = $4B ; Jumping Boom-Boom (can actually hit ? blocks!)
OBJ_BOOMBOOMFLY = $4C ; Flying Boom-boom
OBJ_THWIMP = $4D ; Thwimp from SMW
OBJ_CHAINCHOMPFREE = $4F ; Jumping chain chomp head after he breaks free
OBJ_BOBOMBEXPLODE = $50 ; Ready-to-explode Bob-Omb
OBJ_ROTODISCDUAL = $51 ; Dual Rotodisc, sync, clockwise
Expand Down Expand Up @@ -5055,6 +5056,13 @@ TERMINATOR = $00 ; Used in the credits as a terminator for end of list
.incbin "CHR/bumpty.chr"
.endif

.if INCLUDE_THWIMP == 0
THWIMP_CHR_BANK = BUMPTY_CHR_BANK
.else
THWIMP_CHR_BANK = BUMPTY_CHR_BANK + 1
.incbin "CHR/fortress.chr"
.endif

; Pad a series of unused graphics
.rept UNUSED_EXTENDED_CHR_BANKS
.incbin "CHR/chr126.chr"
Expand Down

0 comments on commit ca8ce1c

Please sign in to comment.