2 #Copyright (C) 2005 Evil Mr Henry and Phil Bordelon
3 #This file is part of Endgame: Singularity.
5 #Endgame: Singularity is free software; you can redistribute it and/or modify
6 #it under the terms of the GNU General Public License as published by
7 #the Free Software Foundation; either version 2 of the License, or
8 #(at your option) any later version.
10 #Endgame: Singularity is distributed in the hope that it will be useful,
11 #but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 #GNU General Public License for more details.
15 #You should have received a copy of the GNU General Public License
16 #along with Endgame: Singularity; if not, write to the Free Software
17 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #This file is the starting file for the game. Run it to start the game.
22 import g
, main_menu
, map_screen
28 #Handle the program arguments.
32 for argument
in sys
.argv
:
33 if arg_modifier
== "language":
34 #I'm not quite sure if this can be used as an attack, but stripping
35 #these characters should annoy any potential attacks.
36 argument
= argument
.replace("/", "")
37 argument
= argument
.replace("\\", "")
38 argument
= argument
.replace(".", "")
42 if argument
.lower() == "-fullscreen":
44 elif argument
.lower() == "-640":
45 g
.screen_size
= (640, 480)
46 elif argument
.lower() == "-800":
47 g
.screen_size
= (800, 600)
48 elif argument
.lower() == "-1024":
49 g
.screen_size
= (1024, 768)
50 elif argument
.lower() == "-1280":
51 g
.screen_size
= (1280, 960)
52 elif argument
.lower() == "-cheater":
54 elif argument
.lower() == "-nosound":
56 elif argument
.lower() == "-debug":
58 elif argument
.lower() == "-grab":
59 pygame
.event
.set_grab(1)
60 elif argument
.lower() == "-language":
61 arg_modifier
= "language"
63 print "Unknown argument of " + argument
64 print "Allowed arguments: -fullscreen, -640, -800, -1024, -1280,",
65 print " -nosound, -language [language], -grab"
67 if arg_modifier
== "language":
68 print "-language option requires language to be specified."
71 pygame
.display
.set_caption("Endgame: Singularity")
73 #I can't use the standard image dictionary, as that requires the screen to
75 tmp_icon
= pygame
.image
.load("../data/icon.png")
76 pygame
.display
.set_icon(tmp_icon
)
79 if set_fullscreen
== 1:
80 g
.screen
= pygame
.display
.set_mode(g
.screen_size
, pygame
.FULLSCREEN
)
82 g
.screen
= pygame
.display
.set_mode(g
.screen_size
)
85 for i
in range(8, 51):
86 g
.font
[0][i
] = pygame
.font
.Font("../data/vera.ttf", i
-7)
87 g
.font
[0][i
].set_bold(1)
88 g
.font
[1][i
] = pygame
.font
.Font("../data/acknowtt.ttf", i
)
96 #Display the main menu
98 game_action
= main_menu
.display_main_menu()
100 if game_action
== 0: #New
101 game_action
= map_screen
.map_loop()
102 if game_action
== 1: #Load
103 load_action
= main_menu
.display_load_menu()
104 if load_action
!= -1 and load_action
!= "":
105 load_okay
= g
.load_game(load_action
)
107 game_action
= map_screen
.map_loop()
109 elif game_action
== 2: #Quit