equal
deleted
inserted
replaced
61 state.removePlayer(this); |
61 state.removePlayer(this); |
62 } |
62 } |
63 |
63 |
64 void Player::spawn (Vector position) { |
64 void Player::spawn (Vector position) { |
65 // dig hole |
65 // dig hole |
66 world.removeGround(position, PLAYER_DIG_RADIUS); |
66 world.terrain.removeGround(position, PLAYER_DIG_RADIUS); |
67 |
67 |
68 // update position |
68 // update position |
69 setPosition(position); |
69 setPosition(position); |
70 |
70 |
71 // reset health |
71 // reset health |
106 void Player::handleDig (Vector pos, float radius) { |
106 void Player::handleDig (Vector pos, float radius) { |
107 // calculate new position and velocity |
107 // calculate new position and velocity |
108 Vector digPosition = pos + getDirection() * PROJECTILE_START_DISTANCE; |
108 Vector digPosition = pos + getDirection() * PROJECTILE_START_DISTANCE; |
109 |
109 |
110 // remove directly |
110 // remove directly |
111 world.removeGround(digPosition, radius); |
111 world.terrain.removeGround(digPosition, radius); |
112 } |
112 } |
113 |
113 |
114 void Player::handleFireWeapon (Weapon *weapon, Vector position, Vector velocity) { |
114 void Player::handleFireWeapon (Weapon *weapon, Vector position, Vector velocity) { |
115 weaponFired(weapon); |
115 weaponFired(weapon); |
116 |
116 |
361 (aim_img_idx + 1) * img_height |
361 (aim_img_idx + 1) * img_height |
362 ), destination, gc |
362 ), destination, gc |
363 ); |
363 ); |
364 |
364 |
365 // draw a proper crosshair-box |
365 // draw a proper crosshair-box |
366 PixelCoordinate crosshair = getCoordinate() + world.getPixelCoordinate(getDirection() * PLAYER_CROSSHAIR_DISTANCE) - camera; |
366 PixelCoordinate crosshair = getCoordinate() + world.terrain.getPixelCoordinate(getDirection() * PLAYER_CROSSHAIR_DISTANCE) - camera; |
367 |
367 |
368 gc->draw_rect( |
368 gc->draw_rect( |
369 CL_Rectf( |
369 CL_Rectf( |
370 crosshair.x - PLAYER_CROSSHAIR_WIDTH / 2, |
370 crosshair.x - PLAYER_CROSSHAIR_WIDTH / 2, |
371 crosshair.y - PLAYER_CROSSHAIR_WIDTH / 2, |
371 crosshair.y - PLAYER_CROSSHAIR_WIDTH / 2, |