Angband
Functions | Variables
game-world.h File Reference

Game core management of the game world. More...

#include "cave.h"

Go to the source code of this file.

Functions

bool is_daytime (void)
 Say whether it's daytime or not. More...
 
int turn_energy (int speed)
 The amount of energy gained in a turn by a player or monster. More...
 
void play_ambient_sound (void)
 Play an ambient sound dependent on dungeon level, and day or night in town. More...
 
void process_world (struct chunk *c)
 Handle things that need updating once every 10 game turns. More...
 
void on_new_level (void)
 Housekeeping on arriving on a new level. More...
 
void process_player (void)
 Process player commands from the command queue, finishing when there is a command using energy (any regular game command), or we run out of commands and need another from the user, or the character changes level or dies, or the game is stopped. More...
 
void run_game_loop (void)
 The main game loop. More...
 

Variables

u16b daycount
 
u32b seed_randart
 
u32b seed_flavor
 
s32b turn
 
bool character_generated
 
bool character_dungeon
 
const byte extract_energy [200]
 This table allows quick conversion from "speed" to "energy" The basic function WAS ((S>=110) ? (S-110) : (100 / (120-S))) Note that table access is much quicker than computation. More...
 

Detailed Description

Game core management of the game world.

Copyright (c) 1997 Ben Harrison, James E. Wilson, Robert A. Koeneke

This work is free software; you can redistribute it and/or modify it under the terms of either:

a) the GNU General Public License as published by the Free Software Foundation, version 2, or

b) the "Angband licence": This software may be copied and distributed for educational, research, and not for profit purposes provided that this copyright and statement are included in all such copies. Other copyrights may also apply.

Function Documentation

bool is_daytime ( void  )
void on_new_level ( void  )
void play_ambient_sound ( void  )

Play an ambient sound dependent on dungeon level, and day or night in town.

References player::depth, is_daytime(), and sound().

Referenced by on_new_level(), and process_world().

void process_player ( void  )

Process player commands from the command queue, finishing when there is a command using energy (any regular game command), or we run out of commands and need another from the user, or the character changes level or dies, or the game is stopped.

Notice the annoying code to handle "pack overflow", which must come first just in case somebody manages to corrupt the savefiles by clever use of menu commands or something. (Can go? NRM)

Notice the annoying code to handle "monster memory" changes, which allows us to avoid having to update the window flags every time we change any internal monster memory field, and also reduces the number of times that the recall window must be redrawn.

References CMD_GAME, cmd_get_nrepeats(), CMD_SLEEP, cmdq_pop(), cmdq_push(), effect_simple(), player_upkeep::energy_use, EVENT_CHECK_INTERRUPT, EVENT_COMMAND_REPEAT, EVENT_REFRESH, event_signal(), player_upkeep::generate_level, handle_stuff(), player::is_dead, player_upkeep::monster_race, notice_stuff(), NULL, pack_overflow(), player_has, player_resting_complete_special(), player_upkeep::playing, PR_MONSTER, process_player_cleanup(), player_upkeep::redraw, source_none(), player::timed, and player::upkeep.

Referenced by run_game_loop().

void process_world ( struct chunk c)
void run_game_loop ( void  )
int turn_energy ( int  speed)

The amount of energy gained in a turn by a player or monster.

References extract_energy, angband_constants::move_energy, and z_info.

Referenced by describe_effect(), process_monsters(), process_world(), and run_game_loop().

Variable Documentation

bool character_dungeon
bool character_generated
u16b daycount
const byte extract_energy[200]

This table allows quick conversion from "speed" to "energy" The basic function WAS ((S>=110) ? (S-110) : (100 / (120-S))) Note that table access is much quicker than computation.

Note that the table has been changed at high speeds. From "Slow (-40)" to "Fast (+30)" is pretty much unchanged, but at speeds above "Fast (+30)", one approaches an asymptotic effective limit of 50 energy per turn. This means that it is relatively easy to reach "Fast (+30)" and get about 40 energy per turn, but then speed becomes very "expensive", and you must get all the way to "Fast (+50)" to reach the point of getting 45 energy per turn. After that point, furthur increases in speed are more or less pointless, except to balance out heavy inventory.

Note that currently the fastest monster is "Fast (+30)".

Referenced by turn_energy().

u32b seed_flavor
u32b seed_randart
s32b turn