forked from yasumitsu/ja2-1.13-source-mirror
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MessageBoxScreen.cpp
1795 lines (1522 loc) · 58.9 KB
/
MessageBoxScreen.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
#ifdef PRECOMPILEDHEADERS
#include "JA2 All.h"
#else
#include "sgp.h"
#include "screenids.h"
#include "fade screen.h"
#include "sysutil.h"
#include "vobject_blitters.h"
#include "MercTextBox.h"
#include "cursors.h"
#include "messageboxscreen.h"
#include "font control.h"
#include "Map Screen Interface.h"
#include "renderworld.h"
#include "gameloop.h"
#include "english.h"
#include "GameSettings.h"
#include "Interface Control.h"
#include "cursor control.h"
#include "laptop.h"
#include "text.h"
#include "Text Input.h"
#include "overhead map.h"
#include "DropDown.h" // added by Flugente
#include "Utilities.h" // added by Flugente for FilenameForBPP(...)
#endif
#define MSGBOX_DEFAULT_WIDTH 300
#define MSGBOX_BUTTON_WIDTH 61
#define MSGBOX_BUTTON_HEIGHT 20
#define MSGBOX_BUTTON_X_SEP 15
#define MSGBOX_SMALL_BUTTON_WIDTH 31
#define MSGBOX_SMALL_BUTTON_X_SEP 8
typedef void (*MSGBOX_CALLBACK)( UINT8 bExitValue );
// old mouse x and y positions
SGPPoint pOldMousePosition;
SGPRect MessageBoxRestrictedCursorRegion;
// if the cursor was locked to a region
BOOLEAN fCursorLockedToArea = FALSE;
BOOLEAN gfInMsgBox = FALSE;
//extern BOOLEAN fMapExitDueToMessageBox;
extern BOOLEAN fInMapMode;
extern BOOLEAN gfOverheadMapDirty;
UINT32 guiMessageBoxImage = 0;
UINT16 guiMessageBoxImageIndex = 0;
//OJW - 20090208
CHAR16 gszMsgBoxInputString[255];
void OKMsgBoxCallback(GUI_BUTTON *btn, INT32 reason );
void YESMsgBoxCallback(GUI_BUTTON *btn, INT32 reason );
void ContractMsgBoxCallback(GUI_BUTTON *btn, INT32 reason );
void LieMsgBoxCallback(GUI_BUTTON *btn, INT32 reason );
void NOMsgBoxCallback(GUI_BUTTON *btn, INT32 reason );
void NumberedMsgBoxCallback(GUI_BUTTON *btn, INT32 reason );
void MsgBoxClickCallback( MOUSE_REGION * pRegion, INT32 iReason );
UINT32 ExitMsgBox( INT8 ubExitCode );
UINT16 GetMSgBoxButtonWidth( INT32 iButtonImage );
SGPRect gOldCursorLimitRectangle;
MESSAGE_BOX_STRUCT gMsgBox;
BOOLEAN gfNewMessageBox = FALSE;
BOOLEAN gfStartedFromGameScreen = FALSE;
BOOLEAN gfStartedFromMapScreen = FALSE;
BOOLEAN fRestoreBackgroundForMessageBox = FALSE;
BOOLEAN gfDontOverRideSaveBuffer = TRUE; //this variable can be unset if ur in a non gamescreen and DONT want the msg box to use the save buffer
extern void HandleTacticalUILoseCursorFromOtherScreen( );
extern STR16 pUpdatePanelButtons[];
CHAR16 gzUserDefinedButton1[ 128 ];
CHAR16 gzUserDefinedButton2[ 128 ];
// Flugente: made an array for user-defined buttons
CHAR16 gzUserDefinedButton[ NUM_CUSTOM_BUTTONS ][ 128 ];
// sevenfm: added color for buttons
UINT16 gzUserDefinedButtonColor[ NUM_CUSTOM_BUTTONS ];
INT32 DoMessageBox( UINT8 ubStyle, const STR16 zString, UINT32 uiExitScreen, UINT32 usFlags, MSGBOX_CALLBACK ReturnCallback, SGPRect *pCenteringRect, UINT8 ubDefaultButton )
{
VSURFACE_DESC vs_desc;
UINT16 usTextBoxWidth;
UINT16 usTextBoxHeight;
SGPRect aRect;
UINT32 uiDestPitchBYTES, uiSrcPitchBYTES;
UINT8 *pDestBuf, *pSrcBuf;
INT16 sButtonX, sButtonY, sBlankSpace;
UINT8 ubMercBoxBackground = BASIC_MERC_POPUP_BACKGROUND, ubMercBoxBorder = BASIC_MERC_POPUP_BORDER;
UINT8 ubFontColor, ubFontShadowColor;
UINT16 usCursor;
INT32 iId = -1;
GetMousePos( &pOldMousePosition );
//this variable can be unset if ur in a non gamescreen and DONT want the msg box to use the save buffer
gfDontOverRideSaveBuffer = TRUE;
SetCurrentCursorFromDatabase( CURSOR_NORMAL );
if( gMsgBox.BackRegion.uiFlags & MSYS_REGION_EXISTS )
{
return( 0 );
}
// Based on style....
switch( ubStyle )
{
//default
case MSG_BOX_BASIC_STYLE:
ubMercBoxBackground = DIALOG_MERC_POPUP_BACKGROUND;
ubMercBoxBorder = DIALOG_MERC_POPUP_BORDER;
// Add button images
gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\popupbuttons.sti", -1,0,-1,1,-1 );
ubFontColor = FONT_MCOLOR_WHITE;
ubFontShadowColor = DEFAULT_SHADOW;
usCursor = CURSOR_NORMAL;
break;
case MSG_BOX_RED_ON_WHITE:
ubMercBoxBackground = WHITE_MERC_POPUP_BACKGROUND;
ubMercBoxBorder = RED_MERC_POPUP_BORDER;
// Add button images
gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\msgboxRedButtons.sti", -1,0,-1,1,-1 );
ubFontColor = 2;
ubFontShadowColor = NO_SHADOW;
usCursor = CURSOR_LAPTOP_SCREEN;
break;
case MSG_BOX_BLUE_ON_GREY:
ubMercBoxBackground = GREY_MERC_POPUP_BACKGROUND;
ubMercBoxBorder = BLUE_MERC_POPUP_BORDER;
// Add button images
gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\msgboxGreyButtons.sti", -1,0,-1,1,-1 );
ubFontColor = 2;
ubFontShadowColor = FONT_MCOLOR_WHITE;
usCursor = CURSOR_LAPTOP_SCREEN;
break;
case MSG_BOX_IMP_STYLE:
ubMercBoxBackground = IMP_POPUP_BACKGROUND;
ubMercBoxBorder = DIALOG_MERC_POPUP_BORDER;
// Add button images
gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\msgboxGreyButtons.sti", -1,0,-1,1,-1 );
ubFontColor = 2;
ubFontShadowColor = FONT_MCOLOR_WHITE;
usCursor = CURSOR_LAPTOP_SCREEN;
break;
case MSG_BOX_BASIC_SMALL_BUTTONS:
ubMercBoxBackground = DIALOG_MERC_POPUP_BACKGROUND;
ubMercBoxBorder = DIALOG_MERC_POPUP_BORDER;
// Add button images
gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\popupbuttons.sti", -1,2,-1,3,-1 );
ubFontColor = FONT_MCOLOR_WHITE;
ubFontShadowColor = DEFAULT_SHADOW;
usCursor = CURSOR_NORMAL;
break;
case MSG_BOX_LAPTOP_DEFAULT:
ubMercBoxBackground = LAPTOP_POPUP_BACKGROUND;
ubMercBoxBorder = LAPTOP_POP_BORDER;
// Add button images
gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\popupbuttons.sti", -1,0,-1,1,-1 );
ubFontColor = FONT_MCOLOR_WHITE;
ubFontShadowColor = DEFAULT_SHADOW;
usCursor = CURSOR_LAPTOP_SCREEN;
break;
case MSG_BOX_BASIC_MEDIUM_BUTTONS:
ubMercBoxBackground = DIALOG_MERC_POPUP_BACKGROUND;
ubMercBoxBorder = DIALOG_MERC_POPUP_BORDER;
// Add button images
gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\PreferencesButtons.sti", -1,0,-1,1,-1 );
ubFontColor = FONT_MCOLOR_WHITE;
ubFontShadowColor = DEFAULT_SHADOW;
usCursor = CURSOR_NORMAL;
break;
default:
ubMercBoxBackground = BASIC_MERC_POPUP_BACKGROUND;
ubMercBoxBorder = BASIC_MERC_POPUP_BORDER;
// Add button images
gMsgBox.iButtonImages = LoadButtonImage( "INTERFACE\\msgboxbuttons.sti", -1,0,-1,1,-1 );
ubFontColor = FONT_MCOLOR_WHITE;
ubFontShadowColor = DEFAULT_SHADOW;
usCursor = CURSOR_NORMAL;
break;
}
if ( usFlags & MSG_BOX_FLAG_USE_CENTERING_RECT && pCenteringRect != NULL )
{
aRect.iTop = pCenteringRect->iTop;
aRect.iLeft = pCenteringRect->iLeft;
aRect.iBottom = pCenteringRect->iBottom;
aRect.iRight = pCenteringRect->iRight;
}
else
{
// Use default!
aRect.iTop = 0;
aRect.iLeft = 0;
aRect.iBottom = SCREEN_HEIGHT;
aRect.iRight = SCREEN_WIDTH;
}
// Set some values!
gMsgBox.usFlags = usFlags;
gMsgBox.uiExitScreen = uiExitScreen;
gMsgBox.ExitCallback = ReturnCallback;
gMsgBox.fRenderBox = TRUE;
gMsgBox.bHandled = 0;
// Flugente: increase the height of the display box under certain conditions
UINT16 heightincrease = 0;
if ( usFlags & MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS )
heightincrease = 120;
if ( usFlags & MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS )
{
if( ubStyle == MSG_BOX_BASIC_MEDIUM_BUTTONS )
heightincrease = 120;
else
heightincrease = 50;
}
if ( usFlags & MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS )
heightincrease = 90;
if ( gMsgBox.usFlags & MSG_BOX_FLAG_IMAGE )
heightincrease = 130;
if ( usFlags & ( MSG_BOX_FLAG_DROPDOWN_1 | MSG_BOX_FLAG_DROPDOWN_2 ) )
heightincrease = 130;
UINT16 usMBWidth=MSGBOX_DEFAULT_WIDTH;
BOOLEAN bFixedWidth = FALSE;
// sevenfm: custom width for 16-medium-button messagebox
if( usFlags & MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS && ubStyle == MSG_BOX_BASIC_STYLE )
{
usMBWidth = MSGBOX_BUTTON_WIDTH * 4;
bFixedWidth = TRUE;
}
// custom width for 8-large-button messagebox
if( usFlags & MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS && ubStyle == MSG_BOX_BASIC_MEDIUM_BUTTONS )
{
usMBWidth = MSGBOX_BUTTON_WIDTH * 4;
bFixedWidth = TRUE;
}
// Init message box
gMsgBox.iBoxId = PrepareMercPopupBox( iId, ubMercBoxBackground, ubMercBoxBorder, zString, usMBWidth, 40, 10, 30 + heightincrease, &usTextBoxWidth, &usTextBoxHeight, bFixedWidth );
if( gMsgBox.iBoxId == -1 )
{
#ifdef JA2BETAVERSION
AssertMsg( 0, "Failed in DoMessageBox(). Probable reason is because the string was too large to fit in max message box size." );
#endif
return 0;
}
// Save height,width
gMsgBox.usWidth = usTextBoxWidth;
gMsgBox.usHeight = usTextBoxHeight;
// Determine position ( centered in rect )
gMsgBox.sX = (INT16)( ( ( ( aRect.iRight - aRect.iLeft ) - usTextBoxWidth ) / 2 ) + aRect.iLeft );
gMsgBox.sY = (INT16)( ( ( ( aRect.iBottom - aRect.iTop ) - usTextBoxHeight ) / 2 ) + aRect.iTop );
if ( guiCurrentScreen == GAME_SCREEN )
{
gfStartedFromGameScreen = TRUE;
}
if ( (fInMapMode == TRUE ) )
{
// fMapExitDueToMessageBox = TRUE;
gfStartedFromMapScreen = TRUE;
fMapPanelDirty = TRUE;
}
// Set pending screen
SetPendingNewScreen( MSG_BOX_SCREEN);
// Init save buffer
vs_desc.fCreateFlags = VSURFACE_CREATE_DEFAULT | VSURFACE_SYSTEM_MEM_USAGE;
vs_desc.usWidth = usTextBoxWidth;
vs_desc.usHeight = usTextBoxHeight;
vs_desc.ubBitDepth = 16;
if( AddVideoSurface( &vs_desc, &gMsgBox.uiSaveBuffer) == FALSE )
{
return( - 1 );
}
//Save what we have under here...
pDestBuf = LockVideoSurface( gMsgBox.uiSaveBuffer, &uiDestPitchBYTES);
pSrcBuf = LockVideoSurface( FRAME_BUFFER, &uiSrcPitchBYTES);
Blt16BPPTo16BPP((UINT16 *)pDestBuf, uiDestPitchBYTES,
(UINT16 *)pSrcBuf, uiSrcPitchBYTES,
0 , 0,
gMsgBox.sX , gMsgBox.sY,
usTextBoxWidth, usTextBoxHeight );
UnLockVideoSurface( gMsgBox.uiSaveBuffer );
UnLockVideoSurface( FRAME_BUFFER );
// Create top-level mouse region
MSYS_DefineRegion( &(gMsgBox.BackRegion), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, MSYS_PRIORITY_HIGHEST - 1, usCursor, MSYS_NO_CALLBACK, MsgBoxClickCallback );
if( gGameSettings.fOptions[ TOPTION_DONT_MOVE_MOUSE ] == FALSE )
{
if( usFlags & MSG_BOX_FLAG_OK )
{
SimulateMouseMovement( ( gMsgBox.sX + ( usTextBoxWidth / 2 ) + 27 ), ( gMsgBox.sY + ( usTextBoxHeight - 10 ) ) );
}
// silversurfer: new mouse positions over a default button
// This can be expanded for other message box types if the need arises.
else if( ubDefaultButton != MSG_BOX_DEFAULT_BUTTON_NONE )
{
if( usFlags & MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS ) // 4 rows, 1 column, medium button size
{
sButtonX = usTextBoxWidth / 2;
sButtonY = usTextBoxHeight - ( (4 - ubDefaultButton) * (MSGBOX_BUTTON_HEIGHT + MSGBOX_SMALL_BUTTON_X_SEP + 5) + 35 );
}
else if( usFlags & MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS )
{
if( ubStyle == MSG_BOX_BASIC_MEDIUM_BUTTONS ) // 4 rows, 2 columns, medium button size
{
// left or right
if( ubDefaultButton % 2)
sButtonX = usTextBoxWidth / 2 - MSGBOX_BUTTON_WIDTH;
else
sButtonX = usTextBoxWidth / 2 + MSGBOX_BUTTON_WIDTH;
sButtonY = usTextBoxHeight - ( (4 - (UINT8)(ubDefaultButton / 2.0f + 0.6f) ) * (MSGBOX_BUTTON_HEIGHT + MSGBOX_SMALL_BUTTON_X_SEP + 5) + 35 );
}
else // 2 rows, 4 columns, small button size
{
// left or right
if( (UINT8)(ubDefaultButton / 2.0f + 0.6f) % 2 )
sButtonX = usTextBoxWidth / 2 - MSGBOX_SMALL_BUTTON_WIDTH / 2 - (ubDefaultButton % 2) * MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
else
sButtonX = usTextBoxWidth / 2 + MSGBOX_SMALL_BUTTON_WIDTH / 2 + (1 - ubDefaultButton % 2) * MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
sButtonY = usTextBoxHeight - ( (2 - (UINT8)(ubDefaultButton / 4.0f + 0.8f) ) * (MSGBOX_BUTTON_HEIGHT + 10) + 30 );
}
}
else if( usFlags & MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS )
{
if( ubStyle == MSG_BOX_BASIC_STYLE ) // 4x4 medium button size
{
// left or right
if( (UINT8)(ubDefaultButton / 2.0f + 0.6f) % 2 )
sButtonX = usTextBoxWidth / 2 - MSGBOX_BUTTON_WIDTH / 2 - (ubDefaultButton % 2) * MSGBOX_BUTTON_WIDTH;
else
sButtonX = usTextBoxWidth / 2 + MSGBOX_BUTTON_WIDTH / 2 + (1 - ubDefaultButton % 2) * MSGBOX_BUTTON_WIDTH;
sButtonY = usTextBoxHeight - ( (4 - (UINT8)(ubDefaultButton / 4.0f + 0.8f) ) * (MSGBOX_BUTTON_HEIGHT + 5) + 30 );
}
else // 4x4 small button size
{
// left or right
if( (UINT8)(ubDefaultButton / 2.0f + 0.6f) % 2 )
sButtonX = usTextBoxWidth / 2 - MSGBOX_SMALL_BUTTON_WIDTH / 2 - (ubDefaultButton % 2) * MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
else
sButtonX = usTextBoxWidth / 2 + MSGBOX_SMALL_BUTTON_WIDTH / 2 + (1 - ubDefaultButton % 2) * MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
sButtonY = usTextBoxHeight - ( (4 - (UINT8)(ubDefaultButton / 4.0f + 0.8f) ) * (MSGBOX_BUTTON_HEIGHT + 10) + 20 );
}
}
SimulateMouseMovement( gMsgBox.sX + sButtonX , gMsgBox.sY + sButtonY );
}
// old default mouse position at bottom center of message box
else
SimulateMouseMovement( gMsgBox.sX + usTextBoxWidth / 2 , gMsgBox.sY + usTextBoxHeight - 4 );
}
// Add region
MSYS_AddRegion(&(gMsgBox.BackRegion) );
// findout if cursor locked, if so, store old params and store, restore when done
if( IsCursorRestricted() )
{
fCursorLockedToArea = TRUE;
GetRestrictedClipCursor( &MessageBoxRestrictedCursorRegion );
FreeMouseCursor( FALSE );
}
// Create four numbered buttons
if ( usFlags & MSG_BOX_FLAG_FOUR_NUMBERED_BUTTONS )
{
// This is exclusive of any other buttons... no ok, no cancel, no nothing
sBlankSpace = usTextBoxWidth - MSGBOX_SMALL_BUTTON_WIDTH * 4 - MSGBOX_SMALL_BUTTON_X_SEP * 3;
sButtonX = sBlankSpace / 2;
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10;
gMsgBox.uiButton[0] = CreateIconAndTextButton( gMsgBox.iButtonImages, L"1", FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback );
MSYS_SetBtnUserData( gMsgBox.uiButton[0], 0, 1);
SetButtonCursor(gMsgBox.uiButton[0], usCursor);
sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
gMsgBox.uiButton[1] = CreateIconAndTextButton( gMsgBox.iButtonImages, L"2", FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback );
MSYS_SetBtnUserData( gMsgBox.uiButton[1], 0, 2);
SetButtonCursor(gMsgBox.uiButton[1], usCursor);
sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
gMsgBox.uiButton[2] = CreateIconAndTextButton( gMsgBox.iButtonImages, L"3", FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback );
MSYS_SetBtnUserData( gMsgBox.uiButton[2], 0, 3);
SetButtonCursor(gMsgBox.uiButton[2], usCursor);
sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
gMsgBox.uiButton[3] = CreateIconAndTextButton( gMsgBox.iButtonImages, L"4", FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback );
MSYS_SetBtnUserData( gMsgBox.uiButton[3], 0, 4);
SetButtonCursor(gMsgBox.uiButton[3], usCursor);
for ( INT8 i = 3; i >= 0; --i)
{
ForceButtonUnDirty( gMsgBox.uiButton[i] );
}
}
// Create four numbered buttons
else if ( usFlags & MSG_BOX_FLAG_GENERIC_FOUR_BUTTONS )
{
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 130 - MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
if ( usFlags & MSG_BOX_BUTTONS_HORIZONTAL_ORIENTATION )
{
sBlankSpace = usTextBoxWidth - (MSGBOX_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP) * 4;
sButtonX = MSGBOX_SMALL_BUTTON_X_SEP;
sButtonY += 60;
}
else
{
sButtonX = ( usTextBoxWidth - 115 ) / 2;
}
for ( INT8 j = 0; j < 4; ++j)
{
if ( usFlags & MSG_BOX_BUTTONS_HORIZONTAL_ORIENTATION )
sButtonX += 60;
else
sButtonY += 35;
gMsgBox.uiButton[j] = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton[j], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback );
MSYS_SetBtnUserData( gMsgBox.uiButton[j], 0, j+1);
SetButtonCursor(gMsgBox.uiButton[j], usCursor);
ForceButtonUnDirty( gMsgBox.uiButton[j] );
}
}
// Create eight numbered buttons
else if ( usFlags & MSG_BOX_FLAG_GENERIC_EIGHT_BUTTONS )
{
if(ubStyle == MSG_BOX_BASIC_MEDIUM_BUTTONS)
{
//sBlankSpace = usTextBoxWidth - MSGBOX_BUTTON_WIDTH * 4 - MSGBOX_SMALL_BUTTON_X_SEP * 3;
sBlankSpace = usTextBoxWidth - MSGBOX_BUTTON_WIDTH * 4 + MSGBOX_SMALL_BUTTON_X_SEP;
sButtonX = sBlankSpace / 2;
sButtonY = usTextBoxHeight - 3*MSGBOX_BUTTON_HEIGHT - heightincrease - 10;
for ( INT8 i = 0; i < 4; ++i)
{
// new row
sButtonY += MSGBOX_SMALL_BUTTON_WIDTH + 5;
// begin from the front
//sButtonX = sBlankSpace / 2 - MSGBOX_BUTTON_WIDTH*2;
sButtonX = sBlankSpace / 2;
for ( INT8 j = 0; j < 2; ++j)
{
INT8 k = 2*i + j;
gMsgBox.uiButton[k] = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton[k], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback );
MSYS_SetBtnUserData( gMsgBox.uiButton[k], 0, k+1);
SetButtonCursor(gMsgBox.uiButton[k], usCursor);
ForceButtonUnDirty( gMsgBox.uiButton[k] );
sButtonX += MSGBOX_BUTTON_WIDTH*2;
}
}
}
else
{
sBlankSpace = usTextBoxWidth - MSGBOX_SMALL_BUTTON_WIDTH * 4 - MSGBOX_SMALL_BUTTON_X_SEP * 3;
sButtonX = sBlankSpace / 2;
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10 - heightincrease;
sButtonY -= MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
for ( INT8 i = 0; i < 2; ++i)
{
// new row
sButtonY += MSGBOX_SMALL_BUTTON_WIDTH;
// begin from the front
sButtonX = sBlankSpace / 2;
for ( INT8 j = 0; j < 4; ++j)
{
INT8 k = 4*i + j;
gMsgBox.uiButton[k] = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton[k], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback );
MSYS_SetBtnUserData( gMsgBox.uiButton[k], 0, k+1);
SetButtonCursor(gMsgBox.uiButton[k], usCursor);
ForceButtonUnDirty( gMsgBox.uiButton[k] );
//sButtonX += 75 + MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
}
}
}
}
// Create sixteen numbered buttons
else if ( usFlags & MSG_BOX_FLAG_GENERIC_SIXTEEN_BUTTONS )
{
if( ubStyle == MSG_BOX_BASIC_STYLE )
{
sBlankSpace = usTextBoxWidth - MSGBOX_BUTTON_WIDTH * 4;
sButtonX = sBlankSpace / 2;
sButtonY = usTextBoxHeight - 2*MSGBOX_BUTTON_HEIGHT - heightincrease - 10;
}
else
{
sBlankSpace = usTextBoxWidth - MSGBOX_SMALL_BUTTON_WIDTH * 4 - MSGBOX_SMALL_BUTTON_X_SEP * 3;
sButtonX = sBlankSpace / 2;
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10 - heightincrease - 6;
sButtonY -= MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
}
for ( INT8 i = 0; i < 4; ++i)
{
if( ubStyle == MSG_BOX_BASIC_STYLE )
{
// new row
sButtonY += MSGBOX_BUTTON_HEIGHT+5;
// begin from the front
sButtonX = sBlankSpace / 2 - MSGBOX_BUTTON_WIDTH;
}
else
{
// new row
sButtonY += MSGBOX_SMALL_BUTTON_WIDTH - 2;// + MSGBOX_SMALL_BUTTON_X_SEP;
// begin from the front
sButtonX = sBlankSpace / 2 - MSGBOX_SMALL_BUTTON_WIDTH - MSGBOX_SMALL_BUTTON_X_SEP;
}
for ( INT8 j = 0; j < 4; ++j)
{
INT8 k = 4*i + j;
if( ubStyle == MSG_BOX_BASIC_STYLE )
sButtonX += MSGBOX_BUTTON_WIDTH;
else
sButtonX += MSGBOX_SMALL_BUTTON_WIDTH + MSGBOX_SMALL_BUTTON_X_SEP;
// sevenfm: added color table for 16-button messagebox
gMsgBox.uiButton[k] = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton[k], FONT12ARIAL,
gzUserDefinedButtonColor[k] ? gzUserDefinedButtonColor[k] : ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NumberedMsgBoxCallback );
MSYS_SetBtnUserData( gMsgBox.uiButton[k], 0, k+1);
SetButtonCursor(gMsgBox.uiButton[k], usCursor);
ForceButtonUnDirty( gMsgBox.uiButton[k] );
}
}
}
else if (usFlags & MSG_BOX_FLAG_INPUTBOX)
{
// Initialise Text Boxes
InitTextInputMode(); // API call to initialise text input mode for this screen
// does not mean we are inputting text right away
// Player Name field
SetTextInputCursor( CUROSR_IBEAM_WHITE );
SetTextInputFont( (UINT16) FONT12ARIALFIXEDWIDTH ); //FONT12ARIAL //FONT12ARIALFIXEDWIDTH
Set16BPPTextFieldColor( Get16BPPColor(FROMRGB( 0, 0, 0) ) );
SetBevelColors( Get16BPPColor(FROMRGB(136, 138, 135)), Get16BPPColor(FROMRGB(24, 61, 81)) );
SetTextInputRegularColors( FONT_WHITE, 2 );
SetTextInputHilitedColors( 2, FONT_WHITE, FONT_WHITE );
SetCursorColor( Get16BPPColor(FROMRGB(255, 255, 255) ) );
int ibx = gMsgBox.sX + 10;
int iby = gMsgBox.sY +(usTextBoxHeight - 20 - 10);
//Add Player Name textbox
AddTextInputField( ibx,
iby,
usTextBoxWidth - 20,
20,
MSYS_PRIORITY_HIGH+2,
gszMsgBoxInputString,
255,
INPUTTYPE_ASCII );//23
// exit text input mode in this screen and clean up text boxes
SetActiveField( 0 );
// initialise the chat toggle boxes
/*int usPosY = gMsgBox.sY + (usTextBoxHeight - 45);
int usPosX = gMsgBox.sX + (usTextBoxWidth / 3);
guiChatToggles[ 0 ] = CreateCheckBoxButton( usPosX, usPosY,
"INTERFACE\\OptionsCheckBoxes_12x12.sti", MSYS_PRIORITY_HIGH+10,
BtnChatTogglesCallback );
MSYS_SetBtnUserData( guiOptionsToggles[ 0 ], 0, 0 );
guiChatToggles[ 1 ] = CreateCheckBoxButton( usPosX, usPosY,
"INTERFACE\\OptionsCheckBoxes_12x12.sti", MSYS_PRIORITY_HIGH+10,
BtnChatTogglesCallback );
MSYS_SetBtnUserData( guiOptionsToggles[ 1 ], 0, 1 );*/
}
else
{
// Create text button
if ( usFlags & MSG_BOX_FLAG_OK )
{
// sButtonX = ( usTextBoxWidth - MSGBOX_BUTTON_WIDTH ) / 2;
sButtonX = ( usTextBoxWidth - GetMSgBoxButtonWidth( gMsgBox.iButtonImages ) ) / 2;
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10;
gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKMsgBoxCallback );
SetButtonCursor(gMsgBox.uiOKButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiOKButton );
}
// Create text button
if ( usFlags & MSG_BOX_FLAG_CANCEL )
{
sButtonX = ( usTextBoxWidth - GetMSgBoxButtonWidth( gMsgBox.iButtonImages ) ) / 2;
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10;
gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_CANCEL ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKMsgBoxCallback );
SetButtonCursor(gMsgBox.uiOKButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiOKButton );
}
if ( usFlags & MSG_BOX_FLAG_YESNO )
{
sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2;
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10;
gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_YES ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback );
SetButtonCursor(gMsgBox.uiYESButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiYESButton );
gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_NO ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback );
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiNOButton );
}
if ( usFlags & MSG_BOX_FLAG_CONTINUESTOP )
{
sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2;
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10;
gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pUpdatePanelButtons[ 0 ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback );
SetButtonCursor(gMsgBox.uiYESButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiYESButton );
gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pUpdatePanelButtons[ 1 ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback );
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiNOButton );
}
if ( usFlags & MSG_BOX_FLAG_OKCONTRACT )
{
sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2;
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10;
gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)OKMsgBoxCallback );
SetButtonCursor(gMsgBox.uiYESButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiYESButton );
gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_REHIRE ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback );
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiNOButton );
}
if ( usFlags & MSG_BOX_FLAG_YESNOCONTRACT )
{
sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 3;
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10;
gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_YES ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback );
SetButtonCursor(gMsgBox.uiYESButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiYESButton );
gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_NO ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback );
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiNOButton );
gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_REHIRE ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX + 2 * ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback );
SetButtonCursor(gMsgBox.uiOKButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiOKButton );
}
if ( usFlags & MSG_BOX_FLAG_GENERICCONTRACT )
{
sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 3;
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10;
gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton1, FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback );
SetButtonCursor(gMsgBox.uiYESButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiYESButton );
gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton2, FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback );
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiNOButton );
gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_REHIRE ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX + 2 * ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)ContractMsgBoxCallback );
SetButtonCursor(gMsgBox.uiOKButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiOKButton );
}
if ( usFlags & MSG_BOX_FLAG_GENERIC_TWO_BUTTONS )
{
sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2;
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10;
gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton1, FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback );
SetButtonCursor(gMsgBox.uiYESButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiYESButton );
gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, gzUserDefinedButton2, FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback );
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiNOButton );
}
if ( usFlags & MSG_BOX_FLAG_YESNOLIE )
{
sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 3;
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10;
gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_YES ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback );
SetButtonCursor(gMsgBox.uiYESButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiYESButton );
gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_NO ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback );
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiNOButton );
gMsgBox.uiOKButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_LIE ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX + 2 * ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)LieMsgBoxCallback );
SetButtonCursor(gMsgBox.uiOKButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiOKButton );
}
if ( usFlags & MSG_BOX_FLAG_OKSKIP )
{
sButtonX = ( usTextBoxWidth - ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ) / 2;
sButtonY = usTextBoxHeight - MSGBOX_BUTTON_HEIGHT - 10;
gMsgBox.uiYESButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_OK ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)YESMsgBoxCallback );
SetButtonCursor(gMsgBox.uiYESButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiYESButton );
gMsgBox.uiNOButton = CreateIconAndTextButton( gMsgBox.iButtonImages, pMessageStrings[ MSG_SKIP ], FONT12ARIAL,
ubFontColor, ubFontShadowColor,
ubFontColor, ubFontShadowColor,
TEXT_CJUSTIFIED,
(INT16)(gMsgBox.sX + sButtonX + ( MSGBOX_BUTTON_WIDTH + MSGBOX_BUTTON_X_SEP ) ), (INT16)(gMsgBox.sY + sButtonY ), BUTTON_TOGGLE ,MSYS_PRIORITY_HIGHEST,
DEFAULT_MOVE_CALLBACK, (GUI_CALLBACK)NOMsgBoxCallback );
SetButtonCursor(gMsgBox.uiNOButton, usCursor);
ForceButtonUnDirty( gMsgBox.uiNOButton );
}
}
if ( gMsgBox.usFlags & MSG_BOX_FLAG_DROPDOWN_1 )
{
DropDownTemplate<DROPDOWNNR_MSGBOX_1>::getInstance( ).Create( (INT16)(gMsgBox.sX + 15), (INT16)(gMsgBox.sY + 35) );
}
if ( gMsgBox.usFlags & MSG_BOX_FLAG_DROPDOWN_2 )
{
DropDownTemplate<DROPDOWNNR_MSGBOX_2>::getInstance( ).Create( (INT16)(gMsgBox.sX + 15), (INT16)(gMsgBox.sY + 66) );
}
#if 0
gMsgBox.fWasPaused = GamePaused();
if (!gMsgBox.fWasPaused)
{
InterruptTime();
PauseGame();
LockPauseState( 1 );
// Pause timers as well....
PauseTime( TRUE );
}
#endif
// Save mouse restriction region...
GetRestrictedClipCursor( &gOldCursorLimitRectangle );
FreeMouseCursor( FALSE );
gfNewMessageBox = TRUE;
gfInMsgBox = TRUE;
return( iId );
}
// once the dropdowns in messagebox are used in more than one occasion, this obviously has to be changed...
// this has to be defined. As the MessageBoxScreenHandle() runs all time, there is nothing to do here though
template<> void DropDownTemplate<DROPDOWNNR_MSGBOX_1>::SetRefresh()
{
INT16 box1key = DropDownTemplate<DROPDOWNNR_MSGBOX_1>::getInstance( ).GetSelectedEntryKey( );
if ( gMsgBox.usFlags & MSG_BOX_FLAG_DROPDOWN_2 )
{
std::vector<std::pair<INT16, STR16> > dropdownvector_2 = GetTileSetIndexVector( box1key );
DropDownTemplate<DROPDOWNNR_MSGBOX_2>::getInstance( ).SetEntries( dropdownvector_2 );
if ( !dropdownvector_2.empty( ) )
{
BOOLEAN found = FALSE;
for ( std::vector<std::pair<INT16, STR16> >::iterator it = dropdownvector_2.begin( ); it != dropdownvector_2.end( ); ++it )
{
if ( (*it).first == guiMessageBoxImageIndex )
{
found = TRUE;
break;
}
}
if ( !found )
guiMessageBoxImageIndex = dropdownvector_2[0].first;
}
DropDownTemplate<DROPDOWNNR_MSGBOX_2>::getInstance( ).SetSelectedEntryKey( guiMessageBoxImageIndex );
}
if ( gMsgBox.usFlags & MSG_BOX_FLAG_IMAGE )