Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rubberduckycooly
GitHub Repository: rubberduckycooly/Sonic-1-Sonic-2-2013-Script-Decompilation
Path: blob/master/Sonic 2/Scripts/CNZ/SlotMachine.txt
1479 views
1
// ----------------------------------
2
// RSDK Project: Sonic 2
3
// Script Description: Slot Machine Object
4
// Script Author: Christian Whitehead/Simon Thomley
5
// Unpacked by Rubberduckycooly's script unpacker
6
// ----------------------------------
7
8
// ========================
9
// Aliases
10
// ========================
11
12
private alias object.value0 : object.timer
13
private alias object.value1 : object.spinSpeedL
14
private alias object.value2 : object.spinSpeedM
15
private alias object.value3 : object.spinSpeedR
16
private alias object.value4 : object.prizeTablePosL
17
private alias object.value5 : object.prizeTablePosM
18
private alias object.value6 : object.prizeTablePosR
19
private alias object.value7 : object.targetSpinSpeedL
20
private alias object.value8 : object.targetSpinSpeedM
21
private alias object.value9 : object.targetSpinSpeedR
22
private alias object.value10 : object.activeSlot
23
private alias object.value11 : object.slotSpinTimer
24
private alias object.value12 : object.rewardRingCount
25
26
// States
27
private alias 0 : SLOTMACHINE_IDLE
28
private alias 1 : SLOTMACHINE_READY
29
private alias 2 : SLOTMACHINE_HOLD
30
private alias 3 : SLOTMACHINE_UNUSED
31
private alias 4 : SLOTMACHINE_REWARD
32
private alias 5 : SLOTMACHINE_WAIT
33
34
// Active Slots
35
private alias 0 : SLOTMACHINE_SLOT_L
36
private alias 1 : SLOTMACHINE_SLOT_M
37
private alias 2 : SLOTMACHINE_SLOT_R
38
39
// Slot Spin Timer Aliases
40
private alias 0 : SLOTMACHINE_SLOTTIMER_SPIN // Spinning, attempting to stop
41
private alias 3 : SLOTMACHINE_SLOTTIMER_SLOW // Stopping in progress, Bounce it back for a few frames
42
private alias 6 : SLOTMACHINE_SLOTTIMER_STOP // Stop Slot Movement all together
43
private alias 7 : SLOTMACHINE_SLOTTIMER_CALC // Calculating Rewards (Only happens on slot R)
44
45
// SlotDisplay FrameIDs
46
private alias 0 : SLOTPRIZE_SONIC
47
private alias 1 : SLOTPRIZE_TAILS
48
private alias 2 : SLOTPRIZE_RING
49
private alias 3 : SLOTPRIZE_BAR
50
private alias 4 : SLOTPRIZE_JACKPOT
51
private alias 5 : SLOTPRIZE_EGGMAN
52
private alias 6 : SLOTPRIZE_KNUX // Only Sonic OR Knux can appear at any one time
53
private alias 7 : SLOTPRIZE_SUPER // (Unused)
54
55
// SlotPrize Aliases
56
private alias object.value0 : slotPrize.originPos.x
57
private alias object.value1 : slotPrize.originPos.y
58
private alias object.value2 : slotPrize.timer
59
60
// SlotPrize States
61
private alias 0 : SLOTPRIZE_WINNER
62
private alias 1 : SLOTPRIZE_LOSER
63
64
// Player Aliases
65
private alias object.state : player.state
66
private alias object.xpos : player.xpos
67
private alias object.ypos : player.ypos
68
private alias object.xvel : player.xvel
69
private alias object.yvel : player.yvel
70
private alias object.speed : player.speed
71
private alias object.gravity : player.gravity
72
private alias object.animationSpeed : player.animationSpeed
73
private alias object.animation : player.animation
74
private alias object.value16 : player.isSidekick
75
private alias object.value17 : debugMode.currentSelection
76
77
// Global Variable ID Aliases
78
private alias 22 : GLOBAL_PLAYERSCORE
79
80
// Achievement Aliases
81
private alias 4 : ACHIEVEMENT_HITITBIG
82
83
84
// ========================
85
// Function Declarations
86
// ========================
87
88
reserve function SlotMachine_PlayRingSfx
89
reserve function SlotMachine_DebugDraw
90
reserve function SlotMachine_DebugSpawn
91
92
93
// ========================
94
// Static Values
95
// ========================
96
97
public value SlotMachine_slotPrizeL = 0
98
public value SlotMachine_slotPrizeM = 0
99
public value SlotMachine_slotPrizeR = 0
100
private value SlotMachine_startDebugID = 0
101
102
103
// ========================
104
// Tables
105
// ========================
106
107
public table SlotMachine_prizeLTable
108
3 // SLOTPRIZE_BAR
109
5 // SLOTPRIZE_EGGMAN
110
2 // SLOTPRIZE_RING
111
1 // SLOTPRIZE_TAILS
112
0 // SLOTPRIZE_SONIC
113
4 // SLOTPRIZE_JACKPOT
114
1 // SLOTPRIZE_TAILS
115
2 // SLOTPRIZE_RING
116
end table
117
118
public table SlotMachine_prizeMTable
119
3 // SLOTPRIZE_BAR
120
5 // SLOTPRIZE_EGGMAN
121
2 // SLOTPRIZE_RING
122
1 // SLOTPRIZE_TAILS
123
0 // SLOTPRIZE_SONIC
124
4 // SLOTPRIZE_JACKPOT
125
5 // SLOTPRIZE_EGGMAN
126
0 // SLOTPRIZE_SONIC
127
end table
128
129
public table SlotMachine_prizeRTable
130
3 // SLOTPRIZE_BAR
131
5 // SLOTPRIZE_EGGMAN
132
2 // SLOTPRIZE_RING
133
1 // SLOTPRIZE_TAILS
134
0 // SLOTPRIZE_SONIC
135
4 // SLOTPRIZE_JACKPOT
136
1 // SLOTPRIZE_TAILS
137
2 // SLOTPRIZE_RING
138
end table
139
140
public table SlotMachine_slotRewardTable
141
30 // SLOTPRIZE_SONIC
142
25 // SLOTPRIZE_TAILS
143
10 // SLOTPRIZE_RING
144
20 // SLOTPRIZE_BAR
145
150 // SLOTPRIZE_JACKPOT
146
-1 // SLOTPRIZE_EGGMAN
147
end table
148
149
// (note for the above table - Knuckles is Sonic, and Amy is ring)
150
151
private table SlotMachine_randomizeTable
152
8, 0, 0, 0, 18, 4, 4, 4, 18, 3, 3, 3, 36, 2, 2, 2
153
30, 5, 5, 5, 30, 1, 1, 1, 0xFF, 15, 15, 15
154
end table
155
156
157
// ========================
158
// Function Definitions
159
// ========================
160
161
private function SlotMachine_PlayRingSfx
162
if ringPan == 0
163
PlaySfx(SfxName[Ring L], false)
164
SetSfxAttributes(SfxName[Ring L], -1, -100)
165
ringPan = 1
166
else
167
PlaySfx(SfxName[Ring R], false)
168
SetSfxAttributes(SfxName[Ring R], -1, 100)
169
ringPan = 0
170
end if
171
end function
172
173
174
private function SlotMachine_DebugDraw
175
DrawSprite(0)
176
end function
177
178
179
private function SlotMachine_DebugSpawn
180
temp0 = debugMode[0].currentSelection
181
temp0 -= SlotMachine_startDebugID
182
CreateTempObject(TypeName[Slot Machine], temp0, object.xpos, object.ypos)
183
object[tempObjectPos].drawOrder = 5
184
end function
185
186
187
// ========================
188
// Events
189
// ========================
190
191
event ObjectUpdate
192
switch object.state
193
case SLOTMACHINE_IDLE
194
object.frame = 0
195
break
196
197
case SLOTMACHINE_READY
198
object.frame = object.animationTimer
199
object.frame >>= 1
200
object.animationTimer++
201
object.animationTimer &= 3
202
203
temp0 = object.timer
204
temp0 &= 0xF
205
if temp0 == 0xF
206
CreateTempObject(TypeName[Object Score], 0, object.xpos, object.ypos)
207
object[tempObjectPos].drawOrder = 4
208
PlaySfx(SfxName[Slot Machine], false)
209
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
210
if player[currentPlayer].state == Player_State_Static
211
BoxCollisionTest(C_TOUCH, object.entityPos, -24, -20, 24, 20, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
212
if checkResult == true
213
// global variable "array" (yes, this is actually how its done)
214
arrayPos0 = GLOBAL_PLAYERSCORE
215
#platform: USE_DECOMP
216
arrayPos0 = VarName[player.score]
217
#endplatform
218
if player[currentPlayer].isSidekick == false
219
arrayPos0 += currentPlayer
220
end if
221
global[arrayPos0] += 100
222
end if
223
end if
224
next
225
end if
226
227
object.timer++
228
if object.timer == 128
229
object.timer = 0
230
object.state = SLOTMACHINE_WAIT
231
object.priority = PRIORITY_BOUNDS
232
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
233
if player[currentPlayer].state == Player_State_Static
234
BoxCollisionTest(C_TOUCH, object.entityPos, -24, -20, 24, 20, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
235
if checkResult == true
236
#platform: USE_STANDALONE
237
player[currentPlayer].state = Player_State_Air
238
#endplatform
239
#platform: USE_ORIGINS
240
player[currentPlayer].state = Player_State_Air_NoDropDash
241
#endplatform
242
player[currentPlayer].gravity = GRAVITY_AIR
243
end if
244
end if
245
next
246
end if
247
break
248
249
case SLOTMACHINE_HOLD
250
object.frame = object.animationTimer
251
object.frame >>= 1
252
object.animationTimer++
253
object.animationTimer &= 3
254
255
temp0 = oscillation
256
temp0 &= 0xF
257
if temp0 == 0xF
258
PlaySfx(SfxName[Slot Machine], false)
259
end if
260
261
temp0 &= 7
262
if temp0 == 0
263
if object.spinSpeedL < object.targetSpinSpeedL
264
object.spinSpeedL++
265
end if
266
267
if object.spinSpeedM < object.targetSpinSpeedM
268
object.spinSpeedM++
269
end if
270
271
if object.spinSpeedR < object.targetSpinSpeedR
272
object.spinSpeedR++
273
end if
274
end if
275
276
SlotMachine_slotPrizeL += object.spinSpeedL
277
SlotMachine_slotPrizeL &= 0xFF
278
SlotMachine_slotPrizeM += object.spinSpeedM
279
SlotMachine_slotPrizeM &= 0xFF
280
SlotMachine_slotPrizeR += object.spinSpeedR
281
SlotMachine_slotPrizeR &= 0xFF
282
283
if object.timer != 0
284
object.timer--
285
else
286
if object.slotSpinTimer != 0
287
object.slotSpinTimer++
288
end if
289
290
switch object.activeSlot
291
case SLOTMACHINE_SLOT_L
292
switch object.slotSpinTimer
293
case SLOTMACHINE_SLOTTIMER_SPIN
294
temp0 = SlotMachine_slotPrizeL
295
temp0 >>= 5
296
if temp0 == object.prizeTablePosL
297
temp0 = SlotMachine_slotPrizeL
298
temp0 &= 0x1F
299
if temp0 < object.spinSpeedL
300
object.spinSpeedL = 2
301
object.targetSpinSpeedL = 2
302
PlaySfx(SfxName[Catch], false)
303
object.slotSpinTimer++
304
end if
305
end if
306
break
307
308
case SLOTMACHINE_SLOTTIMER_SLOW
309
object.spinSpeedL = -2
310
object.targetSpinSpeedL = -2
311
break
312
313
case SLOTMACHINE_SLOTTIMER_STOP
314
object.spinSpeedL = 0
315
object.targetSpinSpeedL = 0
316
object.slotSpinTimer = 0
317
object.activeSlot++
318
break
319
end switch
320
break
321
322
case SLOTMACHINE_SLOT_M
323
switch object.slotSpinTimer
324
case SLOTMACHINE_SLOTTIMER_SPIN
325
GetBit(temp0, SlotMachine_slotPrizeL, 4)
326
if temp0 == true
327
SlotMachine_slotPrizeL += 0x20
328
SlotMachine_slotPrizeL &= 0xFF
329
end if
330
SlotMachine_slotPrizeL &= 0xE0
331
332
temp0 = SlotMachine_slotPrizeM
333
temp0 >>= 5
334
if temp0 == object.prizeTablePosM
335
temp0 = SlotMachine_slotPrizeM
336
temp0 &= 0x1F
337
if temp0 < object.spinSpeedM
338
object.spinSpeedM = 2
339
object.targetSpinSpeedM = 2
340
PlaySfx(SfxName[Catch], false)
341
object.slotSpinTimer++
342
end if
343
end if
344
break
345
346
case SLOTMACHINE_SLOTTIMER_SLOW
347
object.spinSpeedM = -2
348
object.targetSpinSpeedM = -2
349
break
350
351
case SLOTMACHINE_SLOTTIMER_STOP
352
object.spinSpeedM = 0
353
object.targetSpinSpeedM = 0
354
object.slotSpinTimer = 0
355
object.activeSlot++
356
break
357
end switch
358
break
359
360
case SLOTMACHINE_SLOT_R
361
switch object.slotSpinTimer
362
case SLOTMACHINE_SLOTTIMER_SPIN
363
GetBit(temp0, SlotMachine_slotPrizeM, 4)
364
if temp0 == true
365
SlotMachine_slotPrizeM += 0x20
366
SlotMachine_slotPrizeM &= 0xFF
367
end if
368
SlotMachine_slotPrizeM &= 0xE0
369
370
temp0 = SlotMachine_slotPrizeR
371
temp0 >>= 5
372
if temp0 == object.prizeTablePosR
373
temp0 = SlotMachine_slotPrizeR
374
temp0 &= 0x1F
375
if temp0 < object.spinSpeedR
376
object.spinSpeedR = 2
377
object.targetSpinSpeedR = 2
378
PlaySfx(SfxName[Catch], false)
379
object.slotSpinTimer++
380
end if
381
end if
382
break
383
384
case SLOTMACHINE_SLOTTIMER_SLOW
385
object.spinSpeedR = -2
386
object.targetSpinSpeedR = -2
387
break
388
389
case SLOTMACHINE_SLOTTIMER_STOP
390
object.spinSpeedR = 0
391
object.targetSpinSpeedR = 0
392
break
393
394
case SLOTMACHINE_SLOTTIMER_CALC
395
GetBit(temp0, SlotMachine_slotPrizeR, 4)
396
if temp0 == true
397
SlotMachine_slotPrizeR += 0x20
398
SlotMachine_slotPrizeR &= 0xFF
399
end if
400
SlotMachine_slotPrizeR &= 0xE0
401
402
// All Slots Stopped, its prize time!
403
object.slotSpinTimer = 0
404
object.activeSlot = SLOTMACHINE_SLOT_L
405
object.state = SLOTMACHINE_REWARD
406
407
GetTableValue(temp1, object.prizeTablePosL, SlotMachine_prizeLTable) // temp1 == prizeL
408
GetTableValue(temp2, object.prizeTablePosM, SlotMachine_prizeMTable) // temp2 == prizeM
409
GetTableValue(temp3, object.prizeTablePosR, SlotMachine_prizeRTable) // temp3 == prizeR
410
411
// 3 Jackpots, You've hit it big!
412
#platform: USE_STANDALONE
413
if stage.debugMode == false
414
if temp1 == temp2
415
if temp2 == temp3
416
if temp1 == SLOTPRIZE_JACKPOT
417
// Grant the "Hit it Big" Achievement
418
CallNativeFunction2(SetAchievement, ACHIEVEMENT_HITITBIG, 100)
419
end if
420
end if
421
end if
422
end if
423
#endplatform
424
#platform: USE_ORIGINS
425
// origins removed the debug mode check LOL
426
if temp1 == temp2
427
if temp2 == temp3
428
if temp1 == SLOTPRIZE_JACKPOT
429
CallNativeFunction4(NotifyCallback, NOTIFY_STATS_PARAM_1, 1, 0, 0)
430
end if
431
end if
432
end if
433
#endplatform
434
435
object.rewardRingCount = 0
436
if temp1 == temp2 // PrizeL == PrizeM
437
if temp2 == temp3 // PrizeM == PrizeR
438
GetTableValue(object.rewardRingCount, temp1, SlotMachine_slotRewardTable)
439
else
440
if temp1 == SLOTPRIZE_JACKPOT // PrizeM != PrizeR && PrizeL == Jackpot
441
GetTableValue(object.rewardRingCount, temp3, SlotMachine_slotRewardTable)
442
object.rewardRingCount <<= 2
443
else
444
if temp3 == SLOTPRIZE_JACKPOT // PrizeM != PrizeR && PrizeR == Jackpot
445
GetTableValue(object.rewardRingCount, temp1, SlotMachine_slotRewardTable)
446
object.rewardRingCount <<= 1
447
end if
448
end if
449
end if
450
else
451
if temp1 == temp3 // PrizeL == PrizeR
452
if temp1 == SLOTPRIZE_JACKPOT // PrizeL == PrizeR && PrizeL != PrizeM && PrizeL == Jackpot
453
GetTableValue(object.rewardRingCount, temp2, SlotMachine_slotRewardTable)
454
object.rewardRingCount <<= 2
455
else
456
if temp2 == SLOTPRIZE_JACKPOT // PrizeL == PrizeR && PrizeL != PrizeM && PrizeR == Jackpot
457
GetTableValue(object.rewardRingCount, temp1, SlotMachine_slotRewardTable)
458
object.rewardRingCount <<= 1
459
end if
460
end if
461
else
462
if temp2 == temp3 // PrizeM == PrizeR
463
if temp2 == SLOTPRIZE_JACKPOT // PrizeM == PrizeR && PrizeL != PrizeM && PrizeL != PrizeR && PrizeM == Jackpot
464
GetTableValue(object.rewardRingCount, temp1, SlotMachine_slotRewardTable)
465
object.rewardRingCount <<= 2
466
else
467
if temp1 == SLOTPRIZE_JACKPOT // PrizeM == PrizeR && PrizeL != PrizeM && PrizeL != PrizeR && PrizeL == Jackpot
468
GetTableValue(object.rewardRingCount, temp2, SlotMachine_slotRewardTable)
469
object.rewardRingCount <<= 1
470
end if
471
end if
472
end if
473
end if
474
end if
475
476
// if no jackpot at all, but we have a BAR...
477
if object.rewardRingCount == 0
478
if temp1 == SLOTPRIZE_BAR
479
object.rewardRingCount += 2
480
end if
481
482
if temp2 == SLOTPRIZE_BAR
483
object.rewardRingCount += 2
484
end if
485
486
if temp3 == SLOTPRIZE_BAR
487
object.rewardRingCount += 2
488
end if
489
end if
490
491
// Eggman...
492
if object.rewardRingCount < 0
493
object.rewardRingCount = -100
494
end if
495
496
497
// No Rings...?
498
if object.rewardRingCount == 0
499
object.timer = 1
500
else
501
if object.rewardRingCount > 0 // Winner!!!
502
object.timer = 26
503
else // Loser...
504
object.timer = 30
505
end if
506
end if
507
break
508
end switch
509
break
510
end switch
511
end if
512
break
513
514
case SLOTMACHINE_REWARD
515
object.frame = object.animationTimer
516
object.frame >>= 1
517
object.animationTimer++
518
object.animationTimer &= 3
519
if object.rewardRingCount == 0
520
object.timer--
521
if object.timer <= 0
522
object.angle = 0
523
object.priority = PRIORITY_BOUNDS
524
object.state = SLOTMACHINE_WAIT
525
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
526
if player[currentPlayer].state == Player_State_Static
527
BoxCollisionTest(C_TOUCH, object.entityPos, -24, -20, 24, 20, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
528
if checkResult == true
529
#platform: USE_STANDALONE
530
player[currentPlayer].state = Player_State_Air
531
#endplatform
532
#platform: USE_ORIGINS
533
player[currentPlayer].state = Player_State_Air_NoDropDash
534
#endplatform
535
player[currentPlayer].gravity = GRAVITY_AIR
536
end if
537
end if
538
next
539
end if
540
else
541
GetBit(temp0, oscillation, 0)
542
if temp0 == false
543
Cos256(temp0, object.angle)
544
temp0 <<= 15
545
temp0 += object.xpos
546
547
Sin256(temp1, object.angle)
548
temp1 <<= 15
549
temp1 += object.ypos
550
551
CreateTempObject(TypeName[Slot Prize], 0, temp0, temp1)
552
slotPrize[tempObjectPos].originPos.x = object.xpos
553
slotPrize[tempObjectPos].originPos.y = object.ypos
554
object[tempObjectPos].inkEffect = INK_ALPHA
555
if object.rewardRingCount > 0
556
slotPrize[tempObjectPos].timer = 26
557
object.angle += 0x89
558
object.rewardRingCount--
559
else
560
slotPrize[tempObjectPos].timer = 30
561
object[tempObjectPos].state = SLOTPRIZE_LOSER
562
object[tempObjectPos].frame = 8
563
object.angle += 0x90
564
object.rewardRingCount++
565
end if
566
object.angle &= 0xFF
567
end if
568
end if
569
break
570
571
case SLOTMACHINE_WAIT
572
object.frame = 0
573
object.timer++
574
if object.timer == 30
575
object.timer = 0
576
object.state = SLOTMACHINE_IDLE
577
end if
578
break
579
580
end switch
581
582
if object.state == SLOTMACHINE_WAIT
583
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
584
BoxCollisionTest(C_SOLID, object.entityPos, -24, -20, -17, 20, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
585
BoxCollisionTest(C_SOLID, object.entityPos, 17, -20, 24, 20, currentPlayer, C_BOX, C_BOX, C_BOX, C_BOX)
586
next
587
else
588
foreach (GROUP_PLAYERS, currentPlayer, ACTIVE_ENTITIES)
589
BoxCollisionTest(C_SOLID, object.entityPos, -24, -20, 24, 20, currentPlayer, C_BOX, -12, C_BOX, 12)
590
switch checkResult
591
case COL_TOP
592
case COL_BOTTOM
593
if object.state == SLOTMACHINE_IDLE
594
object.priority = PRIORITY_ACTIVE
595
if object.propertyValue == 0
596
object.state = SLOTMACHINE_READY
597
else
598
object.state = SLOTMACHINE_HOLD
599
if options.vsMode == false
600
Rand(object.targetSpinSpeedL, 4)
601
object.targetSpinSpeedL += 2
602
Rand(object.targetSpinSpeedM, 4)
603
object.targetSpinSpeedM += 2
604
Rand(object.targetSpinSpeedR, 4)
605
object.targetSpinSpeedR += 2
606
Rand(object.timer, 16)
607
else
608
vs.randomValue *= 1103515245
609
vs.randomValue += 12345
610
vs.randomValue &= 0x7FFFFFFF
611
object.targetSpinSpeedL = vs.randomValue
612
object.targetSpinSpeedL >>= 16
613
object.targetSpinSpeedL &= 3
614
object.targetSpinSpeedL += 2
615
616
vs.randomValue *= 1103515245
617
vs.randomValue += 12345
618
vs.randomValue &= 0x7FFFFFFF
619
object.targetSpinSpeedM = vs.randomValue
620
object.targetSpinSpeedM >>= 16
621
object.targetSpinSpeedM &= 3
622
object.targetSpinSpeedM += 2
623
624
vs.randomValue *= 1103515245
625
vs.randomValue += 12345
626
vs.randomValue &= 0x7FFFFFFF
627
object.targetSpinSpeedR = vs.randomValue
628
object.targetSpinSpeedR >>= 16
629
object.targetSpinSpeedR &= 3
630
object.targetSpinSpeedR += 2
631
632
vs.randomValue *= 1103515245
633
vs.randomValue += 12345
634
vs.randomValue &= 0x7FFFFFFF
635
object.timer = vs.randomValue
636
object.timer >>= 16
637
object.timer &= 15
638
end if
639
object.timer += 14
640
object.timer *= 3
641
642
temp0 = 0
643
temp1 = 0
644
temp2 = oscillation
645
temp2 &= 0xFF
646
while temp1 != 0xFF
647
GetTableValue(temp1, temp0, SlotMachine_randomizeTable)
648
temp2 -= temp1
649
if temp2 >= 0
650
temp0 += 4
651
else
652
temp1 = 0xFF
653
end if
654
loop
655
656
GetTableValue(temp1, temp0, SlotMachine_randomizeTable)
657
if temp1 != 0xFF
658
temp0++
659
GetTableValue(object.prizeTablePosL, temp0, SlotMachine_randomizeTable)
660
661
temp0++
662
GetTableValue(object.prizeTablePosM, temp0, SlotMachine_randomizeTable)
663
664
temp0++
665
GetTableValue(object.prizeTablePosR, temp0, SlotMachine_randomizeTable)
666
else
667
if options.vsMode == false
668
Rand(object.prizeTablePosL, 8)
669
Rand(object.prizeTablePosM, 8)
670
Rand(object.prizeTablePosR, 8)
671
else
672
vs.randomValue *= 1103515245
673
vs.randomValue += 2758389
674
vs.randomValue &= 0x7FFFFFFF
675
object.prizeTablePosL = vs.randomValue
676
object.prizeTablePosL >>= 16
677
object.prizeTablePosL &= 7
678
679
vs.randomValue *= 1103515245
680
vs.randomValue += 12568
681
vs.randomValue &= 0x7FFFFFFF
682
object.prizeTablePosM = vs.randomValue
683
object.prizeTablePosM >>= 16
684
object.prizeTablePosM &= 7
685
686
vs.randomValue *= 1103515245
687
vs.randomValue += 1284239
688
vs.randomValue &= 0x7FFFFFFF
689
object.prizeTablePosR = vs.randomValue
690
object.prizeTablePosR >>= 16
691
object.prizeTablePosR &= 7
692
end if
693
end if
694
end if
695
end if
696
697
player[currentPlayer].state = Player_State_Static
698
player[currentPlayer].animation = ANI_JUMPING
699
player[currentPlayer].gravity = 1
700
player[currentPlayer].animationSpeed = 40
701
player[currentPlayer].speed = 0
702
player[currentPlayer].xvel = 0
703
player[currentPlayer].yvel = 1 // just 1? that's a really small yvel..
704
player[currentPlayer].xpos = object.xpos
705
player[currentPlayer].ypos = object.ypos
706
break
707
end switch
708
next
709
end if
710
end event
711
712
713
event ObjectDraw
714
DrawSprite(object.frame)
715
end event
716
717
718
event ObjectStartup
719
LoadSpriteSheet("CNZ/Objects.gif")
720
SpriteFrame(-24, -20, 48, 40, 1, 99)
721
SpriteFrame(-24, -20, 48, 40, 50, 99)
722
723
foreach (TypeName[Slot Machine], arrayPos0, ALL_ENTITIES)
724
object[arrayPos0].drawOrder = 5
725
next
726
727
// Randomize the initial slot prize displays
728
if options.vsMode == false
729
Rand(SlotMachine_slotPrizeL, 8)
730
SlotMachine_slotPrizeL <<= 5
731
Rand(SlotMachine_slotPrizeM, 8)
732
SlotMachine_slotPrizeM <<= 5
733
Rand(SlotMachine_slotPrizeR, 8)
734
SlotMachine_slotPrizeR <<= 5
735
else
736
vs.randomValue *= 1103515245
737
vs.randomValue += 12345
738
vs.randomValue &= 0x7FFFFFFF
739
SlotMachine_slotPrizeL = vs.randomValue
740
SlotMachine_slotPrizeL >>= 16
741
SlotMachine_slotPrizeL &= 7
742
SlotMachine_slotPrizeL <<= 5
743
744
vs.randomValue *= 1103515245
745
vs.randomValue += 12345
746
vs.randomValue &= 0x7FFFFFFF
747
SlotMachine_slotPrizeM = vs.randomValue
748
SlotMachine_slotPrizeM >>= 16
749
SlotMachine_slotPrizeM &= 7
750
SlotMachine_slotPrizeM <<= 5
751
752
vs.randomValue *= 1103515245
753
vs.randomValue += 12345
754
vs.randomValue &= 0x7FFFFFFF
755
SlotMachine_slotPrizeR = vs.randomValue
756
SlotMachine_slotPrizeR >>= 16
757
SlotMachine_slotPrizeR &= 7
758
SlotMachine_slotPrizeR <<= 5
759
end if
760
761
temp0 = 0
762
SlotMachine_startDebugID = DebugMode_ObjCount
763
while temp0 < 2
764
SetTableValue(TypeName[Slot Machine], DebugMode_ObjCount, DebugMode_TypesTable)
765
SetTableValue(SlotMachine_DebugDraw, DebugMode_ObjCount, DebugMode_DrawTable)
766
SetTableValue(SlotMachine_DebugSpawn, DebugMode_ObjCount, DebugMode_SpawnTable)
767
DebugMode_ObjCount++
768
temp0++
769
loop
770
end event
771
772
773
// ========================
774
// Editor Events
775
// ========================
776
777
event RSDKEdit
778
if editor.returnVariable == true
779
switch editor.variableID
780
case EDIT_VAR_PROPVAL // property value
781
checkResult = object.propertyValue
782
break
783
784
case 0 // type
785
checkResult = object.propertyValue
786
break
787
788
end switch
789
else
790
switch editor.variableID
791
case EDIT_VAR_PROPVAL // property value
792
object.propertyValue = editor.variableValue
793
break
794
795
case 0 // type
796
object.propertyValue = editor.variableValue
797
break
798
799
end switch
800
end if
801
end event
802
803
804
event RSDKDraw
805
DrawSprite(0)
806
end event
807
808
809
event RSDKLoad
810
LoadSpriteSheet("CNZ/Objects.gif")
811
SpriteFrame(-24, -20, 48, 40, 1, 99)
812
813
AddEditorVariable("type")
814
SetActiveVariable("type")
815
AddEnumVariable("Slot Combo Machine", 0)
816
AddEnumVariable("Slot Prize Machine", 1)
817
end event
818
819