ruby-ogre 0.0.2-x86-linux → 0.0.3-x86-linux

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. data/README.md +80 -5
  2. data/Rakefile +26 -19
  3. data/bindings/ogre/interface/Rakefile +22 -0
  4. data/bindings/ogre/interface/ogre.i +3 -1
  5. data/bindings/ogre/interface/ogre_wrap.cpp +99671 -17485
  6. data/bindings/ogre/interface/ogre_wrap.o +0 -0
  7. data/bindings/ogrebites/interface/Rakefile +22 -0
  8. data/bindings/ogrebites/interface/ogrebites.i +1 -1
  9. data/bindings/ogrebites/interface/ogrebites_wrap.cpp +728 -728
  10. data/bindings/ogrebites/interface/ogrebites_wrap.h +2 -2
  11. data/bindings/ogrebites/interface/ogrebites_wrap.o +0 -0
  12. data/bindings/ois/interface/Rakefile +22 -0
  13. data/bindings/ois/interface/ois.i +1 -1
  14. data/bindings/ois/interface/ois_wrap.cpp +553 -553
  15. data/bindings/ois/interface/ois_wrap.h +2 -2
  16. data/bindings/ois/interface/ois_wrap.o +0 -0
  17. data/bindings/procedural/interface/Rakefile +22 -0
  18. data/bindings/procedural/interface/procedural.i +1 -1
  19. data/bindings/procedural/interface/procedural_wrap.cpp +1247 -1247
  20. data/bindings/procedural/interface/procedural_wrap.o +0 -0
  21. data/lib/{Ogre.so → ogre.so} +0 -0
  22. data/lib/ogre_config.rb +37 -0
  23. data/lib/ogrebites.so +0 -0
  24. data/lib/{OIS.so → ois.so} +0 -0
  25. data/lib/{Procedural.so → procedural.so} +0 -0
  26. data/lib/{Version.rb → version.rb} +1 -1
  27. data/sample/charactor/camera_mover.rb +184 -0
  28. data/sample/{Charactor → charactor}/plugins.cfg +0 -0
  29. data/sample/{Charactor → charactor}/resources.cfg +0 -0
  30. data/sample/{Charactor → charactor}/sinbad +1 -1
  31. data/sample/charactor/sinbad.rb +246 -0
  32. data/sample/{Charactor → charactor}/sinbad.win +1 -1
  33. data/sample/{Charactor/SinbadCharacter.rb → charactor/sinbad_character.rb} +125 -125
  34. data/sample/charactor/ui_listener.rb +65 -0
  35. metadata +22 -21
  36. data/bindings/ogre/interface/Makefile +0 -19
  37. data/bindings/ogrebites/interface/Makefile +0 -19
  38. data/bindings/ois/interface/Makefile +0 -19
  39. data/bindings/procedural/interface/Makefile +0 -19
  40. data/lib/OgreBites.so +0 -0
  41. data/lib/OgreConfig.rb +0 -37
  42. data/sample/Charactor/CameraMover.rb +0 -184
  43. data/sample/Charactor/Sinbad.rb +0 -246
  44. data/sample/Charactor/UiListener.rb +0 -65
@@ -2,4 +2,4 @@
2
2
 
3
3
  FILE_PATH=`dirname "$0"`
4
4
 
5
- PATH=$FILE_PATH/../../deps/lib:$FILE_PATH/../../lib:$PATH ruby $FILE_PATH/Sinbad.rb
5
+ PATH=$FILE_PATH/../../deps/lib:$FILE_PATH/../../lib:$PATH ruby $FILE_PATH/sinbad.rb
@@ -24,39 +24,39 @@ class SinbadCharacter
24
24
  ANIM_NONE = 13
25
25
 
26
26
  def initialize(sceneMgr, cameraMover)
