-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoverworld.h
2875 lines (2626 loc) · 117 KB
/
overworld.h
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
//MINI BOSS SLIME EM DESENVOLVIMENTO! //
#include <time.h>
#include <stdio.h> // FUNCOES BASICAS // se necessario
#include <stdlib.h>
#include <stdbool.h> // BOOLEANAS //
#include <math.h> // matematica top /
#include <time.h>
#include "SDL2/SDL.h" //SDL LIBRARY //
#include "SDL2/SDL_image.h"
#include "SDL2/SDL_mixer.h"
#include "SDL2/SDL_ttf.h"
// BIBLIOTECAS PROPRIAS //
#include "headers/colisor.h"
#include "headers/knockback.h"
#include "headers/meatbox.h"
#include "headers/ogre.h"
#include "headers/explosion.h"
#include "headers/mage.h"
#include "headers/player.h"
#include "headers/cristal.h"
#include "headers/npc.h"
#include "headers/book.h"
#include "headers/potion.h"
#include "headers/bigboss.h"
#define LIFE 5
#define LIFEMOB1 3
#define DELAY_PROJETIL 60
#define SENTINELAPROJETIL 2
//test//
SDL_Rect temp;
//VARIAVEIS, SURFACES, ETC//
int sala=2, checkSala = 2;
int w=1280,h=800;
bool gaming = true; //GAME LOOP//
float gX = 3692, gY = 97; //MOVIMENTAÇÃO//
//float gX = 1531, gY = 491; //MOVIMENTAÇÃO//
int xd,xe,yb,yc; //VARIAVEIS EXTRAS//
// BOOK //
BOOK book;
SDL_Surface * bookSurf;
SDL_Texture * bookTex;
// TUTORIAL //
SDL_Surface * tutorialSurf;
SDL_Texture * tutorialTex;
bool houvetutorial = false;
// BIGBOSS//
BIGBOSS bigboss[1];
SDL_Surface * bigbossSurf;
SDL_Texture * bigbossTex;
// DOG && CAT //
SDL_Surface * dog1Surf;
SDL_Texture * dog1Tex;
SDL_Surface * cat1Surf;
SDL_Texture * cat1Tex;
ANIMALS animals[2];
int animalsmax = 2;
// NPC //
SDL_Surface * npcSurf;
SDL_Texture * npcTex;
NPC npc[4];
int npcmax = 4;
// IRMAO
NPC irmao;
// ANCIAO //
NPC anciao;
// MEAT BOX //
SDL_Surface* meatboxSurf;
SDL_Texture* meatboxTex;
MEATBOX meatbox[10];
int meatboxMobs = 10;
// OGRE //
SDL_Surface* ogreSurf;
SDL_Texture* ogreTex;
OGRE ogre[9];
int ogreMobs = 9;
// MAGE //
MAGE mage[8];
SDL_Surface* mageSurf;
SDL_Texture* mageTex;
int mageMobs = 8;
// EXPLOSION //
MEGUMIN explodir;
SDL_Surface* explodirSurf;
SDL_Texture* explodirTex;
// CRISTAL //
SDL_Surface* cristalSurf;
SDL_Texture* cristalTex;
CRISTAL cristal[7];
static int cristalQuantidade = 7;
// MOUSE //
PONTEIROMOUSE mouse;
SDL_Cursor* cursor;
SDL_Surface* colorCursor;
// MISSAO //
DESAFIOS missao;
// PORTAO //
SDL_Surface* portaoSurf;
SDL_Texture* portaoTex;
PORTAO portao;
//COLISOES//
bool colisao = false;
//MAP//
SDL_Rect rRcam = {0,0,640, 400};
SDL_Texture* mapTex; //textura da wall//
SDL_Surface* mapSurf; //surface da wall//
SDL_Texture* mapTex2; //textura da wall//
SDL_Surface* mapSurf2; //surface da wall//
int mapw = 6360;
int maph = 2880;
bool pause = false;
//WALL//
SDL_Rect rRw[400];
SDL_Texture* wallTex; //textura da wall//
SDL_Surface* wallSurf; //surface da wall//
int numWall = 400;
struct CHEST {
bool estado;
int x;
int y;
SDL_Rect pos;
};
typedef struct CHEST CHEST;
CHEST chest[5];
int numChest = 5;
SDL_Rect sChestF = {0,0, 16, 16};
SDL_Rect sChestA = {32, 0, 16, 16};
SDL_Surface* chestSurf;
SDL_Texture* chestTex;
SDL_Rect rPortal[2];
SDL_Rect sPortal;
SDL_Surface * portalSurf;
SDL_Texture * portalTex;
// MINI BOSS//
SDL_Surface* minibossSurf;
SDL_Texture* minibossTex;
struct MINIBOSS {
SDL_Rect posTela;
SDL_Rect posCorte;
int life;
int velocidade;
int posicaox;
int posicaoy;
int direcao;
int andando;
bool sala;
};
typedef struct MINIBOSS MINIBOSS;
MINIBOSS miniboss[1];
SDL_Rect rBossBar = {212,370, 217, 12};
SDL_Rect sBossBar = {0, 0, 217, 12};
SDL_Rect rBossLife;
SDL_Rect sBossLife = {220, 1, 9, 9};
// MOUSE //
PONTEIROMOUSE mouse;
SDL_Cursor* cursor;
SDL_Surface* colorCursor;
/*
mage->sRp.x = 62; mage->sRp.w = 14;
mage->sRp.y = 2; mage->sRp.h = 14;
*/
//PLAYER//
bool firsttimeunderworld = false;
bool firsttimeoverworld = false;
bool wakeup;
SDL_Surface * projSurf;
SDL_Texture * projTex;
SDL_Rect projsR = {62,14,2,14};
SDL_Rect rR;
SDL_Rect sR;
SDL_Texture* playerTex; //textura do Personagem
SDL_Surface* playerSurf; //Surface do Player
SDL_Texture* objectTex; //textura de objtos//
SDL_Surface* objectSurf; // surface de objetos//
int life = LIFE; //VIDA DO PLAYER//
int coins = 0;
int invencible = 0; //INVENCIBILIDADE DE DANO//
KBACK kback;
float const vel = 2.1; // VELOCIDADE DO PLAYER //
char sentido = 'b';
bool cajado = false; //se esta equipando o cajado magico topzudo//
bool interagir = false; // se estamos interagindo com algum item maneiro //
bool regeneffect = false;
bool regeneffectkeydown = false;
bool projetilstop;
float potionvel = 1;
bool veleffect;
bool veleffectkeydown;
int velffectcounter = 0;
int danofx = 1;
bool danoeffect;
bool danoeffectkeydown;
int danocounter = 0;
//cajado//
bool projetil = false;
SDL_Rect rProjetil;
SDL_Rect sProjetil;
SDL_Surface * cajadoSurf;
SDL_Texture * cajadoTex;
CAJADO staff;
SDL_Point centerstaff;
//hud//
SDL_Rect rH; //rect HUD//
SDL_Texture* heartTex; //textura do Personagem
SDL_Surface* heartSurf; //Surface do Player
SDL_Texture* HUDTex; // textura dos huds*//
SDL_Surface* HUDSurf; // surface dos huds//
// pocao //
typedef struct {
SDL_Rect sRcura;
SDL_Rect rRcura;
SDL_Rect sRvel;
SDL_Rect rRvel;
SDL_Rect sRdano;
SDL_Rect rRdano;
SDL_Rect sRcoin;
SDL_Rect rRcoin;
SDL_Rect sRkey;
SDL_Rect rRkey;
SDL_Rect sRstaff;
SDL_Rect rRstaff;
}HUD;
HUD huds;
SDL_Rect siconpotion = {37, 11, 10, 11};
SDL_Rect riconpotion = {15, 42, 15, 16.5};
//int chaves = 0;
//int book.potion.cura = 2;
// CAIXAS DE DIALOGO//
SDL_Surface* dialogboxSurf;
SDL_Texture* dialogboxTex;
SDL_Rect sDialogBox = {1,2,539, 114};
SDL_Rect rDialogBox = {50,280, 539, 114};
bool emDialogo = false;
SDL_Surface * iconSurf;
SDL_Texture * iconTex;
SDL_Surface* fadeSurf;//fade in-out surface//
SDL_Texture* fadeTex;
int fadeAlpha = 0;
SDL_Window* gJanela = NULL; // CRIANDO JANELA //
SDL_Renderer* render;// Render da Screen //
SDL_Event event; //LER EVENTOS//
//AUDIO//
Mix_Chunk* damage;
Mix_Chunk* death;
Mix_Chunk* hitwall;
Mix_Chunk* welcome;
Mix_Chunk* projetilhit;
Mix_Chunk* projetilstart;
Mix_Chunk* projetilend;
Mix_Chunk* walk;
Mix_Chunk* warning;
//Mix_Chunk* cannon;
Mix_Chunk* regen;
Mix_Chunk* interactioneffect;
Mix_Chunk* error;
Mix_Chunk* openchest;
Mix_Chunk* killenemys;
Mix_Chunk* cristalsounds;
Mix_Chunk* opendoor;
Mix_Music* overworld;
Mix_Music* underworld;
Mix_Chunk* talk;
//fonte//
// SDL_Rect riconpotion = {15, 42, 15, 16.5};
SDL_Rect textRect = {12.5,60, 100, 500};
TTF_Font* fonte;
TTF_Font* fonte2;
SDL_Surface* fontePote;
SDL_Surface* fonteDialogo;
SDL_Color cor = {255,255,255}; // branco como a neve //
SDL_Texture* text[10];
char numerodepocoes[50] = "10";
//CHAMADA//
bool janela (void);
void surfaces (void);
bool renderizar(void);
void renderizarBaus(void);
bool rescalar(void);
void movements (void);
void makemovements(void);
void teladeAnimacaoIN (void);
void teladeAnimacaoOUT (void);
int mob (int i, bool colid, SDL_Rect r1);
void teladeAnimacao (void);
bool collision(SDL_Rect r1, SDL_Rect r2, int velocidadex, int velocidadey);
void salaCamera();
void salaAtual();
void slimeAnimated(int i);
void interaction(void);
void blocksinteractive(void);
void verificator(void);
bool wall_agua(int i);
void renderizarparedes(void);
void iniciarCanhoes (void);
void player_canhao(void);
void fontes(void);
//void alterarfonte(int i);
void renderizarMiniBoss(void);
void abrirDialogbox (char texto[], char texto2[], char texto3[], char texto4[], int yicon) ;
// FUNCOES //
//INICIAÇÃO//
// INICIAR BIGBOSS //
void bigbossStart(void)
{
bigboss[0].life = 50; bigboss[0].lifemaxima = 50; bigboss[0].x = 4875; bigboss[0].y = 234;
bigboss[0].velocidade = 1.5; bigboss[0].distancia = 600; bigboss[0].seguir = 1;
bigboss[0].dir = true; bigboss[0].espera = 1; bigboss[0].i = 0; bigboss[0].contador = 0;
bigboss[0].maximo = 60; bigboss[0].delay = 60; bigboss[0].j = 0; bigboss[0].k = 0;
bigboss[0].contadoranime = 0; bigboss[0].morrer = 0; bigboss[0].kbdelay = 0;
bigboss[0].chat1 = false; bigboss[0].chat2 = false;
// tiro 0 - 0 GRAUS PRA CIMA//
bigboss[0].velpx[0] = 0; bigboss[0].velpy[0] = -5;
// tiro 0 - 45 GRAUS PRA CIMA//
bigboss[0].velpx[1] = -5; bigboss[0].velpy[1] = -5;
// tiro 0 - 90 GRAUS PRA CIMA//
bigboss[0].velpx[2] = -5; bigboss[0].velpy[2] = 0;
// tiro 0 - 135 GRAUS PRA CIMA//
bigboss[0].velpx[3] = -5; bigboss[0].velpy[3] = 5;
// tiro 0 - 180 GRAUS PRA CIMA//
bigboss[0].velpx[4] = 0; bigboss[0].velpy[4] = 5;
// tiro 0 - 225 GRAUS PRA CIMA//
bigboss[0].velpx[5] = 5; bigboss[0].velpy[5] = 5;
// tiro 0 - 270 GRAUS PRA CIMA//
bigboss[0].velpx[6] = 5; bigboss[0].velpy[6] = 0;
// tiro 0 - 315 GRAUS PRA CIMA//
bigboss[0].velpx[7] = 5; bigboss[0].velpy[7] = -5;
}
//PLAYERSTART//
void playerStart (void) {
firsttimeunderworld = false;
firsttimeoverworld = false;
cajado = false;
wakeup = false;
xd = 0; xe = 0; yc = 0; yb = 0;
//gX = 3692, gY = 97;
gX = 1494; gY = 241;
//gX = 4900; gY = 988;
kback.mobNUMERO = 0; // NUMERO DO MOB //
kback.mobTYPE = 'M'; // M = MEATBOX //
kback.emKBACK = false;
rProjetil.x = -5000;
rProjetil.y = -5000;
staff.sR.x = 0; staff.sR.y = 0; staff.sR.w = 8; staff.sR.h = 30;
staff.rR.x = 0; staff.rR.y = 0; staff.rR.w = 12; staff.rR.h = 45;
book.aberto = false; book.ativo = false; book.coins = 000; book.keys = 00;
book.potion.cura = 00; book.potion.dano = 0; book.potion.velocidade = 0;
book.pontos = 0;book.life = LIFE;
portao.x = 3672; portao.y = 504;
portao.contador = 0;
//HUD //
//SDL_Rect siconpotion = {37, 11, 10, 11};
//SDL_Rect riconpotion = {15, 42, 15, 16.5};
huds.rRcura.x = 15; huds.rRcura.y = 42; huds.rRcura.w = 15; huds.rRcura.h = 16.5;
huds.sRcura.x = 38; huds.sRcura.y = 11; huds.sRcura.w = 10; huds.sRcura.h = 11;
huds.rRvel.x = 45; huds.rRvel.y = 42; huds.rRvel.w = 15; huds.rRvel.h = 16.5;
huds.sRvel.x = 49; huds.sRvel.y = 11; huds.sRvel.w = 10; huds.sRvel.h = 11;
huds.rRdano.x = 75; huds.rRdano.y = 42; huds.rRdano.w = 15; huds.rRdano.h = 16.5;
huds.sRdano.x = 60; huds.sRdano.y = 11; huds.sRdano.w = 10; huds.sRdano.h = 11;
huds.sRcoin.x = 88; huds.sRcoin.y = 12; huds.sRcoin.w = 8; huds.sRcoin.h = 8;
huds.rRcoin.x = 550; huds.rRcoin.y = 10; huds.rRcoin.w = 16; huds.rRcoin.h = 16;
huds.sRkey.x = 72; huds.sRkey.y = 13; huds.sRkey.w = 14; huds.sRkey.h = 7;
huds.rRkey.x = 600; huds.rRkey.y = 10; huds.rRkey.w = 21; huds.rRkey.h = 10.5;
huds.sRstaff.x = 16; huds.sRstaff.y = 1; huds.sRstaff.w = 8; huds.sRstaff.h = 30;
huds.rRstaff.x = 600; huds.rRstaff.y = 350; huds.rRstaff.w = 12; huds.rRstaff.h = 45;
}
// CRISTAL START //
void cristalStart (void) {
cristal[0].contadorrgb = 0; cristal[0].contadoranime = 0;
cristal[0].x = 3000+532; cristal[0].y = 607; cristal[0].ativo = true; // cristal da de baixo
cristal[1].contadorrgb = 0; cristal[1].contadoranime = 0;
cristal[1].x = 3000+1033; cristal[1].y = 173; cristal[1].ativo = true; //cristal la de cima
cristal[2].contadorrgb = 0; cristal[2].contadoranime = 0;
cristal[2].x = 3000+820; cristal[2].y = 183; cristal[2].ativo = true; // cristal do meio
cristal[3].contadorrgb = 0; cristal[3].contadoranime = 0;
cristal[3].x = 3000+480; cristal[3].y = 202; cristal[3].ativo = true; // cristal cima esquerda
// ASH //
cristal[4].contadorrgb = 0; cristal[4].contadoranime = 0;
cristal[4].x = 5135; cristal[4].y = 1892; cristal[4].ativo =true; // cristal baixo
cristal[5].contadorrgb = 0; cristal[5].contadoranime = 0;
cristal[5].x = 5040; cristal[5].y = 997; cristal[5].ativo = true; // cristal cima esquerda
cristal[6].contadorrgb = 0; cristal[6].contadoranime = 0;
cristal[6].x = 6042; cristal[6].y = 1103; cristal[6].ativo =true; // cristal cima esquerda
}
// INIICAR MAGE //
void mageStart (void) {
// MAGE 0 //
if(cristal[1].ativo) {
mage[0].life = 1; mage[0].distancia = 900; mage[0].delay = 90; mage[0].dir = false;
mage[0].i = 0; mage[0].morrer = 0; mage[0].damage = 3; mage[0].x = 3000+975;
mage[0].y = 200; mage[0].xp = mage[0].x; mage[0].y; mage[0].yp = mage[0].y;
mage[0].velmx = 0; mage[0].velmy = 0; mage[0].j = 0; mage[0].espera = 0;
}
// MAGE 1//s
if(cristal[3].ativo) {
mage[1].life = 1; mage[1].distancia = 900; mage[1].delay = 90; mage[1].dir = false;
mage[1].i = 0; mage[1].morrer = 0; mage[1].damage = 3; mage[1].x = 3000+488;
mage[1].y = 358; mage[1].xp = mage[1].x; mage[1].y; mage[1].yp = mage[1].y;
mage[1].velmx = 0; mage[1].velmy = 0; mage[1].j = 0; mage[1].espera = 0;
}
// MAGE ASH 1 //
if(cristal[4].ativo) {
mage[2].life = 1; mage[2].distancia = 900; mage[2].delay = 90; mage[2].dir = false;
mage[2].i = 0; mage[2].morrer = 0; mage[2].damage = 3; mage[2].x = 5012;
mage[2].y = 1920; mage[2].xp = mage[2].x; mage[2].y; mage[2].yp = mage[2].y;
mage[2].velmx = 0; mage[2].velmy = 0; mage[2].j = 0; mage[2].espera = 0;
}
if(cristal[5].ativo) {
mage[3].life = 1; mage[3].distancia = 900; mage[3].delay = 90; mage[3].dir = false;
mage[3].i = 0; mage[3].morrer = 0; mage[3].damage = 3; mage[3].x = 4728;
mage[3].y = 1065; mage[3].xp = mage[3].x; mage[3].y; mage[3].yp = mage[3].y;
mage[3].velmx = 0; mage[3].velmy = 0; mage[3].j = 0; mage[3].espera = 0;
mage[4].life = 1; mage[4].distancia = 900; mage[4].delay = 90; mage[4].dir = false;
mage[4].i = 0; mage[4].morrer = 0; mage[4].damage = 3; mage[4].x = 5317;
mage[4].y = 1118; mage[4].xp = mage[4].x; mage[4].y; mage[4].yp = mage[4].y;
mage[4].velmx = 0; mage[4].velmy = 0; mage[4].j = 0; mage[4].espera = 0;
}
if(cristal[6].ativo) {
mage[5].life = 1; mage[5].distancia = 900; mage[5].delay = 90; mage[5].dir = false;
mage[5].i = 0; mage[5].morrer = 0; mage[5].damage = 3; mage[5].x = 6280;
mage[5].y = 1215; mage[5].xp = mage[5].x; mage[5].y; mage[5].yp = mage[5].y;
mage[5].velmx = 0; mage[5].velmy = 0; mage[5].j = 0; mage[5].espera = 0;
mage[6].life = 1; mage[6].distancia = 900; mage[6].delay = 90; mage[6].dir = false;
mage[6].i = 0; mage[6].morrer = 0; mage[6].damage = 3; mage[6].x = 5904;
mage[6].y = 1050; mage[6].xp = mage[6].x; mage[6].y; mage[6].yp = mage[6].y;
mage[6].velmx = 0; mage[6].velmy = 0; mage[6].j = 0; mage[6].espera = 0;
mage[7].life = 1; mage[7].distancia = 900; mage[7].delay = 90; mage[7].dir = false;
mage[7].i = 0; mage[7].morrer = 0; mage[7].damage = 3; mage[7].x = 6162;
mage[7].y = 1024; mage[7].xp = mage[7].x; mage[7].y; mage[7].yp = mage[7].y;
mage[7].velmx = 0; mage[7].velmy = 0; mage[7].j = 0; mage[7].espera = 0;
}
printf("[Console]OS MAGOS IRAO QUEIMAR SUA ALMA!\n");
}
// INICIAR MEATBOX //
void meatboxStart (void) {
static bool start = true;
if(start) {
meatbox[0].life = -1; meatbox[1].life = -1; meatbox[2].life = -1;
meatbox[3].life = -1; meatbox[4].life = -1; meatbox[5].life = -1;
meatbox[6].life = -1; meatbox[7].life = -1; meatbox[8].life = -1;
meatbox[9].life = -1;
start = false;
}
// MEATBOX 0 //
if(cristal[4].ativo && meatbox[0].life < 0) {
meatbox[0].life = 2; meatbox[0].velocidade = 1.5; meatbox[0].distancia = 450; meatbox[0].i = 0;
meatbox[0].x = 4946; meatbox[0].y = 2078; meatbox[0].agressivo = false; meatbox[0].espera = 1;
meatbox[0].sR.w = 23;meatbox[0].sR.h = 34; meatbox[0].sR.y = 0; meatbox[0].dir = true; meatbox[0].damage = 2;
meatbox[0].contador = 0; meatbox[0].maximo = 60; meatbox[0].delay = 0; meatbox[0].morrer = 0; meatbox[0].seguir = 1;
}
// meatbox 1 //
if(cristal[4].ativo && meatbox[1].life < 0) {
meatbox[1].life = 2; meatbox[1].velocidade = 1.5; meatbox[1].distancia = 450; meatbox[1].i = 0;
meatbox[1].x = 5427; meatbox[1].y = 2074; meatbox[1].agressivo = false; meatbox[1].espera = 1;
meatbox[1].sR.w = 23;meatbox[1].sR.h = 34; meatbox[1].sR.y = 0; meatbox[1].dir = true; meatbox[1].damage = 2;
meatbox[1].contador = 0; meatbox[1].maximo = 60; meatbox[1].delay = 0; meatbox[1].morrer = 0; meatbox[1].seguir = 1;
}
// meatbox 2 //
if(cristal[5].ativo && meatbox[5].life < 0) {
meatbox[5].life = 2; meatbox[5].velocidade = 1.5; meatbox[5].distancia = 450; meatbox[5].i = 0;
meatbox[5].x = 4818; meatbox[5].y = 1219; meatbox[5].agressivo = false; meatbox[5].espera = 1;
meatbox[5].sR.w = 23;meatbox[5].sR.h = 34; meatbox[5].sR.y = 0; meatbox[5].dir = true; meatbox[5].damage = 2;
meatbox[5].contador = 0; meatbox[5].maximo = 60; meatbox[5].delay = 0; meatbox[5].morrer = 0; meatbox[5].seguir = 1;
}
if(cristal[5].ativo && meatbox[6].life < 0) {
meatbox[6].life = 2; meatbox[6].velocidade = 1.5; meatbox[6].distancia = 450; meatbox[6].i = 0;
meatbox[6].x = 5186; meatbox[6].y = 1409; meatbox[6].agressivo = false; meatbox[6].espera = 1;
meatbox[6].sR.w = 23;meatbox[6].sR.h = 34; meatbox[6].sR.y = 0; meatbox[6].dir = true; meatbox[6].damage = 2;
meatbox[6].contador = 0; meatbox[6].maximo = 60; meatbox[6].delay = 0; meatbox[6].morrer = 0; meatbox[6].seguir = 1;
}
if(cristal[6].ativo) {
if(meatbox[7].life < 0) {
meatbox[7].life = 2; meatbox[7].velocidade = 1.5; meatbox[7].distancia = 450; meatbox[7].i = 0;
meatbox[7].x = 5932; meatbox[7].y = 1195; meatbox[7].agressivo = false; meatbox[7].espera = 1;
meatbox[7].sR.w = 23;meatbox[7].sR.h = 34; meatbox[7].sR.y = 0; meatbox[5].dir = true; meatbox[7].damage = 2;
meatbox[7].contador = 0; meatbox[7].maximo = 60; meatbox[7].delay = 0; meatbox[7].morrer = 0; meatbox[7].seguir = 1;
}
else {
meatbox[7].life = 2;
}
if(meatbox[8].life < 0) {
meatbox[8].life = 2; meatbox[8].velocidade = 1.5; meatbox[8].distancia = 450; meatbox[8].i = 0;
meatbox[8].x = 6212; meatbox[8].y = 1332; meatbox[8].agressivo = false; meatbox[8].espera = 1;
meatbox[8].sR.w = 23;meatbox[8].sR.h = 34; meatbox[8].sR.y = 0; meatbox[6].dir = true; meatbox[8].damage = 2;
meatbox[8].contador = 0; meatbox[8].maximo = 60; meatbox[8].delay = 0; meatbox[8].morrer = 0; meatbox[8].seguir = 1;
}
else {
meatbox[8].life = 2;
}
if(meatbox[9].life < 0) {
meatbox[9].life = 2; meatbox[9].velocidade = 1.5; meatbox[9].distancia = 450; meatbox[9].i = 0;
meatbox[9].x = 5715; meatbox[9].y = 828; meatbox[9].agressivo = false; meatbox[9].espera = 1;
meatbox[9].sR.w = 23;meatbox[9].sR.h = 34; meatbox[9].sR.y = 0; meatbox[6].dir = true; meatbox[9].damage = 2;
meatbox[9].contador = 0; meatbox[9].maximo = 60; meatbox[9].delay = 0; meatbox[9].morrer = 0; meatbox[9].seguir = 1;
}
else {
meatbox[9].life = 2;
}
}
printf("[Console] MEATBOX PRONTO PARA MATAR!\n");
}
// INICIAR OGRE //
void ogreStart (void) {
// OGRE 0 //
if(cristal[2].ativo) {
ogre[0].life = 1; ogre[0].velocidade = 2; ogre[0].troca = false; ogre[0].direct = 1; ogre[0].dir = false;
ogre[0].damage = 1; ogre[0].x = 3000+554; ogre[0].y = 169; ogre[0].espera = 1; ogre[0].maximo = 60;
ogre[0].i = 0; ogre[0].delay = 1; ogre[0].loop = 1; ogre[0].danodelay = 0; ogre[0].morrer = 0;
}
// OGRE 1 //
if(cristal[2].ativo) {
ogre[1].life = 1; ogre[1].velocidade = 2; ogre[1].troca = false; ogre[1].direct = 1; ogre[1].dir = false;
ogre[1].damage = 1; ogre[1].x = 3000+ 942; ogre[1].y = 233; ogre[1].espera = 1; ogre[1].maximo = 60;
ogre[1].i = 0; ogre[1].delay = 1; ogre[1].loop = 1; ogre[1].danodelay = 0; ogre[1].morrer = 0;
}
// OGRE 2 //
if(cristal[2].ativo) {
ogre[2].life = 1; ogre[2].velocidade = 2; ogre[2].troca = false; ogre[2].direct = 1; ogre[2].dir = false;
ogre[2].damage = 1; ogre[2].x = 3000+1129; ogre[2].y = 796; ogre[2].espera = 1; ogre[2].maximo = 60;
ogre[2].i = 0; ogre[2].delay = 1; ogre[2].loop = 1; ogre[2].danodelay = 0; ogre[2].morrer = 0;
}
// OGRE 3 //
if(cristal[2].ativo) {
ogre[3].life = 1; ogre[3].velocidade = 2; ogre[3].troca = false; ogre[3].direct = 1; ogre[3].dir = false;
ogre[3].damage = 1; ogre[3].x =3000+429; ogre[3].y = 386; ogre[3].espera = 1; ogre[3].maximo = 60;
ogre[3].i = 0; ogre[3].delay = 1; ogre[3].loop = 1; ogre[3].danodelay = 0; ogre[3].morrer = 0;
}
if(cristal[5].ativo) {
ogre[4].life = 1; ogre[4].velocidade = 2; ogre[4].troca = false; ogre[4].direct = 1; ogre[4].dir = false;
ogre[4].damage = 1; ogre[4].x = 5186; ogre[4].y = 1409; ogre[4].espera = 1; ogre[4].maximo = 60;
ogre[4].i = 0; ogre[4].delay = 1; ogre[4].loop = 1; ogre[4].danodelay = 0; ogre[4].morrer = 0;
ogre[5].life = 1; ogre[5].velocidade = 2; ogre[5].troca = false; ogre[5].direct = 1; ogre[5].dir = false;
ogre[5].damage = 1; ogre[5].x = 4559; ogre[5].y = 1240; ogre[5].espera = 1; ogre[5].maximo = 60;
ogre[5].i = 0; ogre[5].delay = 1; ogre[5].loop = 1; ogre[5].danodelay = 0; ogre[5].morrer = 0;
ogre[6].life = 1; ogre[6].velocidade = 2; ogre[6].troca = false; ogre[6].direct = 1; ogre[6].dir = false;
ogre[6].damage = 1; ogre[6].x = 5471; ogre[6].y = 1436; ogre[6].espera = 1; ogre[6].maximo = 60;
ogre[6].i = 0; ogre[6].delay = 1; ogre[6].loop = 1; ogre[6].danodelay = 0; ogre[6].morrer = 0;
ogre[7].life = 1; ogre[7].velocidade = 2; ogre[7].troca = false; ogre[7].direct = 1; ogre[7].dir = false;
ogre[7].damage = 1; ogre[7].x = 5705; ogre[7].y = 705; ogre[7].espera = 1; ogre[7].maximo = 60;
ogre[7].i = 0; ogre[7].delay = 1; ogre[7].loop = 1; ogre[7].danodelay = 0; ogre[7].morrer = 0;
ogre[8].life = 1; ogre[8].velocidade = 2; ogre[8].troca = false; ogre[8].direct = 1; ogre[8].dir = false;
ogre[8].damage = 1; ogre[8].x = 4594; ogre[8].y = 1348; ogre[8].espera = 1; ogre[8].maximo = 60;
ogre[8].i = 0; ogre[8].delay = 1; ogre[8].loop = 1; ogre[8].danodelay = 0; ogre[8].morrer = 0;
}
printf("[Console] OGROS AO ATAQUE!\n");
}
void iniciarNPC (void) {
// icon gato = 175 // cachorro = 150 //
animals[0].inicialx = 857; animals[0].inicialy = 732; animals[0].contadoranime = 0;
animals[0].x = animals[0].inicialx; animals[0].y = animals[0].inicialy; animals[0].icon = 175;
animals[0].maximo = 100; animals[0].sentido = 3; animals[0].type = 2; animals[0].velocidade = 0.5;
strcpy(animals[0].texto, "AMBER: Bom Dia, Dave.... Oops, MEOW!!!");
animals[1].inicialx = 193; animals[1].inicialy = 185; animals[1].contadoranime = 0;
animals[1].x = animals[1].inicialx; animals[1].y = animals[1].inicialy; animals[1].icon = 150;
animals[1].maximo = 100; animals[1].sentido = 2; animals[1].type = 1; animals[1].velocidade = 0.5;
strcpy(animals[1].texto, "COPPER: AUAU, Proteger!!! AUAU o.o");
// icon npc // guerreiro = 0 // barbudo = 25 // menina = 50 // anciao = 75 //
// bau = 100 // placa = 125 //
npc[0].sentido = 2; npc[0].x = 752; npc[0].y = 595; npc[0].type = 1; npc[0].icon = 0;
strcpy(npc[0].texto, "SENTINELA: Bom Dia, Dave! O anciao lhe procura...");
strcpy(npc[0].texto2, "SENTINELA: Eae camarada, tudo bem?");
npc[1].sentido = 2; npc[1].x = 346; npc[1].y = 622; npc[1].type = 3; npc[1].icon = 50;
strcpy(npc[1].texto, "DORELLA: Acho que ha algo muito ruim com o anciao...");
strcpy(npc[1].texto2, "DORELLA: Uau! Esse e o cajado do anciao?");
npc[2].sentido = 2; npc[2].x = 860; npc[2].y = 325; npc[2].type = 1; npc[2].icon = 0;
strcpy(npc[2].texto, "SENTINELA: Vamos jogar D&D?");
strcpy(npc[2].texto2, "SENTINELA: Por favor.... Vamos jogar D&D!!!");
npc[3].sentido = 2; npc[3].x = 248; npc[3].y = 145; npc[3].type = 3; npc[3].icon = 50;
strcpy(npc[3].texto, "SRa NIMBUS: O velho ta desesperado te chamando ae!");
strcpy(npc[3].texto2, "SRa NIMBUS: Te desejo sorte na sua aventura!");
irmao.sentido = 2; irmao.x = 1630; irmao.y = 142; irmao.type = 2; irmao.icon = 25;
irmao.talk = false;
anciao.sentido = 2; anciao.x = 2518; anciao.y = 119; anciao.type = 4; anciao.icon = 75;
anciao.talk = false; anciao.talk2 = false;
}
void iniciarChests (void) {
// chest 1 //
chest[0].estado = true;
chest[0].x = 2472;
chest[0].y = 335;
chest[0].pos.x = chest[0].x - rRcam.x; chest[0].pos.y = chest[0].y - rRcam.y;
chest[0].pos.w = 32; chest[0].pos.h = 32;
//char chest[0].texto[100] = "Oi";
// fim chest 1 //
// chest 2 //
chest[1].estado = true;
chest[1].x =3000+475;
chest[1].y = 335;
chest[1].pos.x = chest[1].x - rRcam.x; chest[1].pos.y = chest[1].y - rRcam.y;
chest[1].pos.w = 32; chest[1].pos.h = 32;
chest[2].estado = true;
chest[2].x =5604;
chest[2].y = 675;
chest[2].pos.x = chest[2].x - rRcam.x; chest[2].pos.y = chest[2].y - rRcam.y;
chest[2].pos.w = 32; chest[2].pos.h = 32;
chest[3].estado = true;
chest[3].x =4444;
chest[3].y = 981;
chest[3].pos.x = chest[3].x - rRcam.x; chest[3].pos.y = chest[3].y - rRcam.y;
chest[3].pos.w = 32; chest[3].pos.h = 32;
chest[4].estado = true;
chest[4].x =5973;
chest[4].y = 572;
chest[4].pos.x = chest[4].x - rRcam.x; chest[4].pos.y = chest[4].y - rRcam.y;
chest[4].pos.w = 32; chest[4].pos.h = 32;
}
void renderizarMiniBoss(void) {
//printf("I,m here\n");
if(rR.x >= 4436 - rRcam.x && rR.x <= 4436 + 652 - rRcam.x &&
rR.y >= 0 - rRcam.y && rR.y <= 932 - rRcam.y) {
//printf("I,m here\n");
rBossLife.x = rBossBar.x + 4; rBossLife.y = rBossBar.y + 1;
//PARTE SUJEITA A MUDANCAS//
rBossLife.w = bigboss[0].life * 4.22; rBossLife.h = 9;
//renderizar();
SDL_RenderCopy(render, minibossTex, &sBossLife, &rBossLife);
SDL_RenderCopy(render, minibossTex, &sBossBar, &rBossBar);
}
}
void dialogoMiniboss(void) {
bool ativos = false;
if(bigboss[0].life <= 0) {
abrirDialogbox("Klyn: MEUS PARABENS, HUMANO...",
"ACABOU COM TODA MINHA NACAO....", "", "", 200);
book.pontos+=4000;
gaming = false;
xe=0;xd=0;yc=0;;yb=0;
}
if(rR.x >= 4903 - rRcam.x && rR.x <= 4903 + 57 - rRcam.x &&
rR.y >= 851 - rRcam.y && rR.y <= 851 + 38 - rRcam.y)
{
for(int i = 0; i < 7 && !ativos; i++) {
ativos = cristal[i].ativo;
}
if(ativos) {
abrirDialogbox("VOCE NAO CUMPRIU SEUS OBJETIVOS!!", "", "", "", 125);
gY += 15;
xe=0;xd=0;yc=0;;yb=0;
}
else
{
if(!bigboss[0].chat1) {
abrirDialogbox("Klyn: VOCE TEVE OUSADIA DE",
"INVADIR MEUS TERRITORIOS",
"DESTRUIR MEUS CRISTAIS E ACABAR",
"COM MEUS SUDITOS?!?!?", 200);
abrirDialogbox("Klyn: IREI MATA-LO PARA MOSTRAR",
"MEU PODER E VINGAR MEU POVO", "SEU VERME!!!", "", 200);
bigboss[0].chat1 = true;
xe=0;xd=0;yc=0;;yb=0;
}
}
}
}
void fontes(void){
static const int FONTSIZE = 12;
static const int FONTSIZE2 = 28;
fonte = TTF_OpenFont("fontes/fontetop.ttf", FONTSIZE);
fonte2 = TTF_OpenFont("fontes/fontetop.ttf", FONTSIZE2);
fontePote = TTF_RenderText_Solid(fonte, numerodepocoes, cor);
text[0] = SDL_CreateTextureFromSurface(render, fontePote);
SDL_QueryTexture(text[0], NULL, NULL, &textRect.w, &textRect.h);
//SDL_BlitSurface(fontePote, NULL, render, NULL);
SDL_FreeSurface(fontePote);
}
void alterarfonte(int quantidade, SDL_Rect potionRect, int i){
// huds.rRcura.x = 15; huds.rRcura.y = 42; huds.rRcura.w = 15; huds.rRcura.h = 16.5; //
// SDL_Rect textRect = {12.5,60, 100, 500}; //
fontePote = TTF_RenderText_Solid(fonte, numerodepocoes, cor);
text[0] = SDL_CreateTextureFromSurface(render, fontePote);
textRect.x = potionRect.x - 2,5;
textRect.y = potionRect.y + 18;
SDL_QueryTexture(text[0], NULL, NULL, &textRect.w, &textRect.h);
}
void audio(void) {
damage = Mix_LoadWAV("sfx/damage.wav");
death = Mix_LoadWAV("sfx/death.wav");
hitwall = Mix_LoadWAV("sfx/hitwall.wav");
welcome = Mix_LoadWAV("sfx/welcome.wav");
projetilhit = Mix_LoadWAV("sfx/projetilhit.wav");
projetilstart = Mix_LoadWAV("sfx/projetilstart.wav");
projetilend = Mix_LoadWAV("sfx/projetilend.wav");
walk = Mix_LoadWAV("sfx/walk.wav");
warning = Mix_LoadWAV("sfx/warning.wav");
//cannon = Mix_LoadWAV("sfx/cannon.wav");
error = Mix_LoadWAV("sfx/error.wav");
regen = Mix_LoadWAV("sfx/regen.wav");
interactioneffect = Mix_LoadWAV("sfx/interaction.wav");
openchest = Mix_LoadWAV("sfx/openchest.wav");
overworld = Mix_LoadMUS("songs/overworld.mp3");
underworld = Mix_LoadMUS("songs/underworld.mp3");
killenemys = Mix_LoadWAV("sfx/killenemys.wav");
cristalsounds = Mix_LoadWAV("sfx/cristal.wav");
opendoor = Mix_LoadWAV("sfx/opendoor.wav");
talk = Mix_LoadWAV("sfx/talk.wav");
}
void surfaces (void) {
//Gerando Texturas e Sprites do Player//
// CURSOR //
colorCursor = IMG_Load("sprites/pointer.png");
cursor = SDL_CreateColorCursor(colorCursor, 0, 0);
//cursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_CROSSHAIR);
SDL_SetCursor(cursor);
//PLAYER SPRITES//
playerSurf = IMG_Load("sprites/char.png");
playerTex = SDL_CreateTextureFromSurface(render, playerSurf);
SDL_FreeSurface(playerSurf);
//WALL//
wallSurf = IMG_Load("sprites/wall.png");
wallTex = SDL_CreateTextureFromSurface(render, wallSurf);
SDL_FreeSurface(wallSurf);
//MAP//
mapSurf = IMG_Load("img/totalworld.png");
mapTex = SDL_CreateTextureFromSurface(render, mapSurf);
SDL_QueryTexture(mapTex, NULL, NULL, &mapw, &maph);
SDL_FreeSurface(mapSurf);
//MAP//
mapSurf2 = IMG_Load("img/totalworldlight.png");
mapTex2 = SDL_CreateTextureFromSurface(render, mapSurf2);
SDL_QueryTexture(mapTex2, NULL, NULL, &mapw, &maph);
SDL_FreeSurface(mapSurf2);
//HEART//
heartSurf = IMG_Load("sprites/hud_heart.png");
heartTex = SDL_CreateTextureFromSurface(render, heartSurf);
SDL_FreeSurface(heartSurf);
//FADE//
fadeSurf = IMG_Load("img/fade.png");
fadeTex = SDL_CreateTextureFromSurface(render, fadeSurf);
SDL_FreeSurface(fadeSurf);
//OBJETOS//
objectSurf = IMG_Load("sprites/objetos.png");
objectTex = SDL_CreateTextureFromSurface(render, objectSurf);
SDL_FreeSurface(objectSurf);
//HUD ITENS//
HUDSurf = IMG_Load("sprites/icon.png");
HUDTex = SDL_CreateTextureFromSurface(render, HUDSurf);
SDL_FreeSurface(HUDSurf);
//bau
chestSurf = IMG_Load("sprites/chest.png");
chestTex = SDL_CreateTextureFromSurface(render, chestSurf);
SDL_FreeSurface(chestSurf);
// MINIBOSS//
minibossSurf = IMG_Load("sprites/bossbar.png");
minibossTex = SDL_CreateTextureFromSurface(render, minibossSurf);
SDL_FreeSurface(minibossSurf);
// baixas de dialogo//
dialogboxSurf = IMG_Load("sprites/dialogbox.png");
dialogboxTex = SDL_CreateTextureFromSurface(render, dialogboxSurf);
SDL_FreeSurface(dialogboxSurf);
// MEAT BOX //
meatboxSurf = IMG_Load("sprites/meatbox.png");
meatboxTex = SDL_CreateTextureFromSurface(render, meatboxSurf);
SDL_FreeSurface(meatboxSurf);
// OGRE //
ogreSurf = IMG_Load("sprites/ogre.png");
ogreTex = SDL_CreateTextureFromSurface(render, ogreSurf);
SDL_FreeSurface(ogreSurf);
// EXPLOSION //
explodirSurf = IMG_Load("sprites/explosion.png");
explodirTex = SDL_CreateTextureFromSurface(render, explodirSurf);
SDL_FreeSurface(explodirSurf);
// MAGE//
mageSurf = IMG_Load("sprites/mage.png");
mageTex = SDL_CreateTextureFromSurface(render, mageSurf);
SDL_FreeSurface(mageSurf);
// cajado//
// cajado//
cajadoSurf = IMG_Load("sprites/cajado.png");
cajadoTex = SDL_CreateTextureFromSurface(render, cajadoSurf);
SDL_FreeSurface(cajadoSurf);
// cristal //
cristalSurf = IMG_Load("sprites/cristais.png");
cristalTex = SDL_CreateTextureFromSurface(render, cristalSurf);
SDL_FreeSurface(cristalSurf);
// portao //
portaoSurf = IMG_Load("sprites/portao.png");
portaoTex = SDL_CreateTextureFromSurface(render, portaoSurf);
SDL_FreeSurface(portaoSurf);
// animais //
dog1Surf = IMG_Load("sprites/dog1.png");
dog1Tex = SDL_CreateTextureFromSurface(render, dog1Surf);
SDL_FreeSurface(dog1Surf);
cat1Surf = IMG_Load("sprites/cat1.png");
cat1Tex = SDL_CreateTextureFromSurface(render, cat1Surf);
SDL_FreeSurface(cat1Surf);
// npc //
npcSurf = IMG_Load("sprites/npc.png");
npcTex = SDL_CreateTextureFromSurface(render, npcSurf);
SDL_FreeSurface(npcSurf);
// projetil
projSurf = IMG_Load("sprites/mage.png");
projTex = SDL_CreateTextureFromSurface(render, projSurf);
SDL_FreeSurface(projSurf);
// icon //
iconSurf = IMG_Load("sprites/dialogicon.png");
iconTex = SDL_CreateTextureFromSurface(render, iconSurf);
SDL_FreeSurface(iconSurf);
// book //
bookSurf = IMG_Load("img/book.png");
bookTex = SDL_CreateTextureFromSurface(render, bookSurf);
SDL_FreeSurface(bookSurf);
// portal //
portalSurf = IMG_Load("sprites/teleport.png");
portalTex = SDL_CreateTextureFromSurface(render, portalSurf);
SDL_FreeSurface(portalSurf);
// bigboss//
bigbossSurf = IMG_Load("sprites/bigboss.png");
bigbossTex = SDL_CreateTextureFromSurface(render, bigbossSurf);
SDL_FreeSurface(bigbossSurf);
// TUTORIAL //
tutorialSurf = IMG_Load("img/tutorial.png");
tutorialTex = SDL_CreateTextureFromSurface(render, tutorialSurf);
SDL_FreeSurface(tutorialSurf);
}
/*
sprintf(numerodepocoes, "%d", book.potion.cura);
fontePote = TTF_RenderText_Solid(fonte, numerodepocoes, cor);
text[0] = SDL_CreateTextureFromSurface(render, fontePote);
SDL_QueryTexture(text[0], NULL, NULL, &textRect.w, &textRect.h);
"Voce recebeu duas pocoes! Clique 'alt' para continuar!"
*/
void abrirDialogbox (char texto[], char texto2[], char texto3[], char texto4[], int yicon) {
bool acabou = false;
SDL_Rect posicaoText = {rDialogBox.x + 75, rDialogBox.y + 20, rDialogBox.w, rDialogBox.h};
SDL_Rect posicaoText2 = {rDialogBox.x + 75, rDialogBox.y + 35, rDialogBox.w, rDialogBox.h};
SDL_Rect posicaoText3 = {rDialogBox.x + 75, rDialogBox.y + 50, rDialogBox.w, rDialogBox.h};
SDL_Rect posicaoText4 = {rDialogBox.x + 75, rDialogBox.y + 65, rDialogBox.w, rDialogBox.h};
SDL_Rect posicaoText5 = {rDialogBox.x + 240, rDialogBox.y + 90, rDialogBox.w, rDialogBox.h};
SDL_Rect iconRect = {0,0,18,25};
iconRect.y = yicon;
SDL_Rect iconTela = {rDialogBox.x + 10, rDialogBox.y + 20, 18 * 3, 25 * 3};
fonteDialogo = TTF_RenderText_Solid(fonte, texto, cor);
text[1] = SDL_CreateTextureFromSurface(render, fonteDialogo);
SDL_QueryTexture(text[1], NULL, NULL, &posicaoText.w, &posicaoText.h);
SDL_FreeSurface(fonteDialogo);
fonteDialogo = TTF_RenderText_Solid(fonte, texto2, cor);
text[2] = SDL_CreateTextureFromSurface(render, fonteDialogo);
SDL_QueryTexture(text[2], NULL, NULL, &posicaoText2.w, &posicaoText2.h);
SDL_FreeSurface(fonteDialogo);
fonteDialogo = TTF_RenderText_Solid(fonte, texto3, cor);
text[3] = SDL_CreateTextureFromSurface(render, fonteDialogo);
SDL_QueryTexture(text[3], NULL, NULL, &posicaoText3.w, &posicaoText3.h);
SDL_FreeSurface(fonteDialogo);
fonteDialogo = TTF_RenderText_Solid(fonte, texto4, cor);
text[4] = SDL_CreateTextureFromSurface(render, fonteDialogo);
SDL_QueryTexture(text[4], NULL, NULL, &posicaoText4.w, &posicaoText4.h);
SDL_FreeSurface(fonteDialogo);
fonteDialogo = TTF_RenderText_Solid(fonte, "Pressione 'E' para continuar...", cor);
text[5] = SDL_CreateTextureFromSurface(render, fonteDialogo);
SDL_QueryTexture(text[5], NULL, NULL, &posicaoText5.w, &posicaoText5.h);
SDL_FreeSurface(fonteDialogo);
Mix_PlayChannel(4, talk,0);
// mini loop//
while(!acabou){
emDialogo = true;
renderizar();
SDL_RenderCopy(render, dialogboxTex, &sDialogBox, &rDialogBox);
SDL_RenderCopy(render, iconTex, &iconRect, &iconTela);
SDL_RenderCopy(render, text[1], NULL, &posicaoText);
SDL_RenderCopy(render, text[2], NULL, &posicaoText2);
SDL_RenderCopy(render, text[3], NULL, &posicaoText3);
SDL_RenderCopy(render, text[4], NULL, &posicaoText4);
SDL_RenderCopy(render, text[5], NULL, &posicaoText5);
SDL_RenderPresent(render);
//printf("eu estive aq!\n");
while(SDL_PollEvent(&event)){
//X to close//
if(event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_e)
acabou = true;
}
SDL_Delay(1000/60);
}
emDialogo = false;
}
/*
bool janela (void) {
bool success = true;
// START //
if(SDL_Init(SDL_INIT_VIDEO) < 0) {