Jo Engine
2026.11.6
Jo Sega Saturn Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
jo_engine
jo
vehicle.h
Go to the documentation of this file.
1
/*
2
** Jo Sega Saturn Engine
3
** Copyright (c) 2012-2026, Johannes Fetz (johannesfetz@gmail.com)
4
** All rights reserved.
5
**
6
** Redistribution and use in source and binary forms, with or without
7
** modification, are permitted provided that the following conditions are met:
8
** * Redistributions of source code must retain the above copyright
9
** notice, this list of conditions and the following disclaimer.
10
** * Redistributions in binary form must reproduce the above copyright
11
** notice, this list of conditions and the following disclaimer in the
12
** documentation and/or other materials provided with the distribution.
13
** * Neither the name of the Johannes Fetz nor the
14
** names of its contributors may be used to endorse or promote products
15
** derived from this software without specific prior written permission.
16
**
17
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
** DISCLAIMED. IN NO EVENT SHALL Johannes Fetz BE LIABLE FOR ANY
21
** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*/
39
40
#ifndef __JO_VEHICLE_H__
41
# define __JO_VEHICLE_H__
42
43
#if defined(JO_COMPILE_WITH_FS_SUPPORT) && defined(JO_COMPILE_WITH_3D_SUPPORT)
44
45
# include "
entity.h
"
46
53
typedef
bool (*
jo_vehicle_ground_callback
)(
const
jo_fixed
x,
const
jo_fixed
z,
int
*
const
height
);
54
56
typedef
struct
57
{
58
jo_actor
actor
;
59
jo_fixed
speed
;
// World units per second (< 0: backward)
60
int
steer
;
// Angle of the front wheels (degrees, > 0: to the right)
61
int
pitch
;
// The front up (degrees x 16)
62
int
roll
;
// The left side up (degrees x 16)
63
int
wheel_angle
;
// Turn of the wheels (degrees)
64
jo_fixed
lift
;
// Suspension: the body above the mean of the wheels (Q16.16)
65
jo_fixed
lift_speed
;
66
short
wheel_bones
[4];
// Front left, front right, rear left, rear right (-1: none)
67
short
steer_bones
[2];
// Front left, front right
68
short
steering_bone
;
// The steering wheel (turns around its column, see steering_tilt)
69
short
steering_tilt_bone
;
// The parent of the steering wheel: its tilt (-1: none)
70
short
steering_tilt
;
// The tilt toward the driver (degrees, around X): the model of the wheel is flat
71
int
wheelbase
;
// Properties (world units, degrees, world units per second)
72
int
track
;
73
int
wheel_radius
;
74
int
max_steer
;
75
int
max_speed
;
76
int
acceleration
;
77
int
braking
;
78
int
impact
;
// Damage of a hit at the full speed
79
jo_3d_model
*
cockpit
;
// Drawn when the player drives (property cockpit_model: what the
80
// driver sees, the same skeleton), JO_NULL: the model
81
bool
driven
;
// The player drives it
82
bool
hit
;
// It hit something (this frame)
83
}
jo_vehicle
;
84
88
void
jo_vehicles_set_ground_callback
(
const
jo_vehicle_ground_callback
callback);
89
97
void
jo_vehicle_drive
(
jo_entity
*
const
entity,
const
int
throttle,
const
int
steering,
const
bool
brake,
98
const
int
elapsed);
99
105
void
jo_vehicle_to_world
(
const
jo_entity
*
const
entity,
const
jo_pos3D_fixed
*
const
local,
106
jo_pos3D_fixed
*
const
world);
107
112
jo_vehicle
*
jo_vehicle_get
(
jo_entity
*
const
entity);
113
114
#endif
/* !JO_COMPILE_WITH_FS_SUPPORT && JO_COMPILE_WITH_3D_SUPPORT */
115
116
#endif
/* !__JO_VEHICLE_H__ */
117
118
/*
119
** END OF FILE
120
*/
entity.h
Entities: the things of a level that live (barrels that explode, trigger zones, relays,...
height
int height
Definition
entity.h:4
jo_entity
struct __jo_entity jo_entity
Definition
entity.h:81
jo_actor
Data of an actor (the first member of the data of a class of actors).
Definition
entity.h:417
jo_3d_model
3D model loaded from a JOM file
Definition
model.h:242
jo_fixed
int jo_fixed
Fixed point Q16.16 number.
Definition
types.h:59
jo_pos3D_fixed
3D position using fixed numbers
Definition
types.h:103
jo_vehicle::max_speed
int max_speed
Definition
vehicle.h:75
jo_vehicle::braking
int braking
Definition
vehicle.h:77
jo_vehicle::track
int track
Definition
vehicle.h:72
jo_vehicle::actor
jo_actor actor
Definition
vehicle.h:58
jo_vehicle::roll
int roll
Definition
vehicle.h:62
jo_vehicle::impact
int impact
Definition
vehicle.h:78
jo_vehicle::steering_tilt_bone
short steering_tilt_bone
Definition
vehicle.h:69
jo_vehicle::lift_speed
jo_fixed lift_speed
Definition
vehicle.h:65
jo_vehicle::wheel_angle
int wheel_angle
Definition
vehicle.h:63
jo_vehicle::wheelbase
int wheelbase
Definition
vehicle.h:71
jo_vehicle::wheel_radius
int wheel_radius
Definition
vehicle.h:73
jo_vehicle::driven
bool driven
Definition
vehicle.h:81
jo_vehicles_set_ground_callback
void jo_vehicles_set_ground_callback(const jo_vehicle_ground_callback callback)
Give the ground to the vehicles.
jo_vehicle_to_world
void jo_vehicle_to_world(const jo_entity *const entity, const jo_pos3D_fixed *const local, jo_pos3D_fixed *const world)
A point of the vehicle in the world (the seat of the driver, the door...).
jo_vehicle::pitch
int pitch
Definition
vehicle.h:61
jo_vehicle::wheel_bones
short wheel_bones[4]
Definition
vehicle.h:66
jo_vehicle::steering_tilt
short steering_tilt
Definition
vehicle.h:70
jo_vehicle::steering_bone
short steering_bone
Definition
vehicle.h:68
jo_vehicle::max_steer
int max_steer
Definition
vehicle.h:74
jo_vehicle::speed
jo_fixed speed
Definition
vehicle.h:59
jo_vehicle::steer_bones
short steer_bones[2]
Definition
vehicle.h:67
jo_vehicle::cockpit
jo_3d_model * cockpit
Definition
vehicle.h:79
jo_vehicle::lift
jo_fixed lift
Definition
vehicle.h:64
jo_vehicle_drive
void jo_vehicle_drive(jo_entity *const entity, const int throttle, const int steering, const bool brake, const int elapsed)
Drive a vehicle (each frame while the player is in it).
jo_vehicle_get
jo_vehicle * jo_vehicle_get(jo_entity *const entity)
Get the vehicle data of an entity.
jo_vehicle::acceleration
int acceleration
Definition
vehicle.h:76
jo_vehicle::hit
bool hit
Definition
vehicle.h:82
jo_vehicle::steer
int steer
Definition
vehicle.h:60
jo_vehicle_ground_callback
bool(*) jo_vehicle_ground_callback(const jo_fixed x, const jo_fixed z, int *const height)
Height of the ground for the vehicles (given by the game).
Definition
vehicle.h:53
jo_vehicle
Data of a vehicle (the data of the class vehicle: an actor first).
Definition
vehicle.h:57
Generated by
1.18.0