allow another monster + refactor
This commit is contained in:
parent
209e100be7
commit
192119eea2
19
w/w.c
19
w/w.c
|
@ -482,6 +482,18 @@ void freerounds()
|
||||||
currentround = NULL;
|
currentround = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gotomonster()
|
||||||
|
{
|
||||||
|
int index = dice() == 6 ? 1 : 0;
|
||||||
|
memcpy(&state.monster, &(monsters[index]), sizeof(Character));
|
||||||
|
state.screen = SC_MONSTER;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gotostation()
|
||||||
|
{
|
||||||
|
state.screen = SC_STATION;
|
||||||
|
}
|
||||||
|
|
||||||
void update(char* command)
|
void update(char* command)
|
||||||
{
|
{
|
||||||
char c = command[0];
|
char c = command[0];
|
||||||
|
@ -496,8 +508,7 @@ void update(char* command)
|
||||||
forward();
|
forward();
|
||||||
if ( (x != state.position.x || y != state.position.y) && dice() > 4)
|
if ( (x != state.position.x || y != state.position.y) && dice() > 4)
|
||||||
{
|
{
|
||||||
memcpy(&state.monster, &(monsters[0]), sizeof(Character));
|
gotomonster();
|
||||||
state.screen = SC_MONSTER;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CMD_RIGHT:
|
case CMD_RIGHT:
|
||||||
|
@ -509,7 +520,7 @@ void update(char* command)
|
||||||
case CMD_BACKTOSTATION:
|
case CMD_BACKTOSTATION:
|
||||||
if (currentchar() == TILE_START)
|
if (currentchar() == TILE_START)
|
||||||
{
|
{
|
||||||
state.screen = SC_STATION;
|
gotostation();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -529,7 +540,7 @@ void update(char* command)
|
||||||
if (strlen(command) > 0)
|
if (strlen(command) > 0)
|
||||||
{
|
{
|
||||||
createhero(command);
|
createhero(command);
|
||||||
state.screen = SC_STATION;
|
gotostation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (state.screen == SC_STATION)
|
else if (state.screen == SC_STATION)
|
||||||
|
|
Loading…
Reference in New Issue