27
- setupBody(sceneMgr)
28
- setupCamera(cameraMover)
29
- setupAnimations()
27
+ setup_body(sceneMgr)
28
+ setup_camera(cameraMover)
29
+ setup_animations()
30
30
  end
31
31
 
32
- def setupBody(sceneMgr)
32
+ def setup_body(sceneMgr)
33
33
  # create main model
34
- @bodyNode = sceneMgr.getRootSceneNode().createChildSceneNode(Ogre::Vector3.UNIT_Y * CHAR_HEIGHT)
35
- @bodyEnt = sceneMgr.createEntity("SinbadBody", "Sinbad.mesh")
36
- @bodyNode.attachObject(@bodyEnt)
34
+ @bodyNode = sceneMgr.get_root_scene_node().create_child_scene_node(Ogre::Vector3.UNIT_Y * CHAR_HEIGHT)
35
+ @bodyEnt = sceneMgr.create_entity("SinbadBody", "Sinbad.mesh")
36
+ @bodyNode.attach_object(@bodyEnt)
37
37
 
38
38
  # create swords and attach to sheath
39
- @sword1 = sceneMgr.createEntity("SinbadSword1", "Sword.mesh")
40
- @sword2 = sceneMgr.createEntity("SinbadSword2", "Sword.mesh")
41
- @bodyEnt.attachObjectToBone("Sheath.L", @sword1)
42
- @bodyEnt.attachObjectToBone("Sheath.R", @sword2)
39
+ @sword1 = sceneMgr.create_entity("SinbadSword1", "Sword.mesh")
40
+ @sword2 = sceneMgr.create_entity("SinbadSword2", "Sword.mesh")
41
+ @bodyEnt.attach_object_to_bone("Sheath.L", @sword1)
42
+ @bodyEnt.attach_object_to_bone("Sheath.R", @sword2)
43
43
 
44
44
  # create a couple of ribbon trails for the swords, just for fun
45
45
  params = {}
46
46
  #params = Ogre::NameValuePairList.new
47
47
  params["numberOfChains"] = "2"
48
48
  params["maxElements"] = "80"
49
- @swordTrail = Ogre::RibbonTrail::cast(sceneMgr.createMovableObject("RibbonTrail", params))
50
- @swordTrail.setMaterialName("Examples/LightRibbonTrail")
51
- @swordTrail.setTrailLength(20)
52
- @swordTrail.setVisible(false)
53
- sceneMgr.getRootSceneNode().attachObject(@swordTrail)
49
+ @swordTrail = Ogre::RibbonTrail::cast(sceneMgr.create_movable_object("RibbonTrail", params))
50
+ @swordTrail.set_material_name("Examples/LightRibbonTrail")
51
+ @swordTrail.set_trail_length(20)
52
+ @swordTrail.set_visible(false)
53
+ sceneMgr.get_root_scene_node().attach_object(@swordTrail)
54
54
 
55
55
  2.times.each {|i|
56
- @swordTrail.setInitialColour(i, 1, 0.8, 0)
57
- @swordTrail.setColourChange(i, 0.75, 1.25, 1.25, 1.25)
58
- @swordTrail.setWidthChange(i, 1)
59
- @swordTrail.setInitialWidth(i, 0.5)
56
+ @swordTrail.set_initial_colour(i, 1, 0.8, 0)
57
+ @swordTrail.set_colour_change(i, 0.75, 1.25, 1.25, 1.25)
58
+ @swordTrail.set_width_change(i, 1)
59
+ @swordTrail.set_initial_width(i, 0.5)
60
60
  }
61
61
 
62
62
  @keyDirection = Ogre::Vector3.new(0, 0, 0)
@@ -64,40 +64,40 @@ class SinbadCharacter
64
64
  @timer = 0
65
65
  end
66
66
 
67
- def setupCamera(cameraMover)
67
+ def setup_camera(cameraMover)
68
68
  @cameraMover = cameraMover
