File: boswars.lua

package info (click to toggle)
boswars 2.8-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 96,652 kB
  • sloc: cpp: 57,250; python: 1,715; sh: 25; makefile: 17
file content (256 lines) | stat: -rw-r--r-- 8,304 bytes parent folder | download
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
--     ____                _       __               
--    / __ )____  _____   | |     / /___ ___________
--   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
--  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  ) 
-- /_____/\____/____/     |__/|__/\__,_/_/  /____/  
--                                              
--       A futuristic real-time strategy game.
--          This file is part of Bos Wars.
--
--	boswars.lua	-	Main configuration file of Bos Wars.
--
--	(c) Copyright 1998-2007 by Crestez Leonard and Francois Beerten
--
--      This program is free software; you can redistribute it and/or modify
--      it under the terms of the GNU General Public License as published by
--      the Free Software Foundation; either version 2 of the License, or
--      (at your option) any later version.
--  
--      This program is distributed in the hope that it will be useful,
--      but WITHOUT ANY WARRANTY; without even the implied warranty of
--      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--      GNU General Public License for more details.
--  
--      You should have received a copy of the GNU General Public License
--      along with this program; if not, write to the Free Software
--      Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
--


if (CompileFeature("DEBUG")) then
  DebugPrint = print
else
  function DebugPrint(x) end
end


DebugPrint("Bos Wars default config file loading ...\n")

-------------------------------------------------------------------------------
--	Config-Part
-------------------------------------------------------------------------------

--	Enter your default title screen.

SetTitleScreens({
  Image = "intro/logo_boswars.png",
  StretchImage = false,
  --Image = "intro/boswars_intro.ogg",      
})


-------------------------------------------------------------------------------
--	Music play list -	Insert your titles here
-------------------------------------------------------------------------------
playlist = {}
local musiclist = ListFilesInDirectory("music/")
for i,f in ipairs(musiclist) do
  if(string.find(f, ".ogg$") or string.find(f, ".wav$") or string.find(f, ".mp3$")) then 
    DebugPrint("Added music file:" .. f) 
    playlist[i] = f
  end
end

Preference.ShowSightRange = false
Preference.ShowAttackRange = false
Preference.ShowReactionRange = false
Preference.ShowOrders = 2

-- Charge and Health sprites
DefineSprites({Name = "sprite-charge", File = "general/mana2.png",
  Offset = {0, -1}, Size = {31, 4}})
DefineSprites({Name = "sprite-health", File = "general/health2.png",
  Offset = {0, -4}, Size = {31, 4}})

-- HealthDot
DefineDecorations({Index = "HitPoints", HideNeutral = true, CenterX = true,
  OffsetPercent = {50, 100}, Method = {"sprite", {"sprite-health"}},
  ShowWhenMax = false})

-- ChargeDot
DefineDecorations({Index = "Charge", HideNeutral = true, CenterX = true,
  OffsetPercent = {50, 100},Method = {"sprite", {"sprite-charge"}},
  ShowWhenMax = false})
DefineDecorations({Index = "Transport", HideNeutral = true, CenterX = true,
  OffsetPercent = {50, 100},Method = {"sprite", {"sprite-charge"}},
  ShowWhenMax = false})
DefineDecorations({Index = "Training", HideNeutral = true, CenterX = true,
  OffsetPercent = {50, 100},Method = {"sprite", {"sprite-charge"}},
  ShowWhenMax = false})

-------------------------------------------------------------------------------
--	Game modification
-------------------------------------------------------------------------------

--  Fighters move by default.
RightButtonMoves();

--	Set the name of the missile to use when clicking (move order)
SetClickMissile("missile-green-cross")

--	Set the name of the missile to use when displaying damage
SetDamageMissile("missile-hit")

--	Enable stopping scrolling on mouse leave.
SetLeaveStops(true)

--	Enable mouse and keyboard scrolling.
SetMouseScroll(true)
SetKeyScroll(true)
SetMouseScrollSpeedDefault(4)
SetMouseScrollSpeedControl(15)

SetDoubleClickDelay(300)
SetHoldClickDelay(1000)

--	Enable minimap terrain by default.
SetMinimapTerrain(true)

--  Use OpenGL texture compression if supported
UseGLTextureCompression = false

-------------------------------------------------------------------------------
--	Define default resources
-------------------------------------------------------------------------------

DefineDefaultResourceNames("energy", "magma")
DefineDefaultDisplayResourceNames(_("Energy"), _("Magma"))

DefinePlayerColorIndex(208, 4)

DefinePlayerColors({
  "red", {{164, 0, 0}, {124, 0, 0}, {92, 4, 0}, {68, 4, 0}},
  "blue", {{12, 72, 204}, {4, 40, 160}, {0, 20, 116}, {0, 4, 76}},
  "violet", {{152, 72, 176}, {116, 44, 132}, {80, 24, 88}, {44, 8, 44}},
  "orange", {{248, 140, 20}, {200, 96, 16}, {152, 60, 16}, {108, 32, 12}},
  "black", {{40, 40, 60}, {28, 28, 44}, {20, 20, 32}, {12, 12, 20}},
  "white", {{224, 224, 224}, {152, 152, 180}, {84, 84, 128}, {36, 40, 76}},
  "yellow", {{252, 252, 72}, {228, 204, 40}, {204, 160, 16}, {180, 116, 0}},
  "green", {{44, 180, 148}, {20, 132, 92}, {4, 84, 44}, {0, 40, 12}},
  "neutral", {{96, 96, 96}, {72, 72, 72}, {48, 48, 48}, {24, 24, 24}},
})

function InitGameVariables()
  SetSpeeds(1)
  ClearAiState()
end

--  Pathfinder
AStarFixedUnitCrossingCost = 1000
AStarMovingUnitCrossingCost = 4
AStarKnowUnseenTerrain = false
AStarUnknownTerrainCost = 2

--	Maximum number of selectable units
SetMaxSelectable(24)

--	All player unit limit
SetAllPlayersUnitLimit(200)
--	All player building limit
SetAllPlayersBuildingLimit(200)
--	All player total unit limit
SetAllPlayersTotalUnitLimit(400)

-------------------------------------------------------------------------------
--  Default triggers for single player

function SinglePlayerTriggers()
  AddTrigger(
    function() return ThisPlayer.TotalNumUnits == 0 end,
    function() return StopGame(GameDefeat) end)

  AddTrigger(
    function() return GetNumOpponents(ThisPlayer.Index) == 0 end,
    function() return StopGame(GameVictory) end)   
end

-------------------------------------------------------------------------------
--	Tables-Part
-------------------------------------------------------------------------------
SetFogOfWarGraphics("general/fog.png")

Load("preferences.lua")

if (preferences == nil) then
  preferences = {
    VideoWidth = 800,
    VideoHeight = 600,
    VideoFullScreen = false,
    PlayerName = nil,
    FogOfWar = true,
    ShowCommandKey = true,
    GroupKeys = "0123456789`",
    GameSpeed = 30,
    EffectsEnabled = true,
    EffectsVolume = 128,
    MusicEnabled = true,
    MusicVolume = 128,
    StratagusTranslation = "",
    GameTranslation = "",
    TipNumber = 0,
    ShowTips = true,
    GrabMouse = false,
    UseOpenGL = false,
  }
end

-- If the user's preferences.lua does not yet have this setting,
-- then add it, to make it easier to discover.
if (preferences.MaxOpenGLTexture == nil) then
   preferences.MaxOpenGLTexture = 512
end

-- If PlayerName is not in the preferences, then use
-- whatever default the engine has chosen.
if preferences.PlayerName ~= nil then
  SetLocalPlayerName(preferences.PlayerName)
end

UseOpenGL = preferences.UseOpenGL
SetVideoResolution(preferences.VideoWidth, preferences.VideoHeight)
SetVideoFullScreen(preferences.VideoFullScreen)
SetMaxOpenGLTexture(preferences.MaxOpenGLTexture)
SetFogOfWar(preferences.FogOfWar)
UI.ButtonPanel.ShowCommandKey = preferences.ShowCommandKey
SetGroupKeys(preferences.GroupKeys)
if GetGameSpeed() < 0 then
  SetGameSpeed(preferences.GameSpeed)
end
SetEffectsEnabled(preferences.EffectsEnabled)
SetEffectsVolume(preferences.EffectsVolume)
SetMusicEnabled(preferences.MusicEnabled)
SetMusicVolume(preferences.MusicVolume)
SetTranslationsFiles(preferences.StratagusTranslation, preferences.GameTranslation)
SetGrabMouse(preferences.GrabMouse)

InitVideo()

--; Uses Stratagus Library path!
Load("scripts/icons.lua")
Load("scripts/sound.lua")
Load("scripts/explosions.lua")
Load("scripts/missiles.lua")
Load("scripts/spells.lua")
Load("scripts/units.lua")
Load("scripts/fonts.lua")
Load("scripts/ui.lua")
Load("scripts/buttons.lua")
Load("scripts/ai.lua")
Load("scripts/commands.lua")
Load("scripts/cheats.lua")
Load("scripts/patches.lua")


default_objectives = {_("Eliminate your enemies.")}

DebugPrint("... ready!")