1:1 source port of the engine and game code; Windows build and system layer; docs. No game files or SDK headers.
This commit is contained in:
parent
c3b032a45a
commit
0ecb47e9cb
3871 changed files with 91080 additions and 1640063 deletions
72
port/game/SlotMachine.h
Normal file
72
port/game/SlotMachine.h
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
// Declarations for the game's SlotMachine.cpp (Chocolatier 3, Big Splash Games): SlotWheel and SlotMachine.
|
||||
// The shipped game has no header for these classes (choc3/cpp_src/SlotMachine.cpp: "no matching header"), so the
|
||||
// declarations are reconstructed from the game binary: member offsets are those of the i386 build (see the notes
|
||||
// in SlotMachine.cpp), member names are chosen here (the game binary has no member names).
|
||||
|
||||
#ifndef SLOTMACHINE_H
|
||||
#define SLOTMACHINE_H
|
||||
|
||||
#include "chocothree.h"
|
||||
#include <pf/sprite.h>
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
|
||||
//*****************************************************************************
|
||||
// One wheel of the slot machine: a column of four item sprites that scroll in steps of 200 units and settle on the
|
||||
// item given to Start. sizeof 0x54 in the game.
|
||||
class SlotWheel
|
||||
{
|
||||
public:
|
||||
SlotWheel(TVec2 position, vector<str>& items);
|
||||
void Start(uint32_t targetIndex);
|
||||
void Tick(void);
|
||||
void Draw(void);
|
||||
|
||||
int32_t unused; // 0x00 (never accessed in the game)
|
||||
uint32_t spinsLeft; // 0x04 steps still to scroll (0 = stopped)
|
||||
uint32_t speed; // 0x08 scroll units per tick
|
||||
uint32_t offset; // 0x0c scroll offset inside one step (0..199)
|
||||
TReal baseY; // 0x10 y of the wheel root sprite
|
||||
vector<str>* pItems; // 0x14 item names
|
||||
int32_t target; // 0x18 index of the item to stop on
|
||||
TSpriteRef pRoot; // 0x1c root sprite
|
||||
str names[4]; // 0x24 item names shown by the four sprites
|
||||
TSpriteRef pSprites[4]; // 0x34 item sprites
|
||||
};
|
||||
|
||||
typedef ::shared_ptr<SlotWheel> SlotWheelRef;
|
||||
|
||||
//*****************************************************************************
|
||||
// sizeof 0x140 in the game.
|
||||
class SlotMachine : public TWindow
|
||||
{
|
||||
public:
|
||||
SlotMachine(void);
|
||||
virtual ~SlotMachine();
|
||||
|
||||
virtual void PostChildrenInit(TWindowStyle& style);
|
||||
virtual bool OnTaskAnimate(void);
|
||||
virtual void Draw(void);
|
||||
|
||||
void StartMachine(uint32_t wheel1, uint32_t wheel2, uint32_t wheel3, uint32_t wheel4, TReal payout);
|
||||
void StopOne(void);
|
||||
|
||||
protected:
|
||||
bool stopped; // 0x30 all wheels have stopped
|
||||
TVec3 payoutPosition; // 0x34 where the payout particles are drawn
|
||||
TLuaParticleSystem payoutParticles; // 0x40
|
||||
int32_t unused; // 0xf8 (cleared by StartMachine, never read)
|
||||
bool payoutDone; // 0xfc
|
||||
TReal payout; // 0x100
|
||||
vector<str> items; // 0x104
|
||||
SlotWheelRef wheels[4]; // 0x110
|
||||
::shared_ptr<TLuaFunction> pOnStopped; // 0x130
|
||||
::shared_ptr<TLuaFunction> pOnPayout; // 0x138
|
||||
|
||||
private:
|
||||
SlotMachine(SlotMachine const&);
|
||||
SlotMachine& operator=(SlotMachine const&);
|
||||
PFTYPEDEF_DC(SlotMachine, TWindow);
|
||||
};
|
||||
|
||||
#endif // SLOTMACHINE_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue