File: ppracer_init.tcl

package info (click to toggle)
ppracer 0.3.1-8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 9,900 kB
  • ctags: 3,046
  • sloc: cpp: 24,190; sh: 3,544; tcl: 2,450; makefile: 608; lisp: 87
file content (312 lines) | stat: -rw-r--r-- 8,623 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# Tux Racer initialization script

#
# Save data directory
# 
set tux_data_dir [pwd]

set tux_terrain_file "none"


#
# Useful subroutines
#
proc tux_goto_data_dir {} {
    global tux_data_dir
    cd $tux_data_dir
}

proc tux_theme_init {theme} {
    global tux_data_dir
    global env

    set cwd [pwd]

    if [file exists "$env(HOME)/.ppracer/themes/$theme/courseinit.tcl"] {
	cd "$env(HOME)/.ppracer/themes/$theme/"
	source courseinit.tcl
    } else {
        cd "$tux_data_dir/courses/themes/"
	source "$theme.tcl"
    }

    source "$tux_data_dir/tux_walk.tcl";

    if [file exists "$cwd/trees.rgb"] {
        tux_trees "$cwd/trees.rgb"
    } elseif [file exists "$cwd/trees.png"] {
        tux_trees "$cwd/trees.png"
    }

    global tux_terrain_file
    tux_load_terrain $tux_terrain_file

    cd $cwd
} 

proc tux_theme_pack_init {type name} {

    global tux_data_dir
    set cwd [pwd]

    cd "$tux_data_dir/courses/themes/$type/$name/";
    source "$type.tcl"

    cd $cwd
}

proc tux_course_init {} {
    tux_theme_init common
} 

proc tux_terrain {terrain} {
    global tux_terrain_file
    set tux_terrain_file [pwd]/$terrain
} 

#
# Read course index
#
source courses/course_idx.tcl

#
# Set Up Music
#

# Splash & Start screens
if { [tux_load_music start_screen music/start1-jt.it] } {
    tux_bind_music splash_screen start_screen -1
    tux_bind_music start_screen start_screen -1
}

# Options screen
if { [tux_load_music options_screen music/options1-jt.it] } {
    tux_bind_music credits_screen options_screen -1
}

# Music played during race
if { [tux_load_music racing music/race1-jt.it] } {
    tux_bind_music intro racing -1
    tux_bind_music racing racing -1
    tux_bind_music paused racing -1
}

# Game Over screen
if { [tux_load_music game_over music/wonrace1-jt.it] } {
    tux_bind_music game_over game_over 1
}


#
# Set Up Sounds
#

# Tree Hit
if { [tux_load_sound tree_hit1 sounds/tux_hit_tree1.wav] } {
    tux_bind_sounds tree_hit tree_hit1 
}

# Fish Pickup
if { [tux_load_sound fish_pickup_sound_1 sounds/fish_pickup1.wav]&& 
     [tux_load_sound fish_pickup_sound_2 sounds/fish_pickup2.wav]&& 
     [tux_load_sound fish_pickup_sound_3 sounds/fish_pickup3.wav] } \
{
    tux_bind_sounds item_collect fish_pickup_sound_1 \
	                         fish_pickup_sound_2 \
				 fish_pickup_sound_3
}

# Snow Sliding
if { [tux_load_sound snow_sound sounds/tux_on_snow1.wav] } {
    tux_bind_sounds snow_sound snow_sound
    tux_bind_sounds flying_sound snow_sound
}

# Rock Sliding
if { [tux_load_sound rock_sound sounds/tux_on_rock1.wav] } {
    tux_bind_sounds rock_sound rock_sound
}

# Ice Sliding
if { [tux_load_sound ice_sound sounds/tux_on_ice1.wav] } {
    tux_bind_sounds ice_sound ice_sound
}

# Splash screen
tux_load_texture splash_screen textures/splash.png 0
tux_bind_texture splash_screen splash_screen

# UI Snow Particle
tux_load_texture ui_snow_particle textures/snowparticles.png 0
tux_bind_texture ui_snow_particle ui_snow_particle

# UI Snow Particle for original Tuxracer
tux_load_texture snow_particle textures/snowparticles.png 0
tux_bind_texture snow_particle snow_particle


# Load truetype fonts
# button label
pp_load_font -binding button_label \
             -font fonts/FreeSansBoldOblique.ttf \
             -size 30

pp_bind_font -binding button_label_hilit \
             -font button_label \
             -color {1.00 0.89 0.01 1.0}

pp_bind_font -binding loading \
             -font button_label_hilit \
             -color {1.00 0.89 0.01 1.0}

pp_bind_font -binding button_label_disabled \
             -font button_label \
             -color { 1.0 1.0 1.0 0.5 }

pp_bind_font -binding menu_label \
             -font button_label


# listbox
pp_load_font -binding listbox_item \
             -font fonts/FreeSansBoldOblique.ttf \
             -size 22 \
             -color { 1.00 0.89 0.01 1.0 }

pp_bind_font -binding listbox_item_insensitive \
             -font listbox_item \
             -color { 1.00 0.89 0.01 0.5 }

# race requirements
pp_load_font -binding race_requirements \
             -font fonts/FreeSansBoldOblique.ttf \
             -size 13

