Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
openjazz
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
openjazz
Commits
fc173b53
Commit
fc173b53
authored
Mar 05, 2010
by
alistert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes, including event paths.
parent
59956ced
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
60 additions
and
30 deletions
+60
-30
eventframe.cpp
src/level/event/eventframe.cpp
+6
-4
level.cpp
src/level/level.cpp
+8
-2
level.h
src/level/level.h
+15
-8
levelframe.cpp
src/level/levelframe.cpp
+1
-1
levelload.cpp
src/level/levelload.cpp
+14
-9
bird.cpp
src/player/bird.cpp
+4
-4
player.cpp
src/player/player.cpp
+11
-1
playerframe.cpp
src/player/playerframe.cpp
+1
-1
No files found.
src/level/event/eventframe.cpp
View file @
fc173b53
...
@@ -164,8 +164,8 @@ bool Event::step (unsigned int ticks, int msps) {
...
@@ -164,8 +164,8 @@ bool Event::step (unsigned int ticks, int msps) {
case
6
:
case
6
:
// Use the path from the level file
// Use the path from the level file
dx
=
TTOF
(
gridX
)
+
F16
+
(
level
->
path
X
[
level
->
pathN
ode
]
<<
9
)
-
x
;
dx
=
TTOF
(
gridX
)
+
F16
+
(
level
->
path
[
set
[
E_MULTIPURPOSE
]].
x
[
level
->
path
[
set
[
E_MULTIPURPOSE
]].
n
ode
]
<<
9
)
-
x
;
dy
=
TTOF
(
gridY
)
+
(
level
->
path
Y
[
level
->
pathN
ode
]
<<
9
)
-
y
;
dy
=
TTOF
(
gridY
)
+
(
level
->
path
[
set
[
E_MULTIPURPOSE
]].
y
[
level
->
path
[
set
[
E_MULTIPURPOSE
]].
n
ode
]
<<
9
)
-
y
;
dx
=
((
dx
<<
10
)
/
msps
)
*
set
[
E_MOVEMENTSP
];
dx
=
((
dx
<<
10
)
/
msps
)
*
set
[
E_MOVEMENTSP
];
dy
=
((
dy
<<
10
)
/
msps
)
*
set
[
E_MOVEMENTSP
];
dy
=
((
dy
<<
10
)
/
msps
)
*
set
[
E_MOVEMENTSP
];
...
@@ -607,9 +607,11 @@ bool Event::step (unsigned int ticks, int msps) {
...
@@ -607,9 +607,11 @@ bool Event::step (unsigned int ticks, int msps) {
// Use the path from the level file
// Use the path from the level file
count
=
level
->
path
[
set
[
E_MULTIPURPOSE
]].
node
;
// Check movement direction
// Check movement direction
if
((
level
->
pathNode
<
3
)
||
if
((
count
<
3
)
||
(
level
->
path
X
[
level
->
pathNode
]
<=
level
->
pathX
[
level
->
pathNode
-
3
]))
(
level
->
path
[
set
[
E_MULTIPURPOSE
]].
x
[
count
]
<=
level
->
path
[
set
[
E_MULTIPURPOSE
]].
x
[
count
-
3
]))
animType
=
E_LEFTANIM
;
animType
=
E_LEFTANIM
;
else
else
animType
=
E_RIGHTANIM
;
animType
=
E_RIGHTANIM
;
...
...
src/level/level.cpp
View file @
fc173b53
...
@@ -80,6 +80,8 @@ Level::Level (char *fileName, unsigned char diff, bool checkpoint) {
...
@@ -80,6 +80,8 @@ Level::Level (char *fileName, unsigned char diff, bool checkpoint) {
Level
::~
Level
()
{
Level
::~
Level
()
{
int
count
;
// Free all data
// Free all data
stopMusic
();
stopMusic
();
...
@@ -112,8 +114,12 @@ Level::~Level () {
...
@@ -112,8 +114,12 @@ Level::~Level () {
}
}
delete
[]
pathX
;
for
(
count
=
0
;
count
<
PATHS
;
count
++
)
{
delete
[]
pathY
;
delete
[]
path
[
count
].
x
;
delete
[]
path
[
count
].
y
;
}
SDL_FreeSurface
(
tileSet
);
SDL_FreeSurface
(
tileSet
);
...
...
src/level/level.h
View file @
fc173b53
...
@@ -52,6 +52,7 @@
...
@@ -52,6 +52,7 @@
#define BULLETS 32
#define BULLETS 32
#define BLENGTH 20
/* Length of bullets, in bytes */
#define BLENGTH 20
/* Length of bullets, in bytes */
#define ANIMS 128
#define ANIMS 128
#define PATHS 16
#define TKEY 127
/* Tileset colour key */
#define TKEY 127
/* Tileset colour key */
// Stages
// Stages
...
@@ -73,7 +74,7 @@
...
@@ -73,7 +74,7 @@
#define TTOI(x) ((x) << 5)
#define TTOI(x) ((x) << 5)
// Datatype
// Datatype
s
typedef
struct
{
typedef
struct
{
...
@@ -86,6 +87,15 @@ typedef struct {
...
@@ -86,6 +87,15 @@ typedef struct {
}
GridElement
;
}
GridElement
;
typedef
struct
{
short
int
*
x
;
short
int
*
y
;
unsigned
char
length
;
unsigned
char
node
;
}
EventPath
;
// Classes
// Classes
...
@@ -103,7 +113,7 @@ class Level {
...
@@ -103,7 +113,7 @@ class Level {
Anim
animSet
[
ANIMS
];
Anim
animSet
[
ANIMS
];
char
miscAnims
[
4
];
char
miscAnims
[
4
];
signed
char
bulletSet
[
BULLETS
][
BLENGTH
];
signed
char
bulletSet
[
BULLETS
][
BLENGTH
];
signed
char
eventSet
[
EVENTS
][
ELENGTH
];
// Not all used
signed
char
eventSet
[
EVENTS
][
ELENGTH
];
char
mask
[
240
][
64
];
// At most 240 tiles, all with 8 * 8 masks
char
mask
[
240
][
64
];
// At most 240 tiles, all with 8 * 8 masks
GridElement
grid
[
LH
][
LW
];
// All levels are the same size
GridElement
grid
[
LH
][
LW
];
// All levels are the same size
int
soundMap
[
32
];
int
soundMap
[
32
];
...
@@ -114,7 +124,6 @@ class Level {
...
@@ -114,7 +124,6 @@ class Level {
int
sprites
;
int
sprites
;
int
levelNum
,
worldNum
,
nextLevelNum
,
nextWorldNum
;
int
levelNum
,
worldNum
,
nextLevelNum
,
nextWorldNum
;
unsigned
char
difficulty
;
unsigned
char
difficulty
;
int
pathLength
;
unsigned
int
endTime
;
unsigned
int
endTime
;
int
enemies
,
items
;
int
enemies
,
items
;
fixed
waterLevel
;
fixed
waterLevel
;
...
@@ -136,11 +145,9 @@ class Level {
...
@@ -136,11 +145,9 @@ class Level {
void
timeCalcs
(
bool
paused
);
void
timeCalcs
(
bool
paused
);
public
:
public
:
Event
*
firstEvent
;
Event
*
firstEvent
;
Bullet
*
firstBullet
;
Bullet
*
firstBullet
;
int
*
pathX
;
EventPath
path
[
PATHS
];
int
*
pathY
;
int
pathNode
;
Level
();
Level
();
Level
(
char
*
fileName
,
unsigned
char
diff
,
Level
(
char
*
fileName
,
unsigned
char
diff
,
...
...
src/level/levelframe.cpp
View file @
fc173b53
...
@@ -110,7 +110,7 @@ int Level::step () {
...
@@ -110,7 +110,7 @@ int Level::step () {
// Process active events
// Process active events
pathNode
=
(
ticks
>>
5
)
%
pathL
ength
;
for
(
x
=
0
;
x
<
PATHS
;
x
++
)
path
[
x
].
node
=
(
ticks
>>
5
)
%
path
[
x
].
l
ength
;
if
(
firstEvent
)
{
if
(
firstEvent
)
{
...
...
src/level/levelload.cpp
View file @
fc173b53
...
@@ -666,17 +666,22 @@ int Level::load (char *fileName, unsigned char diff, bool checkpoint) {
...
@@ -666,17 +666,22 @@ int Level::load (char *fileName, unsigned char diff, bool checkpoint) {
// Load special event path
// Load special event path
buffer
=
file
->
loadRLE
(
8192
);
buffer
=
file
->
loadRLE
(
PATHS
<<
9
);
pathLength
=
buffer
[
0
]
+
(
buffer
[
1
]
<<
8
);
pathNode
=
0
;
if
(
pathLength
<
1
)
pathLength
=
1
;
pathX
=
new
int
[
pathLength
];
pathY
=
new
int
[
pathLength
];
for
(
count
=
0
;
count
<
pathLength
;
count
++
)
{
for
(
type
=
0
;
type
<
PATHS
;
type
++
)
{
pathX
[
count
]
=
((
signed
char
*
)
buffer
)[(
count
<<
1
)
+
3
]
<<
2
;
path
[
type
].
length
=
buffer
[
type
<<
9
]
+
(
buffer
[(
type
<<
9
)
+
1
]
<<
8
);
pathY
[
count
]
=
((
signed
char
*
)
buffer
)[(
count
<<
1
)
+
2
];
path
[
type
].
node
=
0
;
if
(
path
[
type
].
length
<
1
)
path
[
type
].
length
=
1
;
path
[
type
].
x
=
new
short
int
[
path
[
type
].
length
];
path
[
type
].
y
=
new
short
int
[
path
[
type
].
length
];
for
(
count
=
0
;
count
<
path
[
type
].
length
;
count
++
)
{
path
[
type
].
x
[
count
]
=
((
signed
char
*
)
buffer
)[(
type
<<
9
)
+
(
count
<<
1
)
+
3
]
<<
2
;
path
[
type
].
y
[
count
]
=
((
signed
char
*
)
buffer
)[(
type
<<
9
)
+
(
count
<<
1
)
+
2
]
<<
2
;
}
}
}
...
...
src/player/bird.cpp
View file @
fc173b53
...
@@ -107,13 +107,13 @@ bool Bird::step (unsigned int ticks, int msps) {
...
@@ -107,13 +107,13 @@ bool Bird::step (unsigned int ticks, int msps) {
// To the left of the player, so move right
// To the left of the player, so move right
if
(
dx
<
F
16
0
)
dx
+=
400
*
msps
;
if
(
dx
<
F
8
0
)
dx
+=
400
*
msps
;
}
else
{
}
else
{
// To the right of the player, so move left
// To the right of the player, so move left
if
(
dx
>
-
F
16
0
)
dx
-=
400
*
msps
;
if
(
dx
>
-
F
8
0
)
dx
-=
400
*
msps
;
}
}
...
@@ -137,13 +137,13 @@ bool Bird::step (unsigned int ticks, int msps) {
...
@@ -137,13 +137,13 @@ bool Bird::step (unsigned int ticks, int msps) {
// Above the player, so move downwards
// Above the player, so move downwards
if
(
dy
<
F
16
0
)
dy
+=
400
*
msps
;
if
(
dy
<
F
8
0
)
dy
+=
400
*
msps
;
}
else
{
}
else
{
// Below the player, so move upwards
// Below the player, so move upwards
if
(
dy
>
-
F
16
0
)
dy
-=
400
*
msps
;
if
(
dy
>
-
F
8
0
)
dy
-=
400
*
msps
;
}
}
...
...
src/player/player.cpp
View file @
fc173b53
...
@@ -496,7 +496,17 @@ bool Player::touchEvent (unsigned char gridX, unsigned char gridY, unsigned int
...
@@ -496,7 +496,17 @@ bool Player::touchEvent (unsigned char gridX, unsigned char gridY, unsigned int
jumpY
=
y
-
(
8
*
F16
);
jumpY
=
y
-
(
8
*
F16
);
}
else
x
+=
set
[
E_MAGNITUDE
]
*
20
*
msps
;
}
else
if
(
set
[
E_MAGNITUDE
]
<
0
)
{
if
(
!
level
->
checkMaskDown
(
x
+
PXO_L
+
(
set
[
E_MAGNITUDE
]
*
20
*
msps
),
y
+
PYO_MID
))
x
+=
set
[
E_MAGNITUDE
]
*
20
*
msps
;
}
else
{
if
(
!
level
->
checkMaskDown
(
x
+
PXO_R
+
(
set
[
E_MAGNITUDE
]
*
20
*
msps
),
y
+
PYO_MID
))
x
+=
set
[
E_MAGNITUDE
]
*
20
*
msps
;
}
break
;
break
;
...
...
src/player/playerframe.cpp
View file @
fc173b53
...
@@ -235,7 +235,7 @@ void Player::control (unsigned int ticks, int msps) {
...
@@ -235,7 +235,7 @@ void Player::control (unsigned int ticks, int msps) {
speed
=
level
->
getEvent
(
eventX
,
eventY
)[
E_MULTIPURPOSE
]
*
-
F20
;
speed
=
level
->
getEvent
(
eventX
,
eventY
)[
E_MULTIPURPOSE
]
*
-
F20
;
if
(
speed
=
=
0
)
speed
=
PYS_JUMP
;
if
(
speed
>
=
0
)
speed
=
PYS_JUMP
;
if
(
dy
<
speed
)
dy
=
speed
;
if
(
dy
<
speed
)
dy
=
speed
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment