Skip to content
This repository
Browse code

onUse, onShot return bool, EVENT_SWIM_SUBMERGED

- ozCore
  * Time::epoch field removed
- matrix
  * onShot can also fail now
  * onUse and onShot hadlers should return boolean to indicate success
  * submerged swimming event
- client
  * rendering order fixed, sea uderwater fog fixed
  * direction keys fixed in UI mode
  • Loading branch information...
commit 8c7ea5aea3eafc2629b2d2032c8d2a2ef868511c 1 parent 57079c7
Davorin Učakar authored

Showing 49 changed files with 261 additions and 245 deletions. Show diff stats Hide diff stats

  1. +3 4 CMakeLists.txt
  2. +3 7 README.md
  3. +0 1  TODO.md
  4. +1 1  data/oz_main/class/bauul.json
  5. +1 1  data/oz_main/class/beast.json
  6. +1 1  data/oz_main/class/cvicek.json
  7. +1 1  data/oz_main/class/cyborg.json
  8. +1 1  data/oz_main/class/droid.OOM-9.json
  9. +1 1  data/oz_main/class/droid.json
  10. +1 1  data/oz_main/class/firstAid.json
  11. +1 1  data/oz_main/class/goblin.json
  12. +1 1  data/oz_main/class/knight.json
  13. +1 1  data/oz_main/class/zombie.json
  14. +11 5 data/oz_main/lua/matrix/generic.lua
  15. +7 1 data/oz_main/lua/matrix/handlers.lua
  16. +46 12 data/oz_main/lua/matrix/weapons.lua
  17. +1 1  data/oz_main/lua/nirvana/minds.lua
  18. +1 1  doc/PREBERI.html
  19. +1 1  doc/README.html
  20. +1 0  etc/PKGBUILD.aur
  21. +1 1  etc/SDL2-CMakeLists-gen.sh
  22. +3 13 run.sh
  23. +12 10 src/builder/Class.cc
  24. +4 2 src/client/BotAudio.cc
  25. +6 8 src/client/Context.cc
  26. +2 0  src/client/GameStage.cc
  27. +2 2 src/client/Input.cc
  28. +0 1  src/client/Lua.cc
  29. +14 2 src/client/Mesh.cc
  30. +18 9 src/client/Render.cc
  31. +1 0  src/client/Render.hh
  32. +3 2 src/client/ui/CreditsMenu.cc
  33. +10 8 src/client/ui/Inventory.cc
  34. +7 9 src/client/ui/Mouse.cc
  35. +2 1  src/matrix/Bot.hh
  36. +14 11 src/matrix/Lua.cc
  37. +1 1  src/matrix/Object.hh
  38. +1 1  src/matrix/ObjectClass.hh
  39. +5 7 src/matrix/Weapon.cc
  40. +2 2 src/matrix/Weapon.hh
  41. +2 1  src/matrix/luaapi.cc
  42. +0 14 src/matrix/luaapi.hh
  43. +0 1  src/nirvana/Lua.cc
  44. +2 2 src/ozCore/System.cc
  45. +41 43 src/ozCore/Time.cc
  46. +18 18 src/ozCore/Time.hh
  47. +5 5 src/tests/CMakeLists.txt
  48. +0 20 src/tests/test.cc
  49. +1 8 src/tools/openzone.cc
7 CMakeLists.txt
@@ -138,7 +138,7 @@ if( NOT PLATFORM_EMBEDDED )
138 138 mark_as_advanced( FREEIMAGE_LIBRARY )
139 139
140 140 if( NOT FREEIMAGE_LIBRARY )
141   - message( FATAL_ERROR "FreeImage library missing" )
  141 + message( FATAL_ERROR "FreeImage library is missing" )
142 142 endif()
143 143
144 144 if( OZ_NONFREE )
@@ -146,7 +146,7 @@ if( NOT PLATFORM_EMBEDDED )
146 146 mark_as_advanced( SQUISH_LIBRARY )
147 147
148 148 if( NOT SQUISH_LIBRARY )
149   - message( FATAL_ERROR "libsquish missing (required by OZ_NONFREE)" )
  149 + message( FATAL_ERROR "libsquish library is missing (required by OZ_NONFREE)" )
150 150 endif()
151 151 endif()
152 152 endif()
@@ -192,8 +192,7 @@ else()
192 192 endif()
193 193
194 194 set( CMAKE_CXX_FLAGS "${flags} ${CMAKE_CXX_FLAGS}" )
195   -# set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fdata-sections -ffunction-sections" )
196   -# set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections" )
  195 +set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-fwhole-program" )
197 196
198 197 # Strings for BuildInfo class.
199 198 string( TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" OZ_CXX_FLAGS )
10 README.md
Source Rendered
... ... @@ -1,11 +1,9 @@
1   -OpenZone
2   -========
3   -
4 1 ![logo](http://ducakar.github.com/openzone/img/title.jpg)
5 2
6   -Simple cross-platform FPS/RTS game engine.
  3 +OpenZone
  4 +========
7 5
8   - http://ducakar.github.com/openzone/
  6 +Simple cross-platform FPS/RTS game engine. http://ducakar.github.com/openzone/.
9 7
10 8 This README file is intended for developers only. See `doc/README.html` if you are an end-user.
11 9
@@ -267,8 +265,6 @@ The following alternative launches are available:
267 265 archives, HTML pages ...), starts a simple python web server in that directory at port 8000
268 266 (`python -m http.server`) and opens `localhost:8000` in chromium browser to test the web-based
269 267 NaCl port. If `strip` is passed as the second option, binaries are stripped too.
270   -- `pnacl`: Same as `nacl` command but create links `.nexe`s that were created from a `.pexe`
271   - (use `./build.sh pnacl`).
272 268
273 269 Documentation
274 270 -------------
1  TODO.md
Source Rendered
... ... @@ -1,6 +1,5 @@
1 1 0.4
2 2
3   -- fix random splash event bug
4 3 - TalkFrame
5 4 - 6-direction-layered meshes
6 5 - fix CreditsMenu scrolling
2  data/oz_main/class/bauul.json
@@ -66,6 +66,6 @@
66 66 "death": "ppm/deathb",
67 67 "step": "openarena/boot4",
68 68 "waterStep": "openarena/splash1",
69   - "swim": "openarena/watr_in"
  69 + "swimSurface": "openarena/watr_in"
70 70 }
71 71 }
2  data/oz_main/class/beast.json
@@ -47,6 +47,6 @@
47 47 "death": "ppm/deathb",
48 48 "step": "openarena/boot4",
49 49 "waterStep": "openarena/splash1",
50   - "swim": "openarena/watr_in"
  50 + "swimSurface": "openarena/watr_in"
51 51 }
52 52 }
2  data/oz_main/class/cvicek.json
@@ -30,6 +30,6 @@
30 30 "land": "grsites/hit2",
31 31 "splash": "free/splash1",
32 32 "use": "aard/tak",
33   - "useFailed": "free/tick"
  33 + "useFailed": "bfxr/failed"
