Path: blob/master/Sonic 2/Scripts/CNZ/SlotDisplay.txt
1480 views
// ----------------------------------1// RSDK Project: Sonic 22// Script Description: Slot Display Object3// Script Author: Christian Whitehead/Simon Thomley4// Unpacked by Rubberduckycooly's script unpacker5// ----------------------------------67// ========================8// Aliases9// ========================1011private alias object.value1 : object.prizePivot.y1213// Frame IDs14private alias 0 : SLOTPRIZE_SONIC15private alias 1 : SLOTPRIZE_TAILS16private alias 2 : SLOTPRIZE_RING // (Amy just replaces the Rings icon, she doesn't get her own slot or anything)17private alias 3 : SLOTPRIZE_BAR18private alias 4 : SLOTPRIZE_JACKPOT19private alias 5 : SLOTPRIZE_EGGMAN20private alias 6 : SLOTPRIZE_KNUX // Only Sonic OR Knux can appear at any one time21private alias 7 : SLOTPRIZE_SUPER // (Unused)222324// ========================25// Static Values26// ========================2728private value SlotDisplay_needsSetup = 1293031// ========================32// Tables33// ========================3435private table SlotDisplay_sheetY_L363 // SLOTPRIZE_BAR375 // SLOTPRIZE_EGGMAN382 // SLOTPRIZE_RING391 // SLOTPRIZE_TAILS400 // SLOTPRIZE_SONIC414 // SLOTPRIZE_JACKPOT421 // SLOTPRIZE_TAILS432 // SLOTPRIZE_RING44end table4546private table SlotDisplay_sheetY_M473 // SLOTPRIZE_BAR485 // SLOTPRIZE_EGGMAN492 // SLOTPRIZE_RING501 // SLOTPRIZE_TAILS510 // SLOTPRIZE_SONIC524 // SLOTPRIZE_JACKPOT535 // SLOTPRIZE_EGGMAN540 // SLOTPRIZE_SONIC55end table5657private table SlotDisplay_sheetY_R583 // SLOTPRIZE_BAR595 // SLOTPRIZE_EGGMAN602 // SLOTPRIZE_RING611 // SLOTPRIZE_TAILS620 // SLOTPRIZE_SONIC634 // SLOTPRIZE_JACKPOT641 // SLOTPRIZE_TAILS652 // SLOTPRIZE_RING66end table6768// These tables have their values initialized in ObjectStartup6970private table SlotDisplay_sheetX_L711, 1, 1, 1, 1, 1, 1, 172end table7374private table SlotDisplay_sheetX_M751, 1, 1, 1, 1, 1, 1, 176end table7778private table SlotDisplay_sheetX_R791, 1, 1, 1, 1, 1, 1, 180end table818283// ========================84// Events85// ========================8687event ObjectDraw88// Slot L - Upper89temp0 = SlotMachine_slotPrizeL90temp0 >>= 591GetTableValue(temp1, temp0, SlotDisplay_sheetY_L)92#platform: USE_ORIGINS93GetTableValue(temp3, temp0, SlotDisplay_sheetX_L)94#endplatform95temp0 = SlotMachine_slotPrizeL96temp0 &= 3197temp2 = 3298temp2 -= temp099object.prizePivot.y = temp0100object.prizePivot.y -= 16101#platform: USE_STANDALONE102EditFrame(0, -48, object.prizePivot.y, 32, temp2, 1, temp1)103#endplatform104#platform: USE_ORIGINS105EditFrame(0, -48, object.prizePivot.y, 32, temp2, temp3, temp1)106#endplatform107108// Slot L - Lower109temp0 = SlotMachine_slotPrizeL110temp0 >>= 5111temp0++112temp0 &= 7113GetTableValue(temp1, temp0, SlotDisplay_sheetY_L)114#platform: USE_ORIGINS115GetTableValue(temp3, temp0, SlotDisplay_sheetX_L)116#endplatform117temp0 = SlotMachine_slotPrizeL118temp0 &= 31119temp2 = 32120temp2 -= temp0121temp1 += temp2122#platform: USE_STANDALONE123EditFrame(1, -48, -16, 32, temp0, 1, temp1)124#endplatform125#platform: USE_ORIGINS126EditFrame(1, -48, -16, 32, temp0, temp3, temp1)127#endplatform128129// Slot M - Upper130temp0 = SlotMachine_slotPrizeM131temp0 >>= 5132GetTableValue(temp1, temp0, SlotDisplay_sheetY_M)133#platform: USE_ORIGINS134GetTableValue(temp3, temp0, SlotDisplay_sheetX_M)135#endplatform136temp0 = SlotMachine_slotPrizeM137temp0 &= 31138temp2 = 32139temp2 -= temp0140object.prizePivot.y = temp0141object.prizePivot.y -= 16142#platform: USE_STANDALONE143EditFrame(2, -16, object.prizePivot.y, 32, temp2, 1, temp1)144#endplatform145#platform: USE_ORIGINS146EditFrame(2, -16, object.prizePivot.y, 32, temp2, temp3, temp1)147#endplatform148149// Slot M - Lower150temp0 = SlotMachine_slotPrizeM151temp0 >>= 5152temp0++153temp0 &= 7154GetTableValue(temp1, temp0, SlotDisplay_sheetY_M)155#platform: USE_ORIGINS156GetTableValue(temp3, temp0, SlotDisplay_sheetX_M)157#endplatform158temp0 = SlotMachine_slotPrizeM159temp0 &= 31160temp2 = 32161temp2 -= temp0162temp1 += temp2163#platform: USE_STANDALONE164EditFrame(3, -16, -16, 32, temp0, 1, temp1)165#endplatform166#platform: USE_ORIGINS167EditFrame(3, -16, -16, 32, temp0, temp3, temp1)168#endplatform169170// Slot R - Upper171temp0 = SlotMachine_slotPrizeR172temp0 >>= 5173GetTableValue(temp1, temp0, SlotDisplay_sheetY_R)174#platform: USE_ORIGINS175GetTableValue(temp3, temp0, SlotDisplay_sheetX_R)176#endplatform177temp0 = SlotMachine_slotPrizeR178temp0 &= 31179temp2 = 32180temp2 -= temp0181object.prizePivot.y = temp0182object.prizePivot.y -= 16183#platform: USE_STANDALONE184EditFrame(4, 16, object.prizePivot.y, 32, temp2, 1, temp1)185#endplatform186#platform: USE_ORIGINS187EditFrame(4, 16, object.prizePivot.y, 32, temp2, temp3, temp1)188#endplatform189190// Slot R - Lower191temp0 = SlotMachine_slotPrizeR192temp0 >>= 5193temp0++194temp0 &= 7195GetTableValue(temp1, temp0, SlotDisplay_sheetY_R)196#platform: USE_ORIGINS197GetTableValue(temp3, temp0, SlotDisplay_sheetX_R)198#endplatform199temp0 = SlotMachine_slotPrizeR200temp0 &= 31201temp2 = 32202temp2 -= temp0203temp1 += temp2204#platform: USE_STANDALONE205EditFrame(5, 16, -16, 32, temp0, 1, temp1)206#endplatform207#platform: USE_ORIGINS208EditFrame(5, 16, -16, 32, temp0, temp3, temp1)209#endplatform210211DrawSprite(0)212DrawSprite(1)213DrawSprite(2)214DrawSprite(3)215DrawSprite(4)216DrawSprite(5)217end event218219220event ObjectStartup221LoadSpriteSheet("CNZ/Objects.gif")222SpriteFrame(-48, -16, 32, 32, 1, 256) // Slot L (Upper) - #0223SpriteFrame(-16, -16, 32, 32, 1, 256) // Slot L (Lower) - #1224SpriteFrame( 16, -16, 32, 32, 1, 256) // Slot M (Upper) - #2225SpriteFrame(-48, -16, 32, 32, 1, 256) // Slot M (Lower) - #3226SpriteFrame(-16, -16, 32, 32, 1, 256) // Slot R (Upper) - #4227SpriteFrame( 16, -16, 32, 32, 1, 256) // Slot R (Lower) - #5228229if SlotDisplay_needsSetup == true230SlotDisplay_needsSetup = false231232temp0 = 0233while temp0 < 8234GetTableValue(temp1, temp0, SlotDisplay_sheetY_L)235GetTableValue(temp2, temp0, SlotDisplay_sheetY_M)236GetTableValue(temp3, temp0, SlotDisplay_sheetY_R)237238#platform: USE_STANDALONE239if stage.playerListPos == PLAYER_KNUCKLES_A240// Replace all Sonics with Knuckles instead241242if temp1 == SLOTPRIZE_SONIC243temp1 = SLOTPRIZE_KNUX244end if245246if temp2 == SLOTPRIZE_SONIC247temp2 = SLOTPRIZE_KNUX248end if249250if temp3 == SLOTPRIZE_SONIC251temp3 = SLOTPRIZE_KNUX252end if253end if254#endplatform255256#platform: USE_ORIGINS257switch stage.playerListPos258case PLAYER_KNUCKLES_A259// Replace all Sonics with Knuckles instead260261if temp1 == SLOTPRIZE_SONIC262temp1 = SLOTPRIZE_KNUX263end if264265if temp2 == SLOTPRIZE_SONIC266temp2 = SLOTPRIZE_KNUX267end if268269if temp3 == SLOTPRIZE_SONIC270temp3 = SLOTPRIZE_KNUX271end if272break273274case PLAYER_AMY_A275// Replace all Sonics with... Rings, and apply Amy's sprite to them276// 34 is the x position of Amy's icon in the spritesheet277278if temp1 == SLOTPRIZE_SONIC279SetTableValue(34, temp0, SlotDisplay_sheetX_L)280temp1 = SLOTPRIZE_RING281end if282283if temp2 == SLOTPRIZE_SONIC284SetTableValue(34, temp0, SlotDisplay_sheetX_M)285temp2 = SLOTPRIZE_RING286end if287288if temp3 == SLOTPRIZE_SONIC289SetTableValue(34, temp0, SlotDisplay_sheetX_R)290temp3 = SLOTPRIZE_RING291end if292break293end switch294#endplatform295296temp1 <<= 5297temp1 += 0x100298299temp2 <<= 5300temp2 += 0x100301302temp3 <<= 5303temp3 += 0x100304305SetTableValue(temp1, temp0, SlotDisplay_sheetY_L)306SetTableValue(temp2, temp0, SlotDisplay_sheetY_M)307SetTableValue(temp3, temp0, SlotDisplay_sheetY_R)308309temp0++310loop311end if312end event313314315// ========================316// Editor Events317// ========================318319event RSDKDraw320DrawSprite(0)321DrawSprite(1)322DrawSprite(2)323end event324325326event RSDKLoad327LoadSpriteSheet("CNZ/Objects.gif")328SpriteFrame(-48, -16, 32, 32, 1, 256) // Slot L - Sonic329SpriteFrame(-16, -16, 32, 32, 1, 416) // Slot M - Eggman330SpriteFrame( 16, -16, 32, 32, 1, 384) // Slot R - Jackpot!331332SetVariableAlias(ALIAS_VAR_PROPVAL, "unused")333end event334335336