Skip to content

Commit 61b47d3

Browse files
author
Giancarlo Rigo
committedJul 6, 2010
corais certos
1 parent 84dbb59 commit 61b47d3

22 files changed

+47
-38
lines changed
 

‎Naufragos

60 Bytes
Binary file not shown.

‎Naufragos.orig

126 KB
Binary file not shown.

‎botes.o

8 Bytes
Binary file not shown.

‎botes.o.BACKUP.15165.o

19.7 KB
Binary file not shown.

‎botes.o.BASE.15165.o

19.7 KB
Binary file not shown.

‎botes.o.LOCAL.15165.o

19.7 KB
Binary file not shown.

‎colisao.o

732 Bytes
Binary file not shown.

‎desenhaEControla.c

+38-33
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,10 @@ void imprimeMar(lista_pessoas lista_p, lista_estaticos lista_e, lista_botes list
2626
imprimeEstaticos(buffer, lista_e);
2727

2828
/* Imprime e controla os botes */
29-
controlaBote1(buffer, &lista_b -> bt, deltaT);
30-
controlaBote2(buffer, &lista_b -> prox -> bt, deltaT);
29+
if( lista_b != NULL )
30+
controlaBote1(buffer, &lista_b -> bt, deltaT);
31+
if( lista_b -> prox != NULL )
32+
controlaBote2(buffer, &lista_b -> prox -> bt, deltaT);
3133

3234
/* Imprime Cabecalho */
3335
imprimeCabecalho(buffer, lista_b);
@@ -192,7 +194,7 @@ void imprimeEstaticos(BITMAP *buffer, lista_estaticos estat)
192194
while( aux != NULL)
193195
{
194196
if( aux -> stc.tipo == 'r' )
195-
draw_sprite(buffer, aux->stc.desenho, aux->stc.pos.x, aux->stc.pos.y);
197+
draw_sprite(buffer, aux->stc.desenho, aux->stc.pos.x-(aux->stc.desenho->w/2), aux->stc.pos.y-(aux->stc.desenho->h/2));
196198
else
197199
draw_sprite(buffer, aux->stc.desenho, aux->stc.pos.x-155, aux->stc.pos.y-66);
198200

@@ -214,43 +216,46 @@ void imprimeCabecalho(BITMAP *buffer, lista_botes botes)
214216
textprintf_ex(buffer, font, 10, 20, makecol(0, 0, 255), -1, "%s", pessoas.jogador1);
215217
textprintf_ex(buffer, font, tela.comprimento-80, 20, makecol(255, 0, 0), -1, "%s", pessoas.jogador2);
216218

217-
/* VIDAS */
218-
coracao = load_bitmap("imagens/coracao.bmp",desktop_palette);
219-
220-
textprintf_ex(buffer, font, 100, 20, makecol(0, 0, 255), -1, "%u x", botes -> prox -> bt.vidas);
221-
draw_sprite(buffer, coracao, 130, 10);
222-
223-
textprintf_ex(buffer, font, tela.comprimento-210, 20, makecol(255, 0, 0), -1, "%u x", botes -> bt.vidas);
224-
draw_sprite(buffer, coracao, tela.comprimento-180, 10);
225219

226-
/* CARGA */
220+
coracao = load_bitmap("imagens/coracao.bmp",desktop_palette);
227221
pessoa = load_bitmap("imagens/pessoa2.bmp",desktop_palette);
228222

229-
textprintf_ex(buffer, font, 170, 20, makecol(0, 0, 255), -1, "%u x", botes -> prox -> bt.carga);
230-
draw_sprite(buffer, pessoa, 200, 15);
231-
232-
textprintf_ex(buffer, font, tela.comprimento-140, 20, makecol(255, 0, 0), -1, "%u x", botes -> bt.carga);
233-
draw_sprite(buffer, pessoa, tela.comprimento-110, 15);
234-
235-
236-
/* PONTOS */
237-
textprintf_ex(buffer, font, 235, 20, makecol(0, 0, 255), -1, "%d", botes -> prox -> bt.pontos);
238-
textprintf_ex(buffer, font, tela.comprimento-265, 20, makecol(255, 0, 0), -1, "%d", botes -> bt.pontos);
239-
240-
/* ANCORAS */
241-
if( botes -> prox -> bt.ancora == '1')
223+
if( botes -> prox != NULL )
242224
{
243-
ancora = load_bitmap("imagens/ancora1.bmp",desktop_palette);
244-
draw_sprite(buffer, ancora, 285, 10);
245-
destroy_bitmap(ancora);
225+
/* VIDAS */
226+
textprintf_ex(buffer, font, 100, 20, makecol(0, 0, 255), -1, "%u x", botes -> prox -> bt.vidas);
227+
draw_sprite(buffer, coracao, 130, 10);
228+
/* CARGA */
229+
textprintf_ex(buffer, font, 170, 20, makecol(0, 0, 255), -1, "%u x", botes -> prox -> bt.carga);
230+
draw_sprite(buffer, pessoa, 200, 15);
231+
/* PONTOS */
232+
textprintf_ex(buffer, font, 235, 20, makecol(0, 0, 255), -1, "%d", botes -> prox -> bt.pontos);
233+
/* ANCORA */
234+
if( botes -> prox -> bt.ancora == '1')
235+
{
236+
ancora = load_bitmap("imagens/ancora1.bmp",desktop_palette);
237+
draw_sprite(buffer, ancora, 285, 10);
238+
destroy_bitmap(ancora);
239+
}
246240
}
247-
if( botes -> bt.ancora == '1')
241+
if( botes != NULL )
248242
{
249-
ancora = load_bitmap("imagens/ancora2.bmp",desktop_palette);
250-
draw_sprite(buffer, ancora, tela.comprimento-305, 10);
251-
destroy_bitmap(ancora);
243+
/* VIDAS */
244+
textprintf_ex(buffer, font, tela.comprimento-210, 20, makecol(255, 0, 0), -1, "%u x", botes -> bt.vidas);
245+
draw_sprite(buffer, coracao, tela.comprimento-180, 10);
246+
/* CARGA */
247+
textprintf_ex(buffer, font, tela.comprimento-140, 20, makecol(255, 0, 0), -1, "%u x", botes -> bt.carga);
248+
draw_sprite(buffer, pessoa, tela.comprimento-110, 15);
249+
/* PONTOS */
250+
textprintf_ex(buffer, font, tela.comprimento-265, 20, makecol(255, 0, 0), -1, "%d", botes -> bt.pontos);
251+
/* ANCORAS */
252+
if( botes -> bt.ancora == '1')
253+
{
254+
ancora = load_bitmap("imagens/ancora2.bmp",desktop_palette);
255+
draw_sprite(buffer, ancora, tela.comprimento-305, 10);
256+
destroy_bitmap(ancora);
257+
}
252258
}
253-
254259
destroy_bitmap(coracao);
255260
destroy_bitmap(pessoa);
256261
}

‎desenhaEControla.o

112 Bytes
Binary file not shown.

‎desloc.o

4 Bytes
Binary file not shown.

‎entidades/estaticos.c

+9-5
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,27 @@ lista_estaticos geraRecifes(lista_pessoas lista_p, lista_estaticos lista_e, list
4141

4242
for(cont = 0; cont < numRecifes; cont++)
4343
{
44-
r.desenho = load_bitmap("imagens/recife.bmp",desktop_palette);
4544
r.pos.x = rand()%tela.comprimento;
4645
r.pos.y = rand()%tela.altura;
4746
r.tipo = 'r';
4847

4948
decideTam = rand()%3;
5049

5150
if( decideTam == 0 ) /* RECIFES MEDIOS */
51+
{
5252
r.raio = raioMedio;
53-
53+
r.desenho = load_bitmap("imagens/recife_medio.bmp",desktop_palette);
54+
}
5455
else if( decideTam == 1) /* RECIFES PEQUENOS */
56+
{
5557
while( (r.raio = rand()%raioMedio) < 5 ); /* Garante que o raio não sera 0 ou muito pequeno */
56-
58+
r.desenho = load_bitmap("imagens/recife_pequeno.bmp",desktop_palette);
59+
}
5760
else /* RECIFES GRANDES */
61+
{
5862
r.raio = raioMedio + rand()%raioMedio;/* No maximo será do dobro do tamanho do medio */
59-
60-
63+
r.desenho = load_bitmap("imagens/recife_grande.bmp",desktop_palette);
64+
}
6165
if( validaPos(lista_p, lista_e, lista_b, NULL, &r, NULL) )
6266
lista_e = insereObjeto(lista_e, r);
6367

‎estaticos.o

172 Bytes
Binary file not shown.

‎imagens/recife.bmp

-19.2 KB
Binary file not shown.

‎imagens/recife_grande.bmp

8.31 KB
Binary file not shown.

‎imagens/recife_medio.bmp

2.79 KB
Binary file not shown.

‎imagens/recife_pequeno.bmp

2.4 KB
Binary file not shown.

‎main.o

8 Bytes
Binary file not shown.

‎mar.o

8 Bytes
Binary file not shown.

‎pessoas.o

8 Bytes
Binary file not shown.

‎pessoas.o.orig

17.4 KB
Binary file not shown.

‎tipos.o

4 Bytes
Binary file not shown.

‎tipos.o.orig

15.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.