20 WriteLn('Only Freepascal supported'); |
20 WriteLn('Only Freepascal supported'); |
21 {$ENDIF} |
21 {$ENDIF} |
22 |
22 |
23 program hwengine; |
23 program hwengine; |
24 uses |
24 uses |
25 SDLh, |
25 SDLh, |
26 GL, |
26 GL, |
27 uConsts in 'uConsts.pas', |
27 uConsts in 'uConsts.pas', |
28 uGame in 'uGame.pas', |
28 uGame in 'uGame.pas', |
29 uMisc in 'uMisc.pas', |
29 uMisc in 'uMisc.pas', |
30 uStore in 'uStore.pas', |
30 uStore in 'uStore.pas', |
31 uWorld in 'uWorld.pas', |
31 uWorld in 'uWorld.pas', |
32 uIO in 'uIO.pas', |
32 uIO in 'uIO.pas', |
33 uGears in 'uGears.pas', |
33 uGears in 'uGears.pas', |
34 uVisualGears in 'uVisualGears.pas', |
34 uVisualGears in 'uVisualGears.pas', |
35 uConsole in 'uConsole.pas', |
35 uConsole in 'uConsole.pas', |
36 uKeys in 'uKeys.pas', |
36 uKeys in 'uKeys.pas', |
37 uTeams in 'uTeams.pas', |
37 uTeams in 'uTeams.pas', |
38 uSound in 'uSound.pas', |
38 uSound in 'uSound.pas', |
39 uRandom in 'uRandom.pas', |
39 uRandom in 'uRandom.pas', |
40 uAI in 'uAI.pas', |
40 uAI in 'uAI.pas', |
41 uAIMisc in 'uAIMisc.pas', |
41 uAIMisc in 'uAIMisc.pas', |
42 uAIAmmoTests in 'uAIAmmoTests.pas', |
42 uAIAmmoTests in 'uAIAmmoTests.pas', |
43 uAIActions in 'uAIActions.pas', |
43 uAIActions in 'uAIActions.pas', |
44 uCollisions in 'uCollisions.pas', |
44 uCollisions in 'uCollisions.pas', |
45 uLand in 'uLand.pas', |
45 uLand in 'uLand.pas', |
46 uLandTemplates in 'uLandTemplates.pas', |
46 uLandTemplates in 'uLandTemplates.pas', |
47 uLandObjects in 'uLandObjects.pas', |
47 uLandObjects in 'uLandObjects.pas', |
48 uLandGraphics in 'uLandGraphics.pas', |
48 uLandGraphics in 'uLandGraphics.pas', |
49 uLocale in 'uLocale.pas', |
49 uLocale in 'uLocale.pas', |
50 uAmmos in 'uAmmos.pas', |
50 uAmmos in 'uAmmos.pas', |
51 uSHA in 'uSHA.pas', |
51 uSHA in 'uSHA.pas', |
52 uFloat in 'uFloat.pas', |
52 uFloat in 'uFloat.pas', |
53 uStats in 'uStats.pas', |
53 uStats in 'uStats.pas', |
54 uChat in 'uChat.pas'; |
54 uChat in 'uChat.pas'; |
55 |
55 |
56 {$INCLUDE options.inc} |
56 {$INCLUDE options.inc} |
57 |
57 |
58 // also: GSHandlers.inc |
58 // also: GSHandlers.inc |
59 // CCHandlers.inc |
59 // CCHandlers.inc |
69 var s: string; |
69 var s: string; |
70 begin |
70 begin |
71 inc(RealTicks, Lag); |
71 inc(RealTicks, Lag); |
72 |
72 |
73 case GameState of |
73 case GameState of |
74 gsLandGen: begin |
74 gsLandGen: begin |
75 GenMap; |
75 GenMap; |
76 GameState:= gsStart; |
76 GameState:= gsStart; |
77 end; |
77 end; |
78 gsStart: begin |
78 gsStart: begin |
79 AddClouds; |
79 AddClouds; |
80 AssignHHCoords; |
80 AssignHHCoords; |
81 AddMiscGears; |
81 AddMiscGears; |
82 StoreLoad; |
82 StoreLoad; |
83 ResetKbd; |
83 ResetKbd; |
84 SoundLoad; |
84 SoundLoad; |
85 if GameType = gmtSave then |
85 if GameType = gmtSave then |
86 begin |
86 begin |
87 isSEBackup:= isSoundEnabled; |
87 isSEBackup:= isSoundEnabled; |
88 isSoundEnabled:= false |
88 isSoundEnabled:= false |
89 end; |
89 end; |
90 FinishProgress; |
90 FinishProgress; |
91 PlayMusic; |
91 PlayMusic; |
92 GameState:= gsGame |
92 GameState:= gsGame |
93 end; |
93 end; |
94 gsConfirm, |
94 gsConfirm, |
95 gsGame: begin |
95 gsGame: begin |
96 ProcessKbd; |
96 ProcessKbd; |
97 DoGameTick(Lag); |
97 DrawWorld(Lag); |
98 ProcessVisualGears(Lag); |
98 DoGameTick(Lag); |
99 DrawWorld(Lag); |
99 ProcessVisualGears(Lag); |
100 end; |
100 end; |
101 gsChat: begin |
101 gsChat: begin |
102 DoGameTick(Lag); |
102 DrawWorld(Lag); |
103 ProcessVisualGears(Lag); |
103 DoGameTick(Lag); |
104 DrawWorld(Lag); |
104 ProcessVisualGears(Lag); |
105 end; |
105 end; |
106 gsExit: begin |
106 gsExit: begin |
107 OnDestroy; |
107 OnDestroy; |
108 end; |
108 end; |
109 end; |
109 end; |
110 |
110 |
111 SDL_GL_SwapBuffers(); |
111 SDL_GL_SwapBuffers(); |
112 if flagMakeCapture then |
112 if flagMakeCapture then |
113 begin |
113 begin |
114 flagMakeCapture:= false; |
114 flagMakeCapture:= false; |
115 s:= 'hw_' + cSeed + '_' + inttostr(GameTicks) + '.tga'; |
115 s:= 'hw_' + cSeed + '_' + inttostr(GameTicks) + '.tga'; |
116 WriteLnToConsole('Saving ' + s); |
116 WriteLnToConsole('Saving ' + s); |
117 MakeScreenshot(s); |
117 MakeScreenshot(s); |
118 // SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(Str2PChar(s), 'wb'), 1) |
118 // SDL_SaveBMP_RW(SDLPrimSurface, SDL_RWFromFile(Str2PChar(s), 'wb'), 1) |
119 end; |
119 end; |
120 end; |
120 end; |
121 |
121 |
122 //////////////////// |
122 //////////////////// |
123 procedure OnDestroy; |
123 procedure OnDestroy; |
124 begin |
124 begin |