-
Notifications
You must be signed in to change notification settings - Fork 0
/
CHARSEL.CPP
2463 lines (2059 loc) · 62.1 KB
/
CHARSEL.CPP
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
/* ========================================================================
Copyright (c) 1990,1996 Synergistic Software
All Rights Reserved
========================================================================
Filename: CharSel.cpp
Author: Michael Branham
========================================================================
Contains the following general functions:
void DomainNewGame (LONG, LONG)
void DisplayRealmSelection(void)
void SelectRegent(LONG, LONG)
void EndSelectDomain(void)
void BeginRule(LONG, LONG)
void SelectAdvParty(void)
®RM250¯======================================================================= */
/* ------------------------------------------------------------------------
Includes
------------------------------------------------------------------------ */
#ifdef _WINDOWS
#include <Windows.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <io.h>
#include <stdlib.h>
#include "TYPEDEFS.H"
#include "SYSTEM.H"
#include "CHARSEL.HXX"
#include "GAME.H"
#include "GAMEMAP.HXX"
#include "GAMETYPE.HXX"
#include "HANDLE.HXX"
#include "INVNGUI.HXX"
#include "LOADSAVE.HXX"
#include "MAPAI.HXX"
#include "MULTIUI.HXX"
#include "MULTIMAP.HXX"
#include "REGENTS.HXX"
#include "MENU.H"
#include "PANEL.H"
#include "REQUEST.H"
#include "PLAYSTAT.HXX"
#include "REALM.HXX"
#include "REPORT.HXX"
#include "SOUND.HXX"
#include "strenum.h"
#include "STRMGR.H"
#include "UNITS.HXX"
#include "CONTEXT.HXX"
#include "PROVTAX.H"
#include "PLACES.HXX"
#ifdef _WINDOWS
#include "WINSYS\MULPLAY.HXX"
#include "WINSYS\MONO_C.H"
#include "REGRELIC.HXX" // [d5-30-97 JPC] lieutenant relics
#endif
/* ------------------------------------------------------------------------
Defines
------------------------------------------------------------------------ */
#define REPORT_MODE 9
#define REPORT_DONE_MODE 10
#define BEFORE_LTACTION 0
#define DURING_LTACTION 1
#define AFTER_LTACTION 2
#define BLACK 1
#define DKBLUE 60
#define BLUE 64
#define DKPURPLE 90
#define LTPURPLE 103
#define DKRED 112
#define MDRED 120
#define DKBROWN 128
#define MDBROWN 136
#define LTBROWN 140
#define ORANGE 142
#define MDYELLOW 168
#define LTYELLOW 175
#define DKGREEN 184
#define MDGREEN 188
#define LTGREEN 192
#define LTTAN 223
#define WHITE 31
#define ADV_NONE 0
#define ADV_GETPARTY 1
#define ADV_GETSITE 2
#define ADV_SITE_DESCR 3
#define ADV_SITE_GO 4
#define ADVENTURER_LIST_SIZE 40
#define DATA_AREA_ACTN 144
#define DATA_AREA_MIN 192
#define DATA_AREA_MAX 352
#define DATA_AREA_MID 216
#define ACTIVATE_REGION_(a,b) activate_region((a),(region_state[a-regFIRST_REGION_STATE]=(b)))
#define RESTORE_REGION_STATE(a) activate_region((a),region_state[a-regFIRST_REGION_STATE])
DEFINE_VECTOR_DATA(CSTRPTR, szRealmTextFile) = {
/* no country */ "",
/* Aerenwe */ "aerenwe",
/* Alamie */ "alamie",
/* Anuire */ "",
/* Avanil */ "",
/* Baruk-Azhik */ "barukazh",
/* Boeruine */ "",
/* Brosengae */ "brosenga",
/* Cariele */ "cariele",
/* Chimaeron */ "",
/* Coeranys */ "coeranys",
/* Dhoesone */ "dhoesone",
/* Diemed */ "diemed",
/* Elinie */ "elinie",
/* Endier */ "endier",
/* Five Peaks */ "",
/* Ghoere */ "",
/* Gorgon's Crown */ "",
/* Ilien */ "ilien",
/* Markazor */ "",
/* Medoere */ "medoere",
/* Mhoried */ "",
/* Mieres */ "",
/* Monsters */ "",
/* Mur-Kilad */ "",
/* Osoerde */ "",
/* Rhuobhe */ "",
/* Roesone */ "roesone",
/* Sielwode */ "sielwode",
/* Spiderfell */ "",
/* Taeghas */ "taeghas",
/* Talinie */ "talinie",
/* Thurazor */ "",
/* Tuarhievel */ "tuarhiev",
/* Tuornen */ "tuornen",
};
DEFINE_VECTOR_CLASS(CSTRPTR, szRealmTextFile);
DEFINE_STATIC_VECTOR_DATA(CSTRPTR, szRegentTextFile) = {
/* dummy */ "",
/* Liliene Swordwraith */ "swordwra",
/* Cole Alwier */ "alwier",
/* Carilon Alam */ "calam",
/* Dierdren Alam */ "dalam",
/* Caliedhe Dosiere */ "",
/* unknown */ "",
/* Darien Avan */ "",
/* Dheraene Bhailie */ "",
/* Grimm Graybeard */ "graybear",
/* Diirk Watershold */ "watersho",
/* Aeric Boeruine */ "",
/* Innes */ "",
/* Eriene Mierelen */ "mierelen",
/* Hyde Termonie */ "termonie",
/* Entier Gladanil */ "gladanil",
/* Mheallie Bireon */ "bireon",
/* Danita Chimaera */ "",
/* Denerik */ "",
/* Eluvie Cariele */ "ecariele",
/* Medhlorie Haensen */ "haensen",
/* Fhiele Dhoesone */ "fdhoeson",
/* Clumine Dhoesone */ "cdhoeson",
/* Heirl Diem */ "hdiem",
/* Lasica Diem */ "ldiem",
/* Assan ibn Daouta */ "adaouta",
/* Kalilah bint Daouda */ "kdaouda",
/* Guilder Kalien */ "kalien",
/* Caine */ "caine",
/* The Eyeless One */ "",
/* The Wizard */ "",
/* Gavin Tael */ "",
/* The Sword Mage */ "",
/* The Gorgon */ "",
/* Kiras Earthcore */ "",
/* Rogr Aglondier */ "raglondi",
/* Alliene Aglondier */ "aaglondi",
/* Razzik Fanggrabber */ "",
/* unknown */ "",
/* Suris Enlien */ "enlien",
/* Kotrin Skirvin */ "skirvin",
/* Daeric Mhoried */ "",
/* Michael Mhoried */ "",
/* */ "",
/* */ "",
/* */ "",
/* */ "",
/* Godar Thurinson */ "",
/* unknown */ "",
/* Jaison Raenech */ "",
/* Terence Gryphon */ "",
/* Rhuobhe the Elf */ "",
/* Nhoun */ "",
/* Marlae Roesone */ "mroesone",
/* Michael Agnelie */ "agnelie",
/* Queen Iselie */ "isaelie",
/* Corwin Rhysdiordan */ "rhysdior",
/* The Spider */ "",
/* unknown */ "",
/* Harald Khorien */ "khorien",
/* Trevor Onwen */ "onwen",
/* Thuriene Donalls */ "donalls",
/* Torele Anviras */ "anviras",
/* Tie'skar */ "",
/* Kral Two-Toes */ "",
/* Fhileraene */ "fhilerae",
/* Llytha Damaan */ "damaan",
/* Laela Flaertes */ "flaertes",
/* Braedonnal Tuare */ "tuare",
};
DEFINE_VECTOR_CLASS(CSTRPTR, szRegentTextFile);
DEFINE_VECTOR_DATA_S(ADV_SITE,advsite,MAX_ADV_SITES) = {
// sorted by level, kinda
{"endie_mw", 1, AVAILABLE, REALM::ALAMIE,54},
{"black_pw", 1, AVAILABLE, REALM::BOERUINE,59},
{"barro_mw", 2, AVAILABLE, REALM::FIVEPEAKS,50},
{"braem_mw", 1, AVAILABLE, REALM::MEDOERE,5},
{"bord_kg", 1, AVAILABLE, REALM::RHUOBHE,61},
{"nowel_kw", 1, AVAILABLE, REALM::TALINIE,9},
{"lofto_mw", 2, AVAILABLE, REALM::ALAMIE,17},
{"bindi_mw", 2, AVAILABLE, REALM::BROSENGAE,10},
{"caerl_kw", 2, AVAILABLE, REALM::CARIELE,25},
{"rourv_mw", 2, AVAILABLE, REALM::COERANYS,29},
{"ilien_mw", 2, AVAILABLE, REALM::ILIEN,4},
{"winte_xx", 2, AVAILABLE, REALM::ROESONE,60},
{"storm_kw", 2, AVAILABLE, REALM::TAEGHAS,12},
{"doom_mw", 2, AVAILABLE, REALM::THURAZOR,52},
{"haes_kw", 1, AVAILABLE, REALM::TUORNEN,16},
{"calri_kw", 3, AVAILABLE, REALM::AERENWE,2},
{"aerel_mw", 3, AVAILABLE, REALM::DIEMED,3},
{"ansie_tw", 2, AVAILABLE, REALM::ELINIE,20},
{"falcomw", 3, AVAILABLE, REALM::ENDIER,21},
{"shadc_mw", 3, AVAILABLE, REALM::GHOERE,58},
{"moons_kw", 3, AVAILABLE, REALM::MHORIED,56},
{"sonne_kw", 3, AVAILABLE, REALM::THURAZOR,62},
{"fellp_kw", 4, AVAILABLE, REALM::GORGONSCROWN,23},
{"shadg_tw", 4, AVAILABLE, REALM::OSOERDE,63},
{"rhoub_kw", 4, AVAILABLE, REALM::RHUOBHE,11},
{"spidfell", 4, AVAILABLE, REALM::SPIDERFELL,7},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
{" ", 1, AVAILABLE, REALM::MONSTERS,-1},
};
DEFINE_VECTOR_CLASS(ADV_SITE, advsite);
typedef struct _ButtonInfo
{
POINT Pos;
GAME_STRING Text;
UBYTE HiLiteTextColor;
UBYTE TextColor;
POINT TextOffs;
SHORT hButtonArt;
SHORT hDepressedButtonArt;
} ButtonInfo;
static ButtonInfo Buttons[2][2];
/* ------------------------------------------------------------------------
Global Variables
------------------------------------------------------------------------ */
static char SourcePath[256];
SHORT localActiveRegent;
static SHORT iRegent1 = fERROR;
static SHORT iRegent2 = fERROR;
static SHORT iOldRealm = fERROR;
static SHORT iRegn1 = fERROR;
static SHORT iRegn2 = fERROR;
static SHORT iRegn3 = fERROR;
static LONG itRegent1ID, itRegent2ID;
static LONG itUnit1, itUnit2;
static LONG iThingType1, iThingType2;
static ALIGNMENT_INFO::TYPE iAlignment1, iAlignment2;
static LONG iWhichRegent;
static char inParty[ADVENTURER_LIST_SIZE] = {0};
static LONG numGoing;
static SHORT iLocalCheck[2];
static LONG iPartyLead;
static LONG iRegentProvince;
static LONG iAdvMode;
static LONG iAdvCountdown;
LONG iSiteChosen;
DEFINE_VECTOR_DATA_S(LONG,whoIndex,ADVENTURER_LIST_SIZE);
DEFINE_VECTOR_CLASS(LONG,whoIndex);
BOOL fRealmSelected = FALSE;
static LONG iRegent1ID;
static LONG iRegent2ID;
static LONG iUnit1;
static LONG iUnit2;
LONG iDomainCharInfo = FALSE;
LONG adv_dif = 0;
DEFINE_VECTOR_DATA_S(LONG,lRealmSelectedByPlayer,LAND_REALM_COUNT);
DEFINE_VECTOR_CLASS(LONG,lRealmSelectedByPlayer);
int iNewSite;
extern LONG iOldSite;
extern LONG TutorialActionNumber;
extern LONG TutorialScreenNumber;
extern BOOL fTutorialSelected;
extern SHORT fFadedOut;
extern SHORT iSelectedUnit;
extern SHORT iUnitInfo;
extern SHORT iPlaceInfo;
extern SHORT iProvInfo;
extern LONG report_done_dturn_mode;
/* ------------------------------------------------------------------------
Extern Variables
------------------------------------------------------------------------ */
extern BOOL char_selected; // from game.cpp
extern BOOL fPreparingSpells; // from invngui.cpp
extern SHORT fRoundOver; // from gamemap.cpp
extern SHORT sitecount[]; // from gameopt.cpp
/* ------------------------------------------------------------------------
Internal Prototypes
------------------------------------------------------------------------ */
static void ClearAdvSites(void);
void SetAllAdvSite(void);
void IncActionTurn(void);
/* ------------------------------------------------------------------------
Extern Prototypes
------------------------------------------------------------------------ */
void ReconstructMap(void);
void DoSlideShow(LONG iWhich);
void crease (LONG x, LONG y, LONG w, LONG h);
void UpdateDataArea(void);
void DataAreaMode (LONG type, LONG dummy);
void DisplayInfo (CSTRPTR szFrame, BOOL fCentered, int iformat, ...);
void InitDomainTurn (LONG);
void DeleteDomainRegions(void);
void AddDomainRegions(void);
void DomainTurnUI (void);
void DrawBorders (LONG x, LONG y, LONG map_x, LONG map_y, LONG w, LONG h, LONG /* scale */);
void UpdateHoldingFlag (void);
void AdventurePrep(void);
//void DoNPCAdmin(void);
void SetRedrawMainMapLevel (void);
void WriteOptionSettings(void);
/* ------------------------------------------------------------------------
Code
------------------------------------------------------------------------ */
/* ========================================================================
Function - MultiSetAdvSite
Description - Set adventure site in multi player
Returns -
======================================================================== */
void MultiSetAdvSite(void)
{
int i;
int j;
ClearAdvSites();
for(i=0; i<MAX_SITES; i++)
{
for(j=1; j<LAND_REALM_COUNT; j++)
if(lRealmSelectedByPlayer[j] != -1)
if(advsite[i].realm == j)
advsite[i].available = DISALLOWED;
}
}
void MultiResetRealmSelect(void)
{
FILE *fp;
LONG i;
#ifdef _WINDOWS
if ( IsMultiPlayer() )
fp = fopen("mpstart.dat", "rb");
else
#endif
fp = fopen("rlmstart.dat", "rb");
LoadGameFiles(fp);
fclose(fp);
date = 0;
fRealmSelected = FALSE;
iOldRealm = fERROR;
iProvSelect = 0;
HomeRealm = REALM::NO_COUNTRY;
char_selected = FALSE;
ReconstructMap();
SetRedrawMainMapLevel();
iCurrentRealmIndex = 0;
max_actions = 3;
for (i=0; i<LAND_REALM_COUNT; i++)
action_turn[i] = 1;
global_action_turn = 1;
fHeldAction = FALSE;
fLTAction = BEFORE_LTACTION;
fRoundOver = FALSE;
fFinalRoll = FALSE;
fDoActionIcon = FALSE;
sMenusUp = 0;
fFadedOut = -1;
fUpdateDataArea = TRUE;
iSelectedUnit = -1;
iProvInfo = 0; // no info up
iUnitInfo = 0;
iPlaceInfo = 0;
}
/* ========================================================================
Function - SelectARealm
Description - Sets HomeRealm to the realm selected
Returns -
======================================================================== */
void SelectARealm(LONG arg, LONG)
{
HomeRealm = (REALM::REALM_TYPE)arg;
fRealmSelected = TRUE;
DrawBorders(0, 0, 0, 0, ((BITMPTR)BLKPTR(iLgMap))->w, ((BITMPTR)BLKPTR(iLgMap))->h, FULL_SCALE);
SetRedrawMainMapLevel();
}
void NewGameConfirmed(LONG,LONG lMultiFlag);
/* ========================================================================
Function - NewGameYNProc
Description - Procedure for new game dialog box
Returns - void
======================================================================== */
static LONG lMultiFlagGlobal=0;//so NewGameYNProc can pass the right flag to NewGameConfirmed
void NewGameYNProc(LONG MenuCombo,LONG arg)
{
LONG MenuId, ButtonId;
SPLIT_LONG(MenuCombo, MenuId, ButtonId);
// click the button
SetButtonHilight(MenuId, ButtonId, TRUE);
RunMenus();
update_screen();
TickDelay(4);
SetButtonHilight(MenuId, ButtonId, FALSE);
RunMenus();
update_screen();
TickDelay(4);
HideMenu(MenuId);
RunMenus();
if (arg==QUESTION_BTN1)
{
#ifdef _WINDOWS
if ( IsMultiPlayer() )
{
NewGameConfirmed( 0,lMultiFlagGlobal );
}
else
#endif
OpenGameSelect(0,lMultiFlagGlobal);
}
}
/* ========================================================================
Function - DomainNewGame
Description - Setup for a new game
Returns -
======================================================================== */
void DomainNewGame (LONG, LONG lMultiFlag )
{
if (!fDomainTurn &&
dturn_mode != CHARSEL_MODE &&
master_game_type != GAME_ADVENTURE &&
master_game_type != GAME_BATTLE )
return;
if ( mouse_button == 2 )
{
SystemHelp( STR_MAIN1_HELP_NEW_TITLE,
STR_MAIN1_HELP_NEW_TEXT, H_Begin_New_Game, 0, 0 );
}
else //---- We need help
{
printf("DomainNewGame - char_selected:%d\n",char_selected);
if (!char_selected)
{
#ifdef _WINDOWS
if ( IsMultiPlayer() )
{
NewGameConfirmed( 0,lMultiFlag );
}
else
{
OpenGameSelect(0,lMultiFlag);
}
#else
OpenGameSelect(0,lMultiFlag);
#endif
return;
}
lMultiFlagGlobal=lMultiFlag;
// set the proc to null
SetButtonProc (D_QUESTION2, 0, NULL, 0, 0 );
// set the question text
SetButtonLabel (D_QUESTION2, QUESTION_TEXT, STR_MAIN1_YN_QUESTION_NEW, BLACK );
// turn on the first button as YES
SetButtonLabel (D_QUESTION2, QUESTION_BTN1, STR_YES, BTN_LABEL_COLOR );
SetButtonProc (D_QUESTION2, QUESTION_BTN1, NewGameYNProc, QUESTION_BTN1, D_KEY_YES );
// turn on the third button as CANCEL
SetButtonLabel (D_QUESTION2, QUESTION_BTN2, STR_CANCEL, BTN_LABEL_COLOR );
SetButtonProc (D_QUESTION2, QUESTION_BTN2, NewGameYNProc, QUESTION_BTN3, D_KEY_CANCEL );
ShowMenu(D_QUESTION2);
}
}
void NewGameConfirmed2(BOOL fMulti)
{
int i;
// initialize the screen for the realm/character selection
HomeRealm = REALM::NO_COUNTRY;
fRealmSelected = FALSE;
iProvSelect = 0;
iOldRealm = fERROR;
for ( i = 0; i < LAND_REALM_COUNT; i++ )
realm[i].mfSetPlayerCtrl(FALSE);
ReconstructMap();
// make the menu go away
// fPause = FALSE;
// fRender = TRUE;
// HideMenu(D_MAINMENU);
if ( !fMulti )
{
GAMEToggleMainMenu(FALSE,0);
// wait for menu to minimize
RunMenus();
}
// make sure data area is the correct size
if (l_map != DATA_AREA_MID)
{
//AddSndObj((BIRTHRT_SND)SND_UI_STATUS_REPORT,0,VOLUME_NINETY);
req_l_map = DATA_AREA_MID;
}
// clear any old menu data
ResetMenus();
ResetPanels();
ResetRequests();
// clear all adventure sites from being viewable
if ( !fMulti )
{
ClearAdvSites();
}
// set the new mode
dturn_mode = CHARSEL_MODE;
SetButtonFlag(D_GAMEBUTTON, 0, D_INVISIBLE);
// activate_region(regDOMAIN_TURN_MODE, FALSE); // domain turn mode OFF
// activate_region(regACTION_MODE, FALSE); // action mode OFF
// activate_region(regMINIMIZED, FALSE); // minimized OFF
// activate_region(regMAXIMIZED, FALSE); // maximized OFF
// activate_region(regTAX_ROLLS, FALSE); // tax rolls OFF
// activate_region(regSWITCH_TO_ACTIONS, FALSE); // switch to actions OFF
// activate_region(regADJUST_TAXES, FALSE); // adjust taxes OFF
// activate_region(1008, FALSE); // map display buttons OFF
// clear the borders
// DrawBorders(0, 0, 0, 0, ((BITMPTR)BLKPTR(iLgMap))->w, ((BITMPTR)BLKPTR(iLgMap))->h, FULL_SCALE);
iRegn1 = GetResourceStd ("UI\\REGBTN1A.PCX", FALSE);
iRegn2 = GetResourceStd ("UI\\REGAREA1.PCX", FALSE);
iRegn3 = GetResourceStd ("UI\\REGAREA2.PCX", FALSE);
}
void NewGameConfirmed(LONG,LONG lMultiFlag)
{
LONG i;
//printf("DomainNewGame: ");
//for (i=0; i<10; i++) printf("%d ",region_state[i]);
//printf("\n");
#ifdef _WINDOWS
//---- If we are not calling this from multiplayer code then finalize current game
if ( lMultiFlag != kFromMulti &&
IsMultiPlayer() )
{
ShowMultiQuit(iMPQ_BEGINNEW, 0);
return;
// AMultiPlayer.Finalize();
}
#endif
if (!fDomainTurn) // New Game only allowed at map level
return;
FILE *fp;
#ifdef _WINDOWS
if ( IsMultiPlayer() )
fp = fopen("mpstart.dat", "rb");
else
#endif
fp = fopen("rlmstart.dat", "rb");
LoadGameFiles(fp);
fclose(fp);
date = 0;
NewGameConfirmed2( FALSE );
}
DEFINE_MATRIX_DATA_S(GAME_STRING,TypesDiffs,LAND_REALM_COUNT,2) =
{
/* NO_COUNTRY */ {STR_NULL, STR_NULL},
/* AERENWE */ {STR_REALMPLAYTYPE_TRA, STR_REALMPLAYTYPE_MED},
/* ALAMIE */ {STR_REALMPLAYTYPE_MIL, STR_REALMPLAYTYPE_HRD},
/* ANUIRE */ {STR_NULL, STR_NULL},
/* AVANIL */ {STR_NULL, STR_NULL},
/* BARUKAZHIK */ {STR_REALMPLAYTYPE_TRA, STR_REALMPLAYTYPE_EAS},
/* BOERUINE */ {STR_NULL, STR_NULL},
/* BROSENGAE */ {STR_REALMPLAYTYPE_TRA, STR_REALMPLAYTYPE_MED},
/* CARIELE */ {STR_REALMPLAYTYPE_TRA, STR_REALMPLAYTYPE_MED},
/* CHIMAERON */ {STR_NULL, STR_NULL},
/* COERANYS */ {STR_REALMPLAYTYPE_TEM, STR_REALMPLAYTYPE_EAS},
/* DHOESONE */ {STR_REALMPLAYTYPE_MAG, STR_REALMPLAYTYPE_EAS},
/* DIEMED */ {STR_REALMPLAYTYPE_MIL, STR_REALMPLAYTYPE_HRD},
/* ELINIE */ {STR_REALMPLAYTYPE_TRA, STR_REALMPLAYTYPE_MED},
/* ENDIER */ {STR_REALMPLAYTYPE_TRA, STR_REALMPLAYTYPE_EAS},
/* FIVEPEAKS */ {STR_NULL, STR_NULL},
/* GHOERE */ {STR_NULL, STR_NULL},
/* GORGONSCROWN */ {STR_NULL, STR_NULL},
/* ILIEN */ {STR_REALMPLAYTYPE_MAG, STR_REALMPLAYTYPE_HRD},
/* MARKAZOR */ {STR_NULL, STR_NULL},
/* MEDOERE */ {STR_REALMPLAYTYPE_TEM, STR_REALMPLAYTYPE_MED},
/* MHORIED */ {STR_NULL, STR_NULL},
/* MIERES */ {STR_NULL, STR_NULL},
/* MONSTERS */ {STR_NULL, STR_NULL},
/* MURKILAD */ {STR_NULL, STR_NULL},
/* OSOERDE */ {STR_NULL, STR_NULL},
/* RHUOBHE */ {STR_NULL, STR_NULL},
/* ROESONE */ {STR_REALMPLAYTYPE_MIL, STR_REALMPLAYTYPE_HRD},
/* SIELWODE */ {STR_REALMPLAYTYPE_MAG, STR_REALMPLAYTYPE_HRD},
/* SPIDERFELL */ {STR_NULL, STR_NULL},
/* TAEGHAS */ {STR_REALMPLAYTYPE_MAG, STR_REALMPLAYTYPE_MED},
/* TALINIE */ {STR_REALMPLAYTYPE_MAG, STR_REALMPLAYTYPE_EAS},
/* THURAZOR */ {STR_NULL, STR_NULL},
/* TUARHIEVEL */ {STR_REALMPLAYTYPE_MAG, STR_REALMPLAYTYPE_HRD},
/* TUORNEN */ {STR_REALMPLAYTYPE_MIL, STR_REALMPLAYTYPE_HRD},
};
DEFINE_MATRIX_CLASS_S(GAME_STRING, TypesDiffs, LAND_REALM_COUNT, 2);
GAME_STRING RealmInfoBlurbs[LAND_REALM_COUNT] =
{
STR_NULL,
STR_REALM_DATA_AERENWE,
STR_REALM_DATA_ALAMIE,
STR_REALM_DATA_ANUIRE,
STR_REALM_DATA_AVANIL,
STR_REALM_DATA_BARUKAZHIK,
STR_REALM_DATA_BOERUINE,
STR_REALM_DATA_BROSENGAE,
STR_REALM_DATA_CARIELE,
STR_REALM_DATA_CHIMAERON,
STR_REALM_DATA_COERANYS,
STR_REALM_DATA_DHOESONE,
STR_REALM_DATA_DIEMED,
STR_REALM_DATA_ELINIE,
STR_REALM_DATA_ENDIER,
STR_REALM_DATA_FIVEPEAKS,
STR_REALM_DATA_GHOERE,
STR_REALM_DATA_GORGONSCROWN,
STR_REALM_DATA_ILIEN,
STR_REALM_DATA_MARKAZOR,
STR_REALM_DATA_MEDOERE,
STR_REALM_DATA_MHORIED,
STR_REALM_DATA_MIERES,
STR_REALM_DATA_MONSTERS,
STR_REALM_DATA_MURKILAD,
STR_REALM_DATA_OSOERDE,
STR_REALM_DATA_RHUOBHE,
STR_REALM_DATA_ROESONE,
STR_REALM_DATA_SIELWODE,
STR_REALM_DATA_SPIDERFELL,
STR_REALM_DATA_TAEGHAS,
STR_REALM_DATA_TALINIE,
STR_REALM_DATA_THURAZOR,
STR_REALM_DATA_TUARHIEVEL,
STR_REALM_DATA_TUORNEN,
};
#define REG_SHOW_STATUS 1
#define REG_BEGIN_RULE 2
#define REG_MORE_INFO 3
//This func shows the info on a regent and sets some parameters dealing with
//that regent. You have to pass in tons of output params so the function knows
//where to put the data, and because of all the silly globals in this file.
//x and y are the upper left coords of the box that this function will show
//the info in. The info the function prints takes up a box that is about
//240x140 pixels.
//Note! This function adds regions but never gets rid of them.
// The caller wipes all the regions dealing with the offending function
//every frame.
static void ShowRegentInfo(ULONG x,ULONG y,LONG RegentIdx,LONG iWhichRegent,LONG* piThingType,ALIGNMENT_INFO::TYPE* piAlignment,SHORT* piRegent,LONG* pitUnit,LONG* pitRegentID,ButtonInfo* pCharButton,ButtonInfo* pBeginRuleButton)
{
char buff[80];
SHORT hStat=fERROR;
SHORT iRegent=fERROR;
LONG iThingType=0;
ALIGNMENT_INFO::TYPE iAlignment=ALIGNMENT_INFO::NON_ALIGNED;
LONG itUnit=0;
LONG itRegentID=0;
REGENT_PTR pRegent = ®ents[RegentIdx];
SHORT hPortraitBack = GetResourceStd ("UI\\REGAREA1.PCX", FALSE);
add_region(x, y+15, 72, 92, 0, SelectRegent, iWhichRegent, REG_MORE_INFO, 1009, STR_CS_SELECT_REGENT);
add_region(x, y+112, 84, 28, 0, SelectRegent, iWhichRegent, REG_SHOW_STATUS,1009, -1);
add_region(x+85,y+112, 84, 28,0, SelectRegent, iWhichRegent, REG_BEGIN_RULE, 1009, -1);
// get the pictures for the potential regents
itUnit = regents[RegentIdx].mfGetunit();
itRegentID = units[itUnit].id;
hStat = LoadStats(itRegentID, fERROR);
if(hStat != fERROR)
{
PLAYER_STATS* pStat = (PLAYER_STATS *) BLKPTR(hStat);
sprintf(buff,"UI\\PORTS_L\\LG%s.pcx", GAME_TTYPE::mfGetArtFileName(pStat->mfGetType()));
iThingType = pStat->mfGetType();
iAlignment = pStat->mfGetAlignment();
iRegent = GetResourceStd (buff, FALSE);
}
// print name and data
print_textf(x, y, DKBROWN, "^F05^C060%s",pRegent->mfGetname());
print_textf(x+82, y+14, DKRED, STRMGR_GetStr(STR_CS_RACE));
print_textf(x+82, y+24, DKBROWN, "^F02%s", STRMGR_GetStr(gsRace[pRegent->mfGetRace()]));
if (pRegent->mfGetClass2() != NO_CLASS && pRegent->mfGetLevel2() > 0)
{
//strmgr can't get two strings in one func call
char buffer[100];
strcpy (buffer,STRMGR_GetStr(gsClass[pRegent->mfGetClass2()]));
print_textf(x+82, y+34, DKBROWN, "^F02%s/%s",STRMGR_GetStr(gsClass[pRegent->mfGetClass1()]), buffer);
print_textf(x+82, y+44, DKBROWN, STRMGR_GetStr(STR_CS_LEVEL2),pRegent->mfGetLevel1(), pRegent->mfGetLevel2());
}
else
{
print_textf(x+82, y+34, DKBROWN, "^F02%s", STRMGR_GetStr(gsClass[pRegent->mfGetClass1()]));
print_textf(x+82, y+44, DKBROWN, STRMGR_GetStr(STR_CS_LEVEL1), pRegent->mfGetLevel1());
}
print_textf(x+82, y+54, DKBROWN, "^F02%s", ALIGNMENT_INFO::mfGetName(iAlignment));
print_textf(x+82, y+69, DKRED, STRMGR_GetStr(STR_CS_BLOOD));
print_textf(x+82, y+79, DKBROWN, "^F02%s", STRMGR_GetStr(gsBL_grade[pRegent->mfGetBL_grade()]));
print_textf(x+82, y+89, DKBROWN, "^F02%s", STRMGR_GetStr(gsBL_deriv[pRegent->mfGetBL_deriv()]));
print_textf(x+82, y+99, DKBROWN, STRMGR_GetStr(STR_CS_STRENGTH), pRegent->mfGetBL_strength());
// draw Portrait
DrawBitmap (x,y+15, hPortraitBack, 0, 0, 72, 92);
SetPurge(hPortraitBack);
hPortraitBack = fERROR;
if(iRegent != fERROR)
{
SetRemapTable((USHORT)HomeRealm);
DrawBitmap (x+4,y+19, iRegent, 0, 16, 64, 84);
ClearRemapTable();
}
if (pCharButton)
{
//pCharButton->Bkgnd=SaveBitmap(x-3,y+109,90,34);
pCharButton->Pos.x=x;
pCharButton->Pos.y=y+112;
pCharButton->Text=STR_3PT_CHARACTER;
pCharButton->TextColor=BTN_LABEL_COLOR;
pCharButton->HiLiteTextColor=BTN_LABEL_HILITE_COLOR;
pCharButton->TextOffs.x=10;
pCharButton->TextOffs.y=8;
// GWP HACK HACK HACK HACK (following test.)
if ( y == 196)
{
pCharButton->hButtonArt = GetResourceStd("UI\\REGBTN3A.PCX", FALSE);
pCharButton->hDepressedButtonArt = GetResourceStd("UI\\REGBTN3B.PCX", FALSE);
}
else
{
pCharButton->hButtonArt = GetResourceStd("UI\\REGBTN5A.PCX", FALSE);
pCharButton->hDepressedButtonArt = GetResourceStd("UI\\REGBTN5B.PCX", FALSE);
}
}
// draw the "Character" button
DrawBitmap (x, y+112, pCharButton->hButtonArt, 0, 0, 84, 28);
print_textf(x+11, y+119, BTN_LABEL_COLOR, STRMGR_GetStr(STR_3PT_CHARACTER));
LONG BeginRuleColor=BTN_LABEL_COLOR;
#ifdef _WINDOWS
if(IsMultiPlayer() && lRealmSelectedByPlayer[pRegent->mfGetRealm()] != -1)
BeginRuleColor=GREY;
#endif
if (pBeginRuleButton)
{
//pBeginRuleButton->Bkgnd=SaveBitmap(x+84,y+109,90,34);
pBeginRuleButton->Pos.x=x+87;
pBeginRuleButton->Pos.y=y+112;
pBeginRuleButton->Text=STR_3PT_BEGIN_RULE;
pBeginRuleButton->TextColor=BeginRuleColor;
pBeginRuleButton->HiLiteTextColor=BTN_LABEL_HILITE_COLOR;
pBeginRuleButton->TextOffs.x=10;
pBeginRuleButton->TextOffs.y=8;
// GWP HACK HACK HACK HACK (following test.)
if ( y == 196)
{
pBeginRuleButton->hButtonArt = GetResourceStd("UI\\REGBTN4A.PCX", FALSE);
pBeginRuleButton->hDepressedButtonArt = GetResourceStd("UI\\REGBTN4B.PCX", FALSE);
}
else
{
pBeginRuleButton->hButtonArt = GetResourceStd("UI\\REGBTN6A.PCX", FALSE);
pBeginRuleButton->hDepressedButtonArt = GetResourceStd("UI\\REGBTN6B.PCX", FALSE);
}
}
// draw the "BeginRule" button
DrawBitmap (x+87, y+112, pBeginRuleButton->hButtonArt, 0, 0, 84, 28);
print_textf(x+97, y+119, BeginRuleColor,STRMGR_GetStr(STR_3PT_BEGIN_RULE));
//assign to the output params.
*piRegent=iRegent;
*piThingType=iThingType;
*piAlignment=iAlignment;
*pitUnit=itUnit;
*pitRegentID=itRegentID;
}
/* ========================================================================
Function - DisplayRealmSelection
Description - Callback function from GameMap.cpp to update the screen
Returns -
======================================================================== */
extern LONG req_x;
extern LONG req_y;
extern LONG map_x;
extern LONG map_y;
extern LONG desired_scale;
extern LONG max_scale;
extern LONG map_scale;
void DisplayRealmSelection(void)
{
PLAYER_STATS *pStat1, *pStat2;
SHORT hStat;
char buff[80];
int i, y = 40;
// draw left panel
DrawBitmap (0, 0, iDTurnBk, (SHORT)(DATA_AREA_MAX-l_map), 0, (SHORT)l_map, 480);
// make sure data area is the proper size
if(l_map != DATA_AREA_MID)
{
req_l_map = DATA_AREA_MID;
return;
}
// delete the old regions
del_region(SelectRegent, 0);
del_region(SelectARealm, 0);
activate_region(regSHOW_HOLDINGS,FALSE);
if(!fRealmSelected)
{
fRealmSelected=TRUE;
SelectARealm(REALM::DHOESONE,0);
}
if (HomeRealm>0)
{
REALM_STRUCT_PTR pRealm = &realm[HomeRealm];
unsigned int Regent_ = pRealm->mfGetRegent();
REGENT_PTR pRegent1 = ®ents[(HomeRealm * 2) - 1];
REGENT_PTR pRegent2 = ®ents[(HomeRealm * 2)];
if(iOldRealm != HomeRealm)
{
// remove the old bitmaps
if (iRegent1!=fERROR)
{
SetPurge(iRegent1);
iRegent1 = fERROR;
}
if (iRegent2!=fERROR)
{
SetPurge(iRegent2);