pp_bind_font -binding race_requirements_label \
             -font race_requirements \
             -color { 1.00 0.95 0.01 1.0 }

# heading
pp_load_font -binding heading \
             -font fonts/FreeSansBoldOblique.ttf \
             -size 40 \
             -color { 1.00 0.89 0.01 1.0 }

pp_bind_font -binding paused \
             -font heading

pp_bind_font -binding race_over \
             -font heading


# several stuff
pp_load_font -binding race_description \
             -font fonts/FreeSansBoldOblique.ttf \
             -size 16

pp_bind_font -binding cup_status \
             -font race_description \
             -color { 1.00 0.89 0.01 1.0 }

pp_load_font -binding race_stats \
             -font fonts/FreeSansBoldOblique.ttf \
             -size 25 \
             -color {1.00 0.89 0.01 1.0}

pp_load_font -binding event_and_cup_label \
             -font fonts/FreeSansBoldOblique.ttf \
             -size 22

# credits
pp_load_font -binding credits_text -font fonts/FreeSansBoldOblique.ttf -size 20
pp_load_font -binding credits_text_small -font fonts/FreeSansBoldOblique.ttf -size 14
pp_bind_font -binding credits_h1 -font button_label_hilit
pp_bind_font -binding credits_h2 -font credits_text -color {1.00 0.89 0.01 1.0}


#we don't be this because hud fonts need to be fast
pp_load_font -binding time_label -font fonts/FreeSansBoldOblique.ttf -size 20 -color {0.8 0.7 0.01 1.0}
pp_load_font -binding herring_count -font fonts/FreeSansBoldOblique.ttf -size 30 -color {0.8 0.7 0.01 1.0}
pp_load_font -binding fps -font fonts/FreeSansBoldOblique.ttf -size 20 -color {0.8 0.7 0.01 1.0}
pp_load_font -binding time_value -font fonts/FreeSansBoldOblique.ttf -size 30 -color {0.8 0.7 0.01 1.0}
pp_load_font -binding speed_digits -font fonts/FreeSansBoldOblique.ttf -size 35 -color {1.00 0.89 0.01 1.0}
pp_load_font -binding speed_units -font fonts/FreeSansBoldOblique.ttf -size 20 -color {1.00 0.89 0.01 1.0}

# not used
#pp_load_font -binding time_hundredths -font fonts/FreeSansBoldOblique.ttf -size 20 -color {1.00 0.89 0.01 1.0}


# HUD
tux_load_texture herring_icon textures/herringicon.png 0
tux_bind_texture herring_icon herring_icon

tux_load_texture gauge_outline textures/gaugeoutline.png 0
tux_bind_texture gauge_outline gauge_outline

tux_load_texture gauge_energy_mask textures/gaugeenergymask.png 0
tux_bind_texture gauge_energy_mask gauge_energy_mask

tux_load_texture gauge_speed_mask textures/gaugespeedmask.png 0
tux_bind_texture gauge_speed_mask gauge_speed_mask


#Energy und Speedmask für die Demobalken
tux_load_texture energy_mask textures/energymask.png 0
tux_bind_texture energy_mask energy_mask
tux_load_texture speed_mask textures/speedmask.png 0
tux_bind_texture speed_mask speed_mask
tux_load_texture mask_outline textures/mask_outline.png 0
tux_bind_texture mask_outline mask_outline
tux_load_texture mask_outline2 textures/mask_outline2.png 0
tux_bind_texture mask_outline2 mask_outline2


# UI widgets
tux_load_texture listbox_arrows textures/listbox_arrows.png 0
tux_bind_texture listbox_arrows listbox_arrows
tux_bind_texture textarea_arrows listbox_arrows

tux_load_texture mirror_button textures/mirror_button.png 0
tux_bind_texture mirror_button mirror_button

tux_load_texture conditions_button textures/conditions_button.png 0
tux_bind_texture conditions_button conditions_button

tux_load_texture snow_button textures/snow_button.png 0
tux_bind_texture snow_button snow_button

tux_load_texture wind_button textures/wind_button.png 0
tux_bind_texture wind_button wind_button


tux_load_texture checkmark textures/checkmark.png 0
tux_bind_texture checkmark checkmark

# Menu decorations
tux_load_texture menu_bottom_left textures/menu_bottom_left.png 0
tux_bind_texture menu_bottom_left menu_bottom_left

tux_load_texture menu_bottom_right textures/menu_bottom_right.png 0
tux_bind_texture menu_bottom_right menu_bottom_right

tux_load_texture menu_top_left textures/menu_top_left.png 0
tux_bind_texture menu_top_left menu_top_left

tux_load_texture menu_top_right textures/menu_top_right.png 0
tux_bind_texture menu_top_right menu_top_right

tux_load_texture menu_title textures/menu_title.png 0
tux_bind_texture menu_title menu_title

# Tux life icon
tux_load_texture tux_life textures/tuxlife.png 0
tux_bind_texture tux_life tux_life

# Mouse cursor
tux_load_texture mouse_cursor textures/mouse_cursor.png 0
tux_bind_texture mouse_cursor mouse_cursor



#stubs/unused functions
proc tux_course_description {description} {}