34 34 }
35 35 }
2  data/oz_main/class/cyborg.json
@@ -71,6 +71,6 @@
71 71 "death": "ppm/deathb",
72 72 "step": "openarena/boot4",
73 73 "waterStep": "openarena/splash1",
74   - "swim": "openarena/watr_in"
  74 + "swimSurface": "openarena/watr_in"
75 75 }
76 76 }
2  data/oz_main/class/droid.OOM-9.json
@@ -63,6 +63,6 @@
63 63 "death": "droid-sounds/death2",
64 64 "step": "openarena/boot4",
65 65 "waterStep": "openarena/splash1",
66   - "swim": "openarena/watr_in"
  66 + "swimSurface": "openarena/watr_in"
67 67 }
68 68 }
2  data/oz_main/class/droid.json
@@ -65,6 +65,6 @@
65 65 "death": "droid-sounds/death2",
66 66 "step": "openarena/boot4",
67 67 "waterStep": "openarena/splash1",
68   - "swim": "openarena/watr_in"
  68 + "swimSurface": "openarena/watr_in"
69 69 }
70 70 }
2  data/oz_main/class/firstAid.json
@@ -31,6 +31,6 @@
31 31 "land": "grsites/hit2",
32 32 "splash": "free/splash1",
33 33 "use": "aard/tak",
34   - "useFailed": "free/tick"
  34 + "useFailed": "bfxr/failed"
35 35 }
36 36 }
2  data/oz_main/class/goblin.json
@@ -63,6 +63,6 @@
63 63 "death": "ppm/deathd",
64 64 "step": "openarena/boot4",
65 65 "waterStep": "openarena/splash1",
66   - "swim": "openarena/watr_in"
  66 + "swimSurface": "openarena/watr_in"
67 67 }
68 68 }
2  data/oz_main/class/knight.json
@@ -46,6 +46,6 @@
46 46 "death": "ppm/deathb",
47 47 "step": "openarena/boot4",
48 48 "waterStep": "openarena/splash1",
49   - "swim": "openarena/watr_in"
  49 + "swimSurface": "openarena/watr_in"
50 50 }
51 51 }
2  data/oz_main/class/zombie.json
@@ -44,6 +44,6 @@
44 44 "death": "aard/die1",
45 45 "step": "openarena/boot4",
46 46 "waterStep": "openarena/splash1",
47   - "swim": "openarena/watr_in"
  47 + "swimSurface": "openarena/watr_in"
48 48 }
49 49 }
16 data/oz_main/lua/matrix/generic.lua
@@ -29,23 +29,27 @@ function healUser( l )
29 29 ozBindUser()
30 30
31 31 if ozBotHasState( OZ_BOT_MECHANICAL_BIT ) then
32   - ozUseFailed()
  32 + return false
33 33 else
34 34 ozObjAddLife( 100.0 )
35 35 end
  36 +
  37 + return true
36 38 end
37 39
38 40 function healUser_disposable( l )
39 41 ozBindUser()
40 42
41 43 if ozBotHasState( OZ_BOT_MECHANICAL_BIT ) then
42   - ozUseFailed()
  44 + return false
43 45 else
44 46 ozObjAddLife( 100.0 )
45 47
46 48 ozBindSelf()
47 49 ozObjDestroy( true )
48 50 end
  51 +
  52 + return true
49 53 end
50 54
51 55 function meleeAttack( l )
@@ -54,21 +58,23 @@ function meleeAttack( l )
54 58 local pX, pY, pZ = ozObjGetPos()
55 59 local vX, vY, vZ = ozBotGetDir()
56 60
57   - ozOrbisBindOverlaps( OZ_OBJECTS_BIT, pX + 0.6*vX, pY + 0.6*vY, pZ + 0.6*vZ, 0.4, 0.4, 0.4 );
  61 + ozOrbisBindOverlaps( OZ_OBJECTS_BIT, pX + 0.6*vX, pY + 0.6*vY, pZ + 0.6*vZ, 0.4, 0.4, 0.4 )
58 62
59 63 while ozBindNextObj() do
60 64 if not ( ozObjIsSelf() or ozObjIsUser() ) then
61 65 ozObjDamage( 100.0 + 50.0 * math.random() )
62 66 end
63 67 end
  68 +
  69 + return true
64 70 end
65 71
66 72 function spawnSmallExplosion( l )
67   - ozOrbisAddObj( OZ_FORCE, "smallExplosion", ozObjGetPos() );
  73 + ozOrbisAddObj( OZ_FORCE, "smallExplosion", ozObjGetPos() )
68 74 end
69 75
70 76 function spawnBigExplosion( l )
71   - ozOrbisAddObj( OZ_FORCE, "bigExplosion", ozObjGetPos() );
  77 + ozOrbisAddObj( OZ_FORCE, "bigExplosion", ozObjGetPos() )
72 78 end
73 79
74 80 function smallExplosion_onUpdate( l )
8 data/oz_main/lua/matrix/handlers.lua
@@ -29,7 +29,7 @@ function cvicek_onUse( l )
29 29 ozBindUser()
30 30
31 31 if ozBotHasState( OZ_BOT_MECHANICAL_BIT ) then
32   - ozUseFailed()
  32 + return false
33 33 else
34 34 ozObjAddLife( 50 )
35 35 ozBotAddStamina( 30 )
@@ -37,6 +37,8 @@ function cvicek_onUse( l )
37 37 ozBindSelf()
38 38 ozObjDestroy( true )
39 39 end
  40 +
  41 + return true
40 42 end
41 43
42 44 function bomb_onUse( l )
@@ -47,6 +49,8 @@ function bomb_onUse( l )
47 49 l.ticks = nil
48 50 ozObjEnableUpdate( false )
49 51 end
  52 +
  53 + return true
50 54 end
51 55
52 56 function bomb_onUpdate( l )
@@ -83,4 +87,6 @@ function serviceStation_onUse( l )
83 87 ozVehicleService()
84 88 end
85 89 end
  90 +
  91 + return true
86 92 end
58 data/oz_main/lua/matrix/weapons.lua
@@ -45,6 +45,9 @@ function plasmagun_onShot( l )
45 45 ozObjEnableUpdate( true )
46 46
47 47 ozBindUser()
  48 + if ozBotHasState( OZ_BOT_SUBMERGED_BIT ) then
  49 + return false
  50 + end
48 51
49 52 local pX, pY, pZ = ozBotGetEyePos()
50 53 local vX, vY, vZ = ozBotGetDir()
@@ -52,11 +55,16 @@ function plasmagun_onShot( l )
52 55 2 - math.random() * 4,
53 56 2 - math.random() * 4
54 57
55   - ozOrbisAddFrag( OZ_FORCE, "plasmaBullet", pX, pY, pZ, vX * 230 + dX, vY * 230 + dY, vZ * 230 + dZ );
  58 + ozOrbisAddFrag( OZ_FORCE, "plasmaBullet", pX, pY, pZ, vX * 230 + dX, vY * 230 + dY, vZ * 230 + dZ )
  59 +
  60 + return true
