-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathINFGF.C
More file actions
2785 lines (2250 loc) · 114 KB
/
Copy pathINFGF.C
File metadata and controls
2785 lines (2250 loc) · 114 KB
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/***************************************************************************
* GUNFIGHTER, AKA BRAWL. *
* *
* Lost source, reconstructed from thin air and sweat. *
* This is version 2.0A, which is pre-worldgroup. *
* *
* Disassembled, decompiled, and beautified by mallocmothra. *
* *
* Thanks to the original game authors - loved this classic! *
* Thanks to the MBBSEmu crew and romhacking.net discord. *
* Thanks to the numerous sources that still host 16-bit PC info. *
***************************************************************************/
#include "gcomm.h"
#include "majorbbs.h"
#include "infgfmsg.h"
#undef LEVEL6
/*******************************************************************************
* type definitions and type-specific constants. *
******************************************************************************/
#define BRAWL_HOLSTER_COUNT (3)
#define BRAWL_AIM_TABLE_COUNT (7)
typedef enum BRAWL_PLAYER_CONFIG_OPTION {
BRAWL_PLAYER_CONFIG_OPTION_NONE = 0,
BRAWL_PLAYER_CONFIG_OPTION_DISABLE_BRAWL = 1,
} BRAWL_PLAYER_CONFIG_OPTION;
typedef enum BRAWL_GAME_STATE {
BRAWL_GAME_STATE_SALOON_IS_OPEN = 0,
BRAWL_GAME_STATE_ROUND_IN_PROGRESS = 1,
BRAWL_GAME_STATE_SHERIFF_IS_HERE = 2,
BRAWL_GAME_STATE_SALOON_IS_CLOSED = 4,
} BRAWL_GAME_STATE;
typedef enum BRAWL_WEAPON {
BRAWL_WEAPON_COLT45 = 0,
BRAWL_WEAPON_REVOLVER = 1,
BRAWL_WEAPON_SNEAKGUN = 2,
BRAWL_WEAPON_PISTOL = 3,
BRAWL_WEAPON_SHOTGUN = 4,
BRAWL_WEAPON_GATLINGGUN = 5,
BRAWL_WEAPON_BOTTLE = 6,
BRAWL_WEAPON_CHAIR = 7,
BRAWL_WEAPON_DYNAMITE = 8,
BRAWL_WEAPON_COUNT = 9,
BRAWL_WEAPON_NONE = -1,
} BRAWL_WEAPON;
typedef enum BRAWL_COMMAND {
BRAWL_COMMAND_INV = 0,
BRAWL_COMMAND_AIM = 1,
BRAWL_COMMAND_SHOOT = 2,
BRAWL_COMMAND_DRAW = 3,
BRAWL_COMMAND_VIEW = 4,
BRAWL_COMMAND_HOLSTER = 5,
BRAWL_COMMAND_DROP = 6,
BRAWL_COMMAND_LOAD = 7,
BRAWL_COMMAND_GRAB = 8,
BRAWL_COMMAND_ESC = 9,
BRAWL_COMMAND_CALLOUT = 10,
BRAWL_COMMAND_BRAWL = 11,
BRAWL_COMMAND_HIT = 12,
BRAWL_COMMAND_LIGHT = 13,
BRAWL_COMMAND_THROW = 14,
BRAWL_COMMAND_DEFUSE = 15,
BRAWL_COMMAND_HELP = 16,
BRAWL_COMMAND_COUNT = 17,
BRAWL_COMMAND_NONE = -1,
} BRAWL_COMMAND;
typedef enum BRAWL_PLAYER_STATE {
BRAWL_PLAYER_STATE_BRAWLING = 1,
BRAWL_PLAYER_STATE_DEAD = 2,
BRAWL_PLAYER_STATE_ESCAPED = 3,
BRAWL_PLAYER_STATE_NOT_BRAWLING = -1,
} BRAWL_PLAYER_STATE;
typedef enum BRAWL_PLAYER_RANK {
BRAWL_PLAYER_RANK_GREENHORN = 0,
BRAWL_PLAYER_RANK_BORDER_RIDER = 1,
BRAWL_PLAYER_RANK_SHARPSHOOTER = 2,
BRAWL_PLAYER_RANK_GUNSLINGER = 3,
BRAWL_PLAYER_RANK_COUNT = 4,
} BRAWL_PLAYER_RANK;
typedef enum BRAWL_DYNAMITE_STATE {
BRAWL_DYNAMITE_STATE_SPAWNED = 0,
BRAWL_DYNAMITE_STATE_LIT = 1,
BRAWL_DYNAMITE_STATE_NOT_SPAWNED = -1,
} BRAWL_DYNAMITE_STATE;
typedef struct brawl_player_holster_data {
enum BRAWL_WEAPON weapon;
int ammo_in_weapon;
} brawl_player_holster_data;
typedef struct brawl_player_data {
int player_index;
enum BRAWL_PLAYER_STATE player_state;
int current_hp;
int callout_update_countdown_timer;
int aim_update_timer;
int aim_target_player_index;
enum BRAWL_COMMAND queued_command;
int queued_command_update_countdown_timer;
int queued_weapon_to_grab_or_draw;
enum BRAWL_WEAPON weapon_in_hand;
int weapon_in_hand_ammo;
int fatigue_points;
int resting_status_update_countdown_timer;
char name_of_last_killer[UIDSIZ]; // Can only really be seen when dead, but isn't cleared on round start
int shots_fired_this_round;
int shots_landed_this_round;
int bounty;
int kill_count;
int money_held;
struct brawl_player_holster_data holsters[BRAWL_HOLSTER_COUNT];
char userid[UIDSIZ];
unsigned int config_option_flags;
BRAWL_PLAYER_RANK rank;
int banked_money_held;
int banked_kill_count;
struct brawl_player_holster_data banked_holsters[BRAWL_HOLSTER_COUNT];
unsigned char unused_padding[20];
} brawl_player_data;
typedef struct brawl_command_table_entry {
char* command_name;
int time_to_escape_if_interrupted; // I think this value is bugged, and basically does nothing. See use of it in code below. TODO: Verify
int can_do_when_dead_or_escaped_or_resting;
} brawl_command_table_entry;
typedef struct brawl_weapon_table_entry {
char* weapon_name;
char* weapon_description;
int time_to_draw;
int time_to_holster;
int time_to_grab;
int time_to_load;
int ammo_capacity;
int shoot_damage_weak;
int shoot_damage_regular;
int shoot_damage_crit;
int max_hit_or_throw_damage_inclusive;
int fatigue_cost_for_hit_or_throw;
int is_destroyed_on_hit_or_throw;
int spawn_chance;
int max_spawn_count;
} brawl_weapon_table_entry;
typedef struct brawl_aim_table_entry {
char* description;
int min_aim_timer_value;
int percent_chance_to_hit;
int max_roll_weak_hit;
int max_roll_regular_hit;
int max_roll_crit;
} brawl_aim_table_entry;
typedef struct brawl_arena_state_t {
enum BRAWL_GAME_STATE game_state;
int sheriff_arrive_update_countdown_timer;
} brawl_arena_state_t;
/***************************************************************************
* constants. *
***************************************************************************/
#define BRAWL_HP_MAX (10)
#define BRAWL_HP_MIN_GOOD_SHAPE (7)
#define BRAWL_HP_MIN_HANGING_IN_THERE (4)
#define BRAWL_KILLS_UNTIL_OUTLAW_THRESHOLD (3)
#define BRAWL_BOUNTY_PER_KILL_AS_OUTLAW (50)
#define BRAWL_KILLS_UNTIL_MEANEST_THRESHOLD (5)
#define BRAWL_MONEY_UNTIL_RICHEST_THRESHOLD (101)
#define BRAWL_HP_DEADEST_THRESHOLD (-3)
#define BRAWL_TIME_TO_SHERIFF_MAX_RANDOM_TIME_TO_APPEND (9)
#define BRAWL_TIME_TO_SHERIFF_MAX_WHEN_ALL_BRAWLERS_DEAD_OR_ESCAPED (6)
#define BRAWL_STARTING_WEAPON (BRAWL_WEAPON_PISTOL)
#define BRAWL_STARTING_WEAPON_AMMO (6)
#define BRAWL_WEAPON_COUNT_MAX_TO_SPAWN_AT_ROUND_START (7)
#define BRAWL_WEAPON_COUNT_MIN_TO_SPAWN_AT_ROUND_START (2)
#define BRAWL_WEAPON_MID_ROUND_DESPAWN_COUNT_THRESHOLD (3)
#define BRAWL_WEAPON_MID_ROUND_CHANCE_DESPAWN (15)
#define BRAWL_WEAPON_MID_ROUND_SPAWN_COUNT_LIMIT (7)
#define BRAWL_WEAPON_MID_ROUND_CHANCE_SPAWN (20)
#define BRAWL_WEAPON_SPAWN_REROLL_COUNT_MAX (4)
#define BRAWL_CHANCE_TO_LAND_HIT_OR_THROW (70)
#define BRAWL_CHANCE_TO_LAND_SHOT_MAX (85)
#define BRAWL_DAMAGE_THRESHOLD_TO_TRIGGER_STUN (2)
#define BRAWL_FATIGUE_THRESHOLD_TO_TRIGGER_RESTING (5)
#define BRAWL_RESTING_STATUS_TIMER_ADDED_WHEN_FATIGUE_THRESHOLD_HIT (4)
#define BRAWL_THROW_MAX_RANDOM_FATIGUE_PENALTY (1)
#define BRAWL_BAREHANDED_DAMAGE_FOR_HIT_OR_THROW (2)
#define BRAWL_BAREHANDED_FATIGUE_FOR_HIT_OR_THROW (1)
#define BRAWL_GATLINGGUN_FIXED_AIM_TIMER_VALUE (3)
#define BRAWL_DYNAMITE_MIN_RANDOM_TIME_ON_LIGHT (3)
#define BRAWL_DYNAMITE_MAX_RANDOM_TIME_ON_LIGHT (9)
#define BRAWL_DYNAMITE_DIRECT_DAMAGE_MIN (4)
#define BRAWL_DYNAMITE_DIRECT_DAMAGE_MAX (8)
#define BRAWL_DYNAMITE_SPLASH_DAMAGE_RATIO (3)
#define BRAWL_BORDER_RIDER_GRAB_TIME_BONUS (2)
#define BRAWL_SHARPSHOOTER_CHANCE_TO_LAND_SHOT_BONUS (15)
#define BRAWL_GUNSLINGER_DRAW_TIME_BONUS (2)
#define BRAWL_NOTIFY_STILL_UNDER_AIM_THREAT_EVERY_NTH_UPDATE (2)
#define BRAWL_NOTIFY_DYNAMITE_STILL_LIT_EVERY_NTH_UPDATE (2)
#define BRAWL_NOTIFY_SHERIFF_ARRIVING_AT_TIMER_VALUE (5)
#define BRAWL_UPDATE_FREQUENCY_IN_SECONDS (5)
#define BRAWL_ADVERTISE_EVERY_NTH_USER_LOGIN (4)
#define BRAWL_DURATION_OF_MODULE_TRIAL_PERIOD_IN_DAYS (14)
#define BRAWL_HACK_OFFSET_TO_STASH_DAYS_MODULE_ACTIVE (2)
#define BRAWL_INITIAL_PLAYER_USERID_DB_FILE_LENGTH (70)
#define TELECONFERENCE_USER_SUBSTATE_ENTERING_TELECONFERENCE (0)
#define TELECONFERENCE_USER_SUBSTATE_NORMAL (1)
#define TELECONFERENCE_USER_SUBSTATE_PRIVATE_CHAT (2)
const struct brawl_command_table_entry brawl_command_table[BRAWL_COMMAND_COUNT] = {
// command_name time_to_escape_if_interrupted can_do_when_dead_or_escaped_or_resting
{ "INV", 0, 1 },
{ "AIM", 0, 0 },
{ "SHOOT", 0, 0 },
{ "DRAW", 99, 0 },
{ "VIEW", 0, 1 },
{ "HOLSTER", 99, 0 },
{ "DROP", 0, 0 },
{ "LOAD", 3, 0 },
{ "GRAB", 99, 0 },
{ "ESC", 3, 0 },
{ "CALLOUT", 0, 0 },
{ "BRAWL", 0, 1 },
{ "HIT", 0, 0 },
{ "LIGHT", 0, 0 },
{ "THROW", 0, 0 },
{ "DEFUSE", 0, 0 },
{ "HELP", 0, 1 },
};
const struct brawl_weapon_table_entry brawl_weapon_table[BRAWL_WEAPON_COUNT] = {
// weapon_name weapon_description
// time_to_draw time_to_holster time_to_grab time_to_load
// ammo_capacity shoot_damage_weak shoot_damage_regular shoot_damage_crit
// max_hit_or_throw_damage_inclusive fatigue_cost_for_hit_or_throw is_destroyed_on_hit_or_throw
// spawn_chance max_spawn_count
{ "COLT45", "Colt 45", 2, 1, 3, 3, 6, 1, 3, 4, 2, 2, 0, 10, 2, },
{ "REVOLVER", "Smith & Wesson revolver", 1, 1, 3, 3, 6, 1, 2, 4, 2, 2, 0, 20, 2, },
{ "SNEAKGUN", "sneak gun", 0, 1, 3, 3, 5, 0, 1, 3, 2, 2, 0, 30, 2, },
{ "PISTOL", "pistol", 2, 1, 3, 3, 6, 1, 2, 3, 2, 2, 0, 40, 2, },
{ "SHOTGUN", "double-barrelled shotgun", 3, 2, 4, 4, 2, 2, 3, 6, 3, 3, 0, 50, 2, },
{ "GATLINGGUN", "Gatling gun!", 0, -1, 3, 10, 10, 1, 1, 1, 3, 5, 0, 60, 1, },
{ "BOTTLE", "whiskey bottle", 0, -1, 0, -1, 0, 0, 0, 0, 2, 1, 1, 80, 4, },
{ "CHAIR", "chair", 0, -1, 2, -1, 0, 0, 0, 0, 5, 5, 1, 90, 1, },
{ "DYNAMITE", "dynamite", 0, -1, 2, -1, 0, 0, 0, 0, 1, 1, 0, 100, 1, },
};
const struct brawl_aim_table_entry brawl_aim_table[BRAWL_AIM_TABLE_COUNT] = {
// description min_aim_timer_value percent_chance_to_hit max_roll_weak_hit max_roll_regular_hit max_roll_crit
{ "lousy", 1, 15, 80, 100, 101, },
{ "awright", 2, 30, 60, 90, 100, },
{ "good", 3, 45, 40, 80, 100, },
{ "darn good", 4, 60, 20, 70, 100, },
{ "deadeye", 5, 75, 10, 60, 100, },
{ "crackshot", 6, 70, 0, 50, 100, },
{ "getting shakey", 7, 65, 0, 40, 100, },
};
const char* brawl_player_rank_names[BRAWL_PLAYER_RANK_COUNT] = {
"Greenhorn",
"Border Rider",
"Sharpshooter",
"Gunslinger",
};
/***************************************************************************
* global variables. *
***************************************************************************/
// These forward declarations are here only so the table can be filled.
// Put other forward declarations below.
int brawl_handle_user_login(void);
int brawl_handle_user_input(void);
void brawl_handle_user_disconnect(void);
void brawl_handle_midnight_cleanup(void);
void brawl_handle_user_delete_account(char* user_id);
void brawl_handle_system_shutdown(void);
struct module brawl_module = {
{ 0 },
brawl_handle_user_login, // user log-on suplement
brawl_handle_user_input, // input routine if selected
dfsthn, // status-input routine
NULL, // "injoth" routine for this module
NULL, // user logoff supplemental routine
brawl_handle_user_disconnect, // hang-up routine
brawl_handle_midnight_cleanup, // midnight clean-up
brawl_handle_user_delete_account, // delete account routine
brawl_handle_system_shutdown, // system shut-down routine
};
unsigned char brawl_advertisement_login_counter = 0;
int brawl_module_index = 0;
BRAWL_DYNAMITE_STATE brawl_dynamite_state = 0;
int brawl_dynamite_target_player_index = 0;
int brawl_dynamite_update_countdown_timer = 0;
int brawl_current_random_message_num = 0;
int brawl_weapon_current_lying_on_floor_count[BRAWL_WEAPON_COUNT] = { 0 };
struct brawl_player_data* brawl_current_aim_target_ptr = NULL; // Temporary data pointer for the player that is currently being aimed at. Why this isn't a local variable? beats me!
struct brawl_player_data* brawl_current_player_data_ptr = NULL; // Temporary data pointer for the player currently being updated. It needs to be set before some functions get called. Other functions set it themselves
struct brawl_player_data* brawl_player_data_array = NULL; // Array of all player data (made w/ malloc)
int brawl_config_is_game_advertisement_enabled = 0; // (BBCALL from INFGFMSG.MSG) Whether or not to advertise brawl to users when they log on the BBS
int brawl_config_player_default_brawl_on_value = 0; // (BBBRWLON from INFGFMSG.MSG) The default "brawl on" value when users enter teleconference
int brawl_config_time_sheriff_stay = 0; // (BBSHFLEN from INFGFMSG.MSG) Time until the sheriff leaves after arriving (in updates. see BRAWL_UPDATE_FREQUENCY_IN_SECONDS)
int brawl_config_time_to_sheriff_arrival = 0; // (BBGAMLEN from INFGFMSG.MSG) Time until the sheriff comes after a brawl starts (in updates. see BRAWL_UPDATE_FREQUENCY_IN_SECONDS)
int brawl_config_time_between_pages_to_draw = 0; // (BBCALLIV from INFGFMSG.MSG) Time between callouts of other users to play brawl (in seconds)
int brawl_unused_1 = 0; // Completely unused. Not read or written
struct brawl_arena_state_t brawl_arena_state = {
BRAWL_GAME_STATE_SALOON_IS_OPEN, // game_state
0, // time_to_sheriff
};
BTVFILE* brawl_btrieve_db_player_userid_file = NULL; // Database for saving player user ids
FILE* brawl_mcv_config_file = NULL; // Binary config file, compiled from INFGFMSG.MSG
int teleconference_module_index = 0; // Module index of the TC module, which this module will patch in an input overlay on top of
/***************************************************************************
* function forward declarations. *
***************************************************************************/
void brawl_callout_player(void);
int brawl_can_aim_weapon(void);
int brawl_can_defuse_dynamite(void);
int brawl_can_draw_weapon(void);
int brawl_can_drop_weapon(void);
int brawl_can_grab_weapon(void);
int brawl_can_hit_or_throw(void);
int brawl_can_holster_weapon(void);
int brawl_can_light_dynamite(void);
int brawl_can_load_weapon(void);
int brawl_can_shoot(void);
void brawl_cancel_aim_and_queued_command(struct brawl_player_data* target_player_data_ptr);
int brawl_check_do_action_and_maybe_start_brawl(BRAWL_COMMAND command);
void brawl_clear_player_queued_command_and_timer(struct brawl_player_data* target_player_data_ptr);
void brawl_create_player_data(void);
void brawl_despawn_most_common_weapon(void);
void brawl_do_damage_for_hit_or_throw(int damage_amount);
void brawl_do_damage_for_shoot(int param_1);
int brawl_find_module_index_by_name(char* module_name);
BRAWL_WEAPON brawl_find_weapon_index_by_name(const char* weapon_name);
int brawl_get_aim_table_index_for_timer_value(int aim_timer);
int brawl_get_fatigue_cost_for_hit_or_throw(void);
const char* brawl_get_hp_description(int hit_points);
int brawl_get_user_count_matching_name(char* name_to_match);
const char* brawl_get_weapon_name(BRAWL_WEAPON weapon);
void brawl_handle_brawl_or_help_command(void);
void brawl_handle_death(struct brawl_player_data* victim, const char* name_of_last_killer);
void brawl_handle_defuse_dynamite(void);
void brawl_handle_draw_weapon(void);
void brawl_handle_drop_weapon(void);
void brawl_handle_exploding_dynamite(void);
int brawl_handle_grab_weapon(void);
void brawl_handle_hit_or_throw(void);
void brawl_handle_light_dynamite(void);
void brawl_handle_print_inventory(void);
void brawl_handle_sheriff_arrives(void);
void brawl_handle_shoot(void);
int brawl_handle_user_input_overlay_shim(void);
void brawl_handle_view_brawlers(void);
int brawl_handle_view_command(void);
void brawl_handle_view_items(void);
void brawl_init_teleconference_overlay(void);
void brawl_output_message_to_all_brawlers(void);
void brawl_output_message_to_all_but_current_and_target_brawlers(int user_index);
void brawl_output_message_to_specified_brawler(int user_index);
BRAWL_WEAPON brawl_pick_random_weapon_to_spawn(void);
void brawl_print_aim_message_for_aimer_and_target(void);
void brawl_print_round_result(void);
void brawl_queue_new_command(void);
void brawl_reset_player_data_for_round(int user_index);
int brawl_roll_and_check_for_shot_hit(int aim_table_index);
int brawl_roll_and_get_damage_for_aim(int aim_table_index, BRAWL_WEAPON weapon);
int brawl_roll_and_get_damage_for_hit_or_throw(void);
void brawl_score_kill_and_collect_bounty(struct brawl_player_data* victim, struct brawl_player_data* killer);
void brawl_spawn_random_weapon(void);
void brawl_update(void);
void brawl_update_weapon_spawns(void);
/***************************************************************************
* function implementations. *
***************************************************************************/
void EXPORT init__brawl(void) {
int brawl_player_data_array_size;
stzcpy(brawl_module.descrp, gmdnam("INFGF.MDF"), MNMSIZ);
brawl_module_index = register_module(&brawl_module);
brawl_mcv_config_file = opnmsg("infgfmsg.mcv");
brawl_btrieve_db_player_userid_file = opnbtv("infgf.dat", BRAWL_INITIAL_PLAYER_USERID_DB_FILE_LENGTH);
brawl_player_data_array = (brawl_player_data*)alcmem(
brawl_player_data_array_size = nterms * sizeof(struct brawl_player_data)); // Doing inline to match original binary
setmem((char*)brawl_player_data_array, brawl_player_data_array_size, 0);
setmem((char*)&brawl_arena_state, sizeof(brawl_arena_state_t), 0);
brawl_arena_state.game_state = BRAWL_GAME_STATE_SALOON_IS_OPEN;
if (ynopt(BBCLOSED)) {
brawl_arena_state.game_state = BRAWL_GAME_STATE_SALOON_IS_CLOSED;
}
brawl_config_is_game_advertisement_enabled = ynopt(BBCALL);
brawl_config_player_default_brawl_on_value = ynopt(BBBRWLON);
brawl_config_time_between_pages_to_draw = numopt(BBCALLIV, 0, 32767);
brawl_config_time_to_sheriff_arrival = numopt(BBGAMLEN, 1, 32767);
brawl_config_time_sheriff_stay = numopt(BBSHFLEN, 1, 32767);
rtkick(1, brawl_init_teleconference_overlay);
rtkick(3, brawl_update);
}
void brawl_init_teleconference_overlay(void) {
// patch the teleconference module, so its user input goes to brawl instead.
// if brawl decides it cannot handle the input, it will feed it on to teleconference.
if ((teleconference_module_index = brawl_find_module_index_by_name("Teleconference")) < 0) { // Doing inline to match original binary
catastro("Gunfighter. Couldn\'t overlay teleconference");
}
shocst("Gunfighter 2.0a-TD loaded", "Overlaying teleconference %d)", teleconference_module_index);
module[brawl_module_index]->sttrou = module[teleconference_module_index]->sttrou;
module[teleconference_module_index]->sttrou = brawl_handle_user_input_overlay_shim;
}
int brawl_find_module_index_by_name(char* module_name) {
int current_module_index;
for (current_module_index = 1; current_module_index < nmods; ++current_module_index) {
if (sameto(module_name, module[current_module_index]->descrp)) {
return current_module_index;
}
}
return -1;
}
void brawl_spawn_weapons_and_set_bounty(void) {
int index;
struct brawl_player_data* current_player_data_ptr;
int max_seen_player_kill_count_player_index;
int max_seen_player_kill_count;
int current_player_kill_count;
int weapons_to_spawn_count;
max_seen_player_kill_count_player_index = -1;
max_seen_player_kill_count = -1;
brawl_dynamite_state = BRAWL_DYNAMITE_STATE_NOT_SPAWNED;
brawl_dynamite_target_player_index = -1;
for (index = 0; index < BRAWL_WEAPON_COUNT; index++) {
brawl_weapon_current_lying_on_floor_count[index] = 0;
}
weapons_to_spawn_count = rand() % (BRAWL_WEAPON_COUNT_MAX_TO_SPAWN_AT_ROUND_START + 1);
if (weapons_to_spawn_count < BRAWL_WEAPON_COUNT_MIN_TO_SPAWN_AT_ROUND_START) {
weapons_to_spawn_count = BRAWL_WEAPON_COUNT_MIN_TO_SPAWN_AT_ROUND_START;
}
if (0 < weapons_to_spawn_count) {
for (index = 0; index < weapons_to_spawn_count; ++index) {
brawl_spawn_random_weapon();
}
}
for (index = 0, current_player_data_ptr = brawl_player_data_array; index < nterms; ++index, ++current_player_data_ptr) {
if ((current_player_kill_count = current_player_data_ptr->kill_count) > max_seen_player_kill_count) { // Doing inline to match original binary
max_seen_player_kill_count = current_player_kill_count;
max_seen_player_kill_count_player_index = index;
}
}
if (BRAWL_KILLS_UNTIL_OUTLAW_THRESHOLD < max_seen_player_kill_count) {
brawl_player_data_array[max_seen_player_kill_count_player_index].bounty =
(brawl_player_data_array[max_seen_player_kill_count_player_index].kill_count - BRAWL_KILLS_UNTIL_OUTLAW_THRESHOLD) * BRAWL_BOUNTY_PER_KILL_AS_OUTLAW;
prfmsg(BBWANTED, brawl_player_data_array[max_seen_player_kill_count_player_index].userid, brawl_player_data_array[max_seen_player_kill_count_player_index].bounty);
brawl_output_message_to_all_brawlers();
}
}
int brawl_handle_user_login(void) {
int advertise_every_nth_user_login;
advertise_every_nth_user_login = BRAWL_ADVERTISE_EVERY_NTH_USER_LOGIN;
setbtv(brawl_btrieve_db_player_userid_file);
brawl_current_player_data_ptr = &brawl_player_data_array[usrnum];
if (strncmp(usaptr->userid, brawl_current_player_data_ptr->userid, UIDSIZ) != 0) {
setmem(brawl_current_player_data_ptr, sizeof(brawl_player_data), 0);
if (!acqbtv(&brawl_current_player_data_ptr->userid, usaptr->userid, 0)) { // Check if the player userid record exists for this user
brawl_create_player_data();
insbtv(&brawl_current_player_data_ptr->userid); // if not, then create it
}
brawl_reset_player_data_for_round(usrnum);
if (brawl_config_is_game_advertisement_enabled && ++brawl_advertisement_login_counter % advertise_every_nth_user_login == 0) {
// send advertisement to user
brawl_advertisement_login_counter = 0;
setmbk(brawl_mcv_config_file);
prfmsg(BRAWLLOG);
outprf(usrnum);
prf("\0");
}
}
return 0;
}
void brawl_create_player_data(void) {
int index;
setmem(brawl_current_player_data_ptr, sizeof(brawl_player_data), 0);
movmem(usaptr->userid, &brawl_current_player_data_ptr->userid, UIDSIZ);
if (brawl_config_player_default_brawl_on_value) {
brawl_current_player_data_ptr->config_option_flags = BRAWL_PLAYER_CONFIG_OPTION_NONE;
} else {
brawl_current_player_data_ptr->config_option_flags = BRAWL_PLAYER_CONFIG_OPTION_DISABLE_BRAWL;
}
index = 0;
do {
brawl_current_player_data_ptr->banked_holsters[index].weapon = BRAWL_WEAPON_NONE;
brawl_current_player_data_ptr->banked_holsters[index].ammo_in_weapon = -1;
++index;
} while (index < BRAWL_HOLSTER_COUNT);
brawl_current_player_data_ptr->banked_holsters[0].weapon = BRAWL_STARTING_WEAPON;
brawl_current_player_data_ptr->banked_holsters[0].ammo_in_weapon = BRAWL_STARTING_WEAPON_AMMO;
}
void brawl_reset_player_data_for_round(int user_index) {
struct brawl_player_data* current_player_data_ptr;
int index;
current_player_data_ptr = &brawl_player_data_array[user_index];
current_player_data_ptr->player_index = user_index;
if (current_player_data_ptr->config_option_flags & BRAWL_PLAYER_CONFIG_OPTION_DISABLE_BRAWL) {
current_player_data_ptr->player_state = BRAWL_PLAYER_STATE_NOT_BRAWLING;
} else {
current_player_data_ptr->player_state = BRAWL_PLAYER_STATE_BRAWLING;
}
current_player_data_ptr->current_hp = BRAWL_HP_MAX;
current_player_data_ptr->aim_update_timer = -1;
current_player_data_ptr->aim_target_player_index = -1;
current_player_data_ptr->queued_command = BRAWL_COMMAND_NONE;
current_player_data_ptr->queued_command_update_countdown_timer = -1;
current_player_data_ptr->queued_weapon_to_grab_or_draw = BRAWL_WEAPON_NONE;
current_player_data_ptr->weapon_in_hand = BRAWL_WEAPON_NONE;
current_player_data_ptr->weapon_in_hand_ammo = -1;
current_player_data_ptr->fatigue_points = 0;
current_player_data_ptr->resting_status_update_countdown_timer = 0;
current_player_data_ptr->shots_fired_this_round = 0;
current_player_data_ptr->shots_landed_this_round = 0;
current_player_data_ptr->bounty = 0;
index = 0;
do {
current_player_data_ptr->holsters[index].weapon = current_player_data_ptr->banked_holsters[index].weapon;
current_player_data_ptr->holsters[index].ammo_in_weapon = current_player_data_ptr->banked_holsters[index].ammo_in_weapon;
++index;
} while (index < BRAWL_HOLSTER_COUNT);
current_player_data_ptr->kill_count = current_player_data_ptr->banked_kill_count;
current_player_data_ptr->money_held = current_player_data_ptr->banked_money_held;
}
int brawl_handle_user_input_overlay_shim(void) {
// This should check the `brawl_handle_user_input()` result directly, without ` == 1`, but the original binary didn't do that
if (usrptr->substt == TELECONFERENCE_USER_SUBSTATE_NORMAL && brawl_handle_user_input() == 1) {
clrprf();
prf("");
return 1;
}
return module[brawl_module_index]->sttrou();
}
int brawl_handle_user_input(void) {
int current_command_index;
if (margc != 0) {
brawl_current_player_data_ptr = &brawl_player_data_array[usrnum];
if (sameas(margv[0], "brawl")) {
setmbk(brawl_mcv_config_file);
brawl_handle_brawl_or_help_command();
return 1;
} else if (sameas(margv[0], "help")) {
if (margc == 2 && sameas(margv[1], "brawl")) {
setmbk(brawl_mcv_config_file);
brawl_handle_brawl_or_help_command();
return 1;
} else {
return 0; // Not logically necessary, but the compiler fails to optimize this out, and the original binary had it
}
} else {
current_command_index = BRAWL_COMMAND_INV;
do {
if (sameas(margv[0], brawl_command_table[current_command_index].command_name)) {
setmbk(brawl_mcv_config_file);
// The original code would skip commands if the module had been active on the BBS for more than 14 days
// The way this was implemented was a bit hacky. The value is stored in space reserved by the MBBS-API for future use.
// This is somewhat fine, since the code could just be upgraded when the BBS is versioned, though no version checks are done in this module.
// But it could also potentially conflict with other modules, if they happen to use the same trick with the same offset.
// The original unmodified code isn't quite this, as this code is somehow one byte short, but it's probably close to this.
// TODO: Figure out the original code, and put that here.
// if (sv.spare[BRAWL_HACK_OFFSET_TO_STASH_DAYS_MODULE_ACTIVE] >= BRAWL_DURATION_OF_MODULE_TRIAL_PERIOD_IN_DAYS) {
// prfmsg(LEVEL4);
// outprf(usrnum);
// return 1;
// }
asm {
mov ax, SEG sv
mov es, ax
cmp byte ptr es:[sv.(struct sysvbl)spare + BRAWL_HACK_OFFSET_TO_STASH_DAYS_MODULE_ACTIVE], BRAWL_DURATION_OF_MODULE_TRIAL_PERIOD_IN_DAYS
// This was probably originally `JL(E) skip_trial_timeout_error`, before a binary modification was applied
jmp skip_trial_timeout_error
// This was probably originally `PUSH 0`, before a binary modification was applied, which would correspond to a LEVEL4 message
jmp skip_trial_timeout_error
db 000h
// Can't call from normal C code since the opcode to push its param got clobbered by the binary modification
call far ptr es:prfmsg
pop cx
}
outprf(usrnum);
return 1;
skip_trial_timeout_error:
if (!brawl_check_do_action_and_maybe_start_brawl(current_command_index)) {
return 1;
}
switch(current_command_index) {
case BRAWL_COMMAND_INV:
brawl_handle_print_inventory();
return 1;
case BRAWL_COMMAND_AIM:
if (!brawl_can_aim_weapon()) {
return 1;
} else {
brawl_clear_player_queued_command_and_timer(brawl_current_player_data_ptr);
brawl_print_aim_message_for_aimer_and_target();
return 1;
}
case BRAWL_COMMAND_SHOOT:
if (brawl_current_player_data_ptr->aim_target_player_index != -1) {
brawl_current_aim_target_ptr = &brawl_player_data_array[brawl_current_player_data_ptr->aim_target_player_index];
}
if (!brawl_can_shoot()) {
return 1;
} else {
brawl_handle_shoot();
if (2 <= margc && sameas(margv[1], "DBL") && brawl_current_player_data_ptr->weapon_in_hand == BRAWL_WEAPON_SHOTGUN) {
// This should check the `brawl_can_shoot()` result directly, without ` == 1`, but the original binary didn't do that
if (brawl_can_shoot() == 1) {
brawl_handle_shoot();
} else {
prf("You must have a shotgun to fire both barrels\r");
brawl_output_message_to_specified_brawler(usrnum);
}
}
brawl_cancel_aim_and_queued_command(brawl_current_player_data_ptr);
brawl_clear_player_queued_command_and_timer(brawl_current_player_data_ptr);
return 1;
}
case BRAWL_COMMAND_DRAW:
if (!brawl_can_draw_weapon()) {
return 1;
} else {
asm {
// This is a JMP queue_new_draw_or_grab_command, but opaque to the compiler
// TODO: Figure out how to get this exact code to be spit out without this hack
// In fact, I'd like to just copy/paste the code here and not have a goto at all!
DB 0ebh, 00ch
}
}
case BRAWL_COMMAND_GRAB:
if (!brawl_can_grab_weapon()) {
return 1;
} else {
queue_new_draw_or_grab_command:
brawl_cancel_aim_and_queued_command(brawl_current_player_data_ptr);
brawl_clear_player_queued_command_and_timer(brawl_current_player_data_ptr);
brawl_current_player_data_ptr->queued_command = current_command_index;
brawl_queue_new_command();
return 1;
}
case BRAWL_COMMAND_HOLSTER:
if (!brawl_can_holster_weapon()) {
return 1;
} else {
brawl_cancel_aim_and_queued_command(brawl_current_player_data_ptr);
brawl_clear_player_queued_command_and_timer(brawl_current_player_data_ptr);
brawl_current_player_data_ptr->queued_command = current_command_index;
brawl_current_player_data_ptr->queued_command_update_countdown_timer = brawl_weapon_table[brawl_current_player_data_ptr->weapon_in_hand].time_to_holster;
prf("%s is holstering the %s\r", usaptr->userid, brawl_get_weapon_name(brawl_current_player_data_ptr->weapon_in_hand));
brawl_output_message_to_all_brawlers();
return 1;
}
case BRAWL_COMMAND_VIEW:
brawl_handle_view_command();
return 1;
case BRAWL_COMMAND_DROP:
if (!brawl_can_drop_weapon()) {
return 1;
} else {
brawl_clear_player_queued_command_and_timer(brawl_current_player_data_ptr);
brawl_cancel_aim_and_queued_command(brawl_current_player_data_ptr);
brawl_handle_drop_weapon();
return 1;
}
case BRAWL_COMMAND_LIGHT:
if (!brawl_can_light_dynamite()) {
return 1;
} else {
brawl_clear_player_queued_command_and_timer(brawl_current_player_data_ptr);
brawl_cancel_aim_and_queued_command(brawl_current_player_data_ptr);
brawl_handle_light_dynamite();
return 1;
}
case BRAWL_COMMAND_DEFUSE:
if (!brawl_can_defuse_dynamite()) {
return 1;
} else {
brawl_clear_player_queued_command_and_timer(brawl_current_player_data_ptr);
brawl_cancel_aim_and_queued_command(brawl_current_player_data_ptr);
brawl_handle_defuse_dynamite();
return 1;
}
case BRAWL_COMMAND_THROW:
if (!brawl_can_hit_or_throw()) {
return 1;
} else {
if (brawl_current_player_data_ptr->weapon_in_hand == BRAWL_WEAPON_DYNAMITE && brawl_dynamite_state == BRAWL_DYNAMITE_STATE_LIT) {
brawl_dynamite_target_player_index = -1;
}
brawl_handle_hit_or_throw();
brawl_cancel_aim_and_queued_command(brawl_current_player_data_ptr);
brawl_clear_player_queued_command_and_timer(brawl_current_player_data_ptr);
return 1;
}
case BRAWL_COMMAND_LOAD:
if (!brawl_can_load_weapon()) {
return 1;
} else {
brawl_clear_player_queued_command_and_timer(brawl_current_player_data_ptr);
brawl_cancel_aim_and_queued_command(brawl_current_player_data_ptr);
brawl_current_player_data_ptr->queued_command = current_command_index;
brawl_current_player_data_ptr->queued_command_update_countdown_timer = brawl_weapon_table[brawl_current_player_data_ptr->weapon_in_hand].time_to_load;
prf("%s is reloading the %s\r", usaptr->userid, brawl_get_weapon_name(brawl_current_player_data_ptr->weapon_in_hand));
brawl_output_message_to_all_brawlers();
return 1;
}
case BRAWL_COMMAND_ESC:
brawl_clear_player_queued_command_and_timer(brawl_current_player_data_ptr);
brawl_cancel_aim_and_queued_command(brawl_current_player_data_ptr);
brawl_current_player_data_ptr->queued_command = current_command_index;
// I think this is a bug in the original code, and this is supposed to use the previous command index.
// Right now it uses `current_command_index`, which in this case I think is always going to be "esc"?
// TODO: Verify if this actually is always escape, or if it somehow grabs the previous command
brawl_current_player_data_ptr->queued_command_update_countdown_timer = brawl_command_table[current_command_index].time_to_escape_if_interrupted;
prf("%s is making a break for it!\r", usaptr->userid);
brawl_output_message_to_all_brawlers();
return 1;
case BRAWL_COMMAND_CALLOUT:
brawl_callout_player();
return 1;
case BRAWL_COMMAND_HIT:
if (!brawl_can_hit_or_throw()) {
return 1;
} else {
brawl_handle_hit_or_throw();
brawl_cancel_aim_and_queued_command(brawl_current_player_data_ptr);
brawl_clear_player_queued_command_and_timer(brawl_current_player_data_ptr);
return 1;
}
default:
return 1;
}
}
++current_command_index;
} while (current_command_index < BRAWL_COMMAND_COUNT);
}
}
return 0;
}
void brawl_queue_new_command(void) {
BRAWL_WEAPON input_specified_weapon_type;
input_specified_weapon_type = brawl_find_weapon_index_by_name(margv[1]);
switch (brawl_current_player_data_ptr->queued_command) {
case BRAWL_COMMAND_DRAW:
brawl_current_player_data_ptr->queued_command_update_countdown_timer = brawl_weapon_table[input_specified_weapon_type].time_to_draw;
brawl_current_player_data_ptr->queued_weapon_to_grab_or_draw = input_specified_weapon_type;
if (brawl_current_player_data_ptr->rank == BRAWL_PLAYER_RANK_GUNSLINGER && input_specified_weapon_type != BRAWL_WEAPON_SHOTGUN) {
brawl_current_player_data_ptr->queued_command_update_countdown_timer = brawl_current_player_data_ptr->queued_command_update_countdown_timer - BRAWL_GUNSLINGER_DRAW_TIME_BONUS;
if (brawl_current_player_data_ptr->queued_command_update_countdown_timer < 0) {
brawl_current_player_data_ptr->queued_command_update_countdown_timer = 0;
}
}
if (!brawl_current_player_data_ptr->queued_command_update_countdown_timer) {
brawl_handle_draw_weapon();
brawl_clear_player_queued_command_and_timer(brawl_current_player_data_ptr);
} else {
prf("%s is drawing a %s!\r", usaptr, brawl_get_weapon_name(input_specified_weapon_type));
brawl_output_message_to_all_brawlers();
}
break;
case BRAWL_COMMAND_GRAB:
brawl_current_player_data_ptr->queued_command_update_countdown_timer = brawl_weapon_table[input_specified_weapon_type].time_to_grab;
brawl_current_player_data_ptr->queued_weapon_to_grab_or_draw = input_specified_weapon_type;
if (BRAWL_PLAYER_RANK_BORDER_RIDER <= brawl_current_player_data_ptr->rank) {
brawl_current_player_data_ptr->queued_command_update_countdown_timer = brawl_current_player_data_ptr->queued_command_update_countdown_timer - BRAWL_BORDER_RIDER_GRAB_TIME_BONUS;
if (brawl_current_player_data_ptr->queued_command_update_countdown_timer < 0) {
brawl_current_player_data_ptr->queued_command_update_countdown_timer = 0;
}
}
if (!brawl_current_player_data_ptr->queued_command_update_countdown_timer) {
brawl_handle_grab_weapon();
brawl_clear_player_queued_command_and_timer(brawl_current_player_data_ptr);
} else {
prf("%s is going for the %s\r", usaptr, brawl_get_weapon_name(input_specified_weapon_type));
brawl_output_message_to_all_brawlers();
}
break;
default:
return;
}
}
void brawl_cancel_aim_and_queued_command(struct brawl_player_data* target_player_data_ptr) {
target_player_data_ptr->aim_update_timer = 0;
target_player_data_ptr->aim_target_player_index = -1;
if (target_player_data_ptr->queued_command == BRAWL_COMMAND_AIM) {
target_player_data_ptr->queued_command = BRAWL_COMMAND_NONE;
}
}
void brawl_clear_player_queued_command_and_timer(struct brawl_player_data* target_player_data_ptr) {
target_player_data_ptr->queued_command = BRAWL_COMMAND_NONE;
target_player_data_ptr->queued_command_update_countdown_timer = 0;
target_player_data_ptr->queued_weapon_to_grab_or_draw = BRAWL_WEAPON_NONE;
}
void brawl_handle_brawl_or_help_command(void) {
if (margc < 2) {
prfmsg(BBBRFMT);
outprf(usrnum);
return;
} else if (sameas(margv[1], "off")) {
// turning brawl off successfully
brawl_current_player_data_ptr->config_option_flags |= BRAWL_PLAYER_CONFIG_OPTION_DISABLE_BRAWL;
brawl_current_player_data_ptr->player_state = BRAWL_PLAYER_STATE_NOT_BRAWLING;
prfmsg(BBOFF);
outprf(usrnum);
return;
} else if (sameas(margv[1], "on")) {
if (brawl_current_player_data_ptr->current_hp <= 0) {
// current player is already dead and cannot act
prfmsg(BBONDEAD);
outprf(usrnum);
brawl_current_player_data_ptr->player_state = BRAWL_PLAYER_STATE_DEAD;
return;
} else if (brawl_current_player_data_ptr->player_state == BRAWL_PLAYER_STATE_ESCAPED) {
// current player has already fled and cannot act
prfmsg(BBONESC);
outprf(usrnum);
return;
} else if (brawl_current_player_data_ptr->player_state == BRAWL_PLAYER_STATE_BRAWLING) {
// current player is already brawling, and doesn't need to "brawl on" again
prfmsg(BBONBRWL);
outprf(usrnum);
return;
} else {
// turning brawl on successfully
brawl_current_player_data_ptr->config_option_flags &= ~BRAWL_PLAYER_CONFIG_OPTION_DISABLE_BRAWL;
brawl_current_player_data_ptr->player_state = BRAWL_PLAYER_STATE_BRAWLING;
prfmsg(BBON);
outprf(usrnum);
return;
}
} else if (sameas(margv[1], "help") ||
(sameas(margv[0], "help") && (sameas(margv[1], "brawl")))) {
// general help message
prfmsg(BBHLPGEN);
outprf(usrnum);
return;
} else if (sameto("act", margv[1])) {
// actions help message
prfmsg(BBHLPACT);
outprf(usrnum);