@@ -26,8 +26,10 @@ void imprimeMar(lista_pessoas lista_p, lista_estaticos lista_e, lista_botes list
26
26
imprimeEstaticos (buffer , lista_e );
27
27
28
28
/* 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 );
31
33
32
34
/* Imprime Cabecalho */
33
35
imprimeCabecalho (buffer , lista_b );
@@ -192,7 +194,7 @@ void imprimeEstaticos(BITMAP *buffer, lista_estaticos estat)
192
194
while ( aux != NULL )
193
195
{
194
196
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 ) );
196
198
else
197
199
draw_sprite (buffer , aux -> stc .desenho , aux -> stc .pos .x - 155 , aux -> stc .pos .y - 66 );
198
200
@@ -214,43 +216,46 @@ void imprimeCabecalho(BITMAP *buffer, lista_botes botes)
214
216
textprintf_ex (buffer , font , 10 , 20 , makecol (0 , 0 , 255 ), -1 , "%s" , pessoas .jogador1 );
215
217
textprintf_ex (buffer , font , tela .comprimento - 80 , 20 , makecol (255 , 0 , 0 ), -1 , "%s" , pessoas .jogador2 );
216
218
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 );
225
219
226
- /* CARGA */
220
+ coracao = load_bitmap ( "imagens/coracao.bmp" , desktop_palette );
227
221
pessoa = load_bitmap ("imagens/pessoa2.bmp" ,desktop_palette );
228
222
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 )
242
224
{
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
+ }
246
240
}
247
- if ( botes -> bt . ancora == '1' )
241
+ if ( botes != NULL )
248
242
{
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
+ }
252
258
}
253
-
254
259
destroy_bitmap (coracao );
255
260
destroy_bitmap (pessoa );
256
261
}
0 commit comments