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
989fb4dd
Commit
989fb4dd
authored
Jun 24, 2010
by
alistert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduced number of global fonts.
parent
58b2311d
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
81 additions
and
52 deletions
+81
-52
bonus.cpp
src/bonus/bonus.cpp
+26
-11
bonus.h
src/bonus/bonus.h
+4
-1
gamemode.cpp
src/game/gamemode.cpp
+5
-5
gamemode.h
src/game/gamemode.h
+6
-5
font.h
src/io/gfx/font.h
+0
-2
demolevel.cpp
src/level/demolevel.cpp
+1
-1
level.cpp
src/level/level.cpp
+18
-16
level.h
src/level/level.h
+4
-2
levelload.cpp
src/level/levelload.cpp
+17
-1
main.cpp
src/main.cpp
+0
-8
No files found.
src/bonus/bonus.cpp
View file @
989fb4dd
...
...
@@ -192,12 +192,25 @@ Bonus::Bonus (char * fileName, unsigned char diff) {
char
*
string
,
*
fileString
;
int
count
,
x
,
y
;
try
{
font
=
new
Font
(
true
);
}
catch
(
int
e
)
{
throw
e
;
}
try
{
file
=
new
File
(
fileName
,
false
);
}
catch
(
int
e
)
{
delete
font
;
throw
e
;
}
...
...
@@ -367,9 +380,11 @@ Bonus::Bonus (char * fileName, unsigned char diff) {
Bonus
::~
Bonus
()
{
// Restore
font palettes
// Restore
panelBigFont palette
panelBigFont
->
restorePalette
();
delete
font
;
return
;
}
...
...
@@ -622,20 +637,20 @@ void Bonus::draw () {
// Show gem count
bonusF
ont
->
showString
(
"*"
,
0
,
0
);
bonusF
ont
->
showNumber
(
localPlayer
->
getItems
()
/
10
,
50
,
0
);
bonusF
ont
->
showNumber
(
localPlayer
->
getItems
()
%
10
,
68
,
0
);
bonusF
ont
->
showString
(
"/"
,
65
,
0
);
bonusF
ont
->
showNumber
(
items
,
124
,
0
);
f
ont
->
showString
(
"*"
,
0
,
0
);
f
ont
->
showNumber
(
localPlayer
->
getItems
()
/
10
,
50
,
0
);
f
ont
->
showNumber
(
localPlayer
->
getItems
()
%
10
,
68
,
0
);
f
ont
->
showString
(
"/"
,
65
,
0
);
f
ont
->
showNumber
(
items
,
124
,
0
);
// Show time remaining
if
(
endTime
>
ticks
)
x
=
(
endTime
-
ticks
)
/
1000
;
else
x
=
0
;
bonusF
ont
->
showNumber
(
x
/
60
,
250
,
0
);
bonusF
ont
->
showString
(
":"
,
247
,
0
);
bonusF
ont
->
showNumber
((
x
/
10
)
%
6
,
274
,
0
);
bonusF
ont
->
showNumber
(
x
%
10
,
291
,
0
);
f
ont
->
showNumber
(
x
/
60
,
250
,
0
);
f
ont
->
showString
(
":"
,
247
,
0
);
f
ont
->
showNumber
((
x
/
10
)
%
6
,
274
,
0
);
f
ont
->
showNumber
(
x
%
10
,
291
,
0
);
return
;
...
...
@@ -774,7 +789,7 @@ int Bonus::play () {
// If paused, draw "PAUSE"
if
(
pmessage
&&
!
pmenu
)
bonusF
ont
->
showString
(
"pause"
,
(
canvasW
>>
1
)
-
44
,
32
);
f
ont
->
showString
(
"pause"
,
(
canvasW
>>
1
)
-
44
,
32
);
// Draw statistics
drawStats
(
stats
,
0
);
...
...
src/bonus/bonus.h
View file @
989fb4dd
...
...
@@ -50,12 +50,15 @@ typedef struct {
}
BonusGridElement
;
// Class
// Classes
class
Font
;
class
Bonus
:
public
BaseLevel
{
private
:
SDL_Surface
*
background
;
Font
*
font
;
Anim
animSet
[
BANIMS
];
BonusGridElement
grid
[
BLH
][
BLW
];
char
mask
[
60
][
64
];
// At most 60 tiles, all with 8 * 8 masks
...
...
src/game/gamemode.cpp
View file @
989fb4dd
...
...
@@ -72,7 +72,7 @@ unsigned char CooperativeGameMode::chooseTeam () {
}
void
CooperativeGameMode
::
drawScore
()
{
void
CooperativeGameMode
::
drawScore
(
Font
*
font
)
{
// Do nothing
...
...
@@ -103,9 +103,9 @@ unsigned char FreeForAllGameMode::chooseTeam () {
}
void
FreeForAllGameMode
::
drawScore
()
{
void
FreeForAllGameMode
::
drawScore
(
Font
*
font
)
{
font
sFont
->
showNumber
(
localPlayer
->
teamScore
,
64
,
4
);
font
->
showNumber
(
localPlayer
->
teamScore
,
64
,
4
);
return
;
...
...
@@ -138,9 +138,9 @@ unsigned char TeamGameMode::chooseTeam () {
}
void
TeamGameMode
::
drawScore
()
{
void
TeamGameMode
::
drawScore
(
Font
*
font
)
{
font
sFont
->
showNumber
(
localPlayer
->
teamScore
,
64
,
4
);
font
->
showNumber
(
localPlayer
->
teamScore
,
64
,
4
);
return
;
...
...
src/game/gamemode.h
View file @
989fb4dd
...
...
@@ -43,6 +43,7 @@ enum GameModeType {
// Classes
class
Font
;
class
Player
;
class
GameMode
{
...
...
@@ -50,7 +51,7 @@ class GameMode {
public
:
virtual
GameModeType
getMode
()
=
0
;
virtual
unsigned
char
chooseTeam
()
=
0
;
virtual
void
drawScore
()
=
0
;
virtual
void
drawScore
(
Font
*
font
)
=
0
;
virtual
bool
hit
(
Player
*
source
,
Player
*
victim
);
virtual
bool
kill
(
Player
*
source
,
Player
*
victim
);
virtual
bool
endOfLevel
(
Player
*
player
,
unsigned
char
gridX
,
unsigned
char
gridY
);
...
...
@@ -62,7 +63,7 @@ class CooperativeGameMode : public GameMode {
public
:
unsigned
char
chooseTeam
();
virtual
void
drawScore
();
virtual
void
drawScore
(
Font
*
font
);
};
...
...
@@ -70,7 +71,7 @@ class FreeForAllGameMode : public GameMode {
public
:
unsigned
char
chooseTeam
();
virtual
void
drawScore
();
virtual
void
drawScore
(
Font
*
font
);
};
...
...
@@ -78,7 +79,7 @@ class TeamGameMode : public GameMode {
public
:
unsigned
char
chooseTeam
();
virtual
void
drawScore
();
virtual
void
drawScore
(
Font
*
font
);
};
...
...
src/io/gfx/font.h
View file @
989fb4dd
...
...
@@ -68,8 +68,6 @@ 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
*
fontsFont
;
/* Found in FONTS.000 */
EXTERN
Font
*
bonusFont
;
/* Found in BONUS.000 */
#endif
src/level/demolevel.cpp
View file @
989fb4dd
...
...
@@ -175,7 +175,7 @@ int DemoLevel::play () {
drawStats
(
stats
,
BLACK
);
font
sFont
->
showString
(
"demo"
,
(
canvasW
>>
1
)
-
36
,
32
);
font
->
showString
(
"demo"
,
(
canvasW
>>
1
)
-
36
,
32
);
}
...
...
src/level/level.cpp
View file @
989fb4dd
...
...
@@ -106,6 +106,8 @@ Level::~Level () {
delete
[]
sceneFile
;
delete
[]
musicFile
;
delete
font
;
return
;
}
...
...
@@ -670,11 +672,11 @@ int Level::play () {
// If paused, draw "PAUSE"
if
(
pmessage
&&
!
pmenu
)
font
sFont
->
showString
(
"pause"
,
(
canvasW
>>
1
)
-
44
,
32
);
font
->
showString
(
"pause"
,
(
canvasW
>>
1
)
-
44
,
32
);
// If this is a competitive game, draw the score
if
(
gameMode
)
gameMode
->
drawScore
();
if
(
gameMode
)
gameMode
->
drawScore
(
font
);
// Draw statistics
...
...
@@ -726,30 +728,30 @@ int Level::play () {
// Display statistics & bonuses
// TODO: Display percentage symbol
font
sFont
->
showString
(
"time"
,
(
canvasW
>>
1
)
-
152
,
(
canvasH
>>
1
)
-
60
);
font
sFont
->
showNumber
(
timeBonus
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
60
);
font
->
showString
(
"time"
,
(
canvasW
>>
1
)
-
152
,
(
canvasH
>>
1
)
-
60
);
font
->
showNumber
(
timeBonus
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
60
);
font
sFont
->
showString
(
"enemies"
,
(
canvasW
>>
1
)
-
152
,
(
canvasH
>>
1
)
-
40
);
font
->
showString
(
"enemies"
,
(
canvasW
>>
1
)
-
152
,
(
canvasH
>>
1
)
-
40
);
if
(
enemies
)
font
sFont
->
showNumber
((
localPlayer
->
getEnemies
()
*
100
)
/
enemies
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
40
);
font
->
showNumber
((
localPlayer
->
getEnemies
()
*
100
)
/
enemies
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
40
);
else
font
sFont
->
showNumber
(
0
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
40
);
font
sFont
->
showString
(
"%"
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
40
);
font
->
showNumber
(
0
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
40
);
font
->
showString
(
"%"
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
40
);
font
sFont
->
showString
(
"items"
,
(
canvasW
>>
1
)
-
152
,
(
canvasH
>>
1
)
-
20
);
font
->
showString
(
"items"
,
(
canvasW
>>
1
)
-
152
,
(
canvasH
>>
1
)
-
20
);
if
(
items
)
font
sFont
->
showNumber
((
localPlayer
->
getItems
()
*
100
)
/
items
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
20
);
font
->
showNumber
((
localPlayer
->
getItems
()
*
100
)
/
items
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
20
);
else
font
sFont
->
showNumber
(
0
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
20
);
font
sFont
->
showString
(
"%"
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
20
);
font
->
showNumber
(
0
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
20
);
font
->
showString
(
"%"
,
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
-
20
);
font
sFont
->
showString
(
"perfect"
,
(
canvasW
>>
1
)
-
152
,
canvasH
>>
1
);
font
sFont
->
showNumber
(
perfect
,
(
canvasW
>>
1
)
+
124
,
canvasH
>>
1
);
font
->
showString
(
"perfect"
,
(
canvasW
>>
1
)
-
152
,
canvasH
>>
1
);
font
->
showNumber
(
perfect
,
(
canvasW
>>
1
)
+
124
,
canvasH
>>
1
);
font
sFont
->
showString
(
"score"
,
(
canvasW
>>
1
)
-
152
,
(
canvasH
>>
1
)
+
40
);
font
sFont
->
showNumber
(
localPlayer
->
getScore
(),
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
+
40
);
font
->
showString
(
"score"
,
(
canvasW
>>
1
)
-
152
,
(
canvasH
>>
1
)
+
40
);
font
->
showNumber
(
localPlayer
->
getScore
(),
(
canvasW
>>
1
)
+
124
,
(
canvasH
>>
1
)
+
40
);
}
...
...
src/level/level.h
View file @
989fb4dd
...
...
@@ -86,6 +86,7 @@ typedef struct {
class
Bullet
;
class
Event
;
class
Font
;
class
Player
;
class
Scene
;
...
...
@@ -123,6 +124,7 @@ class Level : public BaseLevel {
void
draw
();
public
:
Font
*
font
;
Event
*
events
;
Bullet
*
bullets
;
EventPath
path
[
PATHS
];
...
...
src/level/levelload.cpp
View file @
989fb4dd
...
...
@@ -330,6 +330,17 @@ int Level::load (char *fileName, unsigned char diff, bool checkpoint) {
int
count
,
x
,
y
,
type
;
try
{
font
=
new
Font
(
false
);
}
catch
(
int
e
)
{
throw
e
;
}
difficulty
=
diff
;
...
...
@@ -356,6 +367,7 @@ int Level::load (char *fileName, unsigned char diff, bool checkpoint) {
}
catch
(
int
e
)
{
delete
[]
string
;
delete
font
;
return
e
;
...
...
@@ -422,6 +434,8 @@ int Level::load (char *fileName, unsigned char diff, bool checkpoint) {
}
catch
(
int
e
)
{
delete
font
;
return
e
;
}
...
...
@@ -483,6 +497,7 @@ int Level::load (char *fileName, unsigned char diff, bool checkpoint) {
if
(
tiles
<
0
)
{
delete
file
;
delete
font
;
return
tiles
;
...
...
@@ -501,6 +516,7 @@ int Level::load (char *fileName, unsigned char diff, bool checkpoint) {
SDL_FreeSurface
(
tileSet
);
delete
file
;
delete
font
;
return
count
;
...
...
src/main.cpp
View file @
989fb4dd
...
...
@@ -396,8 +396,6 @@ int loadMain (int argc, char *argv[]) {
// Load fonts
fontsFont
=
NULL
;
bonusFont
=
NULL
;
panelBigFont
=
NULL
;
panelSmallFont
=
NULL
;
font2
=
NULL
;
...
...
@@ -407,8 +405,6 @@ int loadMain (int argc, char *argv[]) {
try
{
fontsFont
=
new
Font
(
false
);
bonusFont
=
new
Font
(
true
);
panelBigFont
=
new
Font
(
pixels
+
(
40
*
320
),
true
);
panelSmallFont
=
new
Font
(
pixels
+
(
48
*
320
),
false
);
font2
=
new
Font
(
F_FONT2_0FN
);
...
...
@@ -419,8 +415,6 @@ int loadMain (int argc, char *argv[]) {
}
catch
(
int
e
)
{
if
(
fontsFont
)
delete
fontsFont
;
if
(
bonusFont
)
delete
bonusFont
;
if
(
panelBigFont
)
delete
panelBigFont
;
if
(
panelSmallFont
)
delete
panelSmallFont
;
if
(
font2
)
delete
font2
;
...
...
@@ -476,8 +470,6 @@ void freeMain () {
delete
net
;
delete
fontsFont
;
delete
bonusFont
;
delete
panelBigFont
;
delete
panelSmallFont
;
delete
font2
;
...
...
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