-
Notifications
You must be signed in to change notification settings - Fork 1
/
fechas.c
executable file
·89 lines (76 loc) · 2.18 KB
/
fechas.c
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
/*
* fechas.c
*
* Created on: 02/10/2009
* Author: bruno
*/
#include <stdio.h>
#include "Header/util.h"
#include "Header/colisao.h"
#include "Header/monstros.h"
#include "Header/opengl.h"
#include "Header/global.h"
#include "Header/mapas.h"
#include "Header/flechas.h"
Lista *primarrow=NULL;
struct arrow *arrowatual=NULL;
int numarrow=0;
int arrowacao(int id,char acao) {
static int opcao=MUDAR_ID;
if (acao=='n') {
arrowatual=(struct arrow *) lista_acao('n',&primarrow,id,opcao,sizeof(struct arrow));
numarrow++;
}
else if (acao=='d') {
arrowatual=(struct arrow *) lista_acao('d',&primarrow,id,opcao,0);
if (arrowatual) numarrow--;
}
else if (acao=='s') {
arrowatual=(struct arrow *) lista_acao('s',&primarrow,id,opcao,numarrow);
return (!arrowatual)?0:1;
}
return 0;
}
void ativar_arrow() {
int codcolide=0;
forList (struct arrow *, arrowTmp, primarrow) {
arrowatual=arrowTmp;
arrowatual->ativa=1;
if (!arrowatual->excluir) {
codcolide=Verif_Colisao((int)arrowatual->posx+arrowatual->mposx,(int)arrowatual->posy+arrowatual->mposy,27,50,(((arrowatual->lado/8)==3) || ((arrowatual->lado/8)==0))?1:0,2+arrowatual->lado/16,1,1,arrowatual->lado);
if (codcolide) {
if (codcolide>1) {
monsterlacao(codcolide-1,'s');
danonosmostr();
}
arrowatual->excluir=1;
}
arrowatual->posx+=arrowatual->mposx; arrowatual->posy+=arrowatual->mposy;
}
}
}
void deletar_arrow() {
Lista *percorreLista=primarrow;
while (percorreLista!=NULL) {
if (((struct arrow *) percorreLista->d)->excluir) {
arrowacao(percorreLista->id,'d');
percorreLista=primarrow;
continue;
}
percorreLista=percorreLista->prox;
}
}
void draw_arrow(int id) {
if (arrowacao(id,'s'))
DrawIMG(flechas[(int)arrowatual->lado], (int)arrowatual->posx-xpos, (int)arrowatual->posy-ypos,32,64,0,0);
}
void criar_arrow(double posxx,double posyy,double mposxx,double mposyy,char lado2) {
arrowacao(numarrow+1,'n');
arrowatual->posx=posxx;
arrowatual->posy=posyy;
arrowatual->mposx=mposxx;
arrowatual->mposy=mposyy;
arrowatual->lado=lado2;
arrowatual->ativa=1;
arrowatual->excluir=0;
}