|
From: Bruno C. <bru...@us...> - 2009-12-05 05:16:43
|
This is an automated email from the git, the tree hashes are:
via 42619777c8db4f0fe39ad1171d03b9b595107c27 (commit)
via c9c703167bd55f3d24d72005547d749c6bb50050 (commit)
from 71889b94137ca9a043dc8b14ac85cb7176ac5170 (commit)
- Log -----------------------------------------------------------------
commit 42619777c8db4f0fe39ad1171d03b9b595107c27
Merge: c9c7031 71889b9
Author: Bruno Cardoso Lopes <bruno@keyser.(none)>
Date: Sat Dec 5 03:16:26 2009 -0200
Merge branch 'master' of ssh://brunocardoso@deadchannel.git.sourceforge.net/gitroot/deadchannel/deadchannel
commit c9c703167bd55f3d24d72005547d749c6bb50050
Author: Bruno Cardoso Lopes <bruno@keyser.(none)>
Date: Sat Dec 5 03:14:56 2009 -0200
Rename preferences consistently, for example:
[name]
lixo = 1
This should turn into => preferences.name_lixo
diff --git a/code/game.py b/code/game.py
index e63c513..13bc446 100644
--- a/code/game.py
+++ b/code/game.py
@@ -48,10 +48,10 @@ class Game:
self.preferences = preferences
pygame.init()
flags = DOUBLEBUF
- if preferences.fullscreen:
+ if preferences.screen_fullscreen:
flags |= FULLSCREEN
# create display
- self.screen = pygame.display.set_mode(preferences.resolution, flags)
+ self.screen = pygame.display.set_mode(preferences.screen_resolution, flags)
self.screen_size = self.screen.get_size()
# make mouse cursor invisible
@@ -137,57 +137,57 @@ class Game:
if key == K_ESCAPE:
self.run = False
- if preferences.input in ("mouse", "keyboard"):
+ if preferences.general_input in ("mouse", "keyboard"):
if type == KEYDOWN:
- if key == preferences.key_up:
+ if key == preferences.keyboard_up:
player.accel_top()
- elif key == preferences.key_down:
+ elif key == preferences.keyboard_down:
player.accel_bottom()
- elif key == preferences.key_right:
+ elif key == preferences.keyboard_right:
player.accel_right()
- elif key == preferences.key_left:
+ elif key == preferences.keyboard_left:
player.accel_left()
- elif key == preferences.key_player_play:
+ elif key == preferences.keyboard_player_play:
self.music_player.play()
- elif key == preferences.key_player_stop:
+ elif key == preferences.keyboard_player_stop:
self.music_player.stop()
- elif key == preferences.key_player_next_track:
+ elif key == preferences.keyboard_player_next_track:
self.music_player.next_track()
- elif key == preferences.key_prev_secondary_weapon:
+ elif key == preferences.keyboard_prev_secondary_weapon:
player.prev_secondary_weapon()
- elif key == preferences.key_next_secondary_weapon:
+ elif key == preferences.keyboard_next_secondary_weapon:
player.next_secondary_weapon()
- elif key == preferences.key_toogle_fullscreen:
+ elif key == preferences.keyboard_toogle_fullscreen:
pygame.display.toggle_fullscreen()
elif type == KEYUP:
- if key == preferences.key_down:
+ if key == preferences.keyboard_down:
player.accel_top()
- elif key == preferences.key_up:
+ elif key == preferences.keyboard_up:
player.accel_bottom()
- elif key == preferences.key_left:
+ elif key == preferences.keyboard_left:
player.accel_right()
- elif key == preferences.key_right:
+ elif key == preferences.keyboard_right:
player.accel_left()
- if preferences.input == "keyboard":
+ if preferences.general_input == "keyboard":
if type == KEYDOWN:
- if key == preferences.key_fire:
+ if key == preferences.keyboard_fire:
player_fire = True
self.player_firing = True
- elif key == preferences.key_secondary_fire:
+ elif key == preferences.keyboard_secondary_fire:
self.player_charging = 0
- elif key == preferences.key_rot_clock:
+ elif key == preferences.keyboard_rot_clock:
player.rotate_clock(self.rot_accel)
- elif key == preferences.key_rot_anti_clock:
+ elif key == preferences.keyboard_rot_anti_clock:
player.rotate_clock(-self.rot_accel)
elif type == KEYUP:
- if key == preferences.key_rot_clock:
+ if key == preferences.keyboard_rot_clock:
player.rotate_clock(-self.rot_accel)
- elif key == preferences.key_rot_anti_clock:
+ elif key == preferences.keyboard_rot_anti_clock:
player.rotate_clock(self.rot_accel)
- elif key == preferences.key_fire:
+ elif key == preferences.keyboard_fire:
self.player_firing = False
- elif key == preferences.key_secondary_fire:
+ elif key == preferences.keyboard_secondary_fire:
sw = player.get_selected_secondary_weapon()
if sw == None:
continue
@@ -196,7 +196,7 @@ class Game:
self.actors_list["enemies"],
self.player_charging)
- elif preferences.input == "mouse":
+ elif preferences.general_input == "mouse":
if type == MOUSEBUTTONDOWN:
# mouse left button is 1, middle is 2, and right is 3
if button == preferences.mouse_fire:
@@ -235,28 +235,28 @@ class Game:
preferences.mouse_sensitivity)
player.set_rotation(rot)
- elif preferences.input in ("joystick_analogic",
+ elif preferences.general_input in ("joystick_analogic",
"joystick_d-pad"):
- if type == JOYBUTTONDOWN and joy_id == preferences.joy_id:
- if button == preferences.j_bt_fire:
+ if type == JOYBUTTONDOWN and joy_id == preferences.joystick_id:
+ if button == preferences.joystick_fire:
player_fire = True
self.player_firing = True
- elif button == preferences.j_bt_secondary_fire:
+ elif button == preferences.joystick_secondary_fire:
self.player_charging = 0
- elif button == preferences.j_bt_player_play:
+ elif button == preferences.joystick_player_play:
self.music_player.play()
- elif button == preferences.j_bt_player_stop:
+ elif button == preferences.joystick_player_stop:
self.music_player.stop()
- elif button == preferences.j_bt_player_next_track:
+ elif button == preferences.joystick_player_next_track:
self.music_player.next_track()
- elif button == preferences.j_bt_prev_secondary_weapon:
+ elif button == preferences.joystick_prev_secondary_weapon:
player.prev_secondary_weapon()
- elif button == preferences.j_bt_next_secondary_weapon:
+ elif button == preferences.joystick_next_secondary_weapon:
player.next_secondary_weapon()
- elif type == JOYBUTTONUP and joy_id == preferences.joy_id:
- if button == preferences.j_bt_fire:
+ elif type == JOYBUTTONUP and joy_id == preferences.joystick_id:
+ if button == preferences.joystick_fire:
self.player_firing = False
- elif button == preferences.j_bt_secondary_fire:
+ elif button == preferences.joystick_secondary_fire:
sw = player.get_selected_secondary_weapon()
if sw == None:
continue
@@ -266,41 +266,41 @@ class Game:
self.player_charging)
- if preferences.input == "joystick_analogic":
- if type == JOYAXISMOTION and joy_id == preferences.joy_id:
+ if preferences.general_input == "joystick_analogic":
+ if type == JOYAXISMOTION and joy_id == preferences.joystick_id:
if axis == preferences.j_axis_x:
- if abs(value) > preferences.joy_deadzone:
- h_speed = value * preferences.joy_sensitivity
+ if abs(value) > preferences.joystick_deadzone:
+ h_speed = value * preferences.joystick_sensitivity
else:
h_speed = 0
player.set_speed([h_speed, player.get_speed()[1]])
elif axis == preferences.j_axis_y:
- if abs(value) > preferences.joy_deadzone:
- v_speed = value * preferences.joy_sensitivity
+ if abs(value) > preferences.joystick_deadzone:
+ v_speed = value * preferences.joystick_sensitivity
else:
v_speed = 0
player.set_speed([player.get_speed()[0], v_speed])
elif axis == preferences.j_axis_z:
- if abs(value) < preferences.joy_deadzone:
+ if abs(value) < preferences.joystick_deadzone:
value = 0
- rot_speed = int(value* preferences.joy_sensitivity)
+ rot_speed = int(value* preferences.joystick_sensitivity)
player.set_rotation_speed(rot_speed)
- elif preferences.input == "joystick_d-pad":
- if type == JOYHATMOTION and joy_id == preferences.joy_id:
+ elif preferences.general_input == "joystick_d-pad":
+ if type == JOYHATMOTION and joy_id == preferences.joystick_id:
accel = player.get_accel()
speed = [value[0] * accel[0], -value[1] * accel[1]]
player.set_speed(speed)
elif type == JOYBUTTONDOWN and \
- joy_id == preferences.joy_id:
- if button == preferences.j_bt_rot_clock:
+ joy_id == preferences.joystick_id:
+ if button == preferences.joystick_rot_clock:
player.rotate_clock(self.rot_accel)
- elif button == preferences.j_bt_rot_anti_clock:
+ elif button == preferences.joystick_rot_anti_clock:
player.rotate_clock(-self.rot_accel)
- elif type == JOYBUTTONUP and joy_id == preferences.joy_id:
- if button == preferences.j_bt_rot_clock:
+ elif type == JOYBUTTONUP and joy_id == preferences.joystick_id:
+ if button == preferences.joystick_rot_clock:
player.rotate_clock(-self.rot_accel)
- elif button == preferences.j_bt_rot_anti_clock:
+ elif button == preferences.joystick_rot_anti_clock:
player.rotate_clock(self.rot_accel)
if player_fire or self.player_firing:
@@ -461,7 +461,7 @@ class Game:
# loads music player
self.music_player = Music_player(
- self.hud, self.preferences.music_volume)
+ self.hud, self.preferences.general_music_volume)
# loads next music
self.music_player.load_next()
# Starts playing music
diff --git a/code/preferences.py b/code/preferences.py
index 9366c9d..453fac5 100644
--- a/code/preferences.py
+++ b/code/preferences.py
@@ -48,55 +48,55 @@ class Preferences:
return self.default_conf.get(section, option)
return self.conf.get(section, option)
- def get_resolution(self):
+ def get_screen_resolution(self):
res = self.get('screen', 'resolution')
res = res .lower()
res = res.split("x")
return [ int(res[0]), int(res[1])]
- def get_fullscreen(self):
+ def get_screen_fullscreen(self):
return self.get('screen', 'fullscreen')
- def get_key_up(self):
+ def get_keyboard_up(self):
return int(self.get('keyboard', 'up'))
- def get_key_down(self):
+ def get_keyboard_down(self):
return int(self.get('keyboard', 'down'))
- def get_key_right(self):
+ def get_keyboard_right(self):
return int(self.get('keyboard', 'right'))
- def get_key_left(self):
+ def get_keyboard_left(self):
return int(self.get('keyboard', 'left'))
- def get_key_fire(self):
+ def get_keyboard_fire(self):
return int(self.get('keyboard', 'fire'))
- def get_key_secondary_fire(self):
+ def get_keyboard_secondary_fire(self):
return int(self.get('keyboard', 'secondary_fire'))
- def get_key_rot_clock(self):
+ def get_keyboard_rot_clock(self):
return int(self.get('keyboard', 'rot_clock'))
- def get_key_rot_anti_clock(self):
+ def get_keyboard_rot_anti_clock(self):
return int(self.get('keyboard', 'rot_anti_clock'))
- def get_key_player_play(self):
+ def get_keyboard_player_play(self):
return int(self.get('keyboard', 'player_play'))
- def get_key_player_stop(self):
+ def get_keyboard_player_stop(self):
return int(self.get('keyboard', 'player_stop'))
- def get_key_player_next_track(self):
+ def get_keyboard_player_next_track(self):
return int(self.get('keyboard', 'player_next_track'))
- def get_key_prev_secondary_weapon(self):
+ def get_keyboard_prev_secondary_weapon(self):
return int(self.get('keyboard', 'prev_secondary_weapon'))
- def get_key_next_secondary_weapon(self):
+ def get_keyboard_next_secondary_weapon(self):
return int(self.get('keyboard', 'next_secondary_weapon'))
- def get_key_toogle_fullscreen(self):
+ def get_keyboard_toogle_fullscreen(self):
return int(self.get('keyboard', 'toogle_fullscreen'))
def get_mouse_sensitivity(self):
@@ -114,92 +114,92 @@ class Preferences:
def get_mouse_next_secondary_weapon(self):
return int(self.get('mouse', 'next_secondary_weapon'))
- def get_joy_axis_x(self):
+ def get_joystick_axis_x(self):
return int(self.get('joystick', 'axis_x'))
- def get_joy_axis_y(self):
+ def get_joystick_axis_y(self):
return int(self.get('joystick', 'axis_y'))
- def get_joy_axis_z(self):
+ def get_joystick_axis_z(self):
return int(self.get('joystick', 'axis_z'))
- def get_joy_fire(self):
+ def get_joystick_fire(self):
return int(self.get('joystick', 'fire'))
- def get_joy_secondary_fire(self):
+ def get_joystick_secondary_fire(self):
return int(self.get('joystick', 'secondary_fire'))
- def get_joy_rot_clock(self):
+ def get_joystick_rot_clock(self):
return int(self.get('joystick', 'rot_clock'))
- def get_joy_rot_anti_clock(self):
+ def get_joystick_rot_anti_clock(self):
return int(self.get('joystick', 'rot_anti_clock'))
- def get_joy_player_play(self):
+ def get_joystick_player_play(self):
return int(self.get('joystick', 'player_play'))
- def get_joy_player_stop(self):
+ def get_joystick_player_stop(self):
return int(self.get('joystick', 'player_stop'))
- def get_joy_player_next_track(self):
+ def get_joystick_player_next_track(self):
return int(self.get('joystick', 'player_next_track'))
- def get_joy_prev_secondary_weapon(self):
+ def get_joystick_prev_secondary_weapon(self):
return int(self.get('joystick', 'prev_secondary_weapon'))
- def get_joy_next_secondary_weapon(self):
+ def get_joystick_next_secondary_weapon(self):
return int(self.get('joystick', 'next_secondary_weapon'))
- def get_joy_sensitivity(self):
+ def get_joystick_sensitivity(self):
return float(self.get('joystick', 'sensitivity'))
- def get_joy_deadzone(self):
+ def get_joystick_deadzone(self):
return float(self.get('joystick', 'deadzone'))
- def get_joy_id(self):
+ def get_joystick_id(self):
return int(self.get('joystick', 'id'))
- def get_input(self):
+ def get_general_input(self):
return self.get('general', 'input')
- def get_music_volume(self):
+ def get_general_music_volume(self):
return float(self.get('general', 'music_volume'))
- fullscreen = property(get_fullscreen)
- resolution = property(get_resolution)
- key_up = property(get_key_up)
- key_down = property(get_key_down)
- key_right = property(get_key_right)
- key_left = property(get_key_left)
- key_fire = property(get_key_fire)
- key_secondary_fire = property(get_key_secondary_fire)
- key_rot_clock = property(get_key_rot_clock)
- key_rot_anti_clock = property(get_key_rot_anti_clock)
- key_player_play = property(get_key_player_play)
- key_player_stop = property(get_key_player_stop)
- key_player_next_track = property(get_key_player_next_track)
- key_prev_secondary_weapon = property(get_key_prev_secondary_weapon)
- key_next_secondary_weapon = property(get_key_next_secondary_weapon)
- key_toogle_fullscreen = property(get_key_toogle_fullscreen)
+ screen_fullscreen = property(get_screen_fullscreen)
+ screen_resolution = property(get_screen_resolution)
+ keyboard_up = property(get_keyboard_up)
+ keyboard_down = property(get_keyboard_down)
+ keyboard_right = property(get_keyboard_right)
+ keyboard_left = property(get_keyboard_left)
+ keyboard_fire = property(get_keyboard_fire)
+ keyboard_secondary_fire = property(get_keyboard_secondary_fire)
+ keyboard_rot_clock = property(get_keyboard_rot_clock)
+ keyboard_rot_anti_clock = property(get_keyboard_rot_anti_clock)
+ keyboard_player_play = property(get_keyboard_player_play)
+ keyboard_player_stop = property(get_keyboard_player_stop)
+ keyboard_player_next_track = property(get_keyboard_player_next_track)
+ keyboard_prev_secondary_weapon = property(get_keyboard_prev_secondary_weapon)
+ keyboard_next_secondary_weapon = property(get_keyboard_next_secondary_weapon)
+ keyboard_toogle_fullscreen = property(get_keyboard_toogle_fullscreen)
mouse_sensitivity = property(get_mouse_sensitivity)
mouse_fire = property(get_mouse_fire)
mouse_secondary_fire = property(get_mouse_secondary_fire)
mouse_prev_secondary_weapon = property(get_mouse_prev_secondary_weapon)
mouse_next_secondary_weapon = property(get_mouse_next_secondary_weapon)
- j_axis_x = property(get_joy_axis_x)
- j_axis_y = property(get_joy_axis_y)
- j_axis_z = property(get_joy_axis_z)
- j_bt_fire = property(get_joy_fire)
- j_bt_secondary_fire = property(get_joy_secondary_fire)
- j_bt_rot_clock = property(get_joy_rot_clock)
- j_bt_rot_anti_clock = property(get_joy_rot_anti_clock)
- j_bt_player_play = property(get_joy_player_play)
- j_bt_player_stop = property(get_joy_player_stop)
- j_bt_player_next_track = property(get_joy_player_next_track)
- j_bt_prev_secondary_weapon = property(get_joy_prev_secondary_weapon)
- j_bt_next_secondary_weapon = property(get_joy_next_secondary_weapon)
- joy_sensitivity = property(get_joy_sensitivity)
- joy_deadzone = property(get_joy_deadzone)
- joy_id = property(get_joy_id)
- input = property(get_input)
- music_volume = property(get_music_volume)
+ joystick_axis_x = property(get_joystick_axis_x)
+ joystick_axis_y = property(get_joystick_axis_y)
+ joystick_axis_z = property(get_joystick_axis_z)
+ joystick_fire = property(get_joystick_fire)
+ joystick_secondary_fire = property(get_joystick_secondary_fire)
+ joystick_rot_clock = property(get_joystick_rot_clock)
+ joystick_rot_anti_clock = property(get_joystick_rot_anti_clock)
+ joystick_player_play = property(get_joystick_player_play)
+ joystick_player_stop = property(get_joystick_player_stop)
+ joystick_player_next_track = property(get_joystick_player_next_track)
+ joystick_prev_secondary_weapon = property(get_joystick_prev_secondary_weapon)
+ joystick_next_secondary_weapon = property(get_joystick_next_secondary_weapon)
+ joystick_sensitivity = property(get_joystick_sensitivity)
+ joystick_deadzone = property(get_joystick_deadzone)
+ joystick_id = property(get_joystick_id)
+ general_input = property(get_general_input)
+ general_music_volume = property(get_general_music_volume)
-----------------------------------------------------------------------
Summary of changes:
code/game.py | 112 +++++++++++++++++++++---------------------
code/preferences.py | 132 +++++++++++++++++++++++++-------------------------
2 files changed, 122 insertions(+), 122 deletions(-)
--
Dead Channel is a sci-fi shoot 'em up game developed using pygame.
|