This repository has been archived by the owner on Apr 19, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Poker_Header.inc
324 lines (249 loc) · 8.37 KB
/
Poker_Header.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
/*
© Los Santos Role Play 2017
Texas Hold 'em Poker
Release Candidate 1
--------------------------------------------------------------------------------
Description:
A complete Texas Hold 'em Poker mini-game
for San Andreas Multiplayer.
--------------------------------------------------------------------------------
Author(s):
Noble -
Game scripting.
San Andreas Multiplayer plugin port.
Cactus Kev -
Hand Evaluator
(http://www.suffecool.net/poker/evaluator.html)
Paul Senzee -
Hash optimizations.
--------------------------------------------------------------------------------
Special Thanks:
Los Santos Role Play development team.
San Andreas Mutliplayer development team.
Los Santos Role Play tester team.
--------------------------------------------------------------------------------
License:
Please see the enclosed LICENSE file in the repository.
*/
enum
{
STRAIGHT_FLUSH,
FOUR_OF_A_KIND,
FULL_HOUSE,
FLUSH,
STRAIGHT,
THREE_OF_A_KIND,
TWO_PAIR,
ONE_PAIR,
HIGH_CARD
};
enum POKER_GAME_POSITION {
Float: PokerX,
Float: PokerY,
Float: PokerZ
};
enum POKER_PLAYER_STATUS {
EMPTY,
LOBBY,
PLAYING, // ACTIVE
WAITING, // ACTIVE
CHECKED, // NON-AGGRESSIVE
RAISED, // AGGRESSIVE
CALLED, // NON-AGGRESSIVE
ALL_IN, // IN-ACTIVE
FOLDED, // IN-ACTIVE
SMALL_BLIND, // ACTIVE
BIG_BLIND, // ACTIVE & AGGRESSIVE
DEALER, // ACTIVE
EVALUATED,
BET
};
enum POKER_MENU_STATES
{
BET,
RAISE,
CHECK,
CALL
};
enum POKER_DIALOGS
{
SIT,
SIT_CONFIRM,
RAISE,
RAISE_CONFIRM,
CALL_CONFIRM,
CHECK_CONFIRM,
BET,
BET_CONFIRM,
STATS,
FOLD_CONFIRM,
ALL_IN_CONFIRM,
CHIPS,
CHIPS_CONFIRM
};
enum POKER_GAME_STATUS
{
LOBBY,
INITIAL_BETTING,
FLOP,
TURN,
RIVER,
EVALUATION
};
enum POKER_GAME {
bool: IS_ASSIGNED,
PLAYERS[MAX_POKER_PLAYERS],
OBJECT_ID,
POSITION[POKER_GAME_POSITION],
Text: READY_TEXTDRAWS[MAX_POKER_PLAYERS],
Text: MENU_TEXTDRAWS[MAX_POKER_MENU_ITEMS],
Text: PLAYER_STATUS_TEXTDRAWS[MAX_POKER_PLAYERS],
Text: PLAYER_CHIPS_TEXTDRAWS[MAX_POKER_PLAYERS],
Text: POT_TEXTDRAW,
Text: PLAYER_GAME_CARD_ONE_TEXTDRAW[MAX_POKER_PLAYERS],
Text: PLAYER_GAME_CARD_TWO_TEXTDRAW[MAX_POKER_PLAYERS],
Text: POKER_BLINDS_TEXTDRAW,
Text: TABLE_CARDS_TEXTDRAWS[MAX_TABLE_CARDS],
Text: TIMER_TEXTDRAW,
PlayerText: PLAYER_PRIV_CARD_ONE_TEXTDRAW[MAX_POKER_PLAYERS],
PlayerText: PLAYER_PRIV_CARD_TWO_TEXTDRAW[MAX_POKER_PLAYERS],
POKER_MENU_STATES: MENU_ITEM_ONE_STATE,
POKER_MENU_STATES: MENU_ITEM_TWO_STATE,
TABLE_CARD_VALUES[MAX_TABLE_CARDS],
PLAYER_CARD_ONE_VALUE[MAX_POKER_PLAYERS],
PLAYER_CARD_TWO_VALUE[MAX_POKER_PLAYERS],
POT,
PLAYER_CHIPS[MAX_POKER_PLAYERS],
POKER_PLAYER_STATUS: PLAYER_STATUS[MAX_POKER_PLAYERS],
BLIND,
DEALER,
SMALL_BLIND_POSITION,
BIG_BLIND_POSITION,
CURRENT_PLAYER_POSITION,
POKER_GAME_STATUS: GAME_STATUS,
CURRENT_BET,
PLAYER_POT_CONTRIBUTIONS[MAX_POKER_PLAYERS],
PLAYER_BET_CONTRIBUTIONS[MAX_POKER_PLAYERS],
LAST_AGGRESSIVE_PLAYER,
AMOUNT_OF_PLAYS,
LAST_BET,
TIMER,
TIMER_START,
BUSINESS_ID
};
new g_rgPokerGames[MAX_POKER_GAMES][POKER_GAME];
#if !defined isnull
#define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif
#define Pkr_GetObjectId(%0) \
g_rgPokerGames[%0][OBJECT_ID]
#define Pkr_SetObjectId(%0,%1) \
g_rgPokerGames[%0][OBJECT_ID] = %1
#define Pkr_ForeachGame(%0) \
for(new %0 = 0; %0 < MAX_POKER_GAMES; ++%0)
#define Pkr_ForeachTable(%0) \
for(new %0 = 0; %0 < MAX_TM_POKER_TABLES; ++%0)
#define Pkr_ForeachPlayer(%0) \
for(new %0 = 0; %0 < MAX_POKER_PLAYERS; ++%0)
#define Pkr_ForeachPlayerIdInPool(%0) \
for(new %0 = 0, poolSize = GetPlayerPoolSize(); %0 <= poolSize; ++%0)
#define Pkr_GetLastBet(%0) \
g_rgPokerGames[%0][LAST_BET]
#define Pkr_SetLastBet(%0,%1) \
g_rgPokerGames[%0][LAST_BET] = %1
#define Pkr_GetLastAggressivePlayer(%0) \
g_rgPokerGames[%0][LAST_AGGRESSIVE_PLAYER]
#define Pkr_SetLastAggressivePlayer(%0,%1) \
g_rgPokerGames[%0][LAST_AGGRESSIVE_PLAYER] = %1
#define Pkr_GetAmountOfPlays(%0) \
g_rgPokerGames[%0][AMOUNT_OF_PLAYS]
#define Pkr_SetAmountOfPlays(%0,%1) \
g_rgPokerGames[%0][AMOUNT_OF_PLAYS] = %1
#define Pkr_IncAmountOfPlays(%0) \
++g_rgPokerGames[%0][AMOUNT_OF_PLAYS]
#define Pkr_SetPlayerBetContribution(%0,%1,%2) \
g_rgPokerGames[%0][PLAYER_BET_CONTRIBUTIONS][%1] = %2
#define Pkr_GetPlayerBetContribution(%0,%1) \
g_rgPokerGames[%0][PLAYER_BET_CONTRIBUTIONS][%1]
#define Pkr_ResetPlayerBetContributions(%0) \
for(new _i = 0; _i < MAX_POKER_PLAYERS; ++_i) Pkr_SetPlayerBetContribution(%0, _i, 0)
#define Pkr_AddToPlayerBetContribution(%0,%1,%2) \
Pkr_SetPlayerBetContribution(%0, %1, Pkr_GetPlayerBetContribution(%0, %1) + %2)
#define Pkr_GetPlayerPotContribution(%0,%1) \
g_rgPokerGames[%0][PLAYER_POT_CONTRIBUTIONS][%1]
#define Pkr_SetPlayerPotContribution(%0,%1,%2) \
g_rgPokerGames[%0][PLAYER_POT_CONTRIBUTIONS][%1] = %2
#define Pkr_AddToPlayerPotContribution(%0,%1,%2) \
Pkr_SetPlayerPotContribution(%0, %1, Pkr_GetPlayerPotContribution(%0, %1) + %2)
#define Pkr_SetAllPlayerPotContribution(%0,%1) \
for(new _j = 0; _j < MAX_POKER_PLAYERS; ++_j) Pkr_SetPlayerPotContribution(%0, _j, %1)
#define Pkr_GetCurrentBet(%0) \
g_rgPokerGames[%0][CURRENT_BET]
#define Pkr_SetCurrentBet(%0,%1) \
g_rgPokerGames[%0][CURRENT_BET] = %1
#define Pkr_AddToCurrentBet(%0,%1) \
g_rgPokerGames[%0][CURRENT_BET] = Pkr_GetCurrentBet(%0) + %1
#define Pkr_GetGameStatus(%0) \
g_rgPokerGames[%0][GAME_STATUS]
#define Pkr_SetGameStatus(%0,%1) \
g_rgPokerGames[%0][GAME_STATUS] = %1
#define Pkr_GetPlayerId(%0,%1) \
g_rgPokerGames[%0][PLAYERS][%1]
#define Pkr_SetPlayerId(%0,%1,%2) \
g_rgPokerGames[%0][PLAYERS][%1] = %2
#define Pkr_GetSmallBlindPosition(%0) \
g_rgPokerGames[%0][SMALL_BLIND_POSITION]
#define Pkr_GetBigBlindPosition(%0) \
g_rgPokerGames[%0][BIG_BLIND_POSITION]
#define Pkr_SetSmallBlindPosition(%0,%1) \
g_rgPokerGames[%0][SMALL_BLIND_POSITION] = %1
#define Pkr_SetBigBlindPosition(%0,%1) \
g_rgPokerGames[%0][BIG_BLIND_POSITION] = %1
#define Pkr_GetDealerPosition(%0) \
g_rgPokerGames[%0][DEALER]
#define Pkr_SetDealerPosition(%0,%1) \
g_rgPokerGames[%0][DEALER] = %1
#define Pkr_GetCurrentPlayerPosition(%0) \
g_rgPokerGames[%0][CURRENT_PLAYER_POSITION]
#define Pkr_SetCurrentPlayerPosition(%0,%1) \
g_rgPokerGames[%0][CURRENT_PLAYER_POSITION] = %1
#define Pkr_GetPlayerChips(%0,%1) \
g_rgPokerGames[%0][PLAYER_CHIPS][%1]
#define Pkr_GetPotAmount(%0) \
g_rgPokerGames[%0][POT]
#define Pkr_AddToPot(%0,%1) \
Pkr_SetPotAmount(%0, Pkr_GetPotAmount(%0) + %1)
#define Pkr_SubFromPot(%0,%1) \
Pkr_SetPotAmount(%0, Pkr_GetPotAmount(%0) - %1)
#define Pkr_SetPokerDialog(%0,%1) \
SetPVarInt(%0, "PokerDialog", _:%1)
#define Pkr_GetPokerDialog(%0) \
GetPVarInt(%0, "PokerDialog")
#define Pkr_IsOdd(%0) \
(%0 % 2)
#define Pkr_GetTimerTextdraw(%0) \
g_rgPokerGames[%0][TIMER_TEXTDRAW]
#define Pkr_SetTimerTextdraw(%0,%1) \
g_rgPokerGames[%0][TIMER_TEXTDRAW] = %1
#define Pkr_GetTimer(%0) \
g_rgPokerGames[%0][TIMER]
#define Pkr_SetTimer(%0,%1) \
g_rgPokerGames[%0][TIMER] = %1
#define Pkr_GetTimerStart(%0) \
g_rgPokerGames[%0][TIMER_START]
#define Pkr_SetTimerStart(%0,%1) \
g_rgPokerGames[%0][TIMER_START] = %1
#define Pkr_ShowCursorForPlayerId(%0) \
SelectTextDraw(%0, COLOR_ORANGE)
#define Pkr_HideCursorForPlayerId(%0) \
CancelSelectTextDraw(playerid)
#define Pkr_SetAllPlayersNotReady(%0) \
Pkr_ForeachPlayer(playerSlot) if(Pkr_GetPlayerId(%0, playerSlot) != INVALID_PLAYER_ID) Pkr_SetPlayerNotReady(%0, playerSlot)
#define Pkr_SetRake(%0,%1) \
BizInfo[%0][BIZ_POKER_RAKE] = %1
#define Pkr_GetRake(%0) \
BizInfo[%0][BIZ_POKER_RAKE]
#define Pkr_SetBusiness(%0,%1) \
g_rgPokerGames[%0][BUSINESS_ID] = %1
#define Pkr_GetBusiness(%0) \
g_rgPokerGames[%0][BUSINESS_ID]