|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
/* $Id: single.c,v 1.55 2004/01/27 21:13:45 stpohle Exp $ */
|
|
|
|
|
/* $Id: single.c,v 1.56 2004/01/28 18:19:12 stpohle Exp $ */
|
|
|
|
|
/* single player */
|
|
|
|
|
|
|
|
|
|
#include "basic.h"
|
|
|
|
@ -19,7 +19,7 @@ single_game_new ()
|
|
|
|
|
bman.players_nr_s++;
|
|
|
|
|
bman.players_nr++;
|
|
|
|
|
players[p].state |= PSF_used + PSF_alife + PSF_playing;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
players[p].state = 0;
|
|
|
|
|
}
|
|
|
|
@ -38,7 +38,7 @@ ai_checkfield (int x, int y)
|
|
|
|
|
{
|
|
|
|
|
return ((map.field[x][y].type == FT_nothing || map.field[x][y].type == FT_fire
|
|
|
|
|
|| map.field[x][y].type == FT_shoe || map.field[x][y].type == FT_bomb
|
|
|
|
|
|| map.field[x][y].type == FT_mixed || map.field[x][y].type == FT_tunnel)
|
|
|
|
|
|| map.field[x][y].type == FT_mixed || map.field[x][y].type == FT_tunnel)
|
|
|
|
|
&& map.bfield[x][y] == 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -51,7 +51,7 @@ ai_easyrunaway (_point p)
|
|
|
|
|
{
|
|
|
|
|
int i,
|
|
|
|
|
done = 0,
|
|
|
|
|
dir = 0;
|
|
|
|
|
dir = 0;
|
|
|
|
|
_point pos[4],
|
|
|
|
|
m[4];
|
|
|
|
|
|
|
|
|
@ -124,12 +124,12 @@ ai_runawayfrom (_point p, int nearbomb, signed char norecursive)
|
|
|
|
|
{
|
|
|
|
|
int i,
|
|
|
|
|
done = 0,
|
|
|
|
|
nbomb,
|
|
|
|
|
tdir,
|
|
|
|
|
_i,
|
|
|
|
|
bdirpoints = 10,
|
|
|
|
|
j,
|
|
|
|
|
c;
|
|
|
|
|
nbomb,
|
|
|
|
|
tdir,
|
|
|
|
|
_i,
|
|
|
|
|
bdirpoints = 10,
|
|
|
|
|
j,
|
|
|
|
|
c;
|
|
|
|
|
_airunaway res;
|
|
|
|
|
_point pos[4],
|
|
|
|
|
m[4],
|
|
|
|
@ -236,8 +236,8 @@ int
|
|
|
|
|
ai_bombpoints (_point pos, int range)
|
|
|
|
|
{
|
|
|
|
|
int points = 0,
|
|
|
|
|
d,
|
|
|
|
|
r;
|
|
|
|
|
d,
|
|
|
|
|
r;
|
|
|
|
|
_point p,
|
|
|
|
|
m;
|
|
|
|
|
|
|
|
|
@ -265,7 +265,10 @@ ai_bombpoints (_point pos, int range)
|
|
|
|
|
|
|
|
|
|
p = pos;
|
|
|
|
|
|
|
|
|
|
for (r = 0; (r < range && (map.field[p.x][p.y].type == FT_nothing || map.field[p.x][p.y].type == FT_tunnel)); r++) {
|
|
|
|
|
for (r = 0;
|
|
|
|
|
(r < range
|
|
|
|
|
&& (map.field[p.x][p.y].type == FT_nothing
|
|
|
|
|
|| map.field[p.x][p.y].type == FT_tunnel)); r++) {
|
|
|
|
|
p.x += m.x;
|
|
|
|
|
p.y += m.y;
|
|
|
|
|
}
|
|
|
|
@ -294,9 +297,9 @@ ai_findbestbombdir (_point pos, int dir, int range)
|
|
|
|
|
int points[5] = { 0, 0, 0, 0, 0 };
|
|
|
|
|
int d,
|
|
|
|
|
done = 0,
|
|
|
|
|
j,
|
|
|
|
|
maxpoints = 0,
|
|
|
|
|
bestd;
|
|
|
|
|
j,
|
|
|
|
|
maxpoints = 0,
|
|
|
|
|
bestd;
|
|
|
|
|
_point m[4],
|
|
|
|
|
p[4];
|
|
|
|
|
|
|
|
|
@ -363,7 +366,7 @@ ai_findbestbombdir (_point pos, int dir, int range)
|
|
|
|
|
/* prevent from turning around */
|
|
|
|
|
if (dir != -1 && (bestd & (0xFF - (1 << ai_invertdir (dir)))))
|
|
|
|
|
bestd &= (0xFF - (1 << ai_invertdir (dir)));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return bestd;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -375,8 +378,7 @@ ai_findnearbombs (_point pos)
|
|
|
|
|
{
|
|
|
|
|
int d,
|
|
|
|
|
res = 0, // result if there is a bomb
|
|
|
|
|
|
|
|
|
|
done = 0;
|
|
|
|
|
done = 0;
|
|
|
|
|
_point m[4]; // direction addition
|
|
|
|
|
_point dist[4]; // to check every direction (on three ways)
|
|
|
|
|
|
|
|
|
@ -448,7 +450,7 @@ ai_checkpos (_player * pl, _point * pos)
|
|
|
|
|
pos->x = rintf (pl->pos.x);
|
|
|
|
|
pos->y = rintf (pl->pos.y);
|
|
|
|
|
|
|
|
|
|
return ((_p.x < 0.15f || _p.x > 0.85f) && (_p.y < 0.15f || _p.y > 0.85f));
|
|
|
|
|
return ((_p.x < 0.15f || _p.x > 0.85f) && (_p.y < 0.15f || _p.y > 0.85f));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -541,19 +543,22 @@ ai_checknewpos (_point pos, int d)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* delete single players from the game */
|
|
|
|
|
void single_delete_ai (int num_players) {
|
|
|
|
|
int p, count;
|
|
|
|
|
|
|
|
|
|
for (p = 0, count = 0; p < MAX_PLAYERS && count < num_players; p++) {
|
|
|
|
|
if (PS_IS_aiplayer (players[p].state)) {
|
|
|
|
|
/* ai player found... delete */
|
|
|
|
|
player_set_gfx (&players[p], -1);
|
|
|
|
|
players[p].state = 0;
|
|
|
|
|
players[p].net.addr.host[0] = 0;
|
|
|
|
|
players[p].net.addr.port[0] = 0;
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
void
|
|
|
|
|
single_delete_ai (int num_players)
|
|
|
|
|
{
|
|
|
|
|
int p,
|
|
|
|
|
count;
|
|
|
|
|
|
|
|
|
|
for (p = 0, count = 0; p < MAX_PLAYERS && count < num_players; p++) {
|
|
|
|
|
if (PS_IS_aiplayer (players[p].state)) {
|
|
|
|
|
/* ai player found... delete */
|
|
|
|
|
player_set_gfx (&players[p], -1);
|
|
|
|
|
players[p].state = 0;
|
|
|
|
|
players[p].net.addr.host[0] = 0;
|
|
|
|
|
players[p].net.addr.port[0] = 0;
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -572,11 +577,11 @@ single_create_ai (int num_players)
|
|
|
|
|
for (pl = NULL, p = 0; (pl == NULL && p < MAX_PLAYERS); p++)
|
|
|
|
|
if (!(PS_IS_used (players[p].state))) {
|
|
|
|
|
pl = &players[p];
|
|
|
|
|
sprintf (pl->name, "AIPlayer %d", p+1);
|
|
|
|
|
sprintf (pl->name, "AIPlayer %d", p + 1);
|
|
|
|
|
pl->state |= PSF_used + PSF_alife + PSF_playing + PSF_ai;
|
|
|
|
|
pl->net.flags = NETF_firewall;
|
|
|
|
|
sprintf (pl->net.addr.host, "localhost");
|
|
|
|
|
sprintf (pl->net.addr.port, "11000");
|
|
|
|
|
pl->net.flags = NETF_firewall;
|
|
|
|
|
sprintf (pl->net.addr.host, "localhost");
|
|
|
|
|
sprintf (pl->net.addr.port, "11000");
|
|
|
|
|
do {
|
|
|
|
|
gfx_sel = s_random (MAX_PLAYERS);
|
|
|
|
|
MW_IS_GFX_SELECT (gfx_sel, i);
|
|
|
|
@ -602,8 +607,8 @@ single_playergame ()
|
|
|
|
|
players[p].points = 0;
|
|
|
|
|
players[p].wins = 0;
|
|
|
|
|
players[p].state = 0;
|
|
|
|
|
players[p].gfx_nr = -1;
|
|
|
|
|
players[p].gfx = NULL;
|
|
|
|
|
players[p].gfx_nr = -1;
|
|
|
|
|
players[p].gfx = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (bman.p_nr = -1, p = 0; (bman.p_nr == -1 && p < MAX_PLAYERS); p++)
|
|
|
|
@ -640,100 +645,110 @@ single_loop ()
|
|
|
|
|
_player *pl;
|
|
|
|
|
_point plpos;
|
|
|
|
|
int nearbomb = 0,
|
|
|
|
|
bestbdir,
|
|
|
|
|
i;
|
|
|
|
|
bestbdir,
|
|
|
|
|
i;
|
|
|
|
|
_airunaway rawdir;
|
|
|
|
|
|
|
|
|
|
if (GT_MP_PTPS) // we are not the master so no need for this.
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (GT_MP_PTPS) // we are not the master so no need for this.
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
for (p = 0; p < MAX_PLAYERS; p++)
|
|
|
|
|
if (p != bman.p_nr && PS_IS_alife (players[p].state) && PS_IS_aiplayer(players[p].state)) {
|
|
|
|
|
pl = &players[p];
|
|
|
|
|
if (p != bman.p_nr && PS_IS_aiplayer (players[p].state)) {
|
|
|
|
|
if (PS_IS_alife (players[p].state)) {
|
|
|
|
|
pl = &players[p];
|
|
|
|
|
|
|
|
|
|
i = ai_checkpos (pl, &plpos);
|
|
|
|
|
i = ai_checkpos (pl, &plpos);
|
|
|
|
|
|
|
|
|
|
if (!i)
|
|
|
|
|
/* we're still moving */
|
|
|
|
|
pl->m = 1;
|
|
|
|
|
else {
|
|
|
|
|
nearbomb = ai_findnearbombs (plpos);
|
|
|
|
|
if (nearbomb == 0) { // no bombs found
|
|
|
|
|
bestbdir = ai_findbestbombdir (plpos, pl->d, pl->range);
|
|
|
|
|
if (bestbdir & DIRM_under) {
|
|
|
|
|
if (ai_easyrunaway (plpos) != 0)
|
|
|
|
|
player_drop_bomb (p);
|
|
|
|
|
}
|
|
|
|
|
else if (bestbdir == 0) {
|
|
|
|
|
pl->d = s_random (4);
|
|
|
|
|
pl->m = 1;
|
|
|
|
|
if (!i)
|
|
|
|
|
/* we're still moving */
|
|
|
|
|
pl->m = 1;
|
|
|
|
|
else {
|
|
|
|
|
nearbomb = ai_findnearbombs (plpos);
|
|
|
|
|
if (nearbomb == 0) { // no bombs found
|
|
|
|
|
bestbdir = ai_findbestbombdir (plpos, pl->d, pl->range);
|
|
|
|
|
if (bestbdir & DIRM_under) {
|
|
|
|
|
if (ai_easyrunaway (plpos) != 0)
|
|
|
|
|
player_drop_bomb (p);
|
|
|
|
|
}
|
|
|
|
|
else if (bestbdir == 0) {
|
|
|
|
|
pl->d = s_random (4);
|
|
|
|
|
pl->m = 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
pl->d = ai_choosedir (bestbdir, 0, pl->d);
|
|
|
|
|
pl->m = 1;
|
|
|
|
|
}
|
|
|
|
|
if (!ai_checknewpos (plpos, pl->d))
|
|
|
|
|
pl->m = 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
pl->d = ai_choosedir (bestbdir, 0, pl->d);
|
|
|
|
|
pl->m = 1;
|
|
|
|
|
}
|
|
|
|
|
if (!ai_checknewpos (plpos, pl->d))
|
|
|
|
|
pl->m = 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// bombs in the near found
|
|
|
|
|
rawdir = ai_runawayfrom (plpos, nearbomb, 0);
|
|
|
|
|
if (rawdir.dir != 0 && rawdir.bestdir == -1) {
|
|
|
|
|
pl->d = ai_choosedir (rawdir.dir, nearbomb, pl->d); // we have to make a choice.. do it
|
|
|
|
|
pl->m = 1;
|
|
|
|
|
// bombs in the near found
|
|
|
|
|
rawdir = ai_runawayfrom (plpos, nearbomb, 0);
|
|
|
|
|
if (rawdir.dir != 0 && rawdir.bestdir == -1) {
|
|
|
|
|
pl->d = ai_choosedir (rawdir.dir, nearbomb, pl->d); // we have to make a choice.. do it
|
|
|
|
|
pl->m = 1;
|
|
|
|
|
}
|
|
|
|
|
else if (rawdir.bestdir != -1) {
|
|
|
|
|
pl->d = rawdir.bestdir;
|
|
|
|
|
pl->m = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (rawdir.bestdir != -1) {
|
|
|
|
|
pl->d = rawdir.bestdir;
|
|
|
|
|
|
|
|
|
|
if (pl->m == 0 && map.field[(int) pl->pos.x][(int) pl->pos.y].type == FT_tunnel)
|
|
|
|
|
pl->m = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (pl->m == 0 && map.field[(int)pl->pos.x][(int)pl->pos.y].type == FT_tunnel)
|
|
|
|
|
pl->m = 1;
|
|
|
|
|
player_ilness_loop (p);
|
|
|
|
|
move_player (p);
|
|
|
|
|
}
|
|
|
|
|
player_ilness_loop (p);
|
|
|
|
|
player_checkdeath (p);
|
|
|
|
|
move_player (p);
|
|
|
|
|
else
|
|
|
|
|
player_checkdeath (p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* singleplayer menü with some options you can make */
|
|
|
|
|
void
|
|
|
|
|
void
|
|
|
|
|
single_menu ()
|
|
|
|
|
{
|
|
|
|
|
int menuselect = 0, i, p, done = 0;
|
|
|
|
|
_charlist nrplayerlist[MAX_PLAYERS+1];
|
|
|
|
|
_charlist *selnrplayer = &nrplayerlist[bman.ai_players];
|
|
|
|
|
|
|
|
|
|
/* fill in the nrplayerlist */
|
|
|
|
|
if (debug) p = 0; else p = 1;
|
|
|
|
|
for (i = 0; p < MAX_PLAYERS+1; i++) {
|
|
|
|
|
sprintf (nrplayerlist[i].text, "%d", p);
|
|
|
|
|
if (p < MAX_PLAYERS-1)
|
|
|
|
|
nrplayerlist[i].next = &nrplayerlist[i+1];
|
|
|
|
|
else
|
|
|
|
|
nrplayerlist[i].next = NULL;
|
|
|
|
|
p++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int menuselect = 0,
|
|
|
|
|
i,
|
|
|
|
|
p,
|
|
|
|
|
done = 0;
|
|
|
|
|
_charlist nrplayerlist[MAX_PLAYERS + 1];
|
|
|
|
|
_charlist *selnrplayer = &nrplayerlist[bman.ai_players];
|
|
|
|
|
|
|
|
|
|
/* fill in the nrplayerlist */
|
|
|
|
|
if (debug)
|
|
|
|
|
p = 0;
|
|
|
|
|
else
|
|
|
|
|
p = 1;
|
|
|
|
|
for (i = 0; p < MAX_PLAYERS + 1; i++) {
|
|
|
|
|
sprintf (nrplayerlist[i].text, "%d", p);
|
|
|
|
|
if (p < MAX_PLAYERS - 1)
|
|
|
|
|
nrplayerlist[i].next = &nrplayerlist[i + 1];
|
|
|
|
|
else
|
|
|
|
|
nrplayerlist[i].next = NULL;
|
|
|
|
|
p++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (!done && bman.state != GS_quit) {
|
|
|
|
|
menu_new ("Single Player", 300, 250);
|
|
|
|
|
menu_create_label ("Number Of AI Players", -1, 55, 0);
|
|
|
|
|
menu_create_list ("Players", -1, 80, 70, 70, nrplayerlist, &selnrplayer, 1);
|
|
|
|
|
menu_create_button ("Map Setting", -1, 180, 150, 2);
|
|
|
|
|
menu_create_button ("OK", -1, 220, 150, 0);
|
|
|
|
|
menuselect = menu_loop ();
|
|
|
|
|
menu_delete ();
|
|
|
|
|
|
|
|
|
|
/* read the current number of AI Players */
|
|
|
|
|
bman.ai_players = (selnrplayer - &nrplayerlist[0]);
|
|
|
|
|
if (!debug)
|
|
|
|
|
bman.ai_players++;
|
|
|
|
|
if (bman.ai_players > MAX_PLAYERS) {
|
|
|
|
|
d_fatal ("single_menu: bman.ai_players selection out of range (%d)\n", bman.ai_players);
|
|
|
|
|
bman.ai_players = 5;
|
|
|
|
|
}
|
|
|
|
|
menu_new ("Single Player", 300, 250);
|
|
|
|
|
menu_create_label ("Number Of AI Players", -1, 55, 0);
|
|
|
|
|
menu_create_list ("Players", -1, 80, 70, 70, nrplayerlist, &selnrplayer, 1);
|
|
|
|
|
menu_create_button ("Map Setting", -1, 180, 150, 2);
|
|
|
|
|
menu_create_button ("OK", -1, 220, 150, 0);
|
|
|
|
|
menuselect = menu_loop ();
|
|
|
|
|
menu_delete ();
|
|
|
|
|
|
|
|
|
|
/* read the current number of AI Players */
|
|
|
|
|
bman.ai_players = (selnrplayer - &nrplayerlist[0]);
|
|
|
|
|
if (!debug)
|
|
|
|
|
bman.ai_players++;
|
|
|
|
|
if (bman.ai_players > MAX_PLAYERS) {
|
|
|
|
|
d_fatal ("single_menu: bman.ai_players selection out of range (%d)\n", bman.ai_players);
|
|
|
|
|
bman.ai_players = 5;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (menuselect) {
|
|
|
|
|
case (0): // Start Game
|
|
|
|
@ -746,8 +761,8 @@ single_menu ()
|
|
|
|
|
done = 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
draw_logo ();
|
|
|
|
|
SDL_Flip (gfx.screen);
|
|
|
|
|
draw_logo ();
|
|
|
|
|
SDL_Flip (gfx.screen);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -758,22 +773,22 @@ int
|
|
|
|
|
single_select_player ()
|
|
|
|
|
{
|
|
|
|
|
int selgfx = 0,
|
|
|
|
|
done = 0,
|
|
|
|
|
x,
|
|
|
|
|
y,
|
|
|
|
|
keypressed = 0,
|
|
|
|
|
frame = 0,
|
|
|
|
|
d = 0,
|
|
|
|
|
dto = 2,
|
|
|
|
|
newplayer = -1,
|
|
|
|
|
pos = 0,
|
|
|
|
|
i;
|
|
|
|
|
done = 0,
|
|
|
|
|
x,
|
|
|
|
|
y,
|
|
|
|
|
keypressed = 0,
|
|
|
|
|
frame = 0,
|
|
|
|
|
d = 0,
|
|
|
|
|
dto = 2,
|
|
|
|
|
newplayer = -1,
|
|
|
|
|
pos = 0,
|
|
|
|
|
i;
|
|
|
|
|
SDL_Rect dest,
|
|
|
|
|
src;
|
|
|
|
|
char text[255];
|
|
|
|
|
SDL_Event event;
|
|
|
|
|
Uint8 *keys;
|
|
|
|
|
Uint32 timeloop1;
|
|
|
|
|
Uint32 timeloop1;
|
|
|
|
|
|
|
|
|
|
// menu_displaytext ("Loading..", "Please Wait", 32, 128, 32);
|
|
|
|
|
|
|
|
|
@ -815,9 +830,9 @@ single_select_player ()
|
|
|
|
|
if (newplayer != -1) {
|
|
|
|
|
SDL_Rect dest1,
|
|
|
|
|
src1;
|
|
|
|
|
|
|
|
|
|
pos += 8;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pos += 8;
|
|
|
|
|
|
|
|
|
|
if (d == left) {
|
|
|
|
|
/* image 1 */
|
|
|
|
|
src.h = dest.h = gfx.players[selgfx].ani.h;
|
|
|
|
@ -832,7 +847,9 @@ single_select_player ()
|
|
|
|
|
src1.w = dest1.w = gfx.players[newplayer].ani.w;
|
|
|
|
|
src1.x = gfx.players[newplayer].ani.w * d;
|
|
|
|
|
src1.y = gfx.players[newplayer].ani.h * frame;
|
|
|
|
|
dest1.x = ((gfx.res.x - gfx.players[newplayer].ani.w) / 2) + ((gfx.res.x / 2)+ 128) - pos;
|
|
|
|
|
dest1.x =
|
|
|
|
|
((gfx.res.x - gfx.players[newplayer].ani.w) / 2) + ((gfx.res.x / 2) + 128) -
|
|
|
|
|
pos;
|
|
|
|
|
dest1.y = y + font[0].size.y + 64;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
@ -849,26 +866,28 @@ single_select_player ()
|
|
|
|
|
src1.w = dest1.w = gfx.players[newplayer].ani.w;
|
|
|
|
|
src1.x = gfx.players[newplayer].ani.w * d;
|
|
|
|
|
src1.y = gfx.players[newplayer].ani.h * frame;
|
|
|
|
|
dest1.x = ((gfx.res.x - gfx.players[newplayer].ani.w) / 2) - ((gfx.res.x / 2)+ 128) + pos;
|
|
|
|
|
dest1.x =
|
|
|
|
|
((gfx.res.x - gfx.players[newplayer].ani.w) / 2) - ((gfx.res.x / 2) + 128) +
|
|
|
|
|
pos;
|
|
|
|
|
dest1.y = y + font[0].size.y + 64;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
redraw_logo (0, y + font[0].size.y + 64, gfx.res.x, 128);
|
|
|
|
|
|
|
|
|
|
if (dest.x + dest.w > 0)
|
|
|
|
|
gfx_blit (gfx.players[selgfx].ani.image, &src, gfx.screen, &dest, 0);
|
|
|
|
|
if (dest1.x + dest1.w > 0)
|
|
|
|
|
if (dest.x + dest.w > 0)
|
|
|
|
|
gfx_blit (gfx.players[selgfx].ani.image, &src, gfx.screen, &dest, 0);
|
|
|
|
|
if (dest1.x + dest1.w > 0)
|
|
|
|
|
gfx_blit (gfx.players[newplayer].ani.image, &src1, gfx.screen, &dest1, 0);
|
|
|
|
|
|
|
|
|
|
if (pos > (gfx.res.x / 2)+ 128) {
|
|
|
|
|
selgfx = newplayer;
|
|
|
|
|
newplayer = -1;
|
|
|
|
|
pos = 0;
|
|
|
|
|
frame = 0;
|
|
|
|
|
d = down;
|
|
|
|
|
dto = 5;
|
|
|
|
|
}
|
|
|
|
|
frame++;
|
|
|
|
|
|
|
|
|
|
if (pos > (gfx.res.x / 2) + 128) {
|
|
|
|
|
selgfx = newplayer;
|
|
|
|
|
newplayer = -1;
|
|
|
|
|
pos = 0;
|
|
|
|
|
frame = 0;
|
|
|
|
|
d = down;
|
|
|
|
|
dto = 5;
|
|
|
|
|
}
|
|
|
|
|
frame++;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
src.h = dest.h = gfx.players[selgfx].ani.h;
|
|
|
|
@ -918,24 +937,25 @@ single_select_player ()
|
|
|
|
|
d = right;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((keys[SDLK_RETURN] ||keys[SDLK_RCTRL] || keys[SDLK_LCTRL]) && (!keypressed) && (event.type = SDL_KEYDOWN) && newplayer == -1) {
|
|
|
|
|
if ((keys[SDLK_RETURN] || keys[SDLK_RCTRL] || keys[SDLK_LCTRL]) && (!keypressed)
|
|
|
|
|
&& (event.type = SDL_KEYDOWN) && newplayer == -1) {
|
|
|
|
|
done = 1;
|
|
|
|
|
keypressed = 1;
|
|
|
|
|
// d_printf("return pressed - done=1\n");
|
|
|
|
|
}
|
|
|
|
|
if (event.type == SDL_KEYUP)
|
|
|
|
|
keypressed = 0;
|
|
|
|
|
else if (event.type == SDL_KEYDOWN)
|
|
|
|
|
else if (event.type == SDL_KEYDOWN)
|
|
|
|
|
keypressed = 1;
|
|
|
|
|
|
|
|
|
|
// calculate time sync.
|
|
|
|
|
timeloop1 = SDL_GetTicks ();
|
|
|
|
|
|
|
|
|
|
if (newplayer != -1)
|
|
|
|
|
i = 17;
|
|
|
|
|
else
|
|
|
|
|
i = 25;
|
|
|
|
|
|
|
|
|
|
if (newplayer != -1)
|
|
|
|
|
i = 17;
|
|
|
|
|
else
|
|
|
|
|
i = 25;
|
|
|
|
|
|
|
|
|
|
while (timeloop1 - timestamp >= 0 && timeloop1 - timestamp < i) {
|
|
|
|
|
s_delay (i - (timeloop1 - timestamp) - 1);
|
|
|
|
|
timeloop1 = SDL_GetTicks ();
|
|
|
|
|