56 61 end
57 62
58 63 function blaster_onShot( l )
59 64 ozBindUser()
  65 + if ozBotHasState( OZ_BOT_SUBMERGED_BIT ) then
  66 + return false
  67 + end
60 68
61 69 local pX, pY, pZ = ozBotGetEyePos()
62 70 local vX, vY, vZ = ozBotGetDir()
@@ -64,11 +72,16 @@ function blaster_onShot( l )
64 72 2 - math.random() * 4,
65 73 2 - math.random() * 4
66 74
67   - ozOrbisAddFrag( OZ_FORCE, "blasterBullet", pX, pY, pZ, vX * 220 + dX, vY * 220 + dY, vZ * 220 + dZ );
  75 + ozOrbisAddFrag( OZ_FORCE, "blasterBullet", pX, pY, pZ, vX * 220 + dX, vY * 220 + dY, vZ * 220 + dZ )
  76 +
  77 + return true
68 78 end
69 79
70 80 function hyperblaster_onShot( l )
71 81 ozBindUser()
  82 + if ozBotHasState( OZ_BOT_SUBMERGED_BIT ) then
  83 + return false
  84 + end
72 85
73 86 local pX, pY, pZ = ozBotGetEyePos()
74 87 local vX, vY, vZ = ozBotGetDir()
@@ -76,11 +89,16 @@ function hyperblaster_onShot( l )
76 89 1 - math.random() * 2,
77 90 1 - math.random() * 2
78 91
79   - ozOrbisAddFrag( OZ_FORCE, "hyperblasterBullet", pX, pY, pZ, vX * 300 + dX, vY * 300 + dY, vZ * 300 + dZ );
  92 + ozOrbisAddFrag( OZ_FORCE, "hyperblasterBullet", pX, pY, pZ, vX * 300 + dX, vY * 300 + dY, vZ * 300 + dZ )
  93 +
  94 + return true
80 95 end
81 96
82 97 function chaingun_onShot( l )
83 98 ozBindUser()
  99 + if ozBotHasState( OZ_BOT_SUBMERGED_BIT ) then
  100 + return false
  101 + end
84 102
85 103 local pX, pY, pZ = ozBotGetEyePos()
86 104 local vX, vY, vZ = ozBotGetDir()
@@ -88,11 +106,16 @@ function chaingun_onShot( l )
88 106 2 - math.random() * 4,
89 107 2 - math.random() * 4
90 108
91   - ozOrbisAddFrag( OZ_FORCE, "chaingunBullet", pX, pY, pZ, vX * 250 + dX, vY * 250 + dY, vZ * 250 + dZ );
  109 + ozOrbisAddFrag( OZ_FORCE, "chaingunBullet", pX, pY, pZ, vX * 250 + dX, vY * 250 + dY, vZ * 250 + dZ )
  110 +
  111 + return true
92 112 end
93 113
94 114 function grenadeLauncher_onShot( l )
95 115 ozBindUser()
  116 + if ozBotHasState( OZ_BOT_SUBMERGED_BIT ) then
  117 + return false
  118 + end
96 119
97 120 local pX, pY, pZ = ozBotGetEyePos()
98 121 local vX, vY, vZ = ozBotGetDir()
@@ -102,21 +125,28 @@ function grenadeLauncher_onShot( l )
102 125
103 126 ozOrbisAddObj( OZ_FORCE, "grenade", pX, pY, pZ )
104 127 ozDynSetMomentum( vX * 30 + dX, vY * 30 + dY, vZ * 30 + dZ )
  128 +
  129 + return true
105 130 end
106 131
107 132 function axe_onShot( l )
108 133 ozBindUser()
  134 + if ozBotHasState( OZ_BOT_SUBMERGED_BIT ) then
  135 + return false
  136 + end
109 137
110 138 local pX, pY, pZ = ozObjGetPos()
111 139 local vX, vY, vZ = ozBotGetDir()
112 140
113   - ozOrbisBindOverlaps( OZ_OBJECTS_BIT, pX + 0.5*vX, pY + 0.5*vY, pZ + 0.5*vZ, 0.3, 0.3, 0.3 );
  141 + ozOrbisBindOverlaps( OZ_OBJECTS_BIT, pX + 0.5*vX, pY + 0.5*vY, pZ + 0.5*vZ, 0.3, 0.3, 0.3 )
114 142
115 143 while ozBindNextObj() do
116 144 if not ( ozObjIsSelf() or ozObjIsUser() ) then
117 145 ozObjDamage( 100.0 + 50.0 * math.random() )
118 146 end
119 147 end
  148 +
  149 + return true
120 150 end
121 151
122 152 function mace_onShot( l )
@@ -125,13 +155,15 @@ function mace_onShot( l )
125 155 local pX, pY, pZ = ozObjGetPos()
126 156 local vX, vY, vZ = ozBotGetDir()
127 157
128   - ozOrbisBindOverlaps( OZ_OBJECTS_BIT, pX + 0.6*vX, pY + 0.6*vY, pZ + 0.6*vZ, 0.4, 0.4, 0.4 );
  158 + ozOrbisBindOverlaps( OZ_OBJECTS_BIT, pX + 0.6*vX, pY + 0.6*vY, pZ + 0.6*vZ, 0.4, 0.4, 0.4 )
129 159
130 160 while ozBindNextObj() do
131 161 if not ( ozObjIsSelf() or ozObjIsUser() ) then
132 162 ozObjDamage( 100.0 + 100.0 * math.random() )
133 163 end
134 164 end
  165 +
  166 + return true
135 167 end
136 168
137 169 function skull_onShot( l )
@@ -140,40 +172,42 @@ function skull_onShot( l )
140 172 local pX, pY, pZ = ozObjGetPos()
141 173 local vX, vY, vZ = ozBotGetDir()
142 174
143   - ozOrbisBindOverlaps( OZ_OBJECTS_BIT, pX + 0.6*vX, pY + 0.6*vY, pZ + 0.6*vZ, 0.4, 0.4, 0.4 );
  175 + ozOrbisBindOverlaps( OZ_OBJECTS_BIT, pX + 0.6*vX, pY + 0.6*vY, pZ + 0.6*vZ, 0.4, 0.4, 0.4 )
144 176
145 177 while ozBindNextObj() do
146 178 if not ( ozObjIsSelf() or ozObjIsUser() ) then
147 179 ozObjDamage( 100.0 + 200.0 * math.random() )
148 180 end
149 181 end
  182 +
  183 + return true
150 184 end
151 185
152 186 function vehicle_heavyBlaster_onShot( l )
153 187 local pX, pY, pZ = ozObjGetPos()
154 188
155   - ozBindUser();
  189 + ozBindUser()
156 190 local vX, vY, vZ = ozBotGetDir()
157 191
158   - ozOrbisAddFrag( OZ_FORCE, "heavyBlasterBullet", pX, pY, pZ, vX * 300, vY * 300, vZ * 300 );
  192 + ozOrbisAddFrag( OZ_FORCE, "heavyBlasterBullet", pX, pY, pZ, vX * 300, vY * 300, vZ * 300 )
159 193 end
160 194
161 195 function vehicle_gatling_onShot( l )
162 196 local pX, pY, pZ = ozObjGetPos()
163 197
164   - ozBindUser();
  198 + ozBindUser()
165 199 local vX, vY, vZ = ozBotGetDir()
166 200 local dX, dY, dZ = 5 - math.random() * 10,
167 201 5 - math.random() * 10,
168 202 5 - math.random() * 10
169 203
170   - ozOrbisAddFrag( OZ_FORCE, "gatlingBullet", pX, pY, pZ, vX * 200 + dX, vY * 200 + dY, vZ * 200 + dZ );
  204 + ozOrbisAddFrag( OZ_FORCE, "gatlingBullet", pX, pY, pZ, vX * 200 + dX, vY * 200 + dY, vZ * 200 + dZ )
171 205 end
172 206
173 207 function vehicle_cannon_onShot( l )
174 208 local pX, pY, pZ = ozObjGetPos()
175 209
176   - ozBindUser();
  210 + ozBindUser()
177 211 local vX, vY, vZ = ozBotGetDir()
178 212
179 213 ozOrbisAddObj( OZ_FORCE, "shell", pX, pY, pZ )
2  data/oz_main/lua/nirvana/minds.lua
@@ -46,7 +46,7 @@ function randomRampage( localData )
46 46 ozSelfAction( OZ_ACTION_JUMP )
47 47 end
48 48 if math.random( 8 ) == 1 then
49   - ozSelfAction( OZ_ACTION_WALK );
  49 + ozSelfAction( OZ_ACTION_WALK )
50 50 end
51 51 end
52 52
2  doc/PREBERI.html
@@ -485,7 +485,7 @@ <h1 class="centre">OpenZone</h1>
485 485 </td>
486 486 </tr>
487 487 <tr>
488   - <th>render.scaleFilter ["NEAREST" | "LINEAR"] "NEAREST"</th>
  488 + <th>render.scaleFilter ["NEAREST" | "LINEAR"] "LINEAR"</th>
489 489 </tr>
490 490 <tr>
491 491 <td>
2  doc/README.html
@@ -485,7 +485,7 @@ <h1 class="centre">OpenZone</h1>
485 485 </td>
486 486 </tr>
487 487 <tr>
488   - <th>render.scaleFilter ["NEAREST" | "LINEAR"] "NEAREST"</th>
  488 + <th>render.scaleFilter ["NEAREST" | "LINEAR"] "LINEAR"</th>
489 489 </tr>
490 490 <tr>
491 491 <td>
1  etc/PKGBUILD.aur
@@ -26,6 +26,7 @@ function build()
26 26 -D CMAKE_BUILD_TYPE=Release \
27 27 -D CMAKE_INSTALL_PREFIX=/usr \
28 28 -D CMAKE_CXX_FLAGS="$CXXFLAGS -msse3 -mfpmath=sse" \
  29 + -D CMAKE_CXX_FLAGS_RELEASE="-Ofast -flto" \
29 30 -D BUILD_SHARED_LIBS=0 \
30 31 -D OZ_LUAJIT=1 \
31 32 -D OZ_NONFREE=1 \
2  etc/SDL2-CMakeLists-gen.sh
@@ -12,7 +12,7 @@ set( SDL_STATIC_LIBS -lSDL2 )
12 12 set( ENABLE_SHARED_TRUE "#" )
13 13 set( ENABLE_SHARED_FALSE "" )
14 14 set( ENABLE_STATIC_TRUE "" )
15   -set( ENABLE_STATIC_FALE "#" )
  15 +set( ENABLE_STATIC_FALSE "#" )
16 16 configure_file( sdl2.pc.in sdl2.pc @ONLY )
17 17 configure_file( sdl2-config.in sdl2-config )
18 18
16 run.sh
@@ -12,8 +12,6 @@
12 12 # archives, HTML pages ...), starts a simple python web server in that directory at port 8000
13 13 # (`python -m http.server`) and opens `localhost:8000` in chromium browser to test the web-based
14 14 # NaCl port. If `strip` is passed as the second option, binaries are stripped too.
15   -# - `pnacl`: Same as `nacl` command but create links `.nexe`s that were created from a `.pexe`
16   -# (use `./build.sh pnacl`).
17 15 #
18 16
19 17 defaultPlatform=Linux-x86_64-Clang
@@ -28,20 +26,12 @@ function run_nacl()
28 26
29 27 # Just create symlinks instead of copying.
30 28 for i in share/openzone/*.{7z,zip} share/openzone/packages.ozManifest \
31   - build/NaCl-*/src/tools/openzone.*.nexe etc/nacl/openzone.nmf \
32   - etc/nacl/openzone.??.html doc
  29 + build/NaCl-*/src/tools/openzone.*.nexe build/PNaCl/src/tools/openzone.pexe \
  30 + etc/nacl/openzone.nmf etc/nacl/openzone.??.html doc
33 31 do
34 32 [[ -e $i ]] && ln -sf ../../$i build/NaCl-test
35 33 done
36 34
37   - if [[ $cmd == pnacl ]]; then
38   - rm -f build/NaCl-test/openzone.*.nexe
39   -
40   - for i in build/PNaCl/src/tools/openzone.*.nexe; do
41   - ln -sf ../../$i build/NaCl-test
42   - done
43   - fi
44   -
45 35 # Strip binaries if `strip` option is given.
46 36 if [[ $arg == strip ]]; then
47 37 if [[ -e build/NaCl-test/openzone.x86_64.nexe ]]; then
@@ -82,7 +72,7 @@ case $1 in
82 72 shift
83 73 exec wine bin/Windows-i686/openzone.exe -p . $@
84 74 ;;
85   - nacl|pnacl)
  75 + nacl)
86 76 run_nacl
87 77 ;;
88 78 *)
22 src/builder/Class.cc
@@ -330,11 +330,11 @@ void Class::fillWeapon( const char* className )
330 330 if( !audioType.isEmpty() ) {
331 331 const JSON& soundsConfig = config["audioSounds"];
332 332
333   - audioSounds[Weapon::EVENT_SHOT] = soundsConfig["shot"].get( "" );
334 333 audioSounds[Weapon::EVENT_SHOT_EMPTY] = soundsConfig["shotEmpty"].get( "" );
  334 + audioSounds[Weapon::EVENT_SHOT] = soundsConfig["shot"].get( "" );
335 335
336   - context.usedSounds.include( audioSounds[Weapon::EVENT_SHOT] );
337 336 context.usedSounds.include( audioSounds[Weapon::EVENT_SHOT_EMPTY] );
  337 + context.usedSounds.include( audioSounds[Weapon::EVENT_SHOT] );
338 338 }
339 339
340 340 int dollar = name.index( '$' );
@@ -367,13 +367,14 @@ void Class::fillBot( const char* className )
367 367 if( !audioType.isEmpty() ) {
368 368 const JSON& soundsConfig = config["audioSounds"];
369 369
370   - audioSounds[Bot::EVENT_JUMP] = soundsConfig["jump"].get( "" );
371   - audioSounds[Bot::EVENT_MELEE] = soundsConfig["melee"].get( "" );
372   - audioSounds[Bot::EVENT_FLIP] = soundsConfig["flip"].get( "" );
373   - audioSounds[Bot::EVENT_DEATH] = soundsConfig["death"].get( "" );
374   - audioSounds[Bot::EVENT_STEP] = soundsConfig["step"].get( "" );
375   - audioSounds[Bot::EVENT_WATERSTEP] = soundsConfig["waterStep"].get( "" );
376   - audioSounds[Bot::EVENT_SWIM] = soundsConfig["swim"].get( "" );
  370 + audioSounds[Bot::EVENT_JUMP] = soundsConfig["jump"].get( "" );
  371 + audioSounds[Bot::EVENT_MELEE] = soundsConfig["melee"].get( "" );
  372 + audioSounds[Bot::EVENT_FLIP] = soundsConfig["flip"].get( "" );
  373 + audioSounds[Bot::EVENT_DEATH] = soundsConfig["death"].get( "" );
  374 + audioSounds[Bot::EVENT_STEP] = soundsConfig["step"].get( "" );
  375 + audioSounds[Bot::EVENT_WATERSTEP] = soundsConfig["waterStep"].get( "" );
  376 + audioSounds[Bot::EVENT_SWIM_SURFACE] = soundsConfig["swimSurface"].get( "" );
  377 + audioSounds[Bot::EVENT_SWIM_SUBMERGED] = soundsConfig["swimSubmerged"].get( "" );
377 378
378 379 context.usedSounds.include( audioSounds[Bot::EVENT_JUMP] );
379 380 context.usedSounds.include( audioSounds[Bot::EVENT_MELEE] );
@@ -381,7 +382,8 @@ void Class::fillBot( const char* className )
381 382 context.usedSounds.include( audioSounds[Bot::EVENT_DEATH] );
382 383 context.usedSounds.include( audioSounds[Bot::EVENT_STEP] );
383 384 context.usedSounds.include( audioSounds[Bot::EVENT_WATERSTEP] );
384   - context.usedSounds.include( audioSounds[Bot::EVENT_SWIM] );
  385 + context.usedSounds.include( audioSounds[Bot::EVENT_SWIM_SURFACE] );
  386 + context.usedSounds.include( audioSounds[Bot::EVENT_SWIM_SUBMERGED] );
385 387 }
386 388
387 389 state = 0;
6 src/client/BotAudio.cc
@@ -92,8 +92,10 @@ void BotAudio::play( const Audio* parent )
92 92
93 93 if( currStep != prevStep ) {
94 94 if( bot->state & Bot::SWIMMING_BIT ) {
95   - if( !( bot->state & Bot::SUBMERGED_BIT ) && sounds[Bot::EVENT_SWIM] >= 0 ) {
96   - playSound( sounds[Bot::EVENT_SWIM], 1.0f, bot );
  95 + int sample = Bot::EVENT_SWIM_SURFACE + ( ( bot->state & Bot::SUBMERGED_BIT ) != 0 );
  96 +
  97 + if( sounds[sample] >= 0 ) {
  98 + playSound( sounds[sample], 1.0f, bot );
97 99 }
98 100 }
99 101 else if( recent[Object::EVENT_FRICTING] != 0 ) {
14 src/client/Context.cc
@@ -426,10 +426,12 @@ uint Context::requestSound( int id )
426 426 OZ_ERROR( "Failed to load WAVE sound '%s'", name.cstr() );
427 427 }
428 428
429   - if( audioSpec.channels != 1 ||
430   - ( audioSpec.format != AUDIO_U8 && audioSpec.format != AUDIO_S16 ) )
431   - {
432   - OZ_ERROR( "Invalid sound '%s' format, should be U8 mono or S16LE mono", name.cstr() );
  429 + if( audioSpec.format != AUDIO_U8 && audioSpec.format != AUDIO_S16 ) {
  430 + OZ_ERROR( "Invalid sound '%s' format, should be U8 or S16LE", name.cstr() );
  431 + }
  432 + if( audioSpec.channels != 1 ) {
  433 + OZ_ERROR( "Invalid sound '%s' format, should be mono but has %d channels",
  434 + name.cstr(), audioSpec.channels );
433 435 }
434 436
435 437 ALenum format = audioSpec.format == AUDIO_U8 ? AL_FORMAT_MONO8 : AL_FORMAT_MONO16;
@@ -441,10 +443,6 @@ uint Context::requestSound( int id )
441 443
442 444 OZ_AL_CHECK_ERROR();
443 445
444   - if( resource.id == 0 ) {
445   - OZ_ERROR( "Sound '%s' loading failed", name.cstr() );
446   - }
447   -
448 446 return resource.id;
449 447 }
450 448
2  src/client/GameStage.cc
@@ -469,6 +469,7 @@ void GameStage::unload()
469 469 float renderCaelumTime = float( render.caelumMicros ) * 1.0e-6f;
470 470 float renderTerraTime = float( render.terraMicros ) * 1.0e-6f;
471 471 float renderMeshesTime = float( render.meshesMicros ) * 1.0e-6f;
  472 + float renderMiscTime = float( render.miscMicros ) * 1.0e-6f;
472 473 float renderPostprocessTime = float( render.postprocessMicros ) * 1.0e-6f;
473 474 float renderUITime = float( render.uiMicros ) * 1.0e-6f;
474 475 float renderSwapTime = float( render.swapMicros ) * 1.0e-6f;
@@ -540,6 +541,7 @@ void GameStage::unload()
540 541 Log::println( "%6.2f %% [M:3] + caelum", renderCaelumTime / runTime * 100.0f );
541 542 Log::println( "%6.2f %% [M:3] + terra", renderTerraTime / runTime * 100.0f );
542 543 Log::println( "%6.2f %% [M:3] + meshes", renderMeshesTime / runTime * 100.0f );
  544 + Log::println( "%6.2f %% [M:3] + misc", renderMiscTime / runTime * 100.0f );
543 545 Log::println( "%6.2f %% [M:3] + postprocess", renderPostprocessTime / runTime * 100.0f );
544 546 Log::println( "%6.2f %% [M:3] + ui", renderUITime / runTime * 100.0f );
545 547 Log::println( "%6.2f %% [M:3] + swap", renderSwapTime / runTime * 100.0f );
4 src/client/Input.cc
@@ -513,8 +513,8 @@ void Input::update()
513 513 }
514 514 }
515 515
516   - lookX = -mouseX * input.mouseSensX;
517   - lookY = +mouseY * input.mouseSensY;
  516 + lookX = 0.0f;
  517 + lookY = 0.0f;
518 518 moveX = 0.0f;
519 519 moveY = 0.0f;
520 520
1  src/client/Lua.cc
@@ -204,7 +204,6 @@ void Lua::init()
204 204
205 205 IMPORT_FUNC( ozGettext );
206 206
207   - IGNORE_FUNC( ozUseFailed );
208 207 IGNORE_FUNC( ozForceUpdate );
209 208
210 209 /*
16 src/client/Mesh.cc
@@ -177,7 +177,19 @@ void Mesh::drawScheduled( int mask )
177 177 shader.program( mesh->shaderId );
178 178
179 179 foreach( instance, mesh->instances.citer() ) {
180   - if( !( mesh->flags & mask ) ) {
  180 + // HACK: This is not a nice way.
  181 + int instanceMask = mask;
  182 +
  183 + if( instance->alpha != 1.0f ) {
  184 + if( mask & ALPHA_BIT ) {
  185 + instanceMask |= SOLID_BIT;
  186 + }
  187 + else {
  188 + continue;
  189 + }
  190 + }
  191 +
  192 + if( !( mesh->flags & instanceMask ) ) {
181 193 continue;
182 194 }
183 195
@@ -185,7 +197,7 @@ void Mesh::drawScheduled( int mask )
185 197 mesh->animate( instance );
186 198 }
187 199
188   - mesh->draw( instance, mask );
  200 + mesh->draw( instance, instanceMask );
189 201 }
190 202 }
191 203
27 src/client/Render.cc
@@ -171,7 +171,7 @@ void Render::prepareDraw()
171 171 }
172 172 }
173 173
174   - if( shader.medium & Medium::WATER_BIT ) {
  174 + if( camera.p.z < 0.0f || ( shader.medium & Medium::WATER_BIT ) ) {
175 175 float colourRatio = Math::mix( caelum.nightLuminance, 1.0f, caelum.ratio );
176 176
177 177 shader.fogColour.x *= colourRatio;
@@ -238,6 +238,10 @@ void Render::drawGeometry()
238 238 glClearColor( shader.fogColour.x, shader.fogColour.y, shader.fogColour.z, shader.fogColour.w );
239 239 glClear( GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT );
240 240
  241 + currentMicros = Time::uclock();
  242 + swapMicros += currentMicros - beginMicros;
  243 + beginMicros = currentMicros;
  244 +
241 245 // camera transformation
242 246 tf.projection();
243 247 tf.camera = camera.rotTMat;
@@ -260,7 +264,7 @@ void Render::drawGeometry()
260 264 }
261 265
262 266 currentMicros = Time::uclock();
263   - swapMicros += currentMicros - beginMicros;
  267 + miscMicros += currentMicros - beginMicros;
264 268 beginMicros = currentMicros;
265 269
266 270 if( !( shader.medium & Medium::LIQUID_MASK ) && camera.p.z >= 0.0f ) {
@@ -290,17 +294,18 @@ void Render::drawGeometry()
290 294 terraMicros += currentMicros - beginMicros;
291 295 beginMicros = currentMicros;
292 296
293   - Mesh::drawScheduled( Mesh::ALPHA_BIT );
294   - Mesh::clearScheduled();
  297 + terra.drawWater();
295 298
296 299 currentMicros = Time::uclock();
297   - meshesMicros += currentMicros - beginMicros;
  300 + terraMicros += currentMicros - beginMicros;
298 301 beginMicros = currentMicros;
299 302
300   - terra.drawWater();
  303 + Mesh::drawScheduled( Mesh::ALPHA_BIT );
  304 + Mesh::clearScheduled();
301 305
302 306 currentMicros = Time::uclock();
303   - terraMicros += currentMicros - beginMicros;
  307 + meshesMicros += currentMicros - beginMicros;
  308 + beginMicros = currentMicros;
304 309
305 310 shape.bind();
306 311 shader.program( shader.plain );
@@ -354,6 +359,9 @@ void Render::drawGeometry()
354 359
355 360 structs.clear();
356 361 objects.clear();
  362 +
  363 + currentMicros = Time::uclock();
  364 + miscMicros += currentMicros - beginMicros;
357 365 }
358 366
359 367 void Render::drawOrbis()
@@ -559,6 +567,7 @@ void Render::load()
559 567 caelumMicros = 0;
560 568 terraMicros = 0;
561 569 meshesMicros = 0;
  570 + miscMicros = 0;
562 571 postprocessMicros = 0;
563 572 uiMicros = 0;
564 573 swapMicros = 0;
@@ -697,7 +706,7 @@ void Render::init()
697 706 isLowDetail = config.include( "render.lowDetail", false ).asBool();
698 707
699 708 scale = config.include( "render.scale", 1.0f ).asFloat();
700   - sScaleFilter = config.include( "render.scaleFilter", "NEAREST" ).asString();
  709 + sScaleFilter = config.include( "render.scaleFilter", "LINEAR" ).asString();
701 710
702 711 visibilityRange = config.include( "render.distance", 400.0f ).asFloat();
703 712 showBounds = config.include( "render.showBounds", false ).asBool();
@@ -713,7 +722,7 @@ void Render::init()
713 722 scaleFilter = GL_LINEAR;
714 723 }
715 724 else {
716   - OZ_ERROR( "render.scaleFilter should be either NEAREST or LINEAR." );
  725 + OZ_ERROR( "render.scaleFilter should be either LINEAR or NEAREST." );
717 726 }
718 727
719 728 mainFrame = 0;
1  src/client/Render.hh
@@ -96,6 +96,7 @@ class Render
96 96 ulong64 caelumMicros;
97 97 ulong64 terraMicros;
98 98 ulong64 meshesMicros;
  99 + ulong64 miscMicros;
99 100 ulong64 postprocessMicros;
100 101 ulong64 uiMicros;
101 102 ulong64 swapMicros;
5 src/client/ui/CreditsMenu.cc
@@ -131,9 +131,10 @@ void CreditsMenu::onDraw()
131 131 for( int i = 0; i < labels.length(); ++i ) {
132 132 int x = ( width - 240 ) / 2;
133 133 int y = height - 60 - ( i + 1 )*stride + bias;
  134 + int j = ( scroll + i ) % labels.length();
134 135
135   - labels[i].set( x, y );
136   - labels[i].draw( this, true );
  136 + labels[j].set( x, y );
  137 + labels[j].draw( this, true );
137 138 }
138 139
139 140 drawChildren();
18 src/client/ui/Inventory.cc
@@ -24,12 +24,12 @@
24 24 #include <stable.hh>
25 25 #include <client/ui/Inventory.hh>
26 26
  27 +#include <common/Timer.hh>
27 28 #include <client/Shape.hh>
28 29 #include <client/Camera.hh>
29 30 #include <client/Context.hh>
30 31 #include <client/Input.hh>
31 32 #include <client/OpenGL.hh>
32   -
33 33 #include <client/ui/Style.hh>
34 34
35 35 namespace oz
@@ -39,7 +39,7 @@ namespace client
39 39 namespace ui
40 40 {
41 41
42   -const float Inventory::ROTATION_VEL = -0.02f;
  42 +const float Inventory::ROTATION_VEL = 1.3f * Timer::TICK_TIME;
43 43
44 44 void Inventory::updateReferences()
45 45 {
@@ -84,6 +84,13 @@ void Inventory::handleComponent( int height, const Object* container, int* tagge
84 84
85 85 const Dynamic* item;
86 86
  87 + if( *tagged != cachedTaggedItemIndex ) {
  88 + taggedItemRotation = 0.0f;
  89 + }
  90 + else {
  91 + taggedItemRotation += ROTATION_VEL;
  92 + }
  93 +
87 94 if( input.leftClick ) {
88 95 if( uint( *tagged ) < uint( container->items.length() ) ) {
89 96 item = static_cast<const Dynamic*>( orbis.objects[ container->items[*tagged] ] );
@@ -198,11 +205,7 @@ void Inventory::drawComponent( int height, const Object* container, int tagged,
198 205
199 206 if( i == tagged ) {
200 207 taggedItem = item;
201   -
202   - if( tagged == cachedTaggedItemIndex ) {
203   - taggedItemRotation += ROTATION_VEL;
204   - tf.model.rotateZ( taggedItemRotation );
205   - }
  208 + tf.model.rotateZ( taggedItemRotation );
206 209 }
207 210
208 211 context.drawImago( item, nullptr );
@@ -264,7 +267,6 @@ void Inventory::drawComponent( int height, const Object* container, int tagged,
264 267
265 268 if( tagged != cachedTaggedItemIndex ) {
266 269 cachedTaggedItemIndex = tagged;
267   - taggedItemRotation = 0.0f;
268 270
269 271 itemDesc.set( -ICON_SIZE - 8, height - FOOTER_SIZE / 2, ALIGN_RIGHT | ALIGN_VCENTRE,
270 272 Font::SANS, "%s", taggedClazz->title.cstr() );
16 src/client/ui/Mouse.cc
@@ -57,18 +57,13 @@ void Mouse::update()
57 57 int newX = x + Math::lround( input.mouseX );
58 58 int newY = y + Math::lround( input.mouseY );
59 59
60   - if( 0 <= newX && newX < camera.width ) {
61   - input.lookX = 0.0f;
62   - }
63   - else {
  60 + if( newX < 0 || camera.width <= newX ) {
64 61 newX = clamp( newX, 0, camera.width - 1 );
  62 + input.lookX -= input.mouseX * input.mouseSensX;
65 63 }
66   -
67   - if( 0 < newY && newY < camera.height ) {
68   - input.lookY = 0.0f;
69   - }
70   - else {
  64 + if( newY < 0 || camera.height <= newY ) {
71 65 newY = clamp( newY, 0, camera.height - 1 );
  66 + input.lookY += input.mouseY * input.mouseSensY;
72 67 }
73 68
74 69 dx = newX - x;
@@ -77,6 +72,9 @@ void Mouse::update()
77 72 y = newY;
78 73 }
79 74 else {
  75 + input.lookX -= input.mouseX * input.mouseSensX;
  76 + input.lookY += input.mouseY * input.mouseSensY;
  77 +
80 78 dx = 0;
81 79 dy = 0;
82 80 x = camera.centreX;
3  src/matrix/Bot.hh
@@ -48,7 +48,8 @@ class Bot : public Dynamic
48 48 // Step and swim events are not in use but merely reserve sound slots.
49 49 static const int EVENT_STEP = 13;
50 50 static const int EVENT_WATERSTEP = 14;
51   - static const int EVENT_SWIM = 15;
  51 + static const int EVENT_SWIM_SURFACE = 15;
  52 + static const int EVENT_SWIM_SUBMERGED = 16;
52 53
53 54 /*
54 55 * ACTIONS
25 src/matrix/Lua.cc
@@ -42,23 +42,28 @@ bool Lua::objectCall( const char* functionName, Object* self_, Bot* user_ )
42 42 ms.frag = nullptr;
43 43 ms.objIndex = 0;
44 44 ms.strIndex = 0;
45   - ms.hasUseFailed = false;
46 45
47 46 hard_assert( l_gettop() == 1 && ms.self != nullptr );
48 47
49 48 l_getglobal( functionName );
50 49 l_rawgeti( 1, ms.self->index );
51   - l_pcall( 1, 0 );
  50 + l_pcall( 1, 1 );
52 51
53   - if( l_gettop() != 1 ) {
54   - Log::println( "Lua[M] in %s(self = %d, user = %d): %s", functionName, ms.self->index,
55   - ms.user == nullptr ? -1 : ms.user->index, l_tostring( -1 ) );
56   - System::bell();
  52 + bool success = true;
57 53
58   - l_pop( 1 );
  54 + if( l_gettop() == 2 ) {
  55 + if( l_type( 2 ) == LUA_TSTRING ) {
  56 + Log::println( "Lua[M] in %s(self = %d, user = %d): %s", functionName, ms.self->index,
  57 + ms.user == nullptr ? -1 : ms.user->index, l_tostring( -1 ) );
  58 + System::bell();
  59 + }
  60 + else {
  61 + success = l_tobool( 2 );
  62 + }
  63 + l_settop( 1 );
59 64 }
60   -
61   - return !ms.hasUseFailed;
  65 + hard_assert( l_gettop() == 1 );
  66 + return success;
62 67 }
63 68
64 69 void Lua::registerObject( int index )
@@ -132,8 +137,6 @@ void Lua::init()
132 137 IMPORT_FUNC( ozError );
133 138 IMPORT_FUNC( ozPrintln );
134 139
135   - IMPORT_FUNC( ozUseFailed );
136   -
137 140 /*
138 141 * Orbis
139 142 */
2  src/matrix/Object.hh
@@ -280,11 +280,11 @@ class Object : public AABB
280 280 if( !( flags & DESTROYED_BIT ) ) {
281 281 life = 0.0f;
282 282 flags |= DESTROYED_BIT;
283   - addEvent( EVENT_DESTROY, 1.0f );
284 283
285 284 if( flags & DESTROY_FUNC_BIT ) {
286 285 onDestroy();
287 286 }
  287 + addEvent( EVENT_DESTROY, 1.0f );
288 288 }
289 289 }
290 290
2  src/matrix/ObjectClass.hh
@@ -37,7 +37,7 @@ class ObjectClass
37 37 {
38 38 public:
39 39
40   - static const int MAX_SOUNDS = 16;
  40 + static const int MAX_SOUNDS = 32;
41 41
42 42 static const int NIGHT_VISION_BIT = 0x01;
43 43 static const int BINOCULARS_BIT = 0x02;
12 src/matrix/Weapon.cc
@@ -88,17 +88,15 @@ void Weapon::trigger( Bot* user )
88 88 const WeaponClass* clazz = static_cast<const WeaponClass*>( this->clazz );
89 89
90 90 if( shotTime == 0.0f ) {
  91 + bool success = false;
  92 +
91 93 shotTime = clazz->shotInterval;
92 94
93   - if( nRounds == 0 ) {
94   - addEvent( EVENT_SHOT_EMPTY, 1.0f );
95   - }
96   - else {
  95 + if( nRounds != 0 && lua.objectCall( clazz->onShot, this, user ) ) {
97 96 nRounds = max( -1, nRounds - 1 );
98   -
99   - addEvent( EVENT_SHOT, 1.0f );
100   - lua.objectCall( clazz->onShot, this, user );
  97 + success = true;
101 98 }
  99 + addEvent( EVENT_SHOT_EMPTY + success, 1.0f );
102 100 }
103 101 }
104 102
4 src/matrix/Weapon.hh
@@ -35,8 +35,8 @@ class Weapon : public Dynamic
35 35 {
36 36 public:
37 37
38   - static const int EVENT_SHOT = 9;
39   - static const int EVENT_SHOT_EMPTY = 10;
  38 + static const int EVENT_SHOT_EMPTY = 9;
  39 + static const int EVENT_SHOT = 10;
40 40
41 41 static Pool<Weapon, 2048> pool;
42 42
3  src/matrix/luaapi.cc
@@ -81,7 +81,8 @@ void importMatrixConstants( lua_State* l )
81 81 registerLuaConstant( l, "OZ_EVENT_DEATH", Bot::EVENT_DEATH );
82 82 registerLuaConstant( l, "OZ_EVENT_STEP", Bot::EVENT_STEP );
83 83 registerLuaConstant( l, "OZ_EVENT_WATERSTEP", Bot::EVENT_WATERSTEP );
84   - registerLuaConstant( l, "OZ_EVENT_SWIM", Bot::EVENT_SWIM );
  84 + registerLuaConstant( l, "OZ_EVENT_SWIM_SURFACE", Bot::EVENT_SWIM_SURFACE );
  85 + registerLuaConstant( l, "OZ_EVENT_SWIM_SUBMERGED", Bot::EVENT_SWIM_SUBMERGED );
85 86 registerLuaConstant( l, "OZ_EVENT_ENGINE", Vehicle::EVENT_ENGINE );
86 87 registerLuaConstant( l, "OZ_EVENT_NEXT_WEAPON", Vehicle::EVENT_NEXT_WEAPON );
87 88 registerLuaConstant( l, "OZ_EVENT_SHOT0", Vehicle::EVENT_SHOT0 );
14 src/matrix/luaapi.hh
@@ -64,8 +64,6 @@ struct MatrixLuaState
64 64
65 65 List<Struct*> structs;
66 66 List<Object*> objects;
67   -
68   - bool hasUseFailed;
69 67 };
70 68
71 69 static MatrixLuaState ms;
@@ -74,18 +72,6 @@ static MatrixLuaState ms;
74 72 /// @{
75 73
76 74 /*
77   - * General functions
78   - */
79   -
80   -static int ozUseFailed( lua_State* l )
81   -{
82   - ARG( 0 );
83   -
84   - ms.hasUseFailed = true;
85   - return 1;
86   -}
87   -
88   -/*
89 75 * Orbis
90 76 */
91 77
1  src/nirvana/Lua.cc
@@ -126,7 +126,6 @@ void Lua::init()
126 126 IMPORT_FUNC( ozError );
127 127 IMPORT_FUNC( ozPrintln );
128 128
129   - IGNORE_FUNC( ozUseFailed );
130 129 IMPORT_FUNC( ozForceUpdate );
131 130
132 131 /*
4 src/ozCore/System.cc
@@ -621,10 +621,10 @@ void System::bell()
621 621 pthread_attr_init( &bellThreadAttr );
622 622 pthread_attr_setdetachstate( &bellThreadAttr, PTHREAD_CREATE_DETACHED );
623 623
624   - if( pthread_create( &bellThread, &bellThreadAttr, bellMain, nullptr ) == 0 ) {
625   - pthread_attr_destroy( &bellThreadAttr );
  624 + if( pthread_create( &bellThread, &bellThreadAttr, bellMain, nullptr ) != 0 ) {
626 625 __sync_lock_release( &bellLock );
627 626 }
  627 + pthread_attr_destroy( &bellThreadAttr );
628 628 }
629 629
630 630 #endif
84 src/ozCore/Time.cc
@@ -146,49 +146,6 @@ long64 Time::time()
146 146 #endif
147 147 }
148 148
149   -Time Time::local()
150   -{
151   - return local( time() );
152   -}
153   -
154   -Time Time::local( long64 epoch )
155   -{
156   -#ifdef _WIN32
157   -
158   - ULARGE_INTEGER largeInteger;
159   - FILETIME fileTime;
160   - FILETIME localFileTime;
161   - SYSTEMTIME timeStruct;
162   -
163   - largeInteger.QuadPart = ulong64( epoch * 10000 );
164   -
165   - fileTime.dwLowDateTime = largeInteger.LowPart;
166   - fileTime.dwHighDateTime = largeInteger.HighPart;
167   -
168   - FileTimeToLocalFileTime( &fileTime, &localFileTime );
169   - FileTimeToSystemTime( &localFileTime, &timeStruct );
170   -
171   - return {
172   - epoch,
173   - int( timeStruct.wYear ), int( timeStruct.wMonth ), int( timeStruct.wDay ),
174   - int( timeStruct.wHour ), int( timeStruct.wMinute ), int( timeStruct.wSecond )
175   - };
176   -
177   -#else
178   -
179   - time_t ctime = time_t( epoch );
180   - struct tm timeStruct;
181   - localtime_r( &ctime, &timeStruct );
182   -
183   - return {
184   - epoch,
185   - int( 1900 + timeStruct.tm_year ), int( 1 + timeStruct.tm_mon ), int( timeStruct.tm_mday ),
186   - int( timeStruct.tm_hour ), int( timeStruct.tm_min ), int( timeStruct.tm_sec )
187   - };
188   -
189   -#endif
190   -}
191   -
192 149 long64 Time::toEpoch() const