forked from MrucznikRolePlay/Mrucznik-RP-Includes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PreviewModelDialog.inc
1312 lines (1099 loc) · 50.1 KB
/
PreviewModelDialog.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
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
#if defined previewmodel_dialog_included
#endinput
#endif
#define previewmodel_dialog_included
/**************************************/
// PreviewModelDialog.inc - v4.7.2 - Last Updated: 2 Oct, 2018 - By Gammix
/***************************************/
#include <memory.inc> // by BigETI
// definitions
#if !defined MAX_DIALOG_PREVIEW_TEXTSIZE
#define MAX_DIALOG_PREVIEW_TEXTSIZE 128
#endif
#if !defined DEFAULT_DIALOG_INCREMENT_SIZE
#define DEFAULT_DIALOG_INCREMENT_SIZE 100
#endif
#define DIALOG_STYLE_PREVIEW_MODEL 6 // new dialog id definition
#define DIALOG_STYLE_PREVMODEL DIALOG_STYLE_PREVIEW_MODEL
#define MAX_DIALOG_PREVIEW_ROWS 2
#define MAX_DIALOG_PREVIEW_COLUMNS 6
#define DIALOG_PREVIEW_HORIZONTAL_GAP 56.5
#define DIALOG_PREVIEW_VERTICAL_GAP 63.5
#define DIALOG_PREVIEW_SELECT_COLOR 0xFF0000FF
#define DIALOG_PREVIEW_UNSELECT_COLOR 0x464646FF
#define SCROLL_BAR_UP_TEXTDRAW Prev@FrameTD[4]
#define SCROLL_BAR_DOWN_TEXTDRAW Prev@FrameTD[6]
#define LEFT_BUTTON_TEXTDRAW Prev@LeftButtonTD[0]
#define RIGHT_BUTTON_TEXTDRAW Prev@RightButtonTD[0]
#define CENTER_BUTTON_TEXTDRAW Prev@CenterButtonTD[0]
#define LISTITEM_TEXTDRAW<%0> Prev@ModelTD[%0][0]
#define LISTITEM_ROTATE_LEFT_TEXTDRAW<%0> Prev@ModelTD[%0][2]
#define LISTITEM_ROTATE_RIGHT_TEXTDRAW<%0> Prev@ModelTD[%0][3]
#define LISTITEM_ZOOM_IN_TEXTDRAW<%0> Prev@ModelTD[%0][4]
#define LISTITEM_ZOOM_OUT_TEXTDRAW<%0> Prev@ModelTD[%0][5]
// variables
static Text:Prev@FrameTD[8];
static Text:Prev@LeftButtonTD[2];
static Text:Prev@RightButtonTD[2];
static Text:Prev@CenterButtonTD[2];
static Text:Prev@ModelTD[MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS][6];
static PlayerText:Prev@HeaderPTD[MAX_PLAYERS];
static PlayerText:Prev@LeftButtonPTD[MAX_PLAYERS];
static PlayerText:Prev@RightButtonPTD[MAX_PLAYERS];
static PlayerText:Prev@CenterButtonPTD[MAX_PLAYERS];
static PlayerText:Prev@PageNumberPTD[MAX_PLAYERS];
static PlayerText:Prev@ScrollBarPTD[MAX_PLAYERS];
static PlayerText:Prev@ModelTextPTD[MAX_PLAYERS][MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS][3];
static bool:Prev@CancelSelection[MAX_PLAYERS];
static Prev@PlayerDialogID[MAX_PLAYERS];
static Prev@PlayerDialogListitem[MAX_PLAYERS];
static Prev@PlayerDialogNumListitems[MAX_PLAYERS];
static Prev@PlayerDialogPage[MAX_PLAYERS];
static Prev@PlayerDialogTickCount[MAX_PLAYERS];
static Pointer:Prev@PlayerListitemPointer[MAX_PLAYERS];
// internal functions
static Prev_GetNumPages(playerid) {
new size = Prev@PlayerDialogNumListitems[playerid];
new page_size = (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS);
return ((size / page_size) + ((size % page_size) ? 1 : 0));
}
static Prev_CancelSelectTextDraw(playerid) {
Prev@CancelSelection[playerid] = true;
return CancelSelectTextDraw(playerid);
}
static Prev_CreateTextDraws() {
/*
* FRAME
*/
Prev@FrameTD[0] = TextDrawCreate(144.0000, 143.0000, "CONTENT_BOX");
TextDrawFont(Prev@FrameTD[0], 2);
TextDrawLetterSize(Prev@FrameTD[0], 0.0000, 19.5000);
TextDrawColor(Prev@FrameTD[0], -1);
TextDrawSetShadow(Prev@FrameTD[0], 0);
TextDrawSetOutline(Prev@FrameTD[0], 0);
TextDrawBackgroundColor(Prev@FrameTD[0], 255);
TextDrawSetProportional(Prev@FrameTD[0], 1);
TextDrawUseBox(Prev@FrameTD[0], 1);
TextDrawBoxColor(Prev@FrameTD[0], 175);
TextDrawTextSize(Prev@FrameTD[0], 501.0000, 0.0000);
Prev@FrameTD[1] = TextDrawCreate(146.5000, 155.5000, "LD_SPAC:WHITE");
TextDrawFont(Prev@FrameTD[1], 4);
TextDrawLetterSize(Prev@FrameTD[1], 0.0000, 18.2000);
TextDrawColor(Prev@FrameTD[1], -1);
TextDrawSetShadow(Prev@FrameTD[1], 0);
TextDrawSetOutline(Prev@FrameTD[1], 0);
TextDrawBackgroundColor(Prev@FrameTD[1], 255);
TextDrawSetProportional(Prev@FrameTD[1], 1);
TextDrawUseBox(Prev@FrameTD[1], 1);
TextDrawBoxColor(Prev@FrameTD[1], 150);
TextDrawTextSize(Prev@FrameTD[1], 351.5000, 130.0000);
Prev@FrameTD[2] = TextDrawCreate(147.0000, 156.0000, "LD_SPAC:BLACK");
TextDrawFont(Prev@FrameTD[2], 4);
TextDrawLetterSize(Prev@FrameTD[2], 0.0000, 18.2000);
TextDrawColor(Prev@FrameTD[2], -1);
TextDrawSetShadow(Prev@FrameTD[2], 0);
TextDrawSetOutline(Prev@FrameTD[2], 0);
TextDrawBackgroundColor(Prev@FrameTD[2], 255);
TextDrawSetProportional(Prev@FrameTD[2], 1);
TextDrawUseBox(Prev@FrameTD[2], 1);
TextDrawBoxColor(Prev@FrameTD[2], 150);
TextDrawTextSize(Prev@FrameTD[2], 340.5000, 129.0000);
Prev@FrameTD[3] = TextDrawCreate(488.0000, 156.0000, "LD_SPAC:BLACK");
TextDrawFont(Prev@FrameTD[3], 4);
TextDrawLetterSize(Prev@FrameTD[3], 0.0000, 18.2000);
TextDrawColor(Prev@FrameTD[3], -1);
TextDrawSetShadow(Prev@FrameTD[3], 0);
TextDrawSetOutline(Prev@FrameTD[3], 0);
TextDrawBackgroundColor(Prev@FrameTD[3], 255);
TextDrawSetProportional(Prev@FrameTD[3], 1);
TextDrawUseBox(Prev@FrameTD[3], 1);
TextDrawBoxColor(Prev@FrameTD[3], 150);
TextDrawTextSize(Prev@FrameTD[3], 9.5000, 129.0000);
// button for scrolling up
Prev@FrameTD[4] = TextDrawCreate(488.0000, 156.0000, "LD_POOL:BALL");
TextDrawFont(Prev@FrameTD[4], 4);
TextDrawLetterSize(Prev@FrameTD[4], 0.0000, 18.2000);
TextDrawColor(Prev@FrameTD[4], -1);
TextDrawSetShadow(Prev@FrameTD[4], 0);
TextDrawSetOutline(Prev@FrameTD[4], 0);
TextDrawBackgroundColor(Prev@FrameTD[4], 255);
TextDrawSetProportional(Prev@FrameTD[4], 1);
TextDrawUseBox(Prev@FrameTD[4], 1);
TextDrawBoxColor(Prev@FrameTD[4], 150);
TextDrawTextSize(Prev@FrameTD[4], 9.5000, 9.5000);
TextDrawSetSelectable(Prev@FrameTD[4], 1);
//
Prev@FrameTD[5] = TextDrawCreate(489.0000, 156.5000, "LD_BEAT:UP");
TextDrawFont(Prev@FrameTD[5], 4);
TextDrawLetterSize(Prev@FrameTD[5], 0.0000, 18.2000);
TextDrawColor(Prev@FrameTD[5], 255);
TextDrawSetShadow(Prev@FrameTD[5], 0);
TextDrawSetOutline(Prev@FrameTD[5], 0);
TextDrawBackgroundColor(Prev@FrameTD[5], 255);
TextDrawSetProportional(Prev@FrameTD[5], 1);
TextDrawUseBox(Prev@FrameTD[5], 1);
TextDrawBoxColor(Prev@FrameTD[5], 150);
TextDrawTextSize(Prev@FrameTD[5], 7.5000, 7.5000);
// button for scrolling down
Prev@FrameTD[6] = TextDrawCreate(488.0000, 275.5000, "LD_POOL:BALL");
TextDrawFont(Prev@FrameTD[6], 4);
TextDrawLetterSize(Prev@FrameTD[6], 0.0000, 18.2000);
TextDrawColor(Prev@FrameTD[6], -1);
TextDrawSetShadow(Prev@FrameTD[6], 0);
TextDrawSetOutline(Prev@FrameTD[6], 0);
TextDrawBackgroundColor(Prev@FrameTD[6], 255);
TextDrawSetProportional(Prev@FrameTD[6], 1);
TextDrawUseBox(Prev@FrameTD[6], 1);
TextDrawBoxColor(Prev@FrameTD[6], 150);
TextDrawTextSize(Prev@FrameTD[6], 9.5000, 9.5000);
TextDrawSetSelectable(Prev@FrameTD[6], 1);
//
Prev@FrameTD[7] = TextDrawCreate(489.0000, 277.0000, "LD_BEAT:DOWN");
TextDrawFont(Prev@FrameTD[7], 4);
TextDrawLetterSize(Prev@FrameTD[7], 0.0000, 18.2000);
TextDrawColor(Prev@FrameTD[7], 255);
TextDrawSetShadow(Prev@FrameTD[7], 0);
TextDrawSetOutline(Prev@FrameTD[7], 0);
TextDrawBackgroundColor(Prev@FrameTD[7], 255);
TextDrawSetProportional(Prev@FrameTD[7], 1);
TextDrawUseBox(Prev@FrameTD[7], 1);
TextDrawBoxColor(Prev@FrameTD[7], 150);
TextDrawTextSize(Prev@FrameTD[7], 7.5000, 7.5000);
/*
* LEFT BUTTON (button1)
*/
// left button for response type "1"
Prev@LeftButtonTD[0] = TextDrawCreate(260.0000, 293.0000, "LD_SPAC:WHITE");
TextDrawFont(Prev@LeftButtonTD[0], 4);
TextDrawLetterSize(Prev@LeftButtonTD[0], 0.5000, 1.0000);
TextDrawColor(Prev@LeftButtonTD[0], -1);
TextDrawSetShadow(Prev@LeftButtonTD[0], 0);
TextDrawSetOutline(Prev@LeftButtonTD[0], 0);
TextDrawBackgroundColor(Prev@LeftButtonTD[0], 255);
TextDrawSetProportional(Prev@LeftButtonTD[0], 1);
TextDrawTextSize(Prev@LeftButtonTD[0], 55.0000, 18.0000);
TextDrawSetSelectable(Prev@LeftButtonTD[0], 1);
//
Prev@LeftButtonTD[1] = TextDrawCreate(260.5000, 293.5000, "LD_SPAC:BLACK");
TextDrawFont(Prev@LeftButtonTD[1], 4);
TextDrawLetterSize(Prev@LeftButtonTD[1], 0.5000, 1.0000);
TextDrawColor(Prev@LeftButtonTD[1], -1);
TextDrawSetShadow(Prev@LeftButtonTD[1], 0);
TextDrawSetOutline(Prev@LeftButtonTD[1], 0);
TextDrawBackgroundColor(Prev@LeftButtonTD[1], 255);
TextDrawSetProportional(Prev@LeftButtonTD[1], 1);
TextDrawTextSize(Prev@LeftButtonTD[1], 54.0000, 17.0000);
/*
* RIGHT BUTTON (button2)
*/
// right button for response type "0"
Prev@RightButtonTD[0] = TextDrawCreate(325.0000, 293.0000, "LD_SPAC:WHITE");
TextDrawFont(Prev@RightButtonTD[0], 4);
TextDrawLetterSize(Prev@RightButtonTD[0], 0.5000, 1.0000);
TextDrawColor(Prev@RightButtonTD[0], -1);
TextDrawSetShadow(Prev@RightButtonTD[0], 0);
TextDrawSetOutline(Prev@RightButtonTD[0], 0);
TextDrawBackgroundColor(Prev@RightButtonTD[0], 255);
TextDrawSetProportional(Prev@RightButtonTD[0], 1);
TextDrawTextSize(Prev@RightButtonTD[0], 55.0000, 18.0000);
TextDrawSetSelectable(Prev@RightButtonTD[0], 1);
//
Prev@RightButtonTD[1] = TextDrawCreate(325.5000, 293.5000, "LD_SPAC:BLACK");
TextDrawFont(Prev@RightButtonTD[1], 4);
TextDrawLetterSize(Prev@RightButtonTD[1], 0.5000, 1.0000);
TextDrawColor(Prev@RightButtonTD[1], -1);
TextDrawSetShadow(Prev@RightButtonTD[1], 0);
TextDrawSetOutline(Prev@RightButtonTD[1], 0);
TextDrawBackgroundColor(Prev@RightButtonTD[1], 255);
TextDrawSetProportional(Prev@RightButtonTD[1], 1);
TextDrawTextSize(Prev@RightButtonTD[1], 54.0000, 17.0000);
/*
* CENTER BUTTON (button3)
*/
// right button for response type "0"
Prev@CenterButtonTD[0] = TextDrawCreate(290.5000, 293.0000, "LD_SPAC:WHITE");
TextDrawFont(Prev@CenterButtonTD[0], 4);
TextDrawLetterSize(Prev@CenterButtonTD[0], 0.5000, 1.0000);
TextDrawColor(Prev@CenterButtonTD[0], -1);
TextDrawSetShadow(Prev@CenterButtonTD[0], 0);
TextDrawSetOutline(Prev@CenterButtonTD[0], 0);
TextDrawBackgroundColor(Prev@CenterButtonTD[0], 255);
TextDrawSetProportional(Prev@CenterButtonTD[0], 1);
TextDrawTextSize(Prev@CenterButtonTD[0], 55.0000, 18.0000);
TextDrawSetSelectable(Prev@CenterButtonTD[0], 1);
//
Prev@CenterButtonTD[1] = TextDrawCreate(291.0000, 293.5000, "LD_SPAC:BLACK");
TextDrawFont(Prev@CenterButtonTD[1], 4);
TextDrawLetterSize(Prev@CenterButtonTD[1], 0.5000, 1.0000);
TextDrawColor(Prev@CenterButtonTD[1], -1);
TextDrawSetShadow(Prev@CenterButtonTD[1], 0);
TextDrawSetOutline(Prev@CenterButtonTD[1], 0);
TextDrawBackgroundColor(Prev@CenterButtonTD[1], 255);
TextDrawSetProportional(Prev@CenterButtonTD[1], 1);
TextDrawTextSize(Prev@CenterButtonTD[1], 54.0000, 17.0000);
/*
* PREVIEW MODEL LISTITEMS
*/
new textdrawid;
for (new a = 0; a < MAX_DIALOG_PREVIEW_ROWS; a++) {
for (new b = 0; b < MAX_DIALOG_PREVIEW_COLUMNS; b++) {
textdrawid = ((a * MAX_DIALOG_PREVIEW_COLUMNS) + b);
// listitem border button to select item
Prev@ModelTD[textdrawid][0] = TextDrawCreate((148.5000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (157.5000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "LD_SPAC:WHITE");
TextDrawFont(Prev@ModelTD[textdrawid][0], 4);
TextDrawLetterSize(Prev@ModelTD[textdrawid][0], 0.5000, 1.0000);
TextDrawColor(Prev@ModelTD[textdrawid][0], -16776961);
TextDrawSetShadow(Prev@ModelTD[textdrawid][0], 0);
TextDrawSetOutline(Prev@ModelTD[textdrawid][0], 0);
TextDrawBackgroundColor(Prev@ModelTD[textdrawid][0], 255);
TextDrawSetProportional(Prev@ModelTD[textdrawid][0], 1);
TextDrawTextSize(Prev@ModelTD[textdrawid][0], 55.0000, 62.0000);
TextDrawSetSelectable(Prev@ModelTD[textdrawid][0], 1);
//
Prev@ModelTD[textdrawid][1] = TextDrawCreate((149.0000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (158.0000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "MODEL");
TextDrawFont(Prev@ModelTD[textdrawid][1], 5);
TextDrawLetterSize(Prev@ModelTD[textdrawid][1], 0.5000, 1.0000);
TextDrawColor(Prev@ModelTD[textdrawid][1], -1);
TextDrawSetShadow(Prev@ModelTD[textdrawid][1], 0);
TextDrawSetOutline(Prev@ModelTD[textdrawid][1], 0);
TextDrawBackgroundColor(Prev@ModelTD[textdrawid][1], 842150655);
TextDrawSetProportional(Prev@ModelTD[textdrawid][1], 1);
TextDrawTextSize(Prev@ModelTD[textdrawid][1], 54.0000, 61.0000);
TextDrawSetPreviewModel(Prev@ModelTD[textdrawid][1], 132);
TextDrawSetPreviewRot(Prev@ModelTD[textdrawid][1], 0.0000, 0.0000, -50.0000, 1.0000);
// listitem rotation button (left)
Prev@ModelTD[textdrawid][2] = TextDrawCreate((157.5000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (204.0000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "LD_BEAT:LEFT");
TextDrawFont(Prev@ModelTD[textdrawid][2], 4);
TextDrawLetterSize(Prev@ModelTD[textdrawid][2], 0.5000, 1.0000);
TextDrawColor(Prev@ModelTD[textdrawid][2], -156);
TextDrawSetShadow(Prev@ModelTD[textdrawid][2], 0);
TextDrawSetOutline(Prev@ModelTD[textdrawid][2], 0);
TextDrawBackgroundColor(Prev@ModelTD[textdrawid][2], 255);
TextDrawSetProportional(Prev@ModelTD[textdrawid][2], 1);
TextDrawTextSize(Prev@ModelTD[textdrawid][2], 10.0000, 10.0000);
TextDrawSetSelectable(Prev@ModelTD[textdrawid][2], 1);
//
// listitem rotation button (right)
Prev@ModelTD[textdrawid][3] = TextDrawCreate((185.0000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (204.0000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "LD_BEAT:RIGHT");
TextDrawFont(Prev@ModelTD[textdrawid][3], 4);
TextDrawLetterSize(Prev@ModelTD[textdrawid][3], 0.5000, 1.0000);
TextDrawColor(Prev@ModelTD[textdrawid][3], -156);
TextDrawSetShadow(Prev@ModelTD[textdrawid][3], 0);
TextDrawSetOutline(Prev@ModelTD[textdrawid][3], 0);
TextDrawBackgroundColor(Prev@ModelTD[textdrawid][3], 255);
TextDrawSetProportional(Prev@ModelTD[textdrawid][3], 1);
TextDrawTextSize(Prev@ModelTD[textdrawid][3], 10.0000, 10.0000);
TextDrawSetSelectable(Prev@ModelTD[textdrawid][3], 1);
//
// listitem zoom-in button
Prev@ModelTD[textdrawid][4] = TextDrawCreate((191.5000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (171.0000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "LD_BEAT:UP");
TextDrawFont(Prev@ModelTD[textdrawid][4], 4);
TextDrawLetterSize(Prev@ModelTD[textdrawid][4], 0.5000, 1.0000);
TextDrawColor(Prev@ModelTD[textdrawid][4], -156);
TextDrawSetShadow(Prev@ModelTD[textdrawid][4], 0);
TextDrawSetOutline(Prev@ModelTD[textdrawid][4], 0);
TextDrawBackgroundColor(Prev@ModelTD[textdrawid][4], 255);
TextDrawSetProportional(Prev@ModelTD[textdrawid][4], 1);
TextDrawTextSize(Prev@ModelTD[textdrawid][4], 10.0000, 10.0000);
TextDrawSetSelectable(Prev@ModelTD[textdrawid][4], 1);
//
// listitem zoom-out button
Prev@ModelTD[textdrawid][5] = TextDrawCreate((191.5000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (193.0000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "LD_BEAT:DOWN");
TextDrawFont(Prev@ModelTD[textdrawid][5], 4);
TextDrawLetterSize(Prev@ModelTD[textdrawid][5], 0.5000, 1.0000);
TextDrawColor(Prev@ModelTD[textdrawid][5], -156);
TextDrawSetShadow(Prev@ModelTD[textdrawid][5], 0);
TextDrawSetOutline(Prev@ModelTD[textdrawid][5], 0);
TextDrawBackgroundColor(Prev@ModelTD[textdrawid][5], 255);
TextDrawSetProportional(Prev@ModelTD[textdrawid][5], 1);
TextDrawTextSize(Prev@ModelTD[textdrawid][5], 10.0000, 10.0000);
TextDrawSetSelectable(Prev@ModelTD[textdrawid][5], 1);
//
}
}
}
static Prev_DestroyTextDraws() {
/*
* FRAME
*/
for (new i = 0; i < sizeof Prev@FrameTD; i++) {
TextDrawDestroy(Prev@FrameTD[i]);
}
/*
* LEFT BUTTON (button1)
*/
TextDrawDestroy(Prev@LeftButtonTD[0]);
TextDrawDestroy(Prev@LeftButtonTD[1]);
/*
* RIGHT BUTTON (button2)
*/
TextDrawDestroy(Prev@RightButtonTD[0]);
TextDrawDestroy(Prev@RightButtonTD[1]);
/*
* CENTER BUTTON (button1)
*/
TextDrawDestroy(Prev@CenterButtonTD[0]);
TextDrawDestroy(Prev@CenterButtonTD[1]);
/*
* PREVIEW MODEL LISTITEMS
*/
for (new i = 0; i < (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS); i++) {
TextDrawDestroy(Prev@ModelTD[i][0]);
TextDrawDestroy(Prev@ModelTD[i][1]);
TextDrawDestroy(Prev@ModelTD[i][2]);
TextDrawDestroy(Prev@ModelTD[i][3]);
TextDrawDestroy(Prev@ModelTD[i][4]);
TextDrawDestroy(Prev@ModelTD[i][5]);
}
}
static Prev_CreatePlayerTextDraws(playerid, header[], button1[], button2[], button3[], totalItems) {
/*
* HEADER
*/
Prev@HeaderPTD[playerid] = CreatePlayerTextDraw(playerid, 144.0000, 143.0000, header);
PlayerTextDrawFont(playerid, Prev@HeaderPTD[playerid], 2);
PlayerTextDrawLetterSize(playerid, Prev@HeaderPTD[playerid], 0.1399, 0.8999);
PlayerTextDrawColor(playerid, Prev@HeaderPTD[playerid], -1);
PlayerTextDrawSetShadow(playerid, Prev@HeaderPTD[playerid], 0);
PlayerTextDrawSetOutline(playerid, Prev@HeaderPTD[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, Prev@HeaderPTD[playerid], 255);
PlayerTextDrawSetProportional(playerid, Prev@HeaderPTD[playerid], 1);
PlayerTextDrawUseBox(playerid, Prev@HeaderPTD[playerid], 1);
PlayerTextDrawBoxColor(playerid, Prev@HeaderPTD[playerid], 255);
PlayerTextDrawTextSize(playerid, Prev@HeaderPTD[playerid], 501.0000, 0.0000);
/*
* LEFT BUTTON (button1)
*/
if (button1[0] != EOS) {
Prev@LeftButtonPTD[playerid] = CreatePlayerTextDraw(playerid, 287.5000, 297.0000, button1);
PlayerTextDrawFont(playerid, Prev@LeftButtonPTD[playerid], 2);
PlayerTextDrawLetterSize(playerid, Prev@LeftButtonPTD[playerid], 0.1399, 0.8999);
PlayerTextDrawAlignment(playerid, Prev@LeftButtonPTD[playerid], 2);
PlayerTextDrawColor(playerid, Prev@LeftButtonPTD[playerid], -1);
PlayerTextDrawSetShadow(playerid, Prev@LeftButtonPTD[playerid], 0);
PlayerTextDrawSetOutline(playerid, Prev@LeftButtonPTD[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, Prev@LeftButtonPTD[playerid], 255);
PlayerTextDrawSetProportional(playerid, Prev@LeftButtonPTD[playerid], 1);
PlayerTextDrawTextSize(playerid, Prev@LeftButtonPTD[playerid], 0.0000, 480.0000);
} else {
Prev@LeftButtonPTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
}
/*
* RIGHT BUTTON (button2)
*/
if (button2[0] != EOS) {
Prev@RightButtonPTD[playerid] = CreatePlayerTextDraw(playerid, 352.5000, 297.0000, button2);
PlayerTextDrawFont(playerid, Prev@RightButtonPTD[playerid], 2);
PlayerTextDrawLetterSize(playerid, Prev@RightButtonPTD[playerid], 0.1399, 0.8999);
PlayerTextDrawAlignment(playerid, Prev@RightButtonPTD[playerid], 2);
PlayerTextDrawColor(playerid, Prev@RightButtonPTD[playerid], -1);
PlayerTextDrawSetShadow(playerid, Prev@RightButtonPTD[playerid], 0);
PlayerTextDrawSetOutline(playerid, Prev@RightButtonPTD[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, Prev@RightButtonPTD[playerid], 255);
PlayerTextDrawSetProportional(playerid, Prev@RightButtonPTD[playerid], 1);
PlayerTextDrawTextSize(playerid, Prev@RightButtonPTD[playerid], 0.0000, 480.0000);
} else {
Prev@RightButtonPTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
}
/*
* CENTER BUTTON (button3)
*/
if (button3[0] != EOS) {
Prev@CenterButtonPTD[playerid] = CreatePlayerTextDraw(playerid, 318.0000, 297.0000, button3);
PlayerTextDrawFont(playerid, Prev@CenterButtonPTD[playerid], 2);
PlayerTextDrawLetterSize(playerid, Prev@CenterButtonPTD[playerid], 0.1399, 0.8999);
PlayerTextDrawAlignment(playerid, Prev@CenterButtonPTD[playerid], 2);
PlayerTextDrawColor(playerid, Prev@CenterButtonPTD[playerid], -1);
PlayerTextDrawSetShadow(playerid, Prev@CenterButtonPTD[playerid], 0);
PlayerTextDrawSetOutline(playerid, Prev@CenterButtonPTD[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, Prev@CenterButtonPTD[playerid], 255);
PlayerTextDrawSetProportional(playerid, Prev@CenterButtonPTD[playerid], 1);
PlayerTextDrawTextSize(playerid, Prev@CenterButtonPTD[playerid], 0.0000, 480.0000);
} else {
Prev@CenterButtonPTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
}
/*
* PAGE NUMBER
*/
if (totalItems > (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) { // if there are more than "12" listitems, create page textdraw
Prev@PageNumberPTD[playerid] = CreatePlayerTextDraw(playerid, 501.5000, 143.0000, "Page: 1");
PlayerTextDrawFont(playerid, Prev@PageNumberPTD[playerid], 2);
PlayerTextDrawLetterSize(playerid, Prev@PageNumberPTD[playerid], 0.1399, 0.8999);
PlayerTextDrawAlignment(playerid, Prev@PageNumberPTD[playerid], 3);
PlayerTextDrawColor(playerid, Prev@PageNumberPTD[playerid], -1);
PlayerTextDrawSetShadow(playerid, Prev@PageNumberPTD[playerid], 0);
PlayerTextDrawSetOutline(playerid, Prev@PageNumberPTD[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, Prev@PageNumberPTD[playerid], 255);
PlayerTextDrawSetProportional(playerid, Prev@PageNumberPTD[playerid], 1);
PlayerTextDrawTextSize(playerid, Prev@PageNumberPTD[playerid], 501.0000, 0.0000);
} else {
Prev@PageNumberPTD[playerid] = PlayerText:INVALID_TEXT_DRAW;
}
/*
* PREVIEW MODEL LISTITEMS
*/
new textdrawid;
for (new a = 0; a < MAX_DIALOG_PREVIEW_ROWS; a++) {
for (new b = 0; b < MAX_DIALOG_PREVIEW_COLUMNS; b++) {
textdrawid = ((a * MAX_DIALOG_PREVIEW_COLUMNS) + b);
if (textdrawid >= totalItems) {
Prev@ModelTextPTD[playerid][textdrawid][0] = PlayerText:INVALID_TEXT_DRAW;
Prev@ModelTextPTD[playerid][textdrawid][1] = PlayerText:INVALID_TEXT_DRAW;
Prev@ModelTextPTD[playerid][textdrawid][2] = PlayerText:INVALID_TEXT_DRAW;
continue;
}
Prev@ModelTextPTD[playerid][textdrawid][0] = CreatePlayerTextDraw(playerid, (153.5000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (161.5000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "");
PlayerTextDrawFont(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 2);
PlayerTextDrawLetterSize(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 0.1399, 0.8999);
PlayerTextDrawColor(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], -1);
PlayerTextDrawSetShadow(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 0);
PlayerTextDrawSetOutline(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 0);
PlayerTextDrawBackgroundColor(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 255);
PlayerTextDrawSetProportional(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 1);
PlayerTextDrawUseBox(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 1);
PlayerTextDrawBoxColor(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], 0);
PlayerTextDrawTextSize(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], (201.5000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), 0.0000);
Prev@ModelTextPTD[playerid][textdrawid][1] = CreatePlayerTextDraw(playerid, (176.5000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (204.5000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "0.0");
PlayerTextDrawFont(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 2);
PlayerTextDrawLetterSize(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 0.1399, 0.8999);
PlayerTextDrawAlignment(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 2);
PlayerTextDrawColor(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], -156);
PlayerTextDrawSetShadow(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 0);
PlayerTextDrawSetOutline(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 0);
PlayerTextDrawBackgroundColor(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 255);
PlayerTextDrawSetProportional(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 1);
PlayerTextDrawTextSize(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], 640.0000, 480.0000);
Prev@ModelTextPTD[playerid][textdrawid][2] = CreatePlayerTextDraw(playerid, (196.5000 + (b * DIALOG_PREVIEW_HORIZONTAL_GAP)), (182.0000 + (a * DIALOG_PREVIEW_VERTICAL_GAP)), "0.0");
PlayerTextDrawFont(playerid, Prev@ModelTextPTD[playerid][textdrawid][2], 2);
PlayerTextDrawLetterSize(playerid, Prev@ModelTextPTD[playerid][textdrawid][2], 0.1399, 0.8999);
PlayerTextDrawAlignment(playerid, Prev@ModelTextPTD[playerid][textdrawid][2], 2);
PlayerTextDrawColor(playerid, Prev@ModelTextPTD[playerid][textdrawid][2], -156);
PlayerTextDrawSetShadow(playerid, Prev@ModelTextPTD[playerid][textdrawid][2], 0);
PlayerTextDrawSetOutline(playerid, Prev@ModelTextPTD[playerid][textdrawid][2], 0);
PlayerTextDrawBackgroundColor(playerid, Prev@ModelTextPTD[playerid][textdrawid][2], 255);
PlayerTextDrawSetProportional(playerid, Prev@ModelTextPTD[playerid][textdrawid][2], 1);
PlayerTextDrawTextSize(playerid, Prev@ModelTextPTD[playerid][textdrawid][2], 640.0000, 480.0000);
}
}
/*
* SCROLLBAR
*/
Prev@ScrollBarPTD[playerid] = PlayerText:INVALID_TEXT_DRAW; // we will create this later if needed in dialog
}
static Prev_DestroyPlayerTextDraws(playerid) {
/*
* HEADER
*/
PlayerTextDrawDestroy(playerid, Prev@HeaderPTD[playerid]);
/*
* LEFT BUTTON (button1)
*/
PlayerTextDrawDestroy(playerid, Prev@LeftButtonPTD[playerid]);
/*
* RIGHT BUTTON (button2)
*/
PlayerTextDrawDestroy(playerid, Prev@RightButtonPTD[playerid]);
/*
* CENTER BUTTON (button3)
*/
PlayerTextDrawDestroy(playerid, Prev@CenterButtonPTD[playerid]);
/*
* PAGE NUMBER
*/
PlayerTextDrawDestroy(playerid, Prev@PageNumberPTD[playerid]);
/*
* SCROLLBAR
*/
PlayerTextDrawDestroy(playerid, Prev@ScrollBarPTD[playerid]);
/*
* PREVIEW MODEL LISTITEMS
*/
for (new i = 0; i < (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS); i++) {
PlayerTextDrawDestroy(playerid, Prev@ModelTextPTD[playerid][i][0]);
PlayerTextDrawDestroy(playerid, Prev@ModelTextPTD[playerid][i][1]);
PlayerTextDrawDestroy(playerid, Prev@ModelTextPTD[playerid][i][2]);
}
}
static Prev_UpdateScrollBar(playerid, page, totalPages) {
PlayerTextDrawDestroy(playerid, Prev@ScrollBarPTD[playerid]);
const Float:MAX_HEIGHT = 108.0000;
new Float:height = (MAX_HEIGHT / totalPages);
new Float:y = 166.5000;
y += (height * page);
Prev@ScrollBarPTD[playerid] = CreatePlayerTextDraw(playerid, 489.0000, y, "LD_SPAC:WHITE");
PlayerTextDrawFont(playerid, Prev@ScrollBarPTD[playerid], 4);
PlayerTextDrawLetterSize(playerid, Prev@ScrollBarPTD[playerid], 0.0000, 18.2000);
PlayerTextDrawColor(playerid, Prev@ScrollBarPTD[playerid], -16776961);
PlayerTextDrawSetShadow(playerid, Prev@ScrollBarPTD[playerid], 0);
PlayerTextDrawSetOutline(playerid, Prev@ScrollBarPTD[playerid], 0);
PlayerTextDrawBackgroundColor(playerid, Prev@ScrollBarPTD[playerid], 255);
PlayerTextDrawSetProportional(playerid, Prev@ScrollBarPTD[playerid], 1);
PlayerTextDrawUseBox(playerid, Prev@ScrollBarPTD[playerid], 1);
PlayerTextDrawBoxColor(playerid, Prev@ScrollBarPTD[playerid], 150);
PlayerTextDrawTextSize(playerid, Prev@ScrollBarPTD[playerid], 7.5000, height);
PlayerTextDrawShow(playerid, Prev@ScrollBarPTD[playerid]);
}
static Prev_UpdateListitems(playerid, page, selected, totalItems) {
new textdrawid;
new listitemid;
new Pointer:listitemPointer;
new Pointer:listitemTextPointer;
new modelid, text[MAX_DIALOG_PREVIEW_TEXTSIZE], Float:rx, Float:ry, Float:rz, Float:zoom, color1, color2;
for (new a = 0; a < MAX_DIALOG_PREVIEW_ROWS; a++) {
for (new b = 0; b < MAX_DIALOG_PREVIEW_COLUMNS; b++) {
textdrawid = ((a * MAX_DIALOG_PREVIEW_COLUMNS) + b);
listitemid = ((page * (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) + textdrawid);
if (listitemid >= totalItems) {
TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][0]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][1]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][2]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][3]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][4]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][5]);
PlayerTextDrawHide(playerid, Prev@ModelTextPTD[playerid][textdrawid][0]);
PlayerTextDrawHide(playerid, Prev@ModelTextPTD[playerid][textdrawid][1]);
PlayerTextDrawHide(playerid, Prev@ModelTextPTD[playerid][textdrawid][2]);
continue;
}
listitemPointer = Pointer:MEM_get_val(Prev@PlayerListitemPointer[playerid], listitemid);
modelid = MEM_get_val(listitemPointer, 0);
listitemTextPointer = Pointer:MEM_get_val(listitemPointer, 1);
rx = Float:MEM_get_val(listitemPointer, 2);
ry = Float:MEM_get_val(listitemPointer, 3);
rz = Float:MEM_get_val(listitemPointer, 4);
zoom = Float:MEM_get_val(listitemPointer, 5);
color1 = MEM_get_val(listitemPointer, 6);
color2 = MEM_get_val(listitemPointer, 7);
TextDrawSetPreviewModel(Prev@ModelTD[textdrawid][1], modelid);
TextDrawSetPreviewRot(Prev@ModelTD[textdrawid][1], rx, ry, rz, zoom);
TextDrawSetPreviewVehCol(Prev@ModelTD[textdrawid][1], color1, color2);
TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][1]);
if (textdrawid == selected) {
TextDrawColor(Prev@ModelTD[textdrawid][0], DIALOG_PREVIEW_SELECT_COLOR);
TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][0]);
TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][2]);
TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][3]);
TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][4]);
TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][5]);
new string[16];
format(string, sizeof string, "%0.1f", rz);
PlayerTextDrawSetString(playerid, Prev@ModelTextPTD[playerid][textdrawid][1], string);
PlayerTextDrawShow(playerid, Prev@ModelTextPTD[playerid][textdrawid][1]);
format(string, sizeof string, "%0.1f", zoom);
PlayerTextDrawSetString(playerid, Prev@ModelTextPTD[playerid][textdrawid][2], string);
PlayerTextDrawShow(playerid, Prev@ModelTextPTD[playerid][textdrawid][2]);
} else {
TextDrawColor(Prev@ModelTD[textdrawid][0], DIALOG_PREVIEW_UNSELECT_COLOR);
TextDrawShowForPlayer(playerid, Prev@ModelTD[textdrawid][0]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][2]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][3]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][4]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[textdrawid][5]);
PlayerTextDrawHide(playerid, Prev@ModelTextPTD[playerid][textdrawid][1]);
PlayerTextDrawHide(playerid, Prev@ModelTextPTD[playerid][textdrawid][2]);
}
if (listitemTextPointer != MEM_NULLPTR) {
MEM_get_arr(listitemTextPointer, 0, text, MEM_get_size(listitemTextPointer));
PlayerTextDrawSetString(playerid, Prev@ModelTextPTD[playerid][textdrawid][0], text);
PlayerTextDrawShow(playerid, Prev@ModelTextPTD[playerid][textdrawid][0]);
} else {
PlayerTextDrawHide(playerid, Prev@ModelTextPTD[playerid][textdrawid][0]);
}
}
}
new string[16];
format(string, sizeof string, "PAGE: %i/%i", (page + 1), Prev_GetNumPages(playerid));
PlayerTextDrawSetString(playerid, Prev@PageNumberPTD[playerid], string);
}
static Prev_DeletePointers(playerid) {
new Pointer:listitemPointer;
new Pointer:listitemTextPointer;
for (new i = 0; i < Prev@PlayerDialogNumListitems[playerid]; i++) {
listitemPointer = Pointer:MEM_get_val(Prev@PlayerListitemPointer[playerid], i);
listitemTextPointer = Pointer:MEM_get_val(listitemPointer, 1);
if (listitemTextPointer != MEM_NULLPTR) {
MEM_delete(listitemTextPointer);
}
MEM_delete(listitemPointer);
}
MEM_delete(Prev@PlayerListitemPointer[playerid]);
Prev@PlayerListitemPointer[playerid] = MEM_NULLPTR;
}
static Prev_HidePlayerDialog(playerid) {
/*
* FRAME
*/
for (new i = 0; i < sizeof Prev@FrameTD; i++) {
TextDrawHideForPlayer(playerid, Prev@FrameTD[i]);
}
/*
* LEFT BUTTON
*/
TextDrawHideForPlayer(playerid, Prev@LeftButtonTD[0]);
TextDrawHideForPlayer(playerid, Prev@LeftButtonTD[1]);
/*
* RIGHT BUTTON
*/
TextDrawHideForPlayer(playerid, Prev@RightButtonTD[0]);
TextDrawHideForPlayer(playerid, Prev@RightButtonTD[1]);
/*
* CENTER BUTTON
*/
TextDrawHideForPlayer(playerid, Prev@CenterButtonTD[0]);
TextDrawHideForPlayer(playerid, Prev@CenterButtonTD[1]);
/*
* PREVIEW MODEL LISTITEMS
*/
for (new i = 0; i < (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS); i++) {
TextDrawHideForPlayer(playerid, Prev@ModelTD[i][0]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[i][1]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[i][2]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[i][3]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[i][4]);
TextDrawHideForPlayer(playerid, Prev@ModelTD[i][5]);
}
/*
* DESTROY DIALOG PLAYER TEXTDRAWS
*/
Prev_DestroyPlayerTextDraws(playerid);
Prev_DeletePointers(playerid);
Prev@PlayerDialogID[playerid] = -1;
return Prev_CancelSelectTextDraw(playerid);
}
static Prev_FetchListitemData(const listitem[], &modelid, text[], &Float:rx, &Float:ry, &Float:rz, &Float:zoom, &color1, &color2, text_size = sizeof(text)) {
rx = 0.0;
ry = 0.0;
rz = -45.0;
zoom = 1.0;
color1 = -1;
color2 = -1;
new pos, next, count;
new valuestr[16];
new modelstr[32 + (sizeof(valuestr) * 7)];
pos = strfind(listitem, "\t");
if (pos == -1) {
strmid(modelstr, listitem, 0, strlen(listitem));
text[0] = EOS;
} else {
strmid(modelstr, listitem, 0, pos);
format(text, text_size, listitem[pos + 1]);
}
if (modelstr[0] == EOS) {
return 0;
}
pos = strfind(modelstr, "(");
if (pos == -1) {
modelid = strval(modelstr);
return 1;
}
if (strfind(modelstr, ")", false, (pos + 1)) == -1) {
return 0;
}
strmid(valuestr, modelstr, 0, pos);
modelid = strval(valuestr);
do {
next = strfind(modelstr, ",", false, pos);
strmid(valuestr, modelstr, pos, ((next == -1) ? strlen(modelstr) : next), sizeof(valuestr));
pos = (next == -1) ? -1 : (next + 1);
switch (count) {
case 0: rx = floatstr(valuestr);
case 1: ry = floatstr(valuestr);
case 2: rz = floatstr(valuestr);
case 3: zoom = floatstr(valuestr);
case 4: color1 = strval(valuestr);
case 5: color2 = strval(valuestr);
}
++count;
} while (pos != -1 && count != 6);
return 1;
}
// hooked methods
public OnGameModeInit() {
Prev_CreateTextDraws();
#if defined PDialog_OnGameModeInit
return PDialog_OnGameModeInit();
#else
return 1;
#endif
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit PDialog_OnGameModeInit
#if defined PDialog_OnGameModeInit
forward PDialog_OnGameModeInit();
#endif
public OnGameModeExit() {
Prev_DestroyTextDraws();
#if defined PDialog_OnGameModeExit
return PDialog_OnGameModeExit();
#else
return 1;
#endif
}
#if defined _ALS_OnGameModeExit
#undef OnGameModeExit
#else
#define _ALS_OnGameModeExit
#endif
#define OnGameModeExit PDialog_OnGameModeExit
#if defined PDialog_OnGameModeExit
forward PDialog_OnGameModeExit();
#endif
public OnFilterScriptInit() {
Prev_CreateTextDraws();
#if defined PDialog_OnFilterScriptInit
return PDialog_OnFilterScriptInit();
#else
return 1;
#endif
}
#if defined _ALS_OnFilterScriptInit
#undef OnFilterScriptInit
#else
#define _ALS_OnFilterScriptInit
#endif
#define OnFilterScriptInit PDialog_OnFilterScriptInit
#if defined PDialog_OnFilterScriptInit
forward PDialog_OnFilterScriptInit();
#endif
public OnFilterScriptExit() {
Prev_DestroyTextDraws();
#if defined PDialog_OnFilterScriptExit
return PDialog_OnFilterScriptExit();
#else
return 1;
#endif
}
#if defined _ALS_OnFilterScriptExit
#undef OnFilterScriptExit
#else
#define _ALS_OnFilterScriptExit
#endif
#define OnFilterScriptExit PDialog_OnFilterScriptExit
#if defined PDialog_OnFilterScriptExit
forward PDialog_OnFilterScriptExit();
#endif
public OnPlayerConnect(playerid) {
Prev@CancelSelection[playerid] = false;
Prev@PlayerDialogID[playerid] = -1;
Prev@PlayerListitemPointer[playerid] = MEM_NULLPTR;
#if defined PDialog_OnPlayerConnect
return PDialog_OnPlayerConnect(playerid);
#else
return 1;
#endif
}
#if defined _ALS_OnPlayerConnect
#undef OnPlayerConnect
#else
#define _ALS_OnPlayerConnect
#endif
#define OnPlayerConnect PDialog_OnPlayerConnect
#if defined PDialog_OnPlayerConnect
forward PDialog_OnPlayerConnect(playerid);
#endif
public OnPlayerDisconnect(playerid, reason) {
if (Prev@PlayerListitemPointer[playerid] != MEM_NULLPTR) {
Prev_DeletePointers(playerid);
}
#if defined PDialog_OnPlayerDisconnect
return PDialog_OnPlayerDisconnect(playerid, reason);
#else
return 1;
#endif
}
#if defined _ALS_OnPlayerDisconnect
#undef OnPlayerDisconnect
#else
#define _ALS_OnPlayerDisconnect
#endif
#define OnPlayerDisconnect PDialog_OnPlayerDisconnect
#if defined PDialog_OnPlayerDisconnect
forward PDialog_OnPlayerDisconnect(playerid, reason);
#endif
public OnPlayerClickTextDraw(playerid, Text:clickedid) {
if (Prev@CancelSelection[playerid]) {
Prev@CancelSelection[playerid] = false;
#if defined PDialog_OnPlayerClickTextDraw
return PDialog_OnPlayerClickTextDraw(playerid, Text:clickedid);
#else
return 1;
#endif
}
if (Prev@PlayerDialogID[playerid] != -1) {
if (clickedid == Text:INVALID_TEXT_DRAW || clickedid == RIGHT_BUTTON_TEXTDRAW) {
new dialogid = Prev@PlayerDialogID[playerid];
new listitem = ((Prev@PlayerDialogPage[playerid] * (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) + Prev@PlayerDialogListitem[playerid]);
new inputtext[16];
valstr(inputtext, MEM_get_val(Pointer:MEM_get_val(Prev@PlayerListitemPointer[playerid], listitem), 0));
Prev_HidePlayerDialog(playerid);
CallLocalFunction("OnDialogResponse", "iiiis", playerid, dialogid, 0, listitem, inputtext);
} else if (clickedid == SCROLL_BAR_UP_TEXTDRAW) {
if (Prev@PlayerDialogPage[playerid] > 0) {
Prev_UpdateListitems(playerid, --Prev@PlayerDialogPage[playerid], 0, Prev@PlayerDialogNumListitems[playerid]);
Prev_UpdateScrollBar(playerid, Prev@PlayerDialogPage[playerid], Prev_GetNumPages(playerid));
Prev@PlayerDialogListitem[playerid] = 0;
}
} else if (clickedid == SCROLL_BAR_DOWN_TEXTDRAW) {
if ((Prev@PlayerDialogPage[playerid] + 1) < Prev_GetNumPages(playerid)) {
Prev_UpdateListitems(playerid, ++Prev@PlayerDialogPage[playerid], 0, Prev@PlayerDialogNumListitems[playerid]);
Prev_UpdateScrollBar(playerid, Prev@PlayerDialogPage[playerid], Prev_GetNumPages(playerid));
Prev@PlayerDialogListitem[playerid] = 0;
}
} else if (clickedid == LEFT_BUTTON_TEXTDRAW || clickedid == CENTER_BUTTON_TEXTDRAW) {
new dialogid = Prev@PlayerDialogID[playerid];
new listitem = ((Prev@PlayerDialogPage[playerid] * (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) + Prev@PlayerDialogListitem[playerid]);
new inputtext[16];
valstr(inputtext, MEM_get_val(Pointer:MEM_get_val(Prev@PlayerListitemPointer[playerid], listitem), 0));
Prev_HidePlayerDialog(playerid);
CallLocalFunction("OnDialogResponse", "iiiis", playerid, dialogid, 1, listitem, inputtext);
} else if (clickedid == LISTITEM_ROTATE_LEFT_TEXTDRAW<Prev@PlayerDialogListitem[playerid]>) {
new listitem = ((Prev@PlayerDialogPage[playerid] * (MAX_DIALOG_PREVIEW_ROWS * MAX_DIALOG_PREVIEW_COLUMNS)) + Prev@PlayerDialogListitem[playerid]);
new Pointer:listitemPointer = Pointer:MEM_get_val(Prev@PlayerListitemPointer[playerid], listitem);
new Float:rx, Float:ry, Float:rz, Float:zoom;
rx = Float:MEM_get_val(listitemPointer, 2);
ry = Float:MEM_get_val(listitemPointer, 3);
rz = Float:MEM_get_val(listitemPointer, 4);