Skip to content

Commit

Permalink
gameplay: adding goto_sym_point move command
Browse files Browse the repository at this point in the history
  • Loading branch information
xesf committed Aug 1, 2023
1 parent a86722c commit 565a6f9
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ _2023_
#### Gameplay

- Adding Push Objects (missing side-ways push in LBA2)
- Adding GOTO_SYM_POINT move command (truck can go backwards)

#### Editor

Expand All @@ -18,6 +19,7 @@ _2023_
- Extra bonus speed
- Behavioiur Menu Icons CSS
- Fixed Sprites out of place caused by wrong scene point coordinates
- Fixed Editor Scene Node Variables


## [v0.6.0](https://github.com/LBALab/lba2remake/compare/v0.5.0...v0.5.1) Big update!
Expand Down
6 changes: 1 addition & 5 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,8 @@ Below are some ideas we want to work on. Feel free to contribute with your own i
- [ ] Sprites not drawn fully (bottom half missing)
- [ ] LBA1: Remove island loading between scenes
- [ ] LBA1: Twinsen stumbles in platforms (2 directions only)
- [ ] Editor: Scene Flags not updating
- [ ] 3D Audio Issues
- [ ] Gameplay: Improve Collisions
- [x] Editor: Scene Flags not updating
- [ ] Scripting: Investigate possible parsing error Scene 155, actor=Hussar, line 135
- [ ] Fix Interjections
- [ ] Improve Bounding Boxes (orientation - LBA1 Truck Citadel)
- [ ] Invisible Bricks Issues
- [ ] Shadows Missing
- [ ] Fix Ground Tiles Atlas Bleeding
Expand Down
9 changes: 8 additions & 1 deletion src/game/Actor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -458,18 +458,25 @@ export default class Actor {
this.physics = initPhysics(this.props);
}

goto(position: THREE.Vector3) {
goto(position: THREE.Vector3, backwards: boolean = false) {
this.physics.temp.destination = position;
let destAngle = angleTo(this.physics.position, position);
if (destAngle < 0) {
destAngle += Math.PI * 2;
}
if (backwards) {
destAngle += Math.PI;
}
this.physics.temp.destAngle = destAngle;
this.state.isWalking = true;
this.state.isTurning = true;
return this.getDistance(position);
}

gotoBackwards(position: THREE.Vector3) {
return this.goto(position, true);
}

gotoPosition(position: THREE.Vector3, delta: number) {
G.position.set(0, 0, 0);
P.set(0, 0, 0);
Expand Down
34 changes: 33 additions & 1 deletion src/game/scripting/move.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,39 @@ export function ANGLE(this: ScriptContext, angle) {
}
}

export const GOTO_SYM_POINT = unimplemented();
export function GOTO_SYM_POINT(this: ScriptContext, point: Point) {
if (!point) {
return;
}
if (this.game.getState().actorTalking > -1) {
this.state.reentryOffset = this.state.offset;
this.state.continue = false;
return;
}
if (this.actor.index === 0 && this.game.controlsState.firstPerson) {
adjustFPAngle(this);
}

let distance = 0;
if (this.actor.props.flags.isSprite) {
distance = this.actor.gotoPosition(
point.physics.position,
this.time.delta * WORLD_SCALE * this.actor.props.speed
);
} else {
distance = this.actor.gotoBackwards(point.physics.position);
}

if (distance > 0.55) {
this.state.reentryOffset = this.state.offset;
this.state.continue = false;
this.state.goingToPoint = true;
} else {
this.actor.stop();
this.state.goingToPoint = false;
delete this.state.lastVRAngleAdjust;
}
}

export function WAIT_NUM_ANIM(this: ScriptContext, repeats) {
if (!this.state.animCount) {
Expand Down
2 changes: 1 addition & 1 deletion www/metadata/lba1/scene_1.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"actorNames": [
null,
null,
"GarbageTruck",
"Grobo",
"CitadelGuard3",
"CitadelGuard4",
Expand Down

0 comments on commit 565a6f9

Please sign in to comment.