69
- cameraMover.setStyle(CameraMover::CS_TPS)
70
- cameraMover.setTarget(@bodyNode)
69
+ cameraMover.set_style(CameraMover::CS_TPS)
70
+ cameraMover.set_target(@bodyNode)
71
71
  end
72
72
 
73
- def setupAnimations()
73
+ def setup_animations()
74
74
  @anims = []
75
75
  @fadingIn = []
76
76
  @fadingOut = []
77
77
  @baseAnimID = 0
78
78
  @topAnimID = 0
79
79
 
80
- @bodyEnt.getSkeleton().setBlendMode(Ogre::ANIMBLEND_CUMULATIVE)
80
+ @bodyEnt.get_skeleton().set_blend_mode(Ogre::ANIMBLEND_CUMULATIVE)
81
81
  animNames =["IdleBase", "IdleTop", "RunBase", "RunTop", "HandsClosed", "HandsRelaxed", "DrawSwords",
82
82
  "SliceVertical", "SliceHorizontal", "Dance", "JumpStart", "JumpLoop", "JumpEnd"]
83
83
  animNames.each_with_index {|name, i|
84
- @anims[i] = @bodyEnt.getAnimationState(name)
85
- @anims[i].setLoop(true)
84
+ @anims[i] = @bodyEnt.get_animation_state(name)
85
+ @anims[i].set_loop(true)
86
86
  @fadingIn[i] = false
87
87
  @fadingOut[i] = false
88
88
  }
89
89
 
90
90
  # start off in the idle state (top and bottom together)
91
- setBaseAnimation(ANIM_IDLE_BASE)
92
- setTopAnimation(ANIM_IDLE_TOP)
91
+ set_base_animation(ANIM_IDLE_BASE)
92
+ set_top_animation(ANIM_IDLE_TOP)
93
93
 
94
94
  # relax the hands since we're not holding anything
95
- @anims[ANIM_HANDS_RELAXED].setEnabled(true)
95
+ @anims[ANIM_HANDS_RELAXED].set_enabled(true)
96
96
 
97
97
  @swordsDrawn = false
98
98
  end
99
99
 
100
- def setBaseAnimation(id, reset = false)
100
+ def set_base_animation(id, reset = false)
101
101
  if (@baseAnimID >= 0 && @baseAnimID < NUM_ANIMS)
102
102
  # if we have an old animation, fade it out
103
103
  @fadingIn[@baseAnimID] = false
@@ -108,15 +108,15 @@ class SinbadCharacter
108
108
 
109
109
  if (id != ANIM_NONE)
110
110
  # if we have a new animation, enable it and fade it in
111
- @anims[id].setEnabled(true)
112
- @anims[id].setWeight(0)
111
+ @anims[id].set_enabled(true)
112
+ @anims[id].set_weight(0)
113
113
  @fadingOut[id] = false
114
114
  @fadingIn[id] = true
115
- @anims[id].setTimePosition(0) if (reset)
115
+ @anims[id].set_time_position(0) if (reset)
116
116
  end
117
117
  end
118
118
 
119
- def setTopAnimation(id, reset = false)
119
+ def set_top_animation(id, reset = false)
120
120
  if (@topAnimID >= 0 && @topAnimID < NUM_ANIMS)
121
121
  # if we have an old animation, fade it out
122
122
  @fadingIn[@topAnimID] = false
@@ -127,31 +127,31 @@ class SinbadCharacter
127
127
 
128
128
  if (id != ANIM_NONE)
129
129
  # if we have a new animation, enable it and fade it in
130
- @anims[id].setEnabled(true)
131
- @anims[id].setWeight(0)
130
+ @anims[id].set_enabled(true)
131
+ @anims[id].set_weight(0)
132
132
  @fadingOut[id] = false
133
133
  @fadingIn[id] = true
134
- @anims[id].setTimePosition(0) if (reset)
134
+ @anims[id].set_time_position(0) if (reset)
135
135
  end
136
136
  end
137
137
 
138
- def updateBody(deltaTime)
138
+ def update_body(deltaTime)
139
139
  @goalDirection = Ogre::Vector3.new(0, 0, 0) # we will calculate this
140
140
 
141
- if (!@keyDirection.isZeroLength && @baseAnimID != ANIM_DANCE)
141
+ if (!@keyDirection.is_zero_length && @baseAnimID != ANIM_DANCE)
142
142
 
143
143
  # calculate actually goal direction in world based on player's key directions
144
- @goalDirection += @cameraMover.camera.getOrientation().zAxis() * @keyDirection.z
145
- @goalDirection += @cameraMover.camera.getOrientation().xAxis() * @keyDirection.x
144
+ @goalDirection += @cameraMover.camera.get_orientation().z_axis() * @keyDirection.z
145
+ @goalDirection += @cameraMover.camera.get_orientation().x_axis() * @keyDirection.x
146
146
  @goalDirection.y = 0
147
147
  @goalDirection.normalise()
148
148
 
149
- zDirection = @cameraMover.camera.getOrientation().zAxis()
149
+ zDirection = @cameraMover.camera.get_orientation().z_axis()
150
150
 
151
- toGoal = @bodyNode.getOrientation().zAxis().getRotationTo(@goalDirection)
151
+ toGoal = @bodyNode.get_orientation().z_axis().get_rotation_to(@goalDirection)
152
152
 
153
153
  # calculate how much the character has to turn to face goal direction
154
- yawToGoal = toGoal.getYaw().valueDegrees()
154
+ yawToGoal = toGoal.get_yaw().value_degrees()
155
155
  # this is how much the character CAN turn this frame
156
156
  yawAtSpeed = yawToGoal / yawToGoal.abs * deltaTime * TURN_SPEED
157
157
  # reduce "turnability" if we're in midair
@@ -164,10 +164,10 @@ class SinbadCharacter
164
164
  yawToGoal = [0, [yawToGoal, yawAtSpeed].min].max
165
165
  end
166
166
 
167
- @bodyNode.yaw(Ogre::Radian.new(Ogre::Degree.new(yawToGoal).valueRadians()))
167
+ @bodyNode.yaw(Ogre::Radian.new(Ogre::Degree.new(yawToGoal).value_radians()))
168
168
 
169
169
  # move in current body direction (not the goal direction)
170
- @bodyNode.translate(0, 0, deltaTime * RUN_SPEED * @anims[@baseAnimID].getWeight(),
170
+ @bodyNode.translate(0, 0, deltaTime * RUN_SPEED * @anims[@baseAnimID].get_weight(),
171
171
  Ogre::Node::TS_LOCAL)
172
172
  end
173
173
 
@@ -176,18 +176,18 @@ class SinbadCharacter
176
176
  @bodyNode.translate(0, @verticalVelocity * deltaTime, 0, Ogre::Node::TS_LOCAL)
177
177
  @verticalVelocity -= GRAVITY * deltaTime;
178
178
 
179
- pos = @bodyNode.getPosition()
179
+ pos = @bodyNode.get_position()
180
180
  if (pos.y <= CHAR_HEIGHT)
181
181
  # if we've hit the ground, change to landing state
182
182
  pos.y = CHAR_HEIGHT
183
- @bodyNode.setPosition(pos)
184
- setBaseAnimation(ANIM_JUMP_END, true)
183
+ @bodyNode.set_position(pos)
184
+ set_base_animation(ANIM_JUMP_END, true)
185
185
  @timer = 0
186
186
  end
187
187
  end
188
188
  end
189
189
 
190
- def updateAnimations(deltaTime)
190
+ def update_animations(deltaTime)
191
191
  baseAnimSpeed = 1
192
192
  topAnimSpeed = 1
193
193
 
@@ -198,77 +198,77 @@ class SinbadCharacter
198
198
  topAnimSpeed = @swordsDrawn ? -1 : 1
199
199
 
200
200
  # half-way through the animation is when the hand grasps the handles...
201
- if (@timer >= @anims[@topAnimID].getLength() / 2 &&
202
- @timer - deltaTime < @anims[@topAnimID].getLength() / 2)
201
+ if (@timer >= @anims[@topAnimID].get_length() / 2 &&
202
+ @timer - deltaTime < @anims[@topAnimID].get_length() / 2)
203
203
  # so transfer the swords from the sheaths to the hands
204
- @bodyEnt.detachAllObjectsFromBone()
205
- @bodyEnt.attachObjectToBone(@swordsDrawn ? "Sheath.L" : "Handle.L", @sword1)
206
- @bodyEnt.attachObjectToBone(@swordsDrawn ? "Sheath.R" : "Handle.R", @sword2)
204
+ @bodyEnt.detach_all_objects_from_bone()
205
+ @bodyEnt.attach_object_to_bone(@swordsDrawn ? "Sheath.L" : "Handle.L", @sword1)
206
+ @bodyEnt.attach_object_to_bone(@swordsDrawn ? "Sheath.R" : "Handle.R", @sword2)
207
207
  # change the hand state to grab or let go
208
- @anims[ANIM_HANDS_CLOSED].setEnabled(!@swordsDrawn)
209
- @anims[ANIM_HANDS_RELAXED].setEnabled(@swordsDrawn)
208
+ @anims[ANIM_HANDS_CLOSED].set_enabled(!@swordsDrawn)
209
+ @anims[ANIM_HANDS_RELAXED].set_enabled(@swordsDrawn)
210
210
 
211
211
  # toggle sword trails
212
212
  if (@swordsDrawn)
213
- @swordTrail.setVisible(false)
214
- @swordTrail.removeNode(@sword1.getParentNode())
215
- @swordTrail.removeNode(@sword2.getParentNode())
213
+ @swordTrail.set_visible(false)
214
+ @swordTrail.remove_node(@sword1.get_parent_node())
215
+ @swordTrail.remove_node(@sword2.get_parent_node())
216
216
  else
217
- @swordTrail.setVisible(true)
218
- @swordTrail.addNode(@sword1.getParentNode())
219
- @swordTrail.addNode(@sword2.getParentNode())
217
+ @swordTrail.set_visible(true)
218
+ @swordTrail.add_node(@sword1.get_parent_node())
219
+ @swordTrail.add_node(@sword2.get_parent_node())
220
220
  end
221
221
  end
222
222
 
223
- if (@timer >= @anims[@topAnimID].getLength())
223
+ if (@timer >= @anims[@topAnimID].get_length())
224
224
  # animation is finished, so return to what we were doing before
225
225
  if (@baseAnimID == ANIM_IDLE_BASE)
226
- setTopAnimation(ANIM_IDLE_TOP)
226
+ set_top_animation(ANIM_IDLE_TOP)
227
227
  else
228
- setTopAnimation(ANIM_RUN_TOP)
229
- @anims[ANIM_RUN_TOP].setTimePosition(@anims[ANIM_RUN_BASE].getTimePosition())
228
+ set_top_animation(ANIM_RUN_TOP)
229
+ @anims[ANIM_RUN_TOP].set_time_position(@anims[ANIM_RUN_BASE].get_time_position())
230
230
  end
231
231
  @swordsDrawn = !@swordsDrawn
232
232
  end
233
233
 
234
234
  elsif (@topAnimID == ANIM_SLICE_VERTICAL || @topAnimID == ANIM_SLICE_HORIZONTAL)
235
- if (@timer >= @anims[@topAnimID].getLength())
235
+ if (@timer >= @anims[@topAnimID].get_length())
236
236
  # animation is finished, so return to what we were doing before
237
237
  if (@baseAnimID == ANIM_IDLE_BASE)
238
- setTopAnimation(ANIM_IDLE_TOP)
238
+ set_top_animation(ANIM_IDLE_TOP)
239
239
  else
240
- setTopAnimation(ANIM_RUN_TOP)
241
- @anims[ANIM_RUN_TOP].setTimePosition(@anims[ANIM_RUN_BASE].getTimePosition())
240
+ set_top_animation(ANIM_RUN_TOP)
241
+ @anims[ANIM_RUN_TOP].set_time_position(@anims[ANIM_RUN_BASE].get_time_position())
242
242
  end
243
243
  end
244
244
  # don't sway hips from side to side when slicing. that's just embarrasing.
245
245
  baseAnimSpeed = 0 if (@baseAnimID == ANIM_IDLE_BASE)
246
246
 
247
247
  elsif (@baseAnimID == ANIM_JUMP_START)
248
- if (@timer >= @anims[@baseAnimID].getLength())
248
+ if (@timer >= @anims[@baseAnimID].get_length())
249
249
  # takeoff animation finished, so time to leave the ground!
250
- setBaseAnimation(ANIM_JUMP_LOOP, true)
250
+ set_base_animation(ANIM_JUMP_LOOP, true)
251
251
  # apply a jump acceleration to the character
252
252
  @verticalVelocity = JUMP_ACCEL
253
253
  end
254
254
  elsif (@baseAnimID == ANIM_JUMP_END)
255
- if (@timer >= @anims[@baseAnimID].getLength())
255
+ if (@timer >= @anims[@baseAnimID].get_length())
256
256
  # safely landed, so go back to running or idling
257
- if (@keyDirection.isZeroLength)
258
- setBaseAnimation(ANIM_IDLE_BASE)
259
- setTopAnimation(ANIM_IDLE_TOP)
257
+ if (@keyDirection.is_zero_length)
258
+ set_base_animation(ANIM_IDLE_BASE)
259
+ set_top_animation(ANIM_IDLE_TOP)
260
260
  else
261
- setBaseAnimation(ANIM_RUN_BASE, true)
262
- setTopAnimation(ANIM_RUN_TOP, true)
261
+ set_base_animation(ANIM_RUN_BASE, true)
262
+ set_top_animation(ANIM_RUN_TOP, true)
263
263
  end
264
264
  end
265
265
  end
266
266
  # increment the current base and top animation times
267
- @anims[@baseAnimID].addTime(deltaTime * baseAnimSpeed) if (@baseAnimID != ANIM_NONE)
268
- @anims[@topAnimID].addTime(deltaTime * topAnimSpeed) if (@topAnimID != ANIM_NONE)
267
+ @anims[@baseAnimID].add_time(deltaTime * baseAnimSpeed) if (@baseAnimID != ANIM_NONE)
268
+ @anims[@topAnimID].add_time(deltaTime * topAnimSpeed) if (@topAnimID != ANIM_NONE)
269
269
 
270
270
  # apply smooth transitioning between our animations
271
- fadeAnimations(deltaTime)
271
+ fade_animations(deltaTime)
272
272
  end
273
273
 
274
274
  def clamp(value, min, max)
@@ -277,100 +277,100 @@ class SinbadCharacter
277
277
  return value
278
278
  end
279
279
 
280
- def fadeAnimations(deltaTime)
280
+ def fade_animations(deltaTime)
281
281
  NUM_ANIMS.times {|i|
282
282
  if (@fadingIn[i])
283
283
  # slowly fade this animation in until it has full weight
284
- newWeight = @anims[i].getWeight() + deltaTime * ANIM_FADE_SPEED
285
- @anims[i].setWeight(clamp(newWeight, 0, 1))
284
+ newWeight = @anims[i].get_weight() + deltaTime * ANIM_FADE_SPEED
285
+ @anims[i].set_weight(clamp(newWeight, 0, 1))
286
286
  @fadingIn[i] = false if (newWeight >= 1)
287
287
 
288
288
  elsif (@fadingOut[i])
289
289
  # slowly fade this animation out until it has no weight, and then disable it
290
- newWeight = @anims[i].getWeight() - deltaTime * ANIM_FADE_SPEED
291
- @anims[i].setWeight(clamp(newWeight, 0, 1))
290
+ newWeight = @anims[i].get_weight() - deltaTime * ANIM_FADE_SPEED
291
+ @anims[i].set_weight(clamp(newWeight, 0, 1))
292
292
  if (newWeight <= 0)
293
- @anims[i].setEnabled(false)
293
+ @anims[i].set_enabled(false)
294
294
  @fadingOut[i] = false
295
295
  end
296
296
  end
297
297
  }
298
298
  end
299
299
 
300
- def addTime(delta)
301
- updateBody(delta)
302
- updateAnimations(delta)
300
+ def add_time(delta)
301
+ update_body(delta)
302
+ update_animations(delta)
303
303
  end
304
304
 
305
- def injectKeyDown(evt)
306
- if (evt.key == OIS::KC_Q && (@topAnimID == ANIM_IDLE_TOP || @topAnimID == ANIM_RUN_TOP))
305
+ def inject_key_down(evt)
306
+ if (evt.key == Ois::KC_Q && (@topAnimID == ANIM_IDLE_TOP || @topAnimID == ANIM_RUN_TOP))
307
307
  # take swords out (or put them back, since it's the same animation but reversed)
308
- setTopAnimation(ANIM_DRAW_SWORDS, true)
308
+ set_top_animation(ANIM_DRAW_SWORDS, true)
309
309
  @timer = 0
310
- elsif (evt.key == OIS::KC_E && !@swordsDrawn)
310
+ elsif (evt.key == Ois::KC_E && !@swordsDrawn)
311
311
  if (@topAnimID == ANIM_IDLE_TOP || @topAnimID == ANIM_RUN_TOP)
312
312
  # start dancing
313
- setBaseAnimation(ANIM_DANCE, true)
314
- setTopAnimation(ANIM_NONE)
313
+ set_base_animation(ANIM_DANCE, true)
314
+ set_top_animation(ANIM_NONE)
315
315
  # disable hand animation because the dance controls hands
316
- @anims[ANIM_HANDS_RELAXED].setEnabled(false)
316
+ @anims[ANIM_HANDS_RELAXED].set_enabled(false)
317
317
  elsif (@baseAnimID == ANIM_DANCE)
318
318
  # stop dancing
319
- setBaseAnimation(ANIM_IDLE_BASE)
320
- setTopAnimation(ANIM_IDLE_TOP);
319
+ set_base_animation(ANIM_IDLE_BASE)
320
+ set_top_animation(ANIM_IDLE_TOP)
321
321
  # re-enable hand animation
322
- @anims[ANIM_HANDS_RELAXED].setEnabled(true)
322
+ @anims[ANIM_HANDS_RELAXED].set_enabled(true)
323
323
  end
324
324
  # keep track of the player's intended direction
325
- elsif (evt.key == OIS::KC_W)
325
+ elsif (evt.key == Ois::KC_W)
326
326
  @keyDirection.z = -1
327
- elsif (evt.key == OIS::KC_A)
327
+ elsif (evt.key == Ois::KC_A)
328
328
  @keyDirection.x = -1
329
- elsif (evt.key == OIS::KC_S)
329
+ elsif (evt.key == Ois::KC_S)
330
330
  @keyDirection.z = 1
331
- elsif (evt.key == OIS::KC_D)
331
+ elsif (evt.key == Ois::KC_D)
332
332
  @keyDirection.x = 1
333
- elsif (evt.key == OIS::KC_SPACE && (@topAnimID == ANIM_IDLE_TOP || @topAnimID == ANIM_RUN_TOP))
333
+ elsif (evt.key == Ois::KC_SPACE && (@topAnimID == ANIM_IDLE_TOP || @topAnimID == ANIM_RUN_TOP))
334
334
  # jump if on ground
335
- setBaseAnimation(ANIM_JUMP_START, true)
336
- setTopAnimation(ANIM_NONE)
335
+ set_base_animation(ANIM_JUMP_START, true)
336
+ set_top_animation(ANIM_NONE)
337
337
  @timer = 0
338
338
  end
339
339
 
340
- if (!@keyDirection.isZeroLength() && @baseAnimID == ANIM_IDLE_BASE)
340
+ if (!@keyDirection.is_zero_length() && @baseAnimID == ANIM_IDLE_BASE)
341
341
  # start running if not already moving and the player wants to move
342
- setBaseAnimation(ANIM_RUN_BASE, true)
343
- setTopAnimation(ANIM_RUN_TOP, true) if (@topAnimID == ANIM_IDLE_TOP)
342
+ set_base_animation(ANIM_RUN_BASE, true)
343
+ set_top_animation(ANIM_RUN_TOP, true) if (@topAnimID == ANIM_IDLE_TOP)
344
344
  end
345
345
 
346
346
  end
347
347
 
348
- def injectKeyUp(evt)
348
+ def inject_key_up(evt)
349
349
  # keep track of the player's intended direction
350
- if (evt.key == OIS::KC_W && @keyDirection.z == -1)
350
+ if (evt.key == Ois::KC_W && @keyDirection.z == -1)
351
351
  @keyDirection.z = 0
352
- elsif (evt.key == OIS::KC_A && @keyDirection.x == -1)
352
+ elsif (evt.key == Ois::KC_A && @keyDirection.x == -1)
353
353
  @keyDirection.x = 0
354
- elsif (evt.key == OIS::KC_S && @keyDirection.z == 1)
354
+ elsif (evt.key == Ois::KC_S && @keyDirection.z == 1)
355
355
  @keyDirection.z = 0
356
- elsif (evt.key == OIS::KC_D && @keyDirection.x == 1)
356
+ elsif (evt.key == Ois::KC_D && @keyDirection.x == 1)
357
357
  @keyDirection.x = 0
358
358
  end
359
359
 
360
- if (@keyDirection.isZeroLength() && @baseAnimID == ANIM_RUN_BASE)
360
+ if (@keyDirection.is_zero_length() && @baseAnimID == ANIM_RUN_BASE)
361
361
  # stop running if already moving and the player doesn't want to move
362
- setBaseAnimation(ANIM_IDLE_BASE);
363
- setTopAnimation(ANIM_IDLE_TOP) if (@topAnimID == ANIM_RUN_TOP)
362
+ set_base_animation(ANIM_IDLE_BASE)
363
+ set_top_animation(ANIM_IDLE_TOP) if (@topAnimID == ANIM_RUN_TOP)
364
364
  end
365
365
  end
366
366
 
367
- def injectMouseDown(evt, id)
367
+ def inject_mouse_down(evt, id)
368
368
  if (@swordsDrawn && (@topAnimID == ANIM_IDLE_TOP || @topAnimID == ANIM_RUN_TOP))
369
369
  # if swords are out, and character's not doing something weird, then SLICE!
370
- if (id == OIS::MB_Left)
371
- setTopAnimation(ANIM_SLICE_VERTICAL, true)
372
- elsif (id == OIS::MB_Right)
373
- setTopAnimation(ANIM_SLICE_HORIZONTAL, true)
370
+ if (id == Ois::MB_Left)
371
+ set_top_animation(ANIM_SLICE_VERTICAL, true)
372
+ elsif (id == Ois::MB_Right)
373
+ set_top_animation(ANIM_SLICE_HORIZONTAL, true)
374
374
  end
375
375
  @timer = 0
376
376
  end