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
4da24843
Commit
4da24843
authored
Oct 03, 2010
by
alistert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Doxygenated comments.
parent
1738194a
Changes
83
Show whitespace changes
Inline
Side-by-side
Showing
83 changed files
with
1474 additions
and
947 deletions
+1474
-947
OpenJazz.h
src/OpenJazz.h
+8
-7
baselevel.cpp
src/baselevel.cpp
+50
-8
baselevel.h
src/baselevel.h
+26
-18
bonus.cpp
src/bonus/bonus.cpp
+12
-10
bonus.h
src/bonus/bonus.h
+18
-15
clientgame.cpp
src/game/clientgame.cpp
+49
-14
game.cpp
src/game/game.cpp
+82
-7
game.h
src/game/game.h
+34
-28
gamemode.cpp
src/game/gamemode.cpp
+116
-5
gamemode.h
src/game/gamemode.h
+21
-10
servergame.cpp
src/game/servergame.cpp
+46
-5
controls.cpp
src/io/controls.cpp
+7
-8
controls.h
src/io/controls.h
+13
-12
file.cpp
src/io/file.cpp
+16
-8
file.h
src/io/file.h
+12
-9
anim.cpp
src/io/gfx/anim.cpp
+6
-5
anim.h
src/io/gfx/anim.h
+13
-11
font.cpp
src/io/gfx/font.cpp
+16
-11
font.h
src/io/gfx/font.h
+19
-17
paletteeffects.cpp
src/io/gfx/paletteeffects.cpp
+7
-6
paletteeffects.h
src/io/gfx/paletteeffects.h
+38
-36
sprite.cpp
src/io/gfx/sprite.cpp
+6
-5
sprite.h
src/io/gfx/sprite.h
+9
-7
video.cpp
src/io/gfx/video.cpp
+9
-10
video.h
src/io/gfx/video.h
+21
-17
network.cpp
src/io/network.cpp
+14
-7
network.h
src/io/network.h
+9
-7
sound.cpp
src/io/sound.cpp
+10
-10
sound.h
src/io/sound.h
+8
-6
jj2event.cpp
src/jj2level/jj2event/jj2event.cpp
+6
-7
jj2event.h
src/jj2level/jj2event/jj2event.h
+13
-6
jj2eventframe.cpp
src/jj2level/jj2event/jj2eventframe.cpp
+10
-11
jj2layer.cpp
src/jj2level/jj2layer.cpp
+12
-11
jj2level.cpp
src/jj2level/jj2level.cpp
+12
-10
jj2level.h
src/jj2level/jj2level.h
+44
-35
jj2levelframe.cpp
src/jj2level/jj2levelframe.cpp
+7
-8
jj2levelload.cpp
src/jj2level/jj2levelload.cpp
+7
-8
bullet.cpp
src/level/bullet.cpp
+6
-5
bullet.h
src/level/bullet.h
+13
-11
demolevel.cpp
src/level/demolevel.cpp
+7
-8
bridge.cpp
src/level/event/bridge.cpp
+7
-8
event.cpp
src/level/event/event.cpp
+16
-11
event.h
src/level/event/event.h
+14
-11
eventframe.cpp
src/level/event/eventframe.cpp
+31
-32
guardians.cpp
src/level/event/guardians.cpp
+7
-8
guardians.h
src/level/event/guardians.h
+9
-8
level.cpp
src/level/level.cpp
+12
-10
level.h
src/level/level.h
+55
-48
levelframe.cpp
src/level/levelframe.cpp
+7
-8
levelload.cpp
src/level/levelload.cpp
+7
-8
movable.cpp
src/level/movable.cpp
+7
-8
movable.h
src/level/movable.h
+8
-6
loop.h
src/loop.h
+6
-4
main.cpp
src/main.cpp
+42
-12
gamemenu.cpp
src/menu/gamemenu.cpp
+8
-9
mainmenu.cpp
src/menu/mainmenu.cpp
+7
-8
menu.cpp
src/menu/menu.cpp
+16
-14
menu.h
src/menu/menu.h
+23
-21
plasma.cpp
src/menu/plasma.cpp
+21
-17
plasma.h
src/menu/plasma.h
+7
-5
setupmenu.cpp
src/menu/setupmenu.cpp
+7
-8
planet.cpp
src/planet/planet.cpp
+7
-8
planet.h
src/planet/planet.h
+12
-10
symbian.cpp
src/platforms/symbian.cpp
+20
-1
wiz.cpp
src/platforms/wiz.cpp
+18
-0
wiz.h
src/platforms/wiz.h
+18
-0
bird.cpp
src/player/bird.cpp
+6
-5
bird.h
src/player/bird.h
+11
-9
bonusplayer.cpp
src/player/bonusplayer.cpp
+8
-9
bonusplayer.h
src/player/bonusplayer.h
+15
-10
jj2levelplayer.cpp
src/player/jj2levelplayer.cpp
+12
-11
jj2levelplayer.h
src/player/jj2levelplayer.h
+29
-24
jj2levelplayerframe.cpp
src/player/jj2levelplayerframe.cpp
+19
-18
levelplayer.cpp
src/player/levelplayer.cpp
+7
-8
levelplayer.h
src/player/levelplayer.h
+33
-28
levelplayerframe.cpp
src/player/levelplayerframe.cpp
+14
-12
player.cpp
src/player/player.cpp
+13
-12
player.h
src/player/player.h
+24
-20
scene.cpp
src/scene/scene.cpp
+8
-9
scene.h
src/scene/scene.h
+28
-26
sceneload.cpp
src/scene/sceneload.cpp
+8
-9
util.cpp
src/util.cpp
+9
-10
util.h
src/util.h
+6
-5
No files found.
src/OpenJazz.h
View file @
4da24843
/*
/*
*
*
* OpenJazz.h
*
@file
OpenJazz.h
*
* Part of the OpenJazz project
*
* @section History
* 23rd August 2005: Created OpenJazz.h
* 31st January 2006: Created level.h from parts of OpenJazz.h
* 31st January 2006: Created player.h from parts of OpenJazz.h
...
...
@@ -18,9 +21,7 @@
* 30th April 2010: Created util.h from parts of OpenJazz.h
* 30th April 2010: Created loop.h from parts of OpenJazz.h
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
src/baselevel.cpp
View file @
4da24843
/*
/*
*
*
* baselevel.cpp
*
* 30th March 2010: Created baselevel.cpp from parts of level.cpp and
* levelframe.cpp
* @file baselevel.cpp
*
* Part of the OpenJazz project
*
* @section History
* 30th March 2010: Created baselevel.cpp from parts of level.cpp and
* levelframe.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with functionality common to ordinary levels and bonus levels.
*
*/
...
...
@@ -40,6 +39,9 @@
#include "loop.h"
/**
* Create a new base level
*/
BaseLevel
::
BaseLevel
()
{
// Arbitrary initial value
...
...
@@ -59,6 +61,9 @@ BaseLevel::BaseLevel () {
}
/**
* Destroy base level
*/
BaseLevel
::~
BaseLevel
()
{
stopMusic
();
...
...
@@ -70,6 +75,13 @@ BaseLevel::~BaseLevel () {
}
/**
* Play a cutscene.
*
* @param file File name of the cutscene to be played
*
* @return Error code
*/
int
BaseLevel
::
playScene
(
char
*
file
)
{
Scene
*
scene
;
...
...
@@ -97,6 +109,9 @@ int BaseLevel::playScene (char* file) {
}
/**
* Perform timing calculations.
*/
void
BaseLevel
::
timeCalcs
()
{
// Calculate smoothed fps
...
...
@@ -142,6 +157,11 @@ void BaseLevel::timeCalcs () {
}
/**
* Display on-screen statistics.
*
* @param bg Palette index of the statistics box(es)
*/
void
BaseLevel
::
drawStats
(
unsigned
char
bg
)
{
int
count
,
width
;
...
...
@@ -205,6 +225,15 @@ void BaseLevel::drawStats (unsigned char bg) {
}
/**
* Process iteration.
*
* @param menu Whether or not the level menu should be displayed
* @param option Selected menu uption
* @param message Whether or not the "paused" message is being displayed
*
* @return Error code
*/
int
BaseLevel
::
loop
(
bool
&
menu
,
int
&
option
,
bool
&
message
)
{
int
ret
;
...
...
@@ -311,6 +340,9 @@ int BaseLevel::loop (bool& menu, int& option, bool& message) {
}
/**
* Add extra time.
*/
void
BaseLevel
::
addTimer
()
{
unsigned
char
buffer
[
MTL_L_PROP
];
...
...
@@ -336,6 +368,11 @@ void BaseLevel::addTimer () {
}
/**
* Set the level stage.
*
* @param newStage New level stage
*/
void
BaseLevel
::
setStage
(
LevelStage
newStage
)
{
unsigned
char
buffer
[
MTL_L_STAGE
];
...
...
@@ -358,6 +395,11 @@ void BaseLevel::setStage (LevelStage newStage) {
}
/**
* Determine the current level stage.
*
* @return The current level stage.
*/
LevelStage
BaseLevel
::
getStage
()
{
return
stage
;
...
...
src/baselevel.h
View file @
4da24843
/*
/*
*
*
* baselevel.h
*
* 30th March 2010: Created baselevel.h from parts of level.h
* @file baselevel.h
*
* Part of the OpenJazz project
*
* @section History
* 30th March 2010: Created baselevel.h from parts of level.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -39,18 +40,21 @@
// Enums
/// Level type
enum
LevelType
{
LT_LEVEL
,
LT_BONUS
,
LT_JJ2LEVEL
};
/// Which stats to display on-screen
enum
LevelStats
{
S_PLAYERS
=
1
,
S_SCREEN
=
2
};
/// Level stage
enum
LevelStage
{
LS_NORMAL
=
0
,
LS_SUDDENDEATH
=
1
,
LS_END
=
2
...
...
@@ -63,23 +67,27 @@ enum LevelStage {
class
File
;
class
Sprite
;
/// Base class for all level classes
class
BaseLevel
{
private
:
SetupMenu
setupMenu
;
SetupMenu
setupMenu
;
///< Setup menu to run on the player's command
protected
:
PaletteEffect
*
paletteEffects
;
SDL_Color
palette
[
256
];
int
sprites
;
unsigned
int
tickOffset
,
prevStepTicks
,
prevTicks
,
ticks
;
unsigned
int
endTime
;
float
smoothfps
;
int
items
;
bool
multiplayer
;
bool
paused
;
LevelStage
stage
;
int
stats
;
PaletteEffect
*
paletteEffects
;
///< Palette effects in use while playing the level
SDL_Color
palette
[
256
];
///< Palette in use while playing the level
int
sprites
;
///< The number of sprite that have been loaded
unsigned
int
tickOffset
;
///< Level time offset from system time
unsigned
int
prevStepTicks
;
///< Time the last step started
unsigned
int
prevTicks
;
///< Time the last visual update started
unsigned
int
ticks
;
///< Current time
unsigned
int
endTime
;
///< Tick at which the level will end
float
smoothfps
;
///< Smoothed FPS counter
int
items
;
///< Number of items to be collected
bool
multiplayer
;
///< Whether or not this is a multiplayer game
bool
paused
;
///< Whether or not the level is paused
LevelStage
stage
;
///< Level stage
int
stats
;
///< Which statistics to display on-screen, see #LevelStats
int
playScene
(
char
*
file
);
void
timeCalcs
();
...
...
@@ -100,8 +108,8 @@ class BaseLevel {
// Variables
EXTERN
BaseLevel
*
baseLevel
;
EXTERN
fixed
viewX
,
viewY
;
EXTERN
BaseLevel
*
baseLevel
;
///< Current level
EXTERN
fixed
viewX
,
viewY
;
///< Level viewing co-ordinates
#endif
src/bonus/bonus.cpp
View file @
4da24843
/*
/*
*
*
* bonus.cpp
*
* 23rd August 2005: Created bonus.c
* 3rd February 2009: Renamed bonus.c to bonus.cpp
* @file bonus.cpp
*
* Part of the OpenJazz project
*
* @section History
* 23rd August 2005: Created bonus.c
* 3rd February 2009: Renamed bonus.c to bonus.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the loading, running and freeing of bonus levels.
*
*/
...
...
@@ -416,10 +415,13 @@ bool Bonus::checkMask (fixed x, fixed y) {
}
/**
* Interpret data received from client/server
*
* @param buffer Received data
*/
void
Bonus
::
receive
(
unsigned
char
*
buffer
)
{
// Interpret data received from client/server
switch
(
buffer
[
1
])
{
case
MT_L_PROP
:
...
...
src/bonus/bonus.h
View file @
4da24843
/*
/*
*
*
* bonus.h
*
* 3rd February 2009: Created bonus.h
* @file bonus.h
*
* Part of the OpenJazz project
*
* @section History
* 3rd February 2009: Created bonus.h
*
* @section Licence
* Copyright (c) 2009-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -42,10 +43,11 @@
// Datatype
/// JJ1 bonus level grid element
typedef
struct
{
unsigned
char
tile
;
// Indexes the tile set
unsigned
char
event
;
unsigned
char
tile
;
//
/<
Indexes the tile set
unsigned
char
event
;
///< Event type
}
BonusGridElement
;
...
...
@@ -54,17 +56,18 @@ typedef struct {
class
Font
;
/// JJ1 bonus level
class
Bonus
:
public
BaseLevel
{
private
:
SDL_Surface
*
tileSet
;
SDL_Surface
*
background
;
Font
*
font
;
Sprite
*
spriteSet
;
Anim
animSet
[
BANIMS
];
BonusGridElement
grid
[
BLH
][
BLW
];
char
mask
[
60
][
64
];
//
At most 60 tiles, all with 8 * 8 masks
fixed
direction
;
SDL_Surface
*
tileSet
;
///< Tile images
SDL_Surface
*
background
;
///< Background image
Font
*
font
;
///< On-screen message font
Sprite
*
spriteSet
;
///< Sprite images
Anim
animSet
[
BANIMS
];
///< Animations
BonusGridElement
grid
[
BLH
][
BLW
];
///< Level grid
char
mask
[
60
][
64
];
//
/< Tile masks (at most 60 tiles, all with 8 * 8 masks)
fixed
direction
;
///< Player's direction
int
loadSprites
();
int
loadTiles
(
char
*
fileName
);
...
...
src/game/clientgame.cpp
View file @
4da24843
/*
/*
*
*
* clientgame.cpp
*
* 18th July 2009: Created clientgame.cpp from parts of game.cpp
* @file clientgame.cpp
*
* Part of the OpenJazz project
*
* @section History
* 18th July 2009: Created clientgame.cpp from parts of game.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -38,6 +39,11 @@
#include <string.h>
/**
* Create game client
*
* @param address Address of the server to which to connect
*/
ClientGame
::
ClientGame
(
char
*
address
)
{
unsigned
char
buffer
[
BUFFER_LENGTH
];
...
...
@@ -229,6 +235,9 @@ ClientGame::ClientGame (char* address) {
}
/**
* Disconnect and destroy client
*/
ClientGame
::~
ClientGame
()
{
net
->
close
(
sock
);
...
...
@@ -242,6 +251,13 @@ ClientGame::~ClientGame () {
}
/**
* Set the next level and receive level data from server
*
* @param fileName The file name of the next level
*
* @return Error code
*/
int
ClientGame
::
setLevel
(
char
*
fileName
)
{
int
ret
;
...
...
@@ -291,6 +307,11 @@ int ClientGame::setLevel (char* fileName) {
}
/**
* Send data to server
*
* @param buffer Data to send. First byte indicates length.
*/
void
ClientGame
::
send
(
unsigned
char
*
buffer
)
{
net
->
send
(
sock
,
buffer
);
...
...
@@ -300,6 +321,13 @@ void ClientGame::send (unsigned char* buffer) {
}
/**
* Game iteration
*
* @param ticks Current time
*
* @return Error code
*/
int
ClientGame
::
step
(
unsigned
int
ticks
)
{
unsigned
char
sendBuffer
[
BUFFER_LENGTH
];
...
...
@@ -505,6 +533,11 @@ int ClientGame::step (unsigned int ticks) {
}
/**
* Ask server to award team a point
*
* @param team Team to receive point
*/
void
ClientGame
::
score
(
unsigned
char
team
)
{
unsigned
char
buffer
[
MTL_G_SCORE
];
...
...
@@ -520,20 +553,22 @@ void ClientGame::score (unsigned char team) {
}
/**
* Ask server to approve new checkpoint
*
* @param gridX X-coordinate (in tiles) of the checkpoint
* @param gridY Y-coordinate (in tiles) of the checkpoint
*/
void
ClientGame
::
setCheckpoint
(
unsigned
char
gridX
,
unsigned
char
gridY
)
{
unsigned
char
buffer
[
MTL_G_CHECK
];
if
(
mode
)
{
buffer
[
0
]
=
MTL_G_CHECK
;
buffer
[
1
]
=
MT_G_CHECK
;
buffer
[
2
]
=
gridX
;
buffer
[
3
]
=
gridY
;
send
(
buffer
);
}
return
;
}
...
...
src/game/game.cpp
View file @
4da24843
/*
/*
*
*
* game.cpp
*
@file
game.cpp
*
* Part of the OpenJazz project
*
* @section History
* 9th March 2009: Created game.cpp from parts of menu.cpp and level.cpp
* 3rd June 2009: Created network.cpp from parts of game.cpp
* 18th July 2009: Created servergame.cpp from parts of game.cpp
* 18th July 2009: Created clientgame.cpp from parts of game.cpp
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -41,6 +42,9 @@
#include <string.h>
/**
* Create base game
*/
Game
::
Game
()
{
levelFile
=
NULL
;
...
...
@@ -52,6 +56,12 @@ Game::Game () {
}
/**
* Create a new game
*
* @param firstLevel File name of the first level to play
* @param gameDifficulty Difficulty setting
*/
Game
::
Game
(
char
*
firstLevel
,
int
gameDifficulty
)
{
levelFile
=
createString
(
firstLevel
);
...
...
@@ -70,6 +80,9 @@ Game::Game (char *firstLevel, int gameDifficulty) {
}
/**
* Destroy game
*/
Game
::~
Game
()
{
if
(
levelFile
)
delete
[]
levelFile
;
...
...
@@ -82,6 +95,13 @@ Game::~Game () {
}
/**
* Create a new game mode
*
* @param modeType The mode to create
*
* @return The new game mode (NULL on failure)
*/
GameMode
*
Game
::
createMode
(
GameModeType
modeType
)
{
switch
(
modeType
)
{
...
...
@@ -113,6 +133,11 @@ GameMode* Game::createMode (GameModeType modeType) {
}
/**
* Get the game's mode
*
* @return The game's mode
*/
GameMode
*
Game
::
getMode
()
{
return
mode
;
...
...
@@ -120,6 +145,13 @@ GameMode* Game::getMode () {
}
/**
* Set the next level
*
* @param fileName The file name of the next level
*
* @return Error code
*/
int
Game
::
setLevel
(
char
*
fileName
)
{
if
(
levelFile
)
delete
[]
levelFile
;
...
...
@@ -132,6 +164,11 @@ int Game::setLevel (char *fileName) {
}
/**
* Play the game
*
* @return Error code
*/
int
Game
::
play
()
{
Planet
*
planet
;
...
...
@@ -326,10 +363,13 @@ int Game::play () {
}
/**
* Move the viewport towards the exit sign
*
* @param change Distance to move
*/
void
Game
::
view
(
int
change
)
{
// Move the viewport towards the exit sign
if
(
TTOF
(
checkX
)
>
viewX
+
(
canvasW
<<
9
)
+
change
)
viewX
+=
change
;
else
if
(
TTOF
(
checkX
)
<
viewX
+
(
canvasW
<<
9
)
-
change
)
viewX
-=
change
;
...
...
@@ -341,6 +381,11 @@ void Game::view (int change) {
}
/**
* No data is sent in single-player mode
*
* @param buffer Data that will not be sent. First byte indicates length.
*/
void
Game
::
send
(
unsigned
char
*
buffer
)
{
// Do nothing
...
...
@@ -350,6 +395,13 @@ void Game::send (unsigned char *buffer) {
}
/**
* Game iteration
*
* @param ticks Current time
*
* @return Error code
*/
int
Game
::
step
(
unsigned
int
ticks
)
{
// Do nothing
...
...
@@ -359,6 +411,11 @@ int Game::step (unsigned int ticks) {
}
/**
* Assign point to team
*
* @param team Team to receive point
*/
void
Game
::
score
(
unsigned
char
team
)
{
// Do nothing
...
...
@@ -368,6 +425,12 @@ void Game::score (unsigned char team) {
}
/**
* Set the checkpoint
*
* @param gridX X-coordinate (in tiles) of the checkpoint
* @param gridY Y-coordinate (in tiles) of the checkpoint
*/
void
Game
::
setCheckpoint
(
unsigned
char
gridX
,
unsigned
char
gridY
)
{
checkX
=
gridX
;
...
...
@@ -378,6 +441,11 @@ void Game::setCheckpoint (unsigned char gridX, unsigned char gridY) {
}
/**
* Make a player restart the level from the beginning/last checkpoint
*
* @param player Player to reset
*/
void
Game
::
resetPlayer
(
Player
*
player
)
{
player
->
reset
(
checkX
,
checkY
);
...
...
@@ -387,6 +455,13 @@ void Game::resetPlayer (Player *player) {
}
/**
* Re-create a player's level player
*
* @param player Player to reset
* @param levelType Type of level (and, consequently, type of level player)
* @param anims New level player's animations
*/
void
Game
::
resetPlayer
(
Player
*
player
,
LevelType
levelType
,
Anim
**
anims
)
{
Anim
*
pAnims
[
PANIMS
];
...
...
src/game/game.h
View file @
4da24843
/*
/*
*
*
* game.h
*
@file
game.h
*
* Part of the OpenJazz project
*
* @section History
* 2nd March 2009: Created network.h from parts of OpenJazz.h
* 9th February 2009: Renamed network.h to game.h
* 2nd August 2009: Created gamemode.h from parts of game.h
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -83,14 +84,17 @@
class
Anim
;
class
File
;
/// Handling for single-player games and base class for multiplayer game handling classes
class
Game
{
protected
:
GameMode
*
mode
;
char
*
levelFile
;
int
difficulty
;
unsigned
int
sendTime
,
checkTime
;
unsigned
char
checkX
,
checkY
;
GameMode
*
mode
;
///< Mode-specific management
char
*
levelFile
;
///< Current level's file name
int
difficulty
;
///< Difficulty setting (0 = easy, 1 = medium, 2 = hard, 3 = turbo (hard in JJ2 levels))
unsigned
int
sendTime
;
///< The next time data will be sent
unsigned
int
checkTime
;
///< The next time a connection/disconnection will be dealt with
unsigned
char
checkX
;
///< X-coordinate of the level checkpoint
unsigned
char
checkY
;
///< Y-coordinate of the level checkpoint
Game
();
...
...
@@ -114,20 +118,21 @@ class Game {
};
/// Game handling for multiplayer servers
class
ServerGame
:
public
Game
{
private
:
int
clientStatus
[
MAX_CLIENTS
];
/*
int
clientStatus
[
MAX_CLIENTS
];
/*
*< Array of client statuses
-2: Connected and operational
-1: Not connected
>=0: Number of bytes of the level that have been sent */
int
clientPlayer
[
MAX_CLIENTS
];
int
clientSock
[
MAX_CLIENTS
];
unsigned
char
recvBuffers
[
MAX_CLIENTS
][
BUFFER_LENGTH
];
int
received
[
MAX_CLIENTS
];
unsigned
char
*
levelData
;
int
levelSize
;
int
sock
;
int
clientPlayer
[
MAX_CLIENTS
];
///< Array of client player indexes
int
clientSock
[
MAX_CLIENTS
];
///< Array of client sockets
unsigned
char
recvBuffers
[
MAX_CLIENTS
][
BUFFER_LENGTH
];
///< Array of buffers containing data received from clients
int
received
[
MAX_CLIENTS
];
///< Array containing the amount of data received from each client
unsigned
char
*
levelData
;
///< Contents of the current level file
int
levelSize
;
///< Size of the current level file
int
sock
;
///< Server socket
public
:
ServerGame
(
GameModeType
mode
,
char
*
firstLevel
,
int
gameDifficulty
);
...
...
@@ -142,15 +147,16 @@ class ServerGame : public Game {
};
/// Game handling for multiplayer clients
class
ClientGame
:
public
Game
{
private
:
File
*
file
;
unsigned
char
recvBuffer
[
BUFFER_LENGTH
];
int
received
;
int
clientID
;
int
maxPlayers
;
int
sock
;
File
*
file
;
///< File to which the incoming level will be written
unsigned
char
recvBuffer
[
BUFFER_LENGTH
];
///< Buffer containing data received from server
int
received
;
///< Amount of data received from server
int
clientID
;
///< Client's index on the server
int
maxPlayers
;
///< The maximum number of players in the game
int
sock
;
///< Client socket
public
:
ClientGame
(
char
*
address
);
...
...
@@ -167,7 +173,7 @@ class ClientGame : public Game {
// Variable
EXTERN
Game
*
game
;
EXTERN
Game
*
game
;
///< Current game
#endif
src/game/gamemode.cpp
View file @
4da24843
/*
/*
*
*
* gamemode.cpp
*
* 2nd August 2009: Created gamemode.cpp from parts of servergame.cpp
* @file gamemode.cpp
*
* Part of the OpenJazz project
*
* @section History
* 2nd August 2009: Created gamemode.cpp from parts of servergame.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -28,6 +29,14 @@
#include "player/levelplayer.h"
/**
* Outcome of player being hit
*
* @param source Player responsible for the hit
* @param victim Player victim of the hit
*
* @return Whether or not the hit should result in energy loss (true)
*/
bool
GameMode
::
hit
(
Player
*
source
,
Player
*
victim
)
{
return
true
;
...
...
@@ -35,6 +44,14 @@ bool GameMode::hit (Player *source, Player *victim) {
}
/**
* Outcome of player being killed
*
* @param source Player responsible for the kill
* @param victim Player victim of the kill
*
* @return Whether or not the player should be be killed (true)
*/
bool
GameMode
::
kill
(
Player
*
source
,
Player
*
victim
)
{
if
(
source
&&
(
victim
==
localPlayer
))
game
->
score
(
source
->
getTeam
());
...
...
@@ -44,6 +61,15 @@ bool GameMode::kill (Player *source, Player *victim) {
}
/**
* Outcome of level being completed
*
* @param player Player that has completed level
* @param gridX X-coordinate (in tiles) of finishing position
* @param gridY Y-coordinate (in tiles) of finishing position
*
* @return Whether or not the end-of-level signpost should be destroyed (true)
*/
bool
GameMode
::
endOfLevel
(
Player
*
player
,
unsigned
char
gridX
,
unsigned
char
gridY
)
{
game
->
setCheckpoint
(
gridX
,
gridY
);
...
...
@@ -55,6 +81,9 @@ bool GameMode::endOfLevel (Player *player, unsigned char gridX, unsigned char gr
}
/**
* Outcome of time running out
*/
void
GameMode
::
outOfTime
()
{
return
;
...
...
@@ -62,6 +91,11 @@ void GameMode::outOfTime () {
}
/**
* Get the game mode type
*
* @return Game mode type (M_SINGLE)
*/
GameModeType
SingleGameMode
::
getMode
()
{
return
M_SINGLE
;
...
...
@@ -69,6 +103,11 @@ GameModeType SingleGameMode::getMode () {
}
/**
* Choose a team for a new player
*
* @return New player's team (0)
*/
unsigned
char
SingleGameMode
::
chooseTeam
()
{
return
0
;
...
...
@@ -76,6 +115,11 @@ unsigned char SingleGameMode::chooseTeam () {
}
/**
* Draw the player's team's score (not in single-player mode)
*
* @param font Font to use to draw score
*/
void
SingleGameMode
::
drawScore
(
Font
*
font
)
{
return
;
...
...
@@ -83,6 +127,11 @@ void SingleGameMode::drawScore (Font* font) {
}
/**
* Choose a team for a new player
*
* @return New player's team (0)
*/
unsigned
char
CooperativeGameMode
::
chooseTeam
()
{
// All players are on the same team
...
...
@@ -92,6 +141,11 @@ unsigned char CooperativeGameMode::chooseTeam () {
}
/**
* Draw the player's team's score (not in cooperative mode)
*
* @param font Font to use to draw score
*/
void
CooperativeGameMode
::
drawScore
(
Font
*
font
)
{
// Do nothing
...
...
@@ -101,6 +155,11 @@ void CooperativeGameMode::drawScore (Font* font) {
}
/**
* Choose a team for a new player
*
* @return New player's team (unique)
*/
unsigned
char
FreeForAllGameMode
::
chooseTeam
()
{
// Every player is on a separate team
...
...
@@ -123,6 +182,11 @@ unsigned char FreeForAllGameMode::chooseTeam () {
}
/**
* Draw the player's team's score
*
* @param font Font to use to draw score
*/
void
FreeForAllGameMode
::
drawScore
(
Font
*
font
)
{
font
->
showNumber
(
localPlayer
->
teamScore
,
64
,
4
);
...
...
@@ -132,6 +196,11 @@ void FreeForAllGameMode::drawScore (Font* font) {
}
/**
* Choose a team for a new player
*
* @return New player's team (0 or 1)
*/
unsigned
char
TeamGameMode
::
chooseTeam
()
{
// Players are split between two teams
...
...
@@ -158,6 +227,11 @@ unsigned char TeamGameMode::chooseTeam () {
}
/**
* Draw the player's team's score
*
* @param font Font to use to draw score
*/
void
TeamGameMode
::
drawScore
(
Font
*
font
)
{
font
->
showNumber
(
localPlayer
->
teamScore
,
64
,
4
);
...
...
@@ -167,6 +241,11 @@ void TeamGameMode::drawScore (Font* font) {
}
/**
* Get the game mode type
*
* @return Game mode type (M_COOP)
*/
GameModeType
CoopGameMode
::
getMode
()
{
return
M_COOP
;
...
...
@@ -174,6 +253,11 @@ GameModeType CoopGameMode::getMode () {
}
/**
* Get the game mode type
*
* @return Game mode type (M_BATTLE)
*/
GameModeType
BattleGameMode
::
getMode
()
{
return
M_BATTLE
;
...
...
@@ -181,6 +265,11 @@ GameModeType BattleGameMode::getMode () {
}
/**
* Get the game mode type
*
* @return Game mode type (M_TEAMBATTLE)
*/
GameModeType
TeamBattleGameMode
::
getMode
()
{
return
M_TEAMBATTLE
;
...
...
@@ -188,6 +277,11 @@ GameModeType TeamBattleGameMode::getMode () {
}
/**
* Get the game mode type
*
* @return Game mode type (M_RACE)
*/
GameModeType
RaceGameMode
::
getMode
()
{
return
M_RACE
;
...
...
@@ -195,6 +289,14 @@ GameModeType RaceGameMode::getMode () {
}
/**
* Outcome of player being hit
*
* @param source Player responsible for the hit
* @param victim Player victim of the hit
*
* @return Whether or not the hit should result in energy loss (false)
*/
bool
RaceGameMode
::
hit
(
Player
*
source
,
Player
*
victim
)
{
return
false
;
...
...
@@ -202,6 +304,15 @@ bool RaceGameMode::hit (Player *source, Player *victim) {
}
/**
* Outcome of level being completed
*
* @param player Player that has completed level
* @param gridX X-coordinate (in tiles) of finishing position
* @param gridY Y-coordinate (in tiles) of finishing position
*
* @return Whether or not the end-of-level signpost should be destroyed (false)
*/
bool
RaceGameMode
::
endOfLevel
(
Player
*
player
,
unsigned
char
gridX
,
unsigned
char
gridY
)
{
if
(
player
==
localPlayer
)
game
->
score
(
localPlayer
->
getTeam
());
...
...
src/game/gamemode.h
View file @
4da24843
/*
/*
*
*
* gamemode.h
*
* 2nd August 2009: Created gamemode.h from parts of game.h
* @file gamemode.h
*
* Part of the OpenJazz project
*
* @section History
* 2nd August 2009: Created gamemode.h from parts of game.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -34,6 +35,7 @@
// Enum
/// Game mode identifier
enum
GameModeType
{
M_SINGLE
=
0
,
M_COOP
=
1
,
M_BATTLE
=
2
,
M_TEAMBATTLE
=
3
,
M_RACE
=
4
...
...
@@ -46,6 +48,7 @@ enum GameModeType {
class
Font
;
class
Player
;
/// Game mode base class
class
GameMode
{
public
:
...
...
@@ -59,6 +62,7 @@ class GameMode {
};
/// Single-player game mode
class
SingleGameMode
:
public
GameMode
{
public
:
...
...
@@ -68,6 +72,7 @@ class SingleGameMode : public GameMode {
};
/// Co-operative game mode base class
class
CooperativeGameMode
:
public
GameMode
{
public
:
...
...
@@ -76,6 +81,7 @@ class CooperativeGameMode : public GameMode {
};
/// Free-for-all game mode base class
class
FreeForAllGameMode
:
public
GameMode
{
public
:
...
...
@@ -84,6 +90,7 @@ class FreeForAllGameMode : public GameMode {
};
/// Team-based game mode base class
class
TeamGameMode
:
public
GameMode
{
public
:
...
...
@@ -92,6 +99,7 @@ class TeamGameMode : public GameMode {
};
/// Co-operative game mode
class
CoopGameMode
:
public
CooperativeGameMode
{
public
:
...
...
@@ -99,30 +107,33 @@ class CoopGameMode : public CooperativeGameMode {
};
/// Battle game mode
class
BattleGameMode
:
public
FreeForAllGameMode
{
private
:
int
targetKills
;
int
targetKills
;
///< Number of kills required for a player to win
public
:
GameModeType
getMode
();
};
/// Team battle game mode
class
TeamBattleGameMode
:
public
TeamGameMode
{
private
:
int
targetKills
;
int
targetKills
;
///< Number of kills required for a team to win
public
:
GameModeType
getMode
();
};
/// Race game mode
class
RaceGameMode
:
public
FreeForAllGameMode
{
private
:
int
targetLaps
;
int
targetLaps
;
///< Number of laps required for a player to win
public
:
GameModeType
getMode
();
...
...
src/game/servergame.cpp
View file @
4da24843
/*
/*
*
*
* servergame.cpp
*
* 18th July 2009: Created servergame.cpp from parts of game.cpp
* 2nd August 2009: Created gamemode.cpp from parts of servergame.cpp
* @file servergame.cpp
*
* Part of the OpenJazz project
*
* @section History
* 18th July 2009: Created servergame.cpp from parts of game.cpp
* 2nd August 2009: Created gamemode.cpp from parts of servergame.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -36,6 +37,13 @@
#include <string.h>
/**
* Create game server
*
* @param modeType Game mode
* @param firstLevel File name of the first level to play
* @param gameDifficulty Difficulty setting
*/
ServerGame
::
ServerGame
(
GameModeType
modeType
,
char
*
firstLevel
,
int
gameDifficulty
)
{
int
count
;
...
...
@@ -84,6 +92,9 @@ ServerGame::ServerGame (GameModeType modeType, char* firstLevel, int gameDifficu
}
/**
* Disconnect clients and destroy server
*/
ServerGame
::~
ServerGame
()
{
int
count
;
...
...
@@ -105,6 +116,13 @@ ServerGame::~ServerGame () {
}
/**
* Set the next level and load it into memory
*
* @param fileName The file name of the next level
*
* @return Error code
*/
int
ServerGame
::
setLevel
(
char
*
fileName
)
{
File
*
file
;
...
...
@@ -162,6 +180,11 @@ int ServerGame::setLevel (char* fileName) {
}
/**
* Send data to clients
*
* @param buffer Data to send. First byte indicates length.
*/
void
ServerGame
::
send
(
unsigned
char
*
buffer
)
{
int
count
;
...
...
@@ -182,6 +205,13 @@ void ServerGame::send (unsigned char* buffer) {
}
/**
* Game iteration
*
* @param ticks Current time
*
* @return Error code
*/
int
ServerGame
::
step
(
unsigned
int
ticks
)
{
unsigned
char
sendBuffer
[
BUFFER_LENGTH
];
...
...
@@ -449,6 +479,11 @@ int ServerGame::step (unsigned int ticks) {
}
/**
* Assign point to team and inform clients
*
* @param team Team to receive point
*/
void
ServerGame
::
score
(
unsigned
char
team
)
{
unsigned
char
buffer
[
MTL_G_SCORE
];
...
...
@@ -472,6 +507,12 @@ void ServerGame::score (unsigned char team) {
}
/**
* Set the checkpoint and inform clients
*
* @param gridX X-coordinate (in tiles) of the checkpoint
* @param gridY Y-coordinate (in tiles) of the checkpoint
*/
void
ServerGame
::
setCheckpoint
(
unsigned
char
gridX
,
unsigned
char
gridY
)
{
unsigned
char
buffer
[
MTL_G_CHECK
];
...
...
src/io/controls.cpp
View file @
4da24843
/*
/*
*
*
* controls.cpp
*
* 13th July 2009: Created controls.cpp from parts of main.cpp
* @file controls.cpp
*
* Part of the OpenJazz project
*
* @section History
* 13th July 2009: Created controls.cpp from parts of main.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -17,9 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with input.
*
*/
...
...
src/io/controls.h
View file @
4da24843
/*
/*
*
*
* controls.h
*
* 13th July 2009: Created controls.h from parts of OpenJazz.h
* @file controls.h
*
* Part of the OpenJazz project
*
* @section History
* 13th July 2009: Created controls.h from parts of OpenJazz.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -54,35 +55,35 @@
// Class
/// Keeps track of all control input
class
Controls
{
private
:
struct
{
int
key
;
// Keyboard key
int
key
;
//
/<
Keyboard key
bool
state
;
}
keys
[
CONTROLS
];
struct
{
int
button
;
// Joystick button
int
button
;
//
/<
Joystick button
bool
state
;
}
buttons
[
CONTROLS
];
struct
{
int
axis
;
// Joystick axis
bool
direction
;
// Axis direction
int
axis
;
//
/<
Joystick axis
bool
direction
;
//
/<
Axis direction
bool
state
;
}
axes
[
CONTROLS
];
struct
{
unsigned
int
time
;
/* The time from which the control will respond
to being pressed */
unsigned
int
time
;
///< The time from which the control will respond to being pressed
bool
state
;
}
controls
[
CONTROLS
];
...
...
src/io/file.cpp
View file @
4da24843
/*
/*
*
*
* file.cpp
*
* 3rd February 2009: Created file.cpp from parts of util.cpp
* @file file.cpp
*
* Part of the OpenJazz project
*
* @section History
* 3rd February 2009: Created file.cpp from parts of util.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -17,6 +18,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* @section Description
* Deals with files.
*
*/
...
...
@@ -29,12 +33,16 @@
#include <zlib.h>
/**
* Try opening a file from the available paths
*
* @param name File name
* @param write Whether or not the file can be written to
*/
File
::
File
(
const
char
*
name
,
bool
write
)
{
Path
*
path
;
// Try opening the file from all the available directories
path
=
firstPath
;
while
(
path
)
{
...
...
src/io/file.h
View file @
4da24843
/*
/*
*
*
* file.h
*
* 3rd February 2009: Created file.h from parts of OpenJazz.h
* @file file.h
*
* Part of the OpenJazz project
*
* @section History
* 3rd February 2009: Created file.h from parts of OpenJazz.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -32,6 +33,7 @@
// Classes
/// File i/o
class
File
{
private
:
...
...
@@ -66,11 +68,12 @@ class File {
};
/// Directory path
class
Path
{
public
:
Path
*
next
;
char
*
path
;
Path
*
next
;
///< Next path to check
char
*
path
;
///< Path
Path
(
Path
*
newNext
,
char
*
newPath
);
~
Path
();
...
...
src/io/gfx/anim.cpp
View file @
4da24843
/*
/*
*
*
* anim.cpp
*
* 26th July 2009: Created anim.cpp from parts of sprite.cpp
* @file anim.cpp
*
* Part of the OpenJazz project
*
* @section History
* 26th July 2009: Created anim.cpp from parts of sprite.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
src/io/gfx/anim.h
View file @
4da24843
/*
/*
*
*
* anim.h
*
* 26th July 2009: Created anim.h from parts of sprite.h
* @file anim.h
*
* Part of the OpenJazz project
*
* @section History
* 26th July 2009: Created anim.h from parts of sprite.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -33,10 +34,11 @@
class
Sprite
;
/// Animation
class
Anim
{
private
:
Sprite
**
sprites
;
Sprite
**
sprites
;
///< Sprite images
signed
char
*
xOffsets
;
signed
char
*
yOffsets
;
bool
ignoreDefaultYOffset
;
...
...
@@ -45,10 +47,10 @@ class Anim {
signed
char
accessoryX
;
signed
char
accessoryY
;
signed
char
yOffset
;
unsigned
char
frames
;
// Number of frames
unsigned
char
frame
;
// Current frame
unsigned
char
accessory
;
// Number of an animation that is an accessory to this animation
// Most of the time accessories are used with guardians.
unsigned
char
frames
;
//
/<
Number of frames
unsigned
char
frame
;
//
/<
Current frame
unsigned
char
accessory
;
//
/<
Number of an animation that is an accessory to this animation
//
/<
Most of the time accessories are used with guardians.
public
:
Anim
();
...
...
src/io/gfx/font.cpp
View file @
4da24843
/*
/*
*
*
* font.cpp
*
* 23rd August 2005: Created font.c
* 3rd February 2009: Renamed font.c to font.cpp
* @file font.cpp
*
* Part of the OpenJazz project
*
* @section History
* 23rd August 2005: Created font.c
* 3rd February 2009: Renamed font.c to font.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the loading, displaying and freeing of screen fonts.
*
*/
...
...
@@ -494,13 +493,19 @@ void Font::showNumber (int n, int x, int y) {
}
/**
* Map a range of palette indices to another range
*
* @param start Start of original range
* @param length Span of original range
* @param newStart Start of new range
* @param newLength Span of new range
*/
void
Font
::
mapPalette
(
int
start
,
int
length
,
int
newStart
,
int
newLength
)
{
SDL_Color
palette
[
256
];
int
count
;
// Map a range of palette indices to another range
for
(
count
=
0
;
count
<
length
;
count
++
)
palette
[
count
].
r
=
palette
[
count
].
g
=
palette
[
count
].
b
=
(
count
*
newLength
/
length
)
+
newStart
;
...
...
src/io/gfx/font.h
View file @
4da24843
/*
/*
*
*
* font.h
*
* 3rd February 2009: Created font.h from parts of OpenJazz.h
* @file font.h
*
* Part of the OpenJazz project
*
* @section History
* 3rd February 2009: Created font.h from parts of OpenJazz.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -33,13 +34,14 @@
class
File
;
/// Font
class
Font
{
private
:
SDL_Surface
*
characters
[
128
];
int
nCharacters
;
unsigned
char
lineHeight
;
char
map
[
128
];
//
Maps ASCII values to letter position
s
SDL_Surface
*
characters
[
128
];
///< Symbol images
int
nCharacters
;
///< Number of symbols
unsigned
char
lineHeight
;
///< Vertical spacing of displayed characters
char
map
[
128
];
//
/< Maps ASCII values to symbol indice
s
public
:
Font
(
const
char
*
fileName
);
...
...
@@ -61,13 +63,13 @@ class Font {
// Variables
EXTERN
Font
*
font2
;
/* Taken from .0FN file name */
EXTERN
Font
*
fontbig
;
/* Taken from .0FN file name */
EXTERN
Font
*
fontiny
;
/* Taken from .0FN file name */
EXTERN
Font
*
fontmn1
;
/* Taken from .0FN file name */
EXTERN
Font
*
fontmn2
;
/* Taken from .0FN file name */
EXTERN
Font
*
panelBigFont
;
/* Found in PANEL.000 */
EXTERN
Font
*
panelSmallFont
;
/* Found in PANEL.000 */
EXTERN
Font
*
font2
;
/*
*
Taken from .0FN file name */
EXTERN
Font
*
fontbig
;
/*
*
Taken from .0FN file name */
EXTERN
Font
*
fontiny
;
/*
*
Taken from .0FN file name */
EXTERN
Font
*
fontmn1
;
/*
*
Taken from .0FN file name */
EXTERN
Font
*
fontmn2
;
/*
*
Taken from .0FN file name */
EXTERN
Font
*
panelBigFont
;
/*
*
Found in PANEL.000 */
EXTERN
Font
*
panelSmallFont
;
/*
*
Found in PANEL.000 */
#endif
src/io/gfx/paletteeffects.cpp
View file @
4da24843
/*
/*
*
*
* paletteeffects.cpp
*
* 4th February 2009: Created palette.cpp from parts of main.cpp and util.cpp
* 1st August 2009: Renamed palette.cpp to paletteeffects.cpp
* @file paletteeffects.cpp
*
* Part of the OpenJazz project
*
* @section History
* 4th February 2009: Created palette.cpp from parts of main.cpp and util.cpp
* 1st August 2009: Renamed palette.cpp to paletteeffects.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -61,7 +62,7 @@ void PaletteEffect::apply (SDL_Color* shownPalette, bool direct, int mspf) {
WhiteInPaletteEffect
::
WhiteInPaletteEffect
(
fixed
newDuration
,
PaletteEffect
*
nextPE
)
:
PaletteEffect
(
nextPE
)
{
(
int
newDuration
,
PaletteEffect
*
nextPE
)
:
PaletteEffect
(
nextPE
)
{
duration
=
newDuration
;
whiteness
=
F1
+
FH
;
...
...
src/io/gfx/paletteeffects.h
View file @
4da24843
/*
/*
*
*
* paletteeffects.h
*
* 4th February 2009: Created palette.h from parts of OpenJazz.h
* 1st August 2009: Renamed palette.h to paletteeffects.h
* @file paletteeffects.h
*
* Part of the OpenJazz project
*
* @section History
* 4th February 2009: Created palette.h from parts of OpenJazz.h
* 1st August 2009: Renamed palette.h to paletteeffects.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -46,10 +47,11 @@
// Class
/// Palette effect base class
class
PaletteEffect
{
protected
:
PaletteEffect
*
next
;
// Next effect to use
PaletteEffect
*
next
;
//
/<
Next effect to use
public
:
PaletteEffect
(
PaletteEffect
*
nextPE
);
...
...
@@ -59,11 +61,11 @@ class PaletteEffect {
};
/// Dissolve from white palette effect
class
WhiteInPaletteEffect
:
public
PaletteEffect
{
private
:
int
duration
;
// Number of milliseconds the effect lasts
int
duration
;
//
/<
Number of milliseconds the effect lasts
fixed
whiteness
;
public
:
...
...
@@ -73,11 +75,11 @@ class WhiteInPaletteEffect : public PaletteEffect {
};
/// Fade in palette effect
class
FadeInPaletteEffect
:
public
PaletteEffect
{
private
:
int
duration
;
// Number of milliseconds the effect lasts
int
duration
;
//
/<
Number of milliseconds the effect lasts
fixed
blackness
;
public
:
...
...
@@ -87,11 +89,11 @@ class FadeInPaletteEffect : public PaletteEffect {
};
/// Dissolve to white palette effect
class
WhiteOutPaletteEffect
:
public
PaletteEffect
{
private
:
int
duration
;
// Number of milliseconds the effect lasts
int
duration
;
//
/<
Number of milliseconds the effect lasts
fixed
whiteness
;
public
:
...
...
@@ -101,11 +103,11 @@ class WhiteOutPaletteEffect : public PaletteEffect {
};
/// Fade out palette effect
class
FadeOutPaletteEffect
:
public
PaletteEffect
{
private
:
int
duration
;
// Number of milliseconds the effect lasts
int
duration
;
//
/<
Number of milliseconds the effect lasts
fixed
blackness
;
public
:
...
...
@@ -115,13 +117,13 @@ class FadeOutPaletteEffect : public PaletteEffect {
};
/// Flash colour (dissolve to it and back again) palette effect
class
FlashPaletteEffect
:
public
PaletteEffect
{
private
:
int
duration
;
// Number of milliseconds the effect lasts
int
duration
;
//
/<
Number of milliseconds the effect lasts
fixed
progress
;
unsigned
char
red
,
green
,
blue
;
// Flash colour
unsigned
char
red
,
green
,
blue
;
//
/<
Flash colour
public
:
FlashPaletteEffect
(
unsigned
char
newRed
,
unsigned
char
newGreen
,
unsigned
char
newBlue
,
int
newDuration
,
PaletteEffect
*
nextPE
);
...
...
@@ -130,13 +132,13 @@ class FlashPaletteEffect : public PaletteEffect {
};
/// Entry rotation palette effect
class
RotatePaletteEffect
:
public
PaletteEffect
{
private
:
unsigned
char
first
;
/
* The first palette index affected */
int
amount
;
/
* The number of (consecutive) palette indices affected */
fixed
speed
;
// Rotations per second
unsigned
char
first
;
/
//< The first palette index affected
int
amount
;
/
//< The number of (consecutive) palette indices affected
fixed
speed
;
//
/<
Rotations per second
fixed
position
;
public
:
...
...
@@ -146,14 +148,14 @@ class RotatePaletteEffect : public PaletteEffect {
};
/// Sky palette palette effect
class
SkyPaletteEffect
:
public
PaletteEffect
{
private
:
SDL_Color
*
skyPalette
;
unsigned
char
first
;
/
* The first palette index affected */
int
amount
;
/
* The number of (consecutive) palette indices affected */
fixed
speed
;
// Relative Y speed - as in Jazz 2
unsigned
char
first
;
/
//< The first palette index affected
int
amount
;
/
//< The number of (consecutive) palette indices affected
fixed
speed
;
//
/<
Relative Y speed - as in Jazz 2
public
:
SkyPaletteEffect
(
unsigned
char
newFirst
,
int
newAmount
,
fixed
newSpeed
,
SDL_Color
*
newSkyPalette
,
PaletteEffect
*
nextPE
);
...
...
@@ -162,13 +164,13 @@ class SkyPaletteEffect : public PaletteEffect {
};
/// 2D parallaxing background palette effect
class
P2DPaletteEffect
:
public
PaletteEffect
{
private
:
unsigned
char
first
;
/
* The first palette index affected */
int
amount
;
/
* The number of (consecutive) palette indices affected */
fixed
speed
;
// Relative X & Y speed - as in Jazz 2
unsigned
char
first
;
/
//< The first palette index affected
int
amount
;
/
//< The number of (consecutive) palette indices affected
fixed
speed
;
//
/<
Relative X & Y speed - as in Jazz 2
public
:
P2DPaletteEffect
(
unsigned
char
newFirst
,
int
newAmount
,
fixed
newSpeed
,
PaletteEffect
*
nextPE
);
...
...
@@ -177,13 +179,13 @@ class P2DPaletteEffect : public PaletteEffect {
};
/// 1D parallaxing background palette effect
class
P1DPaletteEffect
:
public
PaletteEffect
{
private
:
unsigned
char
first
;
/
* The first palette index affected */
int
amount
;
/
* The number of (consecutive) palette indices affected */
fixed
speed
;
// Relative X & Y speed - as in Jazz 2
unsigned
char
first
;
/
//< The first palette index affected
int
amount
;
/
//< The number of (consecutive) palette indices affected
fixed
speed
;
//
/<
Relative X & Y speed - as in Jazz 2
public
:
P1DPaletteEffect
(
unsigned
char
newFirst
,
int
newAmount
,
fixed
newSpeed
,
PaletteEffect
*
nextPE
);
...
...
@@ -192,11 +194,11 @@ class P1DPaletteEffect : public PaletteEffect {
};
/// Underwater darkening palette effect
class
WaterPaletteEffect
:
public
PaletteEffect
{
private
:
fixed
depth
;
/
* Number of pixels between water surface and total darkness */
fixed
depth
;
/
//< Number of pixels between water surface and total darkness
public
:
WaterPaletteEffect
(
fixed
newDepth
,
PaletteEffect
*
nextPE
);
...
...
src/io/gfx/sprite.cpp
View file @
4da24843
/*
/*
*
*
* sprite.cpp
*
* 19th March 2009: Created sprite.cpp from parts of event.cpp and player.cpp
* 26th July 2009: Created anim.cpp from parts of sprite.cpp
* @file sprite.cpp
*
* Part of the OpenJazz project
*
* @section History
* 19th March 2009: Created sprite.cpp from parts of event.cpp and player.cpp
* 26th July 2009: Created anim.cpp from parts of sprite.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
src/io/gfx/sprite.h
View file @
4da24843
/*
/*
*
*
* sprite.h
*
* 19th March 2009: Created sprite.h from parts of level.h
* 26th July 2009: Created anim.h from parts of sprite.h
* @file sprite.h
*
* Part of the OpenJazz project
*
* @section History
* 19th March 2009: Created sprite.h from parts of level.h
* 26th July 2009: Created anim.h from parts of sprite.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -32,10 +33,11 @@
// Class
/// Sprite
class
Sprite
{
private
:
SDL_Surface
*
pixels
;
SDL_Surface
*
pixels
;
///< Sprite image
public
:
short
int
xOffset
;
...
...
src/io/gfx/video.cpp
View file @
4da24843
/*
/*
*
*
* video.cpp
*
* 13th July 2009: Created graphics.cpp from parts of util.cpp
* 26th July 2009: Renamed graphics.cpp to video.cpp
* @file video.cpp
*
* Part of the OpenJazz project
*
* @section History
* 13th July 2009: Created graphics.cpp from parts of util.cpp
* 26th July 2009: Renamed graphics.cpp to video.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Contains graphics utility functions.
*
*/
...
...
@@ -152,7 +151,7 @@ bool Video::create (int width, int height) {
gain.
b) the palette is emulated, there will be a HUGE speed loss.
Therefore, assume the palette is emulated. */
//
TODO: Find a better way
//
/ @todo Find a better way to determine if palette is emulated
fakePalette
=
true
;
return
true
;
...
...
src/io/gfx/video.h
View file @
4da24843
/*
/*
*
*
* video.h
*
* 13th July 2009: Created graphics.h from parts of OpenJazz.h
* 26th July 2009: Renamed graphics.h to video.h
* @file video.h
*
* Part of the OpenJazz project
*
* @section History
* 13th July 2009: Created graphics.h from parts of OpenJazz.h
* 26th July 2009: Renamed graphics.h to video.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -53,22 +54,24 @@
// Class
/// Video output
class
Video
{
private
:
SDL_Surface
*
screen
;
SDL_Surface
*
screen
;
///< Output surface
// Palettes
SDL_Color
*
currentPalette
;
SDL_Color
logicalPalette
[
256
];
bool
fakePalette
;
SDL_Color
*
currentPalette
;
///< Current palette
SDL_Color
logicalPalette
[
256
];
///< Logical palette (greyscale)
bool
fakePalette
;
///< Whether or not the palette mode is being emulated
int
screenW
,
screenH
;
int
screenW
;
///< Real width
int
screenH
;
///< Real height
#ifdef SCALE
int
scaleFactor
;
int
scaleFactor
;
///< Scaling factor
#endif
#ifndef FULLSCREEN_ONLY
bool
fullscreen
;
bool
fullscreen
;
///< Full-screen mode
#endif
public
:
...
...
@@ -102,10 +105,11 @@ class Video {
// Variables
EXTERN
SDL_Surface
*
canvas
;
EXTERN
int
canvasW
,
canvasH
;
EXTERN
SDL_Surface
*
canvas
;
///< Surface used for drawing
EXTERN
int
canvasW
;
///< Drawing surface width
EXTERN
int
canvasH
;
///< Drawing surface height
EXTERN
Video
video
;
EXTERN
Video
video
;
///< Video output
// Functions
...
...
src/io/network.cpp
View file @
4da24843
/*
/*
*
*
* network.cpp
*
* 3rd June 2009: Created network.cpp from parts of game.cpp
* @file network.cpp
*
* Part of the OpenJazz project
*
* @section History
* 3rd June 2009: Created network.cpp from parts of game.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -17,9 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with a platform-specific networking API.
*
* On most platforms, USE_SOCKETS should be defined.
...
...
@@ -73,6 +72,7 @@ Network::Network () {
}
Network
::~
Network
()
{
#ifdef USE_SOCKETS
...
...
@@ -88,6 +88,7 @@ Network::~Network () {
}
int
Network
::
host
()
{
#ifdef USE_SOCKETS
...
...
@@ -141,6 +142,7 @@ int Network::host () {
}
int
Network
::
join
(
char
*
address
)
{
#ifdef USE_SOCKETS
...
...
@@ -250,6 +252,7 @@ int Network::join (char *address) {
}
int
Network
::
accept
(
int
sock
)
{
#ifdef USE_SOCKETS
...
...
@@ -281,6 +284,7 @@ int Network::accept (int sock) {
}
void
Network
::
close
(
int
sock
)
{
#ifdef USE_SOCKETS
...
...
@@ -297,6 +301,7 @@ void Network::close (int sock) {
}
int
Network
::
send
(
int
sock
,
unsigned
char
*
buffer
)
{
#ifdef USE_SOCKETS
...
...
@@ -309,6 +314,7 @@ int Network::send (int sock, unsigned char *buffer) {
}
int
Network
::
recv
(
int
sock
,
unsigned
char
*
buffer
,
int
length
)
{
#ifdef USE_SOCKETS
...
...
@@ -321,6 +327,7 @@ int Network::recv (int sock, unsigned char *buffer, int length) {
}
bool
Network
::
isConnected
(
int
sock
)
{
#ifdef USE_SOCKETS
...
...
src/io/network.h
View file @
4da24843
/*
/*
*
*
* network.h
*
* 3rd June 2009: Created network.h from parts of OpenJazz.h
* @file network.h
*
* Part of the OpenJazz project
*
* @section History
* 3rd June 2009: Created network.h from parts of OpenJazz.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -48,6 +49,7 @@
// Class
/// Networking
class
Network
{
public
:
...
...
@@ -75,7 +77,7 @@ class Network {
// Variables
EXTERN
char
*
netAddress
;
EXTERN
char
*
netAddress
;
/// Server address
EXTERN
Network
*
net
;
#endif
...
...
src/io/sound.cpp
View file @
4da24843
/*
/*
*
*
* sound.cpp
*
* 23rd August 2005: Created sound.c
* 3rd February 2009: Renamed sound.c to sound.cpp
* @file sound.cpp
*
* Part of the OpenJazz project
*
* @section History
* 23rd August 2005: Created sound.c
* 3rd February 2009: Renamed sound.c to sound.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the loading, playing and freeing of music and sound effects.
*
* For music, USE_MODPLUG must be defined.
...
...
@@ -354,10 +353,11 @@ void freeSounds () {
}
/**
* Set the sound to be played
*/
void
playSound
(
int
newSound
)
{
// Set the sound to be played
if
(
sounds
&&
(
newSound
>=
0
))
sounds
[
newSound
].
position
=
0
;
return
;
...
...
src/io/sound.h
View file @
4da24843
/*
/*
*
*
* sound.h
*
* 2nd June 2009: Created sound.h from parts of OpenJazz.h
* @file sound.h
*
* Part of the OpenJazz project
*
* @section History
* 2nd June 2009: Created sound.h from parts of OpenJazz.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -56,6 +57,7 @@
// Datatype
/// Sound effect
typedef
struct
{
unsigned
char
*
data
;
...
...
src/jj2level/jj2event/jj2event.cpp
View file @
4da24843
/*
/*
*
*
* jj2event.cpp
*
* 2nd July 2010: Created jj2event.cpp from parts of jj2level.cpp
* @file jj2event.cpp
*
* Part of the OpenJazz project
*
* @section History
* 2nd July 2010: Created jj2event.cpp from parts of jj2level.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -17,9 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the creating and freeing of JJ2 events.
*
*/
...
...
src/jj2level/jj2event/jj2event.h
View file @
4da24843
/*
/*
*
*
* jj2event.h
*
* 2nd July 2010: Created jj2event.h from parts of jj2level.h
* @file jj2event.h
*
* Part of the OpenJazz project
*
* @section History
* 2nd July 2010: Created jj2event.h from parts of jj2level.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -31,6 +32,7 @@
class
Anim
;
/// JJ2 level "movable" event
class
JJ2Event
:
public
Movable
{
private
:
...
...
@@ -39,8 +41,8 @@ class JJ2Event : public Movable {
protected
:
unsigned
char
type
;
int
properties
;
unsigned
int
endTime
;
//
Point at which the event will terminate
bool
flipped
;
unsigned
int
endTime
;
///<
Point at which the event will terminate
bool
flipped
;
///< Whether or not the sprite image should be flipped
JJ2Event
(
JJ2Event
*
newNext
,
unsigned
char
gridX
,
unsigned
char
gridY
,
unsigned
char
newType
,
int
newProperties
);
...
...
@@ -59,6 +61,7 @@ class JJ2Event : public Movable {
};
/// JJ2 level pickup event
class
PickupJJ2Event
:
public
JJ2Event
{
private
:
...
...
@@ -72,6 +75,7 @@ class PickupJJ2Event : public JJ2Event {
};
/// JJ2 level ammo
class
AmmoJJ2Event
:
public
PickupJJ2Event
{
public
:
...
...
@@ -82,6 +86,7 @@ class AmmoJJ2Event : public PickupJJ2Event {
};
/// JJ2 level gold/silver coin
class
CoinGemJJ2Event
:
public
PickupJJ2Event
{
private
:
...
...
@@ -95,6 +100,7 @@ class CoinGemJJ2Event : public PickupJJ2Event {
};
/// JJ2 level food
class
FoodJJ2Event
:
public
PickupJJ2Event
{
public
:
...
...
@@ -105,6 +111,7 @@ class FoodJJ2Event : public PickupJJ2Event {
};
/// Unimplemented JJ2 level event
class
OtherJJ2Event
:
public
JJ2Event
{
public
:
...
...
src/jj2level/jj2event/jj2eventframe.cpp
View file @
4da24843
/*
/*
*
*
* jj2eventframe.cpp
*
* 2nd July 2010: Created jj2eventframe.cpp from parts of jj2level.cpp
* @file jj2eventframe.cpp
*
* Part of the OpenJazz project
*
* @section History
* 2nd July 2010: Created jj2eventframe.cpp from parts of jj2level.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -17,9 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the playing of JJ2 levels.
*
*/
...
...
@@ -34,7 +33,7 @@
#include "player/jj2levelplayer.h"
// Look-up table for ammo animations (in animSet 1)
//
/
Look-up table for ammo animations (in animSet 1)
const
unsigned
char
ammoAnims
[]
=
{
28
,
// Ice
24
,
// Bouncer
...
...
@@ -46,7 +45,7 @@ const unsigned char ammoAnims[] = {
67
// Sparks
};
// Look-up table for food etc. animations (in animSet 67)
//
/
Look-up table for food etc. animations (in animSet 67)
const
unsigned
char
pickupAnims
[]
=
{
0
,
// 0
0
,
// 1
...
...
@@ -347,7 +346,7 @@ JJ2Event* PickupJJ2Event::step (unsigned int ticks, int msps) {
}
else
{
//
TODO:
Check for bullet overlap
//
/ @todo
Check for bullet overlap
// floating = false;
}
...
...
@@ -367,7 +366,7 @@ void AmmoJJ2Event::draw (unsigned int ticks, int change) {
drawX
=
getDrawX
(
change
);
drawY
=
getDrawY
(
change
);
//
TODO:
Check if ammo is powered up
//
/ @todo
Check if ammo is powered up
if
(
!
endTime
)
an
=
jj2Level
->
getAnim
(
0
,
ammoAnims
[
type
-
33
]
+
1
,
flipped
);
else
an
=
jj2Level
->
getAnim
(
67
,
86
,
flipped
);
...
...
src/jj2level/jj2layer.cpp
View file @
4da24843
/*
/*
*
*
* jj2layer.cpp
*
* 30th June 2010: Created jj2layer.cpp from parts of jj2levelframe.cpp
* @file jj2layer.cpp
*
* Part of the OpenJazz project
*
* @section History
* 30th June 2010: Created jj2layer.cpp from parts of jj2levelframe.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -17,9 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Handles JJ2 level layers.
*
*/
...
...
@@ -30,10 +29,11 @@
#include "io/gfx/video.h"
/**
* Create a blank layer
*/
JJ2Layer
::
JJ2Layer
()
{
// Create a blank layer
width
=
height
=
1
;
grid
=
new
JJ2Tile
*
[
1
];
...
...
@@ -78,10 +78,11 @@ JJ2Layer::~JJ2Layer () {
}
/**
* Get flipped. We aim to offend!
*/
bool
JJ2Layer
::
getFlipped
(
int
x
,
int
y
)
{
// Get flipped. We aim to offend!
if
((
x
<
0
)
||
(
y
<
0
)
||
(
x
>=
width
)
||
(
y
>=
height
))
return
false
;
return
grid
[
y
][
x
].
flipped
;
...
...
src/jj2level/jj2level.cpp
View file @
4da24843
/*
/*
*
*
* jj2level.cpp
*
@file
jj2level.cpp
*
* Part of the OpenJazz project
*
* @section History
* 29th June 2010: Created jj2level.cpp from parts of level.cpp
* 2nd July 2010: Created jj2event.cpp from parts of jj2level.cpp
* 2nd July 2010: Created jj2eventframe.cpp from parts of jj2level.cpp
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -19,9 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the creating, playing and freeing of JJ2 levels.
*
*/
...
...
@@ -269,10 +268,13 @@ void JJ2Level::warp (JJ2LevelPlayer *player, int id) {
}
/**
* Interpret data received from client/server
*
* @param buffer Received data
*/
void
JJ2Level
::
receive
(
unsigned
char
*
buffer
)
{
// Interpret data received from client/server
switch
(
buffer
[
1
])
{
case
MT_L_PROP
:
...
...
src/jj2level/jj2level.h
View file @
4da24843
/*
/*
*
*
* jj2level.h
*
* 29th June 2010: Created jj2level.h from parts of level.h
* 2nd July 2010: Created jj2event.h from parts of jj2level.h
* @file jj2level.h
*
* Part of the OpenJazz project
*
* @section History
* 29th June 2010: Created jj2level.h from parts of level.h
* 2nd July 2010: Created jj2event.h from parts of jj2level.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -48,14 +49,16 @@
// Datatypes
/// JJ2 level tile
typedef
struct
{
unsigned
short
int
tile
;
//
Indexes the tile set
unsigned
char
frame
;
//
Current frame being used (for animated tiles)
bool
flipped
;
unsigned
short
int
tile
;
///<
Indexes the tile set
unsigned
char
frame
;
///<
Current frame being used (for animated tiles)
bool
flipped
;
///< Whether or not the tile image and mask are flipped
}
JJ2Tile
;
/// JJ2 level tile modifier event
typedef
struct
{
unsigned
char
type
;
...
...
@@ -68,12 +71,17 @@ typedef struct {
class
Font
;
///< JJ2 level parallaxing layer
class
JJ2Layer
{
private
:
JJ2Tile
**
grid
;
int
width
,
height
;
bool
tileX
,
tileY
,
limit
,
warp
;
JJ2Tile
**
grid
;
///< Layer tiles
int
width
;
///< Width (in tiles)
int
height
;
///< Height (in tiles)
bool
tileX
;
///< Repeat horizontally
bool
tileY
;
///< Repeat vertically
bool
limit
;
///< Do not view beyond edges
bool
warp
;
///< Warp effect
public
:
JJ2Layer
();
...
...
@@ -94,30 +102,31 @@ class JJ2Layer {
class
JJ2Event
;
class
JJ2LevelPlayer
;
/// JJ2 level
class
JJ2Level
:
public
BaseLevel
{
private
:
SDL_Surface
*
tileSet
;
SDL_Surface
*
flippedTileSet
;
JJ2Event
*
events
;
Font
*
font
;
char
*
mask
;
char
*
flippedMask
;
char
*
musicFile
;
char
*
nextLevel
;
Sprite
*
spriteSet
;
Sprite
*
flippedSpriteSet
;
Anim
**
animSets
;
Anim
**
flippedAnimSets
;
JJ2Layer
*
layers
[
LAYERS
];
JJ2Layer
*
layer
;
JJ2Modifier
**
mods
;
int
nAnimSets
;
bool
TSF
;
unsigned
char
difficulty
;
fixed
waterLevel
;
fixed
waterLevelTarget
;
fixed
waterLevelSpeed
;
SDL_Surface
*
tileSet
;
///< Tile images
SDL_Surface
*
flippedTileSet
;
///< Tile images (flipped)
JJ2Event
*
events
;
///< "Movable" events
Font
*
font
;
///< On-screen message font
char
*
mask
;
///< Tile masks
char
*
flippedMask
;
///< Tile masks (flipped)
char
*
musicFile
;
///< Music file name
char
*
nextLevel
;
///< Next level file name
Sprite
*
spriteSet
;
///< Sprite images
Sprite
*
flippedSpriteSet
;
///< Sprite images (flipped)
Anim
**
animSets
;
///< Animation sets
Anim
**
flippedAnimSets
;
///< Animation sets (flipped)
JJ2Layer
*
layers
[
LAYERS
];
///< All layers
JJ2Layer
*
layer
;
///< Layer 4
JJ2Modifier
**
mods
;
///< Modifier events for each tile in layer 4
int
nAnimSets
;
///< Number of animation sets
bool
TSF
;
///< 1.24 level
unsigned
char
difficulty
;
///< Difficulty setting (0 = easy, 1 = medium, 2 or 3 = hard)
fixed
waterLevel
;
///< Height of water
fixed
waterLevelTarget
;
///< Future height of water
fixed
waterLevelSpeed
;
///< Rate of water level change
void
createEvent
(
int
x
,
int
y
,
unsigned
char
*
data
);
int
load
(
char
*
fileName
,
unsigned
char
diff
,
bool
checkpoint
);
...
...
@@ -152,7 +161,7 @@ class JJ2Level : public BaseLevel {
// Variable
EXTERN
JJ2Level
*
jj2Level
;
EXTERN
JJ2Level
*
jj2Level
;
//< JJ2 level
#endif
src/jj2level/jj2levelframe.cpp
View file @
4da24843
/*
/*
*
*
* jj2levelframe.cpp
*
* 29th June 2010: Created jj2levelframe.cpp from parts of levelframe.cpp
* 30th June 2010: Created jj2layer.cpp from parts of jj2levelframe.cpp
* @file jj2levelframe.cpp
*
* Part of the OpenJazz project
*
* @section History
* 29th June 2010: Created jj2levelframe.cpp from parts of levelframe.cpp
* 30th June 2010: Created jj2layer.cpp from parts of jj2levelframe.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Provides the once-per-frame functions for levels.
*
*/
...
...
src/jj2level/jj2levelload.cpp
View file @
4da24843
/*
/*
*
*
* levelloadjj2.cpp
*
* 28th June 2010: Created levelloadjj2.cpp from parts of levelload.cpp
* 29th June 2010: Renamed levelloadjj2.cpp to jj2levelload.cpp
* @file jj2levelload.cpp
*
* Part of the OpenJazz project
*
* @section History
* 28th June 2010: Created levelloadjj2.cpp from parts of levelload.cpp
* 29th June 2010: Renamed levelloadjj2.cpp to jj2levelload.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the loading of JJ2 level data.
*
*/
...
...
src/level/bullet.cpp
View file @
4da24843
/*
/*
*
*
* bullet.cpp
*
* 11th February 2009: Created bullet.cpp from parts of events.cpp
* @file bullet.cpp
*
* Part of the OpenJazz project
*
* @section History
* 11th February 2009: Created bullet.cpp from parts of events.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
src/level/bullet.h
View file @
4da24843
/*
/*
*
*
* bullet.h
*
* 11th February 2009: Created bullet.h from parts of events.h
* @file bullet.h
*
* Part of the OpenJazz project
*
* @section History
* 11th February 2009: Created bullet.h from parts of events.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -54,15 +55,16 @@ class Event;
class
LevelPlayer
;
class
Sprite
;
/// Bullet
class
Bullet
:
public
Movable
{
private
:
Bullet
*
next
;
LevelPlayer
*
source
;
//
If NULL, was fired by an event
Sprite
*
sprite
;
int
type
;
//
-1 is TNT, otherwise indexes the bullet set
int
direction
;
// 0: Left, 1: Right, 2: L (lower), 3: R (lower)
unsigned
int
time
;
//
Time at which the bullet will self-destruct
LevelPlayer
*
source
;
///< Source player.
If NULL, was fired by an event
Sprite
*
sprite
;
///< Sprite
int
type
;
///<
-1 is TNT, otherwise indexes the bullet set
int
direction
;
//
/<
0: Left, 1: Right, 2: L (lower), 3: R (lower)
unsigned
int
time
;
///<
Time at which the bullet will self-destruct
Bullet
*
remove
();
...
...
src/level/demolevel.cpp
View file @
4da24843
/*
/*
*
*
* demolevel.cpp
*
* 18th July 2009: Created demolevel.cpp from parts of level.cpp and
* levelload.cpp
* @file demolevel.cpp
*
* Part of the OpenJazz project
*
* @section History
* 18th July 2009: Created demolevel.cpp from parts of level.cpp and
* levelload.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the loading and playing of demo levels.
*
*/
...
...
src/level/event/bridge.cpp
View file @
4da24843
/*
/*
*
*
* bridge.cpp
*
* 2nd March 2010: Created bridge.cpp from parts of event.cpp and eventframe.cpp
* @file bridge.cpp
*
* Part of the OpenJazz project
*
* @section History
* 2nd March 2010: Created bridge.cpp from parts of event.cpp and eventframe.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -17,9 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Provides the functions of bridge events.
*
*/
...
...
src/level/event/event.cpp
View file @
4da24843
/*
/*
*
*
* event.cpp
*
@file
event.cpp
*
* Part of the OpenJazz project
*
* @section History
* 1st January 2006: Created events.c from parts of level.c
* 3rd February 2009: Renamed events.c to events.cpp
* 5th February 2009: Added parts of events.cpp and level.cpp to player.cpp
...
...
@@ -14,9 +17,7 @@
* 2nd March 2010: Created guardians.cpp from parts of event.cpp and eventframe.cpp
* 2nd March 2010: Created bridge.cpp from parts of event.cpp and eventframe.cpp
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -26,9 +27,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with events in ordinary levels.
*
*/
...
...
@@ -158,12 +157,18 @@ void Event::destroy (unsigned int ticks) {
}
/**
* Deal with bullet collisions
*
* @param source Source of the bullet
* @param ticks Current time
*
* @return Whether or not the hit was successful
*/
bool
Event
::
hit
(
LevelPlayer
*
source
,
unsigned
int
ticks
)
{
int
hitsRemaining
;
// Deal with bullet collisions
// Check if event has already been destroyed
if
((
animType
==
E_LFINISHANIM
)
||
(
animType
==
E_RFINISHANIM
)
||
(
ticks
<
flashTime
))
return
false
;
...
...
src/level/event/event.h
View file @
4da24843
/*
/*
*
*
* event.h
*
@file
event.h
*
* Part of the OpenJazz project
*
* @section History
* 4th February 2009: Created events.h from parts of level.h
* 11th February 2009: Created bullet.h from parts of events.h
* 1st March 2009: Created bird.h from parts of events.h
* 19th July 2009: Renamed events.h to event.h
* 2nd March 2010: Created guardians.h from parts of event.h
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -79,14 +80,15 @@
class
LevelPlayer
;
/// JJ1 level event
class
Event
:
public
Movable
{
protected
:
Event
*
next
;
unsigned
char
gridX
,
gridY
;
// Grid position of the event
unsigned
char
animType
;
//
E_LEFTANIM, etc, or 0
unsigned
char
frame
;
unsigned
int
flashTime
;
unsigned
char
gridX
,
gridY
;
//
/<
Grid position of the event
unsigned
char
animType
;
///<
E_LEFTANIM, etc, or 0
unsigned
char
frame
;
///< Current animation frame
unsigned
int
flashTime
;
///< Time flash will end
bool
noAnimOffset
;
bool
onlyLAnimOffset
;
bool
onlyRAnimOffset
;
...
...
@@ -119,6 +121,7 @@ class Event : public Movable {
};
/// JJ1 level bridge
class
Bridge
:
public
Event
{
private
:
...
...
src/level/event/eventframe.cpp
View file @
4da24843
/*
/*
*
*
* eventframe.cpp
*
@file
eventframe.cpp
*
* Part of the OpenJazz project
*
* @section History
* 19th July 2009: Created eventframe.cpp from parts of events.cpp
* 2nd March 2010: Created guardians.cpp from parts of event.cpp and eventframe.cpp
* 2nd March 2010: Created bridge.cpp from parts of event.cpp and eventframe.cpp
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -19,9 +20,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Provides the once-per-frame functions of ordinary events.
*
*/
...
...
@@ -155,7 +154,7 @@ Event* Event::step (unsigned int ticks, int msps) {
case
5
:
//
TODO: Find out what this
is
//
/ @todo Find out what behaviour 5
is
break
;
...
...
@@ -182,19 +181,19 @@ Event* Event::step (unsigned int ticks, int msps) {
case
8
:
//
TODO:
Bird-esque following
//
/ @todo
Bird-esque following
break
;
case
9
:
//
TODO: Find out what this
is
//
/ @todo Find out what behaviour 9
is
break
;
case
10
:
//
TODO: Find out what this
is
//
/ @todo Find out what behaviour 10
is
break
;
...
...
@@ -226,13 +225,13 @@ Event* Event::step (unsigned int ticks, int msps) {
case
14
:
//
TODO:
Move back and forth rapidly
//
/ @todo
Move back and forth rapidly
break
;
case
15
:
//
TODO:
Rise or lower to meet jazz
//
/ @todo
Rise or lower to meet jazz
break
;
...
...
@@ -246,25 +245,25 @@ Event* Event::step (unsigned int ticks, int msps) {
case
17
:
//
TODO: Find out what this
is
//
/ @todo Find out what behaviour 17
is
break
;
case
18
:
//
TODO: Find out what this
is
//
/ @todo Find out what behaviour 18
is
break
;
case
19
:
//
TODO: Find out what this
is
//
/ @todo Find out what behaviour 19
is
break
;
case
20
:
//
TODO: Find out what this
is
//
/ @todo Find out what behaviour 20
is
break
;
...
...
@@ -278,31 +277,31 @@ Event* Event::step (unsigned int ticks, int msps) {
case
22
:
//
TODO:
Fall down in random spot and repeat
//
/ @todo
Fall down in random spot and repeat
break
;
case
23
:
//
TODO: Find out what this
is
//
/ @todo Find out what behaviour 23
is
break
;
case
24
:
//
TODO:
Crawl along ground and go downstairs
//
/ @todo
Crawl along ground and go downstairs
break
;
case
26
:
//
TODO: Find out what this
is
//
/ @todo Find out what behaviour 26
is
break
;
case
27
:
//
TODO:
Face jazz
//
/ @todo
Face jazz
break
;
...
...
@@ -467,49 +466,49 @@ Event* Event::step (unsigned int ticks, int msps) {
case
39
:
//
TODO:
Collapsing floor
//
/ @todo
Collapsing floor
break
;
case
40
:
//
TODO: Find out what this
is
//
/ @todo Find out what behaviour 40
is
break
;
case
41
:
//
TODO:
Switch left & right anim periodically
//
/ @todo
Switch left & right anim periodically
break
;
case
42
:
//
TODO: Find out what this
is
//
/ @todo Find out what behaviour 42
is
break
;
case
43
:
//
TODO: Find out what this
is
//
/ @todo Find out what behaviour 43
is
break
;
case
44
:
//
TODO:
Leap to greet Jazz very quickly
//
/ @todo
Leap to greet Jazz very quickly
break
;
case
45
:
//
TODO: Find out what this
is
//
/ @todo Find out what behaviour 45
is
break
;
case
46
:
//
TODO:
"Final" boss
//
/ @todo
"Final" boss
break
;
...
...
@@ -533,7 +532,7 @@ Event* Event::step (unsigned int ticks, int msps) {
// 0: Static
// 25: Float up / Belt
//
TODO:
Remaining event behaviours
//
/ @todo
Remaining event behaviours
break
;
...
...
src/level/event/guardians.cpp
View file @
4da24843
/*
/*
*
*
* guardians.cpp
*
* 2nd March 2010: Created guardians.cpp from parts of event.cpp and eventframe.cpp
* @file guardians.cpp
*
* Part of the OpenJazz project
*
* @section History
* 2nd March 2010: Created guardians.cpp from parts of event.cpp and eventframe.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -17,9 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Provides the functions of guardian events.
*
*/
...
...
src/level/event/guardians.h
View file @
4da24843
/*
/*
*
*
* guardians.h
*
* 2nd March 2010: Created guardians.h from parts of event.h
* @file guardians.h
*
* Part of the OpenJazz project
*
* @section History
* 2nd March 2010: Created guardians.h from parts of event.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -29,7 +30,7 @@
// Class
/// Guardian event base class
class
Guardian
:
public
Event
{
protected
:
...
...
@@ -40,7 +41,7 @@ class Guardian : public Event {
};
/// Episode B guardian
class
DeckGuardian
:
public
Guardian
{
public
:
...
...
@@ -52,7 +53,7 @@ class DeckGuardian : public Guardian {
};
/// Episode 1 guardian
class
MedGuardian
:
public
Guardian
{
private
:
...
...
src/level/level.cpp
View file @
4da24843
/*
/*
*
*
* level.cpp
*
@file
level.cpp
*
* Part of the OpenJazz project
*
* @section History
* 23rd August 2005: Created level.c
* 1st January 2006: Created events.c from parts of level.c
* 22nd July 2008: Created levelload.c from parts of level.c
...
...
@@ -17,9 +20,7 @@
* levelframe.cpp
* 29th June 2010: Created jj2level.cpp from parts of level.cpp
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -29,9 +30,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the creating, playing and freeing of levels.
*
*/
...
...
@@ -468,10 +467,13 @@ int Level::playBonus () {
}
/**
* Interpret data received from client/server
*
* @param buffer Received data
*/
void
Level
::
receive
(
unsigned
char
*
buffer
)
{
// Interpret data received from client/server
switch
(
buffer
[
1
])
{
case
MT_L_PROP
:
...
...
src/level/level.h
View file @
4da24843
/*
/*
*
*
* level.h
*
@file
level.h
*
* Part of the OpenJazz project
*
* @section History
* 31st January 2006: Created level.h from parts of OpenJazz.h
* 4th February 2009: Created events.h from parts of level.h
* 19th March 2009: Created sprite.h from parts of level.h
* 30th March 2010: Created baselevel.h from parts of level.h
* 29th June 2010: Created jj2level.h from parts of level.h
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -63,22 +64,24 @@
// Datatypes
/// JJ1 level grid element
typedef
struct
{
unsigned
char
tile
;
//
Indexes the tile set
unsigned
char
bg
;
//
0 = Effect background, 1 = Black background
unsigned
char
event
;
// Indexes the event set
unsigned
char
hits
;
//
Number of times the event has been shot
int
time
;
/* Point at which the event will do something, e.g. terminate */
unsigned
char
tile
;
///<
Indexes the tile set
unsigned
char
bg
;
///<
0 = Effect background, 1 = Black background
unsigned
char
event
;
//
/<
Indexes the event set
unsigned
char
hits
;
///<
Number of times the event has been shot
int
time
;
///< Point at which the event will do something, e.g. terminate
}
GridElement
;
/// Pre-defined JJ1 event movement path
typedef
struct
{
short
int
*
x
;
short
int
*
y
;
unsigned
char
length
;
unsigned
char
node
;
short
int
*
x
;
///< X-coordinates for each node
short
int
*
y
;
///< Y-coordinates for each node
unsigned
char
length
;
///< Number of nodes
unsigned
char
node
;
///< Current node
}
EventPath
;
...
...
@@ -91,33 +94,37 @@ class Font;
class
LevelPlayer
;
class
Scene
;
/// JJ1 level
class
Level
:
public
BaseLevel
{
private
:
SDL_Surface
*
tileSet
;
SDL_Surface
*
panel
;
SDL_Surface
*
panelAmmo
[
5
];
Event
*
events
;
char
*
musicFile
;
char
*
sceneFile
;
Sprite
*
spriteSet
;
Anim
animSet
[
ANIMS
];
char
miscAnims
[
4
];
signed
char
bulletSet
[
BULLETS
][
BLENGTH
];
signed
char
eventSet
[
EVENTS
][
ELENGTH
];
char
mask
[
240
][
64
];
// At most 240 tiles, all with 8 * 8 masks
GridElement
grid
[
LH
][
LW
];
// All levels are the same size
int
soundMap
[
32
];
SDL_Color
skyPalette
[
256
];
bool
sky
;
unsigned
char
skyOrb
;
int
levelNum
,
worldNum
,
nextLevelNum
,
nextWorldNum
;
unsigned
char
difficulty
;
int
enemies
;
fixed
waterLevel
;
fixed
waterLevelTarget
;
fixed
waterLevelSpeed
;
fixed
energyBar
;
SDL_Surface
*
tileSet
;
///< Tile images
SDL_Surface
*
panel
;
///< HUD background image
SDL_Surface
*
panelAmmo
[
5
];
///< HUD ammo type images
Event
*
events
;
///< Events
char
*
musicFile
;
///< Music file name
char
*
sceneFile
;
///< File name of cutscene to play when level has been completed
Sprite
*
spriteSet
;
///< Sprites
Anim
animSet
[
ANIMS
];
///< Animations
char
miscAnims
[
4
];
///< Further animations
signed
char
bulletSet
[
BULLETS
][
BLENGTH
];
///< Bullet types
signed
char
eventSet
[
EVENTS
][
ELENGTH
];
///< Event types
char
mask
[
240
][
64
];
///< Tile masks. At most 240 tiles, all with 8 * 8 masks
GridElement
grid
[
LH
][
LW
];
///< Level grid. All levels are the same size
int
soundMap
[
32
];
///< Maps event sound effect numbers to actual sound effect indices
SDL_Color
skyPalette
[
256
];
///< Full palette for sky background
bool
sky
;
///< Whether or not to use sky background
unsigned
char
skyOrb
;
///< The tile to use as the background sun/moon/etc.
int
levelNum
;
///<
int
worldNum
;
///<
int
nextLevelNum
;
///<
int
nextWorldNum
;
///<
unsigned
char
difficulty
;
///< Difficulty setting (0 = easy, 1 = medium, 2 = hard, 3 = turbo)
int
enemies
;
///< Number of enemies to kill
fixed
waterLevel
;
///< Height of water
fixed
waterLevelTarget
;
///< Future height of water
fixed
waterLevelSpeed
;
///< Rate of water level change
fixed
energyBar
;
///< HUD energy bar fullness
void
deletePanel
();
int
loadPanel
();
...
...
@@ -127,15 +134,15 @@ class Level : public BaseLevel {
int
playBonus
();
protected
:
Font
*
font
;
Font
*
font
;
///< On-screen message font
int
load
(
char
*
fileName
,
unsigned
char
diff
,
bool
checkpoint
);
int
step
();
void
draw
();
public
:
Bullet
*
bullets
;
EventPath
path
[
PATHS
];
Bullet
*
bullets
;
///< Active bullets
EventPath
path
[
PATHS
];
///< Pre-defined event movement paths
Level
();
Level
(
char
*
fileName
,
unsigned
char
diff
,
bool
checkpoint
,
bool
multi
);
...
...
@@ -167,11 +174,11 @@ class Level : public BaseLevel {
};
/// JJ1 level played as a demo
class
DemoLevel
:
public
Level
{
private
:
unsigned
char
*
macro
;
unsigned
char
*
macro
;
///< Sequence of player control codes
public
:
DemoLevel
(
const
char
*
fileName
);
...
...
@@ -184,9 +191,9 @@ class DemoLevel : public Level {
// Variables
EXTERN
Level
*
level
;
EXTERN
Level
*
level
;
///< JJ1 level
EXTERN
int
viewH
;
EXTERN
int
viewH
;
///< Canvas height, minus 33 if the panel obscures the whole of the bottom of the canvas
#define viewW canvasW
#endif
...
...
src/level/levelframe.cpp
View file @
4da24843
/*
/*
*
*
* levelframe.cpp
* @file levelframe.cpp
*
* Part of the OpenJazz project
*
* @section History
* 19th July 2009: Created levelframe.cpp from parts of level.cpp
* 30th March 2010: Created baselevel.cpp from parts of level.cpp and
* levelframe.cpp
* 29th June 2010: Created jj2levelframe.cpp from parts of levelframe.cpp
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -20,9 +21,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Provides the once-per-frame functions for levels.
*
*/
...
...
src/level/levelload.cpp
View file @
4da24843
/*
/*
*
*
* levelload.cpp
* @file levelload.cpp
*
* Part of the OpenJazz project
*
* @section History
* 22nd July 2008: Created levelload.c from parts of level.c
* 3rd February 2009: Renamed levelload.c to levelload.cpp
* 18th July 2009: Created demolevel.cpp from parts of level.cpp and
...
...
@@ -10,9 +13,7 @@
* 19th July 2009: Added parts of levelload.cpp to level.cpp
* 28th June 2010: Created levelloadjj2.cpp from parts of levelload.cpp
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -22,9 +23,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the loading of level data.
*
*/
...
...
src/level/movable.cpp
View file @
4da24843
/*
/*
*
*
* movable.cpp
*
* 15th January 2010: Created movable.cpp
* @file movable.cpp
*
* Part of the OpenJazz project
*
* @section History
* 15th January 2010: Created movable.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -17,9 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Contains the base class for all movable objects.
*
*/
...
...
src/level/movable.h
View file @
4da24843
/*
/*
*
*
* movable.h
*
* 15th January 2010: Created movable.h
* @file movable.h
*
* Part of the OpenJazz project
*
* @section History
* 15th January 2010: Created movable.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -29,6 +30,7 @@
// Class
/// Base class for all movable objects (players, events, bullets, birds)
class
Movable
{
protected
:
...
...
src/loop.h
View file @
4da24843
/*
/*
*
*
* loop.h
*
* 30th April 2010: Created loop.h from parts of OpenJazz.h
* @file loop.h
*
* Part of the OpenJazz project
*
* @section History
* 30th April 2010: Created loop.h from parts of OpenJazz.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -29,6 +30,7 @@
// Enum
/// Ways the loop function should handle input.
enum
LoopType
{
NORMAL_LOOP
,
TYPING_LOOP
,
SET_KEY_LOOP
,
SET_JOYSTICK_LOOP
...
...
src/main.cpp
View file @
4da24843
/*
/*
*
*
* main.cpp
*
@file
main.cpp
*
* Part of the OpenJazz project
*
* @section History
* 23rd August 2005: Created main.c
* 22nd July 2008: Created util.c from parts of main.c
* 3rd February 2009: Renamed main.c to main.cpp
* 4th February 2009: Created palette.cpp from parts of main.cpp and util.cpp
* 13th July 2009: Created controls.cpp from parts of main.cpp
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -21,9 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Contains the main function.
*
*/
...
...
@@ -64,6 +63,17 @@ extern float sinf (float);
#define PI 3.141592f
/**
* Initialises OpenJazz.
*
* Establishes the paths from which to read files, loads configuration, sets up
* the game window and loads required data.
*
* @param argc Number of arguments, as passed to main function
* @param argv Array of argument strings, as apsse to main function
*
* @return Error code
*/
int
loadMain
(
int
argc
,
char
*
argv
[])
{
File
*
file
;
...
...
@@ -400,6 +410,11 @@ int loadMain (int argc, char *argv[]) {
}
/**
* De-initialises OpenJazz.
*
* Frees data, writes configuration, and shuts down SDL.
*/
void
freeMain
()
{
File
*
file
;
...
...
@@ -503,6 +518,16 @@ void freeMain () {
}
/**
* Process iteration.
*
* Called once per game iteration. Updates timing, video, and input
*
* @param type Type of loop. Normal, typing, or input configuration
* @param paletteEffects Palette effects to apply to video output
*
* @return Error code
*/
int
loop
(
LoopType
type
,
PaletteEffect
*
paletteEffects
)
{
SDL_Event
event
;
...
...
@@ -597,6 +622,11 @@ int loop (LoopType type, PaletteEffect* paletteEffects) {
}
/**
* Main.
*
* Initialises SDL and launches game.
*/
int
main
(
int
argc
,
char
*
argv
[])
{
MainMenu
*
mainMenu
=
NULL
;
...
...
src/menu/gamemenu.cpp
View file @
4da24843
/*
/*
*
*
* gamemenu.cpp
*
* 18th July 2009: Created menugame.cpp from parts of menu.cpp
* 26th July 2009: Renamed menugame.cpp to gamemenu.cpp
* @file gamemenu.cpp
*
* Part of the OpenJazz project
*
* @section History
* 18th July 2009: Created menugame.cpp from parts of menu.cpp
* 26th July 2009: Renamed menugame.cpp to gamemenu.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the running of the menus used to create a new game.
*
*/
...
...
@@ -234,7 +233,7 @@ int GameMenu::newGameDifficulty (GameModeType mode, int levelNum, int worldNum)
int
GameMenu
::
loadGame
()
{
//
TODO:
Actual loading of saved games
//
/ @todo
Actual loading of saved games
int
option
,
worldNum
,
levelNum
;
...
...
src/menu/mainmenu.cpp
View file @
4da24843
/*
/*
*
*
* mainmenu.cpp
*
* 19th July 2009: Created menumain.cpp from parts of menu.cpp
* 26th July 2009: Renamed menumain.cpp to mainmenu.cpp
* @file mainmenu.cpp
*
* Part of the OpenJazz project
*
* @section History
* 19th July 2009: Created menumain.cpp from parts of menu.cpp
* 26th July 2009: Renamed menumain.cpp to mainmenu.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the running of the main menu and its generic sub-menus.
*
*/
...
...
src/menu/menu.cpp
View file @
4da24843
/*
/*
*
*
* menu.cpp
*
@file
menu.cpp
*
* Part of the OpenJazz project
*
* @section History
* 23rd of August 2005: Created menu.c
* 3rd of February 2009: Renamed menu.c to menu.cpp
* 9th March 2009: Created game.cpp from parts of menu.cpp and level.cpp
...
...
@@ -12,9 +15,7 @@
* 19th July 2009: Created menumain.cpp from parts of menu.cpp
* 23rd June 2010: Merged menuutil.cpp into menu.cpp
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -24,9 +25,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Provides various generic menus.
*
*/
...
...
@@ -44,10 +43,11 @@
#include <string.h>
/**
* Display a message to the user
*/
int
Menu
::
message
(
const
char
*
text
)
{
// Display a message to the user
video
.
setPalette
(
menuPalette
);
while
(
true
)
{
...
...
@@ -71,10 +71,11 @@ int Menu::message (const char* text) {
}
/**
* Let the user select from a menu of the given options
*/
int
Menu
::
generic
(
const
char
**
optionNames
,
int
options
,
int
&
chosen
)
{
// Let the user select from a menu of the given options
int
count
;
video
.
setPalette
(
menuPalette
);
...
...
@@ -121,10 +122,11 @@ int Menu::generic (const char** optionNames, int options, int& chosen) {
}
/**
* Let the user edit a text string
*/
int
Menu
::
textInput
(
const
char
*
request
,
char
*&
text
)
{
// Let the user to edit a text string
char
*
input
;
int
count
,
terminate
,
character
,
x
;
unsigned
int
cursor
;
...
...
src/menu/menu.h
View file @
4da24843
/*
/*
*
*
* menu.h
*
* 3rd February 2009: Created menu.h from parts of OpenJazz.h
* @file menu.h
*
* Part of the OpenJazz project
*
* @section History
* 3rd February 2009: Created menu.h from parts of OpenJazz.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -40,6 +41,7 @@
// Classes
/// Menu base class, providing generic menu screens
class
Menu
{
protected
:
...
...
@@ -49,16 +51,16 @@ class Menu {
};
/// New game menus
class
GameMenu
:
public
Menu
{
private
:
SDL_Surface
*
episodeScreens
[
11
];
SDL_Surface
*
difficultyScreen
;
SDL_Color
palette
[
256
];
SDL_Color
greyPalette
[
256
];
int
episodes
;
unsigned
char
difficulty
;
SDL_Surface
*
episodeScreens
[
11
];
///< Episode images
SDL_Surface
*
difficultyScreen
;
///< 4 difficulty images
SDL_Color
palette
[
256
];
///< Episode selection palette
SDL_Color
greyPalette
[
256
];
///< Greyed-out episode selection palette
int
episodes
;
///< Number of episodes
unsigned
char
difficulty
;
///< Difficulty setting (0 = easy, 1 = medium, 2 = hard, 3 = turbo (hard in JJ2 levels))
int
newGameDifficulty
(
GameModeType
mode
,
char
*
firstLevel
);
int
newGameDifficulty
(
GameModeType
mode
,
int
levelNum
,
int
worldNum
);
...
...
@@ -75,7 +77,7 @@ class GameMenu : public Menu {
};
/// Setup menus
class
SetupMenu
:
public
Menu
{
private
:
...
...
@@ -92,15 +94,15 @@ class SetupMenu : public Menu {
};
/// Main menu
class
MainMenu
:
public
Menu
{
private
:
SDL_Surface
*
background
;
SDL_Surface
*
highlight
;
SDL_Surface
*
logo
;
GameMenu
*
gameMenu
;
SDL_Color
palette
[
256
];
SDL_Surface
*
background
;
///< Menu image
SDL_Surface
*
highlight
;
///< Menu image with highlighted text
SDL_Surface
*
logo
;
///< OJ logo image
GameMenu
*
gameMenu
;
///< New game menu
SDL_Color
palette
[
256
];
///< Menu palette
public
:
MainMenu
();
...
...
@@ -113,7 +115,7 @@ class MainMenu : public Menu {
// Variable
EXTERN
SDL_Color
menuPalette
[
256
];
EXTERN
SDL_Color
menuPalette
[
256
];
/// Palette used by most menu screens
#endif
src/menu/plasma.cpp
View file @
4da24843
/*
/*
*
*
* plasma.cpp
*
* 23rd June 2010: Created plasma.c
* @file plasma.cpp
*
* Part of the OpenJazz project
*
* @section History
* 23rd June 2010: Created plasma.cpp
*
* @section Licence
* Copyright (c) 2010 Alireza Nejati
*
* OpenJazz is distributed under the terms of
...
...
@@ -17,10 +18,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Cool plasma effects for the main menu.
*
*/
...
...
@@ -35,7 +35,9 @@
#include "io/gfx/scale2x/scalebit.h"
#endif
// Precalculate buffers
/**
* Precalculate buffers
*/
Plasma
::
Plasma
(){
p0
=
0
;
...
...
@@ -47,9 +49,11 @@ Plasma::Plasma(){
// -1024 < out < 1024
}
//
TODO:
this code is awful in so many ways
//
/ @todo
this code is awful in so many ways
// Draws plasma onto canvas
/**
* Draws plasma onto canvas
*/
int
Plasma
::
draw
(){
int
x
,
y
;
...
...
src/menu/plasma.h
View file @
4da24843
/*
/*
*
*
* plasma.h
*
* 23rd June 2010: Created plasma.h
* @file plasma.h
*
* Part of the OpenJazz project
*
* @section History
* 23rd June 2010: Created plasma.h
*
* @section Licence
* Copyright (c) 2010 Alireza Nejati
*
* OpenJazz is distributed under the terms of
...
...
@@ -24,6 +25,7 @@
#include <SDL/SDL.h>
/// Main menu background plasma effect
class
Plasma
{
private
:
...
...
src/menu/setupmenu.cpp
View file @
4da24843
/*
/*
*
*
* setupmenu.cpp
*
* 18th July 2009: Created menusetup.cpp from parts of menu.cpp
* 26th July 2009: Renamed menusetup.cpp to setupmenu.cpp
* @file setupmenu.cpp
*
* Part of the OpenJazz project
*
* @section History
* 18th July 2009: Created menusetup.cpp from parts of menu.cpp
* 26th July 2009: Renamed menusetup.cpp to setupmenu.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the running of setup menus.
*
*/
...
...
src/planet/planet.cpp
View file @
4da24843
/*
/*
*
*
* planet.cpp
*
* 23rd August 2005: Created planet.c
* 3rd February 2009: Renamed planet.c to planet.cpp
* @file planet.cpp
*
* Part of the OpenJazz project
*
* @section History
* 23rd August 2005: Created planet.c
* 3rd February 2009: Renamed planet.c to planet.cpp
*
* @section Licence
* Copyright (c) 2005-2009 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the loading, displaying and freeing of the planet landing
* sequence.
*
...
...
src/planet/planet.h
View file @
4da24843
/*
/*
*
*
* planet.h
*
* 3rd of February 2009: Created planet.h
* @file planet.h
*
* Part of the OpenJazz project
*
* @section History
* 3rd of February 2009: Created planet.h
*
* @section Licence
* Copyright (c) 2009 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -31,13 +32,14 @@
// Class
/// Planet approach sequence
class
Planet
{
private
:
SDL_Color
palette
[
256
];
Sprite
sprite
;
char
*
name
;
int
id
;
SDL_Color
palette
[
256
];
/// Palette
Sprite
sprite
;
/// Planet image
char
*
name
;
/// Planet name
int
id
;
/// World number
public
:
Planet
(
char
*
fileName
,
int
previous
);
...
...
src/platforms/symbian.cpp
View file @
4da24843
/**
*
* @file symbian.cpp
*
* Part of the OpenJazz project
*
* @section Licence
* OpenJazz is distributed under the terms of
* the GNU General Public License, version 2.0
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include <eikenv.h>
#include <eikapp.h>
#include <eikappui.h>
...
...
@@ -13,6 +31,7 @@ char KOpenJazzPath[256];
FILE
*
mystdout
=
NULL
;
FILE
*
mystderr
=
NULL
;
/// Symbian app
class
COpenJazzApp
:
public
CSDLApp
{
public
:
COpenJazzApp
();
...
...
src/platforms/wiz.cpp
View file @
4da24843
/**
*
* @file wiz.cpp
*
* Part of the OpenJazz project
*
* @section Licence
* OpenJazz is distributed under the terms of
* the GNU General Public License, version 2.0
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#include "wiz.h"
#if defined(WIZ) || defined(GP2X)
...
...
src/platforms/wiz.h
View file @
4da24843
/**
*
* @file wiz.h
*
* Part of the OpenJazz project
*
* @section Licence
* OpenJazz is distributed under the terms of
* the GNU General Public License, version 2.0
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef _WIZ_H
#define _WIZ_H
...
...
src/player/bird.cpp
View file @
4da24843
/*
/*
*
*
* bird.cpp
*
* 1st March 2009: Created bird.cpp from parts of events.cpp
* @file bird.cpp
*
* Part of the OpenJazz project
*
* @section History
* 1st March 2009: Created bird.cpp from parts of events.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
src/player/bird.h
View file @
4da24843
/*
/*
*
*
* bird.h
*
* 1st March 2009: Created bird.h from parts of events.h
* @file bird.h
*
* Part of the OpenJazz project
*
* @section History
* 1st March 2009: Created bird.h from parts of events.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -42,12 +43,13 @@
class
LevelPlayer
;
/// JJ1 bird companion
class
Bird
:
public
Movable
{
private
:
LevelPlayer
*
player
;
bool
fleeing
;
unsigned
int
fireTime
;
LevelPlayer
*
player
;
///< Player that rescued the bird
bool
fleeing
;
///< Flying away, player having been shot
unsigned
int
fireTime
;
///< Next time the bird will fire
public
:
Bird
(
LevelPlayer
*
player
,
unsigned
char
gX
,
unsigned
char
gY
);
...
...
src/player/bonusplayer.cpp
View file @
4da24843
/*
/*
*
*
* bonusplayer.cpp
*
* 24th June 2010: Created bonusplayer.cpp from parts of player.cpp and
* playerframe.cpp
* @file bonusplayer.cpp
*
* Part of the OpenJazz project
*
* @section History
* 24th June 2010: Created bonusplayer.cpp from parts of player.cpp and
* playerframe.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with players in bonus levels.
*
*/
...
...
@@ -59,7 +58,7 @@ BonusPlayer::BonusPlayer (Player* parent, Anim **newAnims, unsigned char startX,
for
(
count
=
0
;
count
<
256
;
count
++
)
palette
[
count
].
r
=
palette
[
count
].
g
=
palette
[
count
].
b
=
count
;
//
TODO:
Custom colours
//
/ @todo
Custom colours
return
;
...
...
src/player/bonusplayer.h
View file @
4da24843
/*
/*
*
*
* bonusplayer.h
*
* 24th June 2010: Created bonusplayer.h from parts of player.h
* @file bonusplayer.h
*
* Part of the OpenJazz project
*
* @section History
* 24th June 2010: Created bonusplayer.h from parts of player.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -59,17 +60,21 @@
class
Anim
;
class
Bonus
;
/// JJ1 bonus level player
class
BonusPlayer
{
private
:
SDL_Color
palette
[
256
];
Anim
*
anims
[
BPANIMS
];
fixed
x
,
y
,
direction
,
dr
;
unsigned
char
animType
;
int
gems
;
SDL_Color
palette
[
256
];
///< Palette (for custom colours)
Anim
*
anims
[
BPANIMS
];
///< Animations
fixed
x
;
///< X-coordinate
fixed
y
;
///< Y-coordinate
fixed
direction
;
///< Direction
fixed
dr
;
///< Forward speed
unsigned
char
animType
;
///< Current animation
int
gems
;
///< Number of gems collected
public
:
Player
*
player
;
Player
*
player
;
///< Corresponding game player
BonusPlayer
(
Player
*
parent
,
Anim
**
newAnims
,
unsigned
char
startX
,
unsigned
char
startY
);
~
BonusPlayer
();
...
...
src/player/jj2levelplayer.cpp
View file @
4da24843
/*
/*
*
*
* jj2levelplayer.cpp
*
* 29th June 2010: Created jj2levelplayer.cpp from parts of levelplayer.cpp
* @file jj2levelplayer.cpp
*
* Part of the OpenJazz project
*
* @section History
* 29th June 2010: Created jj2levelplayer.cpp from parts of levelplayer.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -17,9 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the creation and destruction of players in levels, and their
* interactions with other level objects.
*
...
...
@@ -555,10 +554,11 @@ bool JJ2LevelPlayer::touchEvent (JJ2Event* touched, unsigned int ticks, int msps
}
/**
* Copy data to be sent to clients/server
*/
void
JJ2LevelPlayer
::
send
(
unsigned
char
*
buffer
)
{
// Copy data to be sent to clients/server
buffer
[
9
]
=
bird
?
1
:
0
;
buffer
[
23
]
=
energy
;
buffer
[
25
]
=
shield
;
...
...
@@ -586,10 +586,11 @@ void JJ2LevelPlayer::send (unsigned char *buffer) {
}
/**
* Interpret data received from client/server
*/
void
JJ2LevelPlayer
::
receive
(
unsigned
char
*
buffer
)
{
// Interpret data received from client/server
switch
(
buffer
[
1
])
{
case
MT_P_ANIMS
:
...
...
src/player/jj2levelplayer.h
View file @
4da24843
/*
/*
*
*
* jj2levelplayer.h
*
* 29th June 2010: Created jj2levelplayer.h from parts of levelplayer.h
* @file jj2levelplayer.h
*
* Part of the OpenJazz project
*
* @section History
* 29th June 2010: Created jj2levelplayer.h from parts of levelplayer.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -226,12 +227,14 @@
// Enum
/// JJ2 player reaction type
enum
JJ2PlayerReaction
{
JJ2PR_NONE
,
JJ2PR_HURT
,
JJ2PR_KILLED
,
JJ2PR_INVINCIBLE
};
/// JJ2 shield type
enum
JJ2Shield
{
JJ2S_NONE
=
0
,
JJ2S_FLAME
=
1
,
JJ2S_BUBBLE
=
2
,
JJ2S_PLASMA
=
3
,
JJ2S_LASER
=
4
...
...
@@ -244,37 +247,39 @@ enum JJ2Shield {
class
Anim
;
class
JJ2Event
;
/// JJ2 level player
class
JJ2LevelPlayer
:
public
Movable
{
private
:
bool
bird
;
// Placeholder for eventual JJ2Bird object
Anim
*
anims
;
Anim
*
flippedAnims
;
JJ2Modifier
*
mod
;
SDL_Color
palette
[
256
];
int
energy
;
JJ2Shield
shield
;
int
floating
;
/* 0 = normal, 1 = helicopter ears, 2 = boarding */
bool
facing
;
unsigned
char
animType
;
PlayerEvent
event
;
int
lookTime
;
/* Negative if looking up, positive if looking down, 0 if neither */
JJ2PlayerReaction
reaction
;
unsigned
int
reactionTime
;
unsigned
int
fireTime
;
fixed
jumpHeight
;
fixed
throwX
,
throwY
;
bool
bird
;
///< Placeholder for eventual JJ2Bird object
Anim
*
anims
;
///< Animations
Anim
*
flippedAnims
;
///< Animations (flipped)
JJ2Modifier
*
mod
;
///< Modifier currently affecting player
SDL_Color
palette
[
256
];
///< Palette (for custom colours)
int
energy
;
///< 0 = dead, 3 or 5 = maximum
JJ2Shield
shield
;
///< Current shield
int
floating
;
///< 0 = normal, 1 = helicopter ears, 2 = boarding
bool
facing
;
///< false = left, true = right
unsigned
char
animType
;
///< Current animation
PlayerEvent
event
;
///< Event type
int
lookTime
;
///< Negative if looking up, positive if looking down, 0 if neither
JJ2PlayerReaction
reaction
;
///< Reaction type
unsigned
int
reactionTime
;
///< Time reaction will end
unsigned
int
fireTime
;
///< The next time the player can fire
fixed
jumpHeight
;
///< The height the player can reach when jumping
fixed
throwX
;
///< Having been thrown, the x-coordinate the player can reach
fixed
throwY
;
///< Having been thrown, the y-coordinate the player can reach
unsigned
int
fastFeetTime
;
unsigned
int
stopTime
;
int
gems
[
4
];
int
coins
;
int
gems
[
4
];
///< Gems collected
int
coins
;
///< Value of coins collected
void
centreX
();
void
centreY
();
void
modify
(
JJ2Modifier
*
nextMod
,
unsigned
int
ticks
);
public
:
Player
*
player
;
Player
*
player
;
///< Corresponding game player
JJ2LevelPlayer
(
Player
*
parent
,
Anim
**
newAnims
,
unsigned
char
startX
,
unsigned
char
startY
,
bool
hasBird
);
~
JJ2LevelPlayer
();
...
...
src/player/jj2levelplayerframe.cpp
View file @
4da24843
/*
/*
*
*
* jj2levelplayerframe.cpp
*
* 29th June 2010: Created jj2levelplayerframe.cpp from parts of
* levelplayerframe.cpp
* @file jj2levelplayerframe.cpp
*
* Part of the OpenJazz project
*
* @section History
* 29th June 2010: Created jj2levelplayerframe.cpp from parts of
* levelplayerframe.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Provides the once-per-frame functions of players in levels.
*
*/
...
...
@@ -178,14 +177,15 @@ void JJ2LevelPlayer::modify (JJ2Modifier* nextMod, unsigned int ticks) {
}
/**
* Respond to controls, unless the player has been killed
*/
void
JJ2LevelPlayer
::
control
(
unsigned
int
ticks
,
int
msps
)
{
JJ2Modifier
*
nextMod
;
bool
drop
,
platform
;
// Respond to controls, unless the player has been killed
// If the player has been killed, do not move
if
(
!
energy
)
{
...
...
@@ -449,7 +449,7 @@ void JJ2LevelPlayer::control (unsigned int ticks, int msps) {
// Make sure bullet position is taken from correct animation
if
(
platform
)
animType
=
PA_STANDSHOOT
;
//
TODO: Create new bullet
//
/ @todo Create new bullet when firing
// Set when the next bullet can be fired
if
(
player
->
fireSpeed
)
fireTime
=
ticks
+
(
1000
/
player
->
fireSpeed
);
...
...
@@ -748,12 +748,13 @@ void JJ2LevelPlayer::move (unsigned int ticks, int msps) {
}
/**
* Calculate viewport
*/
void
JJ2LevelPlayer
::
view
(
unsigned
int
ticks
,
int
mspf
)
{
int
oldViewX
,
oldViewY
,
speed
;
// Calculate viewport
// Record old viewport position for applying lag
oldViewX
=
viewX
;
oldViewY
=
viewY
;
...
...
@@ -847,7 +848,7 @@ void JJ2LevelPlayer::draw (unsigned int ticks, int change) {
if
(
reaction
==
JJ2PR_INVINCIBLE
)
{
//
TODO:
Show invincibility effect
//
/ @todo
Show invincibility effect
}
...
...
@@ -861,25 +862,25 @@ void JJ2LevelPlayer::draw (unsigned int ticks, int change) {
case
JJ2S_FLAME
:
//
TODO:
Show shield effect
//
/ @todo
Show shield effect
break
;
case
JJ2S_BUBBLE
:
//
TODO:
Show shield effect
//
/ @todo
Show shield effect
break
;
case
JJ2S_PLASMA
:
//
TODO:
Show shield effect
//
/ @todo
Show shield effect
break
;
case
JJ2S_LASER
:
//
TODO:
Show shield effect
//
/ @todo
Show shield effect
break
;
...
...
src/player/levelplayer.cpp
View file @
4da24843
/*
/*
*
*
* levelplayer.cpp
*
* 24th June 2010: Created levelplayer.cpp from parts of player.cpp
* 29th June 2010: Created jj2levelplayer.cpp from parts of levelplayer.cpp
* @file levelplayer.cpp
*
* Part of the OpenJazz project
*
* @section History
* 24th June 2010: Created levelplayer.cpp from parts of player.cpp
* 29th June 2010: Created jj2levelplayer.cpp from parts of levelplayer.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -18,9 +19,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the creation and destruction of players in levels, and their
* interactions with other level objects.
*
...
...
src/player/levelplayer.h
View file @
4da24843
/*
/*
*
*
* levelplayer.h
*
* 24th June 2010: Created levelplayer.h from parts of player.h
* 29th June 2010: Created jj2levelplayer.h from parts of levelplayer.h
* @file levelplayer.h
*
* Part of the OpenJazz project
*
* @section History
* 24th June 2010: Created levelplayer.h from parts of player.h
* 29th June 2010: Created jj2levelplayer.h from parts of levelplayer.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -135,6 +136,7 @@
// Enum
/// JJ1 player reaction type
enum
PlayerReaction
{
PR_NONE
,
PR_HURT
,
PR_KILLED
,
PR_INVINCIBLE
...
...
@@ -147,34 +149,37 @@ enum PlayerReaction {
class
Anim
;
class
Bird
;
/// JJ1 level player
class
LevelPlayer
:
public
Movable
{
private
:
Bird
*
bird
;
SDL_Color
palette
[
256
];
Anim
*
anims
[
PANIMS
];
int
energy
;
int
shield
;
/* 0 = none, 1 = 1 yellow, 2 = 2 yellow, 3 = 1 orange, 4 = 2 orange, 5 = 3 orange, 6 = 4 orange */
bool
floating
;
/* false = normal, true = boarding/bird/etc. */
bool
facing
;
unsigned
char
animType
;
unsigned
char
eventX
;
unsigned
char
eventY
;
/* Position of an event (spring, platform, bridge) */
PlayerEvent
event
;
int
lookTime
;
/* Negative if looking up, positive if looking down, 0 if neither */
PlayerReaction
reaction
;
unsigned
int
reactionTime
;
unsigned
int
fireTime
;
fixed
jumpHeight
;
fixed
jumpY
;
unsigned
int
fastFeetTime
;
unsigned
char
warpX
,
warpY
;
unsigned
int
warpTime
;
int
enemies
,
items
;
bool
gem
;
Bird
*
bird
;
///< Bird companion
SDL_Color
palette
[
256
];
///< Palette (for custom colours)
Anim
*
anims
[
PANIMS
];
///< Animations
int
energy
;
///< 0 = dead, 4 = maximum
int
shield
;
///< 0 = none, 1 = 1 yellow, 2 = 2 yellow, 3 = 1 orange, 4 = 2 orange, 5 = 3 orange, 6 = 4 orange
bool
floating
;
///< false = normal, true = boarding/bird/etc.
bool
facing
;
///< false = left, true = right
unsigned
char
animType
;
///< Current animation
unsigned
char
eventX
;
///< X-coordinate (in tiles) of an event (spring, platform, bridge)
unsigned
char
eventY
;
///< Y-coordinate (in tiles) of an event (spring, platform, bridge)
PlayerEvent
event
;
///< Event type
int
lookTime
;
///< Negative if looking up, positive if looking down, 0 if neither
PlayerReaction
reaction
;
///< Reaction type
unsigned
int
reactionTime
;
///< Time reaction will end
unsigned
int
fireTime
;
///< The next time the player can fire
fixed
jumpHeight
;
///< The height the player can reach when jumping
fixed
jumpY
;
///< Having started jumping, the y-coordinate the player can reach
unsigned
int
fastFeetTime
;
///< Time fast feet will expire
unsigned
char
warpX
;
///< X-coordinate (in tiles) player will warp to
unsigned
char
warpY
;
///< Y-coordinate (in tiles) player will warp to
unsigned
int
warpTime
;
///< Time the warp will happen
int
enemies
;
///< Number of enemies killed
int
items
;
///< Number of items collected
bool
gem
;
///< Bonus level gem collected
public
:
Player
*
player
;
Player
*
player
;
///< Corresponding game player
LevelPlayer
(
Player
*
parent
,
Anim
**
newAnims
,
unsigned
char
startX
,
unsigned
char
startY
,
bool
hasBird
);
~
LevelPlayer
();
...
...
src/player/levelplayerframe.cpp
View file @
4da24843
/*
/*
*
*
* levelplayerframe.cpp
* @file levelplayerframe.cpp
*
* Part of the OpenJazz project
*
* @section History
* 18th July 2009: Created playerframe.cpp from parts of player.cpp
* 24th June 2010: Renamed playerframe.cpp to levelplayerframe.cpp
* 29th June 2010: Created jj2levelplayerframe.cpp from parts of
* levelplayerframe.cpp
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -20,9 +21,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Provides the once-per-frame functions of players in levels.
*
*/
...
...
@@ -43,12 +42,14 @@
#include "util.h"
/**
* Respond to controls, unless the player has been killed
*/
void
LevelPlayer
::
control
(
unsigned
int
ticks
,
int
msps
)
{
int
speed
;
bool
platform
;
// Respond to controls, unless the player has been killed
// If the player has been killed, drop but otherwise do not move
if
(
!
energy
)
{
...
...
@@ -619,12 +620,13 @@ void LevelPlayer::move (unsigned int ticks, int msps) {
}
/**
* Calculate viewport
*/
void
LevelPlayer
::
view
(
unsigned
int
ticks
,
int
mspf
)
{
int
oldViewX
,
oldViewY
,
speed
;
// Calculate viewport
// Record old viewport position for applying lag
oldViewX
=
viewX
;
oldViewY
=
viewY
;
...
...
src/player/player.cpp
View file @
4da24843
/*
/*
*
*
* player.cpp
*
@file
player.cpp
*
* Part of the OpenJazz project
*
* @section History
* 3rd February 2009: Created player.cpp
* 5th February 2009: Added parts of events.cpp and level.cpp to player.cpp
* 19th March 2009: Created sprite.cpp from parts of event.cpp and player.cpp
* 18th July 2009: Created playerframe.cpp from parts of player.cpp
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -20,9 +21,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the creation and destruction of players, and their interactions
* with other objects.
*
...
...
@@ -295,10 +294,11 @@ unsigned char Player::getTeam () {
}
/**
* Copy data to be sent to clients/server
*/
void
Player
::
send
(
unsigned
char
*
buffer
)
{
// Copy data to be sent to clients/server
buffer
[
3
]
=
pcontrols
[
C_UP
];
buffer
[
4
]
=
pcontrols
[
C_DOWN
];
buffer
[
5
]
=
pcontrols
[
C_LEFT
];
...
...
@@ -331,10 +331,11 @@ void Player::send (unsigned char *buffer) {
}
/**
* Interpret data received from client/server
*/
void
Player
::
receive
(
unsigned
char
*
buffer
)
{
// Interpret data received from client/server
if
(
buffer
[
1
]
==
MT_P_TEMP
)
{
pcontrols
[
C_UP
]
=
buffer
[
3
];
...
...
src/player/player.h
View file @
4da24843
/*
/*
*
*
* player.h
*
@file
player.h
*
* Part of the OpenJazz project
*
* @section History
* 31st January 2006: Created player.h from parts of OpenJazz.h
* 24th June 2010: Created levelplayer.h from parts of player.h
* 24th June 2010: Created bonusplayer.h from parts of player.h
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -50,6 +51,7 @@
// Enums
/// Player colours
enum
PlayerColour
{
PC_GREY
=
0
,
...
...
@@ -69,6 +71,7 @@ enum PlayerColour {
};
/// Player event types
enum
PlayerEvent
{
LPE_NONE
,
LPE_SPRING
,
LPE_FLOAT
,
LPE_PLATFORM
...
...
@@ -83,27 +86,28 @@ class LevelPlayer;
class
BonusPlayer
;
class
JJ2LevelPlayer
;
/// Game player
class
Player
{
private
:
LevelPlayer
*
levelPlayer
;
BonusPlayer
*
bonusPlayer
;
JJ2LevelPlayer
*
jj2LevelPlayer
;
char
*
name
;
bool
pcontrols
[
PCONTROLS
];
unsigned
char
cols
[
PCOLOURS
];
int
ammo
[
4
];
int
ammoType
;
/
* -1 = blaster, 0 = toaster, 1 = missiles, 2 = bouncer 3 = TNT */
int
score
;
int
lives
;
int
fireSpeed
;
bool
bird
;
unsigned
char
team
;
LevelPlayer
*
levelPlayer
;
///< JJ1 level player
BonusPlayer
*
bonusPlayer
;
///< JJ1 bonus level player
JJ2LevelPlayer
*
jj2LevelPlayer
;
///< JJ2 level player
char
*
name
;
///< Name
bool
pcontrols
[
PCONTROLS
];
///< Control status
unsigned
char
cols
[
PCOLOURS
];
///< Character colours
int
ammo
[
4
];
///< Amount of ammo
int
ammoType
;
/
//< Ammo type. -1 = blaster, 0 = toaster, 1 = missiles, 2 = bouncer 3 = TNT
int
score
;
///< Total score
int
lives
;
///< Remaining lives
int
fireSpeed
;
///< Rapid-fire rate
bool
bird
;
///< Accompanied by a bird
unsigned
char
team
;
///< Team ID
void
addAmmo
(
int
type
,
int
amount
);
public
:
int
teamScore
;
int
teamScore
;
///< Team's total score
Player
();
~
Player
();
...
...
src/scene/scene.cpp
View file @
4da24843
/*
/**
*
* @file scene.cpp
*
*
scene.cpp
*
Part of the OpenJazz project
*
* @section History
* 23rd August 2005: Created scene.c
* 3rd February 2009: Created scene.h from parts of scene.c
* 3rd February 2009: Renamed scene.c to scene.cpp
* 27th March 2010: Created sceneload.cpp from parts of scene.cpp
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -20,9 +21,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the displaying and freeing of the cutscenes.
*
*/
...
...
@@ -198,7 +197,7 @@ Scene::Scene (const char * fileName) {
palettes
=
NULL
;
animations
=
NULL
;
file
->
seek
(
ESignatureLength
,
true
);
// Skip Digital Dimensions header
file
->
seek
(
0x13
,
true
);
// Skip Digital Dimensions header
signed
long
int
dataOffset
=
file
->
loadInt
();
//get offset pointer to first data block
scriptItems
=
file
->
loadShort
();
// Get number of script items
...
...
src/scene/scene.h
View file @
4da24843
/*
*
* scene.h
/**
*
*
3rd February 2009: Created scene.h from parts of scene.c
*
@file scene.h
*
* Part of the OpenJazz project
*
* @section History
* 3rd February 2009: Created scene.h from parts of scene.c
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -32,6 +33,7 @@
// Enums
/**
* Cutscene file animation headers
11
1L
/0/0
...
...
@@ -50,34 +52,26 @@ MX
ST
SL
*/
enum
ANIHeaders
{
E11AniHeader
=
0x3131
,
// Background/start image
E11AniHeader
=
0x3131
,
//
/<
Background/start image
E1LAniHeader
=
0x4c31
,
EPBAniHeader
=
0x4250
,
EFFAniHeader
=
0x4646
,
// Floodfill? or full frame?
EFFAniHeader
=
0x4646
,
//
/<
Floodfill? or full frame?
ERNAniHeader
=
0x4e52
,
ERBAniHeader
=
0x4252
,
ERCAniHeader
=
0x4352
,
ERLAniHeader
=
0x4c52
,
ERRAniHeader
=
0x5252
,
E_EHeader
=
0x455F
,
// ANI End
E_EHeader
=
0x455F
,
//
/<
ANI End
ESquareAniHeader
=
0x5b5d
,
EMXAniHeader
=
0x584d
,
ESTAniHeader
=
0x5453
,
// Sound tag
ESTAniHeader
=
0x5453
,
//
/<
Sound tag
ESoundListAniHeader
=
0x4C53
,
EPlayListAniHeader
=
0x4C50
};
enum
{
ESignatureLength
=
0x13
,
EScriptStartTag
=
0x50
,
EAnimationData
=
0x4e41
};
// These are the known script types
/// Cutscene script types - these are the known types
enum
{
ESceneYesNo
=
0x23
,
ESceneMusic
=
0x2A
,
...
...
@@ -111,6 +105,7 @@ enum {
class
Font
;
/// Cutscene page text
class
SceneText
{
public
:
...
...
@@ -127,6 +122,7 @@ class SceneText {
};
/// Cutscene page
class
ScenePage
{
public
:
...
...
@@ -140,7 +136,7 @@ class ScenePage {
int
animIndex
;
int
nextPageAfterAnim
;
// Length of the scene in seconds, or if zero = anim complete, or 256 = user interaction
//
/
Length of the scene in seconds, or if zero = anim complete, or 256 = user interaction
int
pageTime
;
SceneText
texts
[
100
];
int
nTexts
;
...
...
@@ -153,6 +149,7 @@ class ScenePage {
};
/// Cutscene background image
class
SceneImage
{
public
:
...
...
@@ -165,6 +162,7 @@ class SceneImage {
};
/// Cutscene palette
class
ScenePalette
{
public
:
...
...
@@ -177,6 +175,7 @@ class ScenePalette {
};
/// Cutscene font
class
SceneFont
{
public
:
...
...
@@ -185,6 +184,7 @@ class SceneFont {
};
/// Cutscene animation frame
class
SceneFrame
{
public
:
...
...
@@ -198,6 +198,7 @@ public:
SceneFrame
*
prev
;
};
/// Cutscene animation
class
SceneAnimation
{
public
:
...
...
@@ -215,6 +216,7 @@ public:
int
reverseAnimation
;
};
/// Cutscene
class
Scene
{
private
:
...
...
@@ -228,7 +230,7 @@ class Scene {
signed
long
int
*
scriptStarts
;
signed
long
int
*
dataOffsets
;
// Scripts all information needed to render script pages, text etc
//
/
Scripts all information needed to render script pages, text etc
ScenePage
*
pages
;
void
loadScripts
(
File
*
f
);
...
...
src/scene/sceneload.cpp
View file @
4da24843
/*
*
* sceneload.cpp
/**
*
*
27th March 2010: Created sceneload.cpp from parts of scene
.cpp
*
@file sceneload
.cpp
*
* Part of the OpenJazz project
*
* @section History
* 27th March 2010: Created sceneload.cpp from parts of scene.cpp
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -17,9 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Deals with the loading of cutscene data.
*
*/
...
...
@@ -454,7 +453,7 @@ void Scene::loadData (File *f) {
LOG
(
"Data dataLen"
,
dataLen
);
// AN
if
(
dataLen
==
EAnimationData
)
{
if
(
dataLen
==
0x4e41
)
{
LOG
(
"Data Type"
,
"ANI"
);
animations
=
new
SceneAnimation
(
animations
);
...
...
@@ -532,7 +531,7 @@ void Scene::loadScripts (File *f) {
bool
textRectValid
=
false
;
f
->
seek
(
scriptStarts
[
loop
],
true
);
// Seek to data start
if
(
f
->
loadChar
()
==
EScriptStartTag
)
{
// Script tag
if
(
f
->
loadChar
()
==
0x50
)
{
// Script tag
unsigned
short
int
scriptid
=
f
->
loadShort
();
LOG
(
"Script id"
,
scriptid
);
...
...
src/util.cpp
View file @
4da24843
/*
/*
*
*
* util.cpp
*
@file
util.cpp
*
* Part of the OpenJazz project
*
* @section History
* 22nd July 2008: Created util.c from parts of main.c
* 3rd February 2009: Renamed util.c to util.cpp
* 3rd February 2009: Created file.cpp from parts of util.cpp
* 4th February 2009: Created palette.cpp from parts of main.cpp and util.cpp
* 13th July 2009: Created graphics.cpp from parts of util.cpp
*
* Part of the OpenJazz project
*
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -21,9 +22,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
/*
* @section Description
* Contains core utility functions.
*
*/
...
...
src/util.h
View file @
4da24843
/*
/*
*
*
* util.h
*
* 30th April 2010: Created util.h from parts of OpenJazz.h
* @file util.h
*
* Part of the OpenJazz project
*
* @section History
* 30th April 2010: Created util.h from parts of OpenJazz.h
*
* @section Licence
* Copyright (c) 2005-2010 Alister Thomson
*
* OpenJazz is distributed under the terms of
...
...
@@ -29,7 +30,7 @@
// Variable
// Trigonometric function look-up table
//
/
Trigonometric function look-up table
EXTERN
fixed
sinLut
[
1024
];
...
...
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