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
411eaa5a
Commit
411eaa5a
authored
Mar 28, 2010
by
alistert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cutscene refactoring. Fixed in-game gfx stats.
parent
1174dd9f
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
263 additions
and
314 deletions
+263
-314
Makefile
Makefile
+2
-1
Makefile.arm
Makefile.arm
+2
-1
Makefile.debian
Makefile.debian
+2
-1
game.cpp
src/game/game.cpp
+1
-1
file.cpp
src/io/file.cpp
+9
-10
file.h
src/io/file.h
+2
-2
video.cpp
src/io/gfx/video.cpp
+1
-1
sound.cpp
src/io/sound.cpp
+2
-2
demolevel.cpp
src/level/demolevel.cpp
+1
-18
level.cpp
src/level/level.cpp
+7
-21
level.h
src/level/level.h
+2
-2
levelframe.cpp
src/level/levelframe.cpp
+31
-1
scene.cpp
src/scene/scene.cpp
+75
-72
scene.h
src/scene/scene.h
+38
-46
sceneload.cpp
src/scene/sceneload.cpp
+88
-135
No files found.
Makefile
View file @
411eaa5a
...
...
@@ -13,7 +13,8 @@ objects = src/bonus/bonus.o \
src/menu/gamemenu.o src/menu/mainmenu.o src/menu/menu.o
\
src/menu/menuutil.o src/menu/setupmenu.o
\
src/player/bird.o src/player/player.o src/player/playerframe.o
\
src/main.o src/movable.o src/planet.o src/scene.o src/util.o
\
src/scene/scene.o src/scene/sceneload.o
\
src/main.o src/movable.o src/planet.o src/util.o
\
src/io/gfx/scale2x/getopt.o src/io/gfx/scale2x/pixel.o
\
src/io/gfx/scale2x/scale2x.o
src/io/gfx/scale2x/scale3x.o
\
src/io/gfx/scale2x/scalebit.o
src/io/gfx/scale2x/simple2x.o
...
...
Makefile.arm
View file @
411eaa5a
...
...
@@ -37,7 +37,8 @@ OBJS = src/bonus/bonus.o \
src/menu/gamemenu.o src/menu/mainmenu.o src/menu/menu.o
\
src/menu/menuutil.o src/menu/setupmenu.o
\
src/player/bird.o src/player/player.o src/player/playerframe.o
\
src/main.o src/movable.o src/planet.o src/scene.o src/util.o
\
src/scene/scene.o src/scene/sceneload.o
\
src/main.o src/movable.o src/planet.o src/util.o
\
src/io/gfx/scale2x/getopt.o src/io/gfx/scale2x/pixel.o
\
src/io/gfx/scale2x/scale2x.o src/io/gfx/scale2x/scale3x.o
\
src/io/gfx/scale2x/scalebit.o src/io/gfx/scale2x/simple2x.o
...
...
Makefile.debian
View file @
411eaa5a
...
...
@@ -13,7 +13,8 @@ objects = src/bonus/bonus.o \
src/menu/gamemenu.o src/menu/mainmenu.o src/menu/menu.o
\
src/menu/menuutil.o src/menu/setupmenu.o
\
src/player/bird.o src/player/player.o src/player/playerframe.o
\
src/main.o src/movable.o src/planet.o src/scene.o src/util.o
\
src/scene/scene.o src/scene/sceneload.o
\
src/main.o src/movable.o src/planet.o src/util.o
\
src/io/gfx/scale2x/getopt.o src/io/gfx/scale2x/pixel.o
\
src/io/gfx/scale2x/scale2x.o src/io/gfx/scale2x/scale3x.o
\
src/io/gfx/scale2x/scalebit.o src/io/gfx/scale2x/simple2x.o
...
...
src/game/game.cpp
View file @
411eaa5a
...
...
@@ -67,7 +67,7 @@ Game::~Game () {
if
(
levelFile
)
delete
[]
levelFile
;
if
(
players
!=
NULL
)
delete
[]
players
;
if
(
players
)
delete
[]
players
;
localPlayer
=
NULL
;
return
;
...
...
src/io/file.cpp
View file @
411eaa5a
...
...
@@ -194,7 +194,7 @@ unsigned char * File::loadBlock (int length) {
}
unsigned
char
*
File
::
loadRLE
(
int
length
,
bool
dontseek
)
{
unsigned
char
*
File
::
loadRLE
(
int
length
)
{
unsigned
char
*
buffer
;
int
rle
,
pos
,
byte
,
count
,
next
;
...
...
@@ -236,9 +236,7 @@ unsigned char * File::loadRLE (int length, bool dontseek) {
}
if
(
!
dontseek
)
{
fseek
(
f
,
next
,
SEEK_SET
);
}
return
buffer
;
...
...
@@ -265,18 +263,18 @@ char * File::loadString () {
int
length
,
count
;
length
=
fgetc
(
f
);
count
=
0
;
if
(
length
)
{
string
=
new
char
[
length
+
1
];
f
or
(;
count
<
length
;
count
++
)
string
[
count
]
=
fgetc
(
f
);
f
read
(
string
,
1
,
length
,
f
);
}
else
{
// If the length is not given, assume it is an 8.3 file name
string
=
new
char
[
13
];
for
(;
count
<
9
;
count
++
)
{
for
(
count
=
0
;
count
<
9
;
count
++
)
{
string
[
count
]
=
fgetc
(
f
);
...
...
@@ -292,19 +290,20 @@ char * File::loadString () {
}
}
length
=
count
;
}
string
[
count
]
=
0
;
string
[
length
]
=
0
;
return
string
;
}
SDL_Surface
*
File
::
loadSurface
(
int
width
,
int
height
,
bool
dontseek
)
{
SDL_Surface
*
File
::
loadSurface
(
int
width
,
int
height
)
{
return
createSurface
(
loadRLE
(
width
*
height
,
dontseek
),
width
,
height
);
return
createSurface
(
loadRLE
(
width
*
height
),
width
,
height
);
}
...
...
src/io/file.h
View file @
411eaa5a
...
...
@@ -54,10 +54,10 @@ class File {
signed
long
int
loadInt
();
void
storeInt
(
signed
long
int
val
);
unsigned
char
*
loadBlock
(
int
length
);
unsigned
char
*
loadRLE
(
int
length
,
bool
dontseek
=
false
);
unsigned
char
*
loadRLE
(
int
length
);
void
skipRLE
();
char
*
loadString
();
SDL_Surface
*
loadSurface
(
int
width
,
int
height
,
bool
dontseek
=
false
);
SDL_Surface
*
loadSurface
(
int
width
,
int
height
);
void
loadPalette
(
SDL_Color
*
palette
);
};
...
...
src/io/gfx/video.cpp
View file @
411eaa5a
...
...
@@ -42,7 +42,7 @@ SDL_Surface * createSurface (unsigned char * pixels, int width, int height) {
// Set the surface's palette
SDL_SetPalette
(
ret
,
SDL_LOGPAL
,
logicalPalette
,
0
,
256
);
if
(
pixels
!=
NULL
)
{
if
(
pixels
)
{
// Upload pixel data to the surface
if
(
SDL_MUSTLOCK
(
ret
))
SDL_LockSurface
(
ret
);
...
...
src/io/sound.cpp
View file @
411eaa5a
...
...
@@ -330,7 +330,7 @@ void freeSounds () {
int
count
;
if
(
sounds
!=
NULL
)
{
if
(
sounds
)
{
for
(
count
=
0
;
count
<
nSounds
;
count
++
)
{
...
...
@@ -352,7 +352,7 @@ void playSound (int newSound) {
// Set the sound to be played
if
(
(
sounds
!=
NULL
)
&&
(
newSound
>=
0
))
sounds
[
newSound
].
position
=
0
;
if
(
sounds
&&
(
newSound
>=
0
))
sounds
[
newSound
].
position
=
0
;
return
;
...
...
src/level/demolevel.cpp
View file @
411eaa5a
...
...
@@ -97,9 +97,6 @@ int DemoLevel::play () {
int
ret
;
// Arbitrary initial value
smoothfps
=
50.0
f
;
tickOffset
=
globalTicks
;
ticks
=
16
;
prevStepTicks
=
0
;
...
...
@@ -170,26 +167,12 @@ int DemoLevel::play () {
// Draw the graphics
draw
();
draw
(
stats
);
fontmn1
->
showString
(
"DEMO"
,
(
canvasW
>>
1
)
-
36
,
32
);
// Draw graphics statistics
if
(
stats
&
S_SCREEN
)
{
drawRect
(
236
,
9
,
80
,
32
,
BLACK
);
panelBigFont
->
showNumber
(
canvasW
,
268
,
15
);
panelBigFont
->
showString
(
"x"
,
272
,
15
);
panelBigFont
->
showNumber
(
canvasH
,
308
,
15
);
panelBigFont
->
showString
(
"fps"
,
244
,
27
);
panelBigFont
->
showNumber
((
int
)
smoothfps
,
308
,
27
);
}
}
return
E_NONE
;
...
...
src/level/level.cpp
View file @
411eaa5a
...
...
@@ -56,8 +56,9 @@
Level
::
Level
()
{
// Do nothing
// Arbitrary initial value
smoothfps
=
50.0
f
;
return
;
}
...
...
@@ -73,6 +74,9 @@ Level::Level (char *fileName, unsigned char diff, bool checkpoint) {
if
(
ret
<
0
)
throw
ret
;
// Arbitrary initial value
smoothfps
=
50.0
f
;
return
;
}
...
...
@@ -574,9 +578,6 @@ int Level::play () {
int
width
;
// Arbitrary initial value
smoothfps
=
50.0
f
;
tickOffset
=
globalTicks
;
ticks
=
16
;
prevStepTicks
=
0
;
...
...
@@ -728,7 +729,7 @@ int Level::play () {
// Draw the graphics
draw
();
draw
(
stats
);
// If paused, draw "PAUSE"
...
...
@@ -766,21 +767,6 @@ int Level::play () {
}
// Draw graphics statistics
if
(
stats
&
S_SCREEN
)
{
drawRect
(
viewW
-
84
,
11
,
80
,
25
,
BLACK
);
panelBigFont
->
showNumber
(
canvasW
,
viewW
-
52
,
14
);
panelBigFont
->
showString
(
"x"
,
viewW
-
48
,
14
);
panelBigFont
->
showNumber
(
canvasH
,
viewW
-
12
,
14
);
panelBigFont
->
showString
(
"fps"
,
viewW
-
76
,
26
);
panelBigFont
->
showNumber
((
int
)
smoothfps
,
viewW
-
12
,
26
);
}
if
(
stage
==
LS_END
)
{
// The level is over, so draw play statistics & bonuses
...
...
src/level/level.h
View file @
411eaa5a
...
...
@@ -131,17 +131,17 @@ class Level {
fixed
waterLevelSpeed
;
fixed
energyBar
;
int
stage
;
float
smoothfps
;
int
loadSprites
(
char
*
fileName
);
int
loadTiles
(
char
*
fileName
);
protected
:
float
smoothfps
;
unsigned
int
tickOffset
,
prevStepTicks
,
prevTicks
,
ticks
;
int
load
(
char
*
fileName
,
unsigned
char
diff
,
bool
checkpoint
);
int
step
();
void
draw
();
void
draw
(
int
stats
);
void
timeCalcs
(
bool
paused
);
public
:
...
...
src/level/levelframe.cpp
View file @
411eaa5a
...
...
@@ -173,7 +173,7 @@ int Level::step () {
void
Level
::
draw
()
{
void
Level
::
draw
(
int
stats
)
{
GridElement
*
ge
;
Event
*
event
;
...
...
@@ -440,6 +440,36 @@ void Level::draw () {
drawRect
(
dst
.
x
,
canvasH
-
13
,
dst
.
w
,
7
,
BLACK
);
// Draw graphics statistics
if
(
stats
&
S_SCREEN
)
{
#ifdef SCALE
if
(
scaleFactor
>
1
)
drawRect
(
viewW
-
84
,
11
,
80
,
37
,
BLACK
);
else
#endif
drawRect
(
viewW
-
84
,
11
,
80
,
25
,
BLACK
);
panelBigFont
->
showNumber
(
screenW
,
viewW
-
52
,
14
);
panelBigFont
->
showString
(
"x"
,
viewW
-
48
,
14
);
panelBigFont
->
showNumber
(
screenH
,
viewW
-
12
,
14
);
panelBigFont
->
showString
(
"fps"
,
viewW
-
76
,
26
);
panelBigFont
->
showNumber
((
int
)
smoothfps
,
viewW
-
12
,
26
);
#ifdef SCALE
if
(
scaleFactor
>
1
)
{
panelBigFont
->
showNumber
(
canvasW
,
viewW
-
52
,
38
);
panelBigFont
->
showString
(
"x"
,
viewW
-
48
,
39
);
panelBigFont
->
showNumber
(
canvasH
,
viewW
-
12
,
38
);
}
#endif
}
return
;
}
...
...
src/scene/scene.cpp
View file @
411eaa5a
...
...
@@ -49,19 +49,38 @@
*
*/
ImageInfo
::
ImageInfo
(
)
{
SceneImage
::
SceneImage
(
SceneImage
*
newNext
)
{
next
=
newNext
;
image
=
NULL
;
}
ImageInfo
::~
ImageInfo
()
{
if
(
image
!=
NULL
)
SDL_FreeSurface
(
image
);
SceneImage
::~
SceneImage
()
{
if
(
next
)
delete
next
;
if
(
image
)
SDL_FreeSurface
(
image
);
}
ScriptText
::
ScriptText
()
{
ScenePalette
::
ScenePalette
(
ScenePalette
*
newNext
)
{
next
=
newNext
;
}
ScenePalette
::~
ScenePalette
()
{
if
(
next
)
delete
next
;
}
SceneText
::
SceneText
()
{
x
=
-
1
;
y
=
-
1
;
...
...
@@ -72,25 +91,25 @@ ScriptText::ScriptText() {
}
Sc
riptText
::~
Script
Text
()
{
Sc
eneText
::~
Scene
Text
()
{
if
(
text
)
delete
[]
text
;
}
Sc
riptPage
::
Script
Page
()
{
Sc
enePage
::
Scene
Page
()
{
pageTime
=
0
;
n
oScript
Texts
=
0
;
nTexts
=
0
;
backgrounds
=
0
;
music
f
ile
=
NULL
;
music
F
ile
=
NULL
;
paletteIndex
=
0
;
}
Sc
riptPage
::~
Script
Page
()
{
Sc
enePage
::~
Scene
Page
()
{
if
(
music
file
)
delete
[]
musicf
ile
;
if
(
music
File
)
delete
[]
musicF
ile
;
}
...
...
@@ -100,7 +119,7 @@ Scene::Scene (const char * fileName) {
File
*
file
;
int
loop
;
n
oScript
Fonts
=
0
;
nFonts
=
0
;
LOG
(
"
\n
Scene"
,
fileName
);
try
{
...
...
@@ -113,22 +132,22 @@ Scene::Scene (const char * fileName) {
}
image
Index
=
0
;
palette
Index
=
0
;
image
s
=
NULL
;
palette
s
=
NULL
;
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
scriptStarts
=
new
signed
long
int
[
scriptItems
];
scriptPages
=
new
Script
Page
[
scriptItems
];
pages
=
new
Scene
Page
[
scriptItems
];
LOG
(
"Scene: Script items"
,
scriptItems
);
for
(
loop
=
0
;
loop
<
scriptItems
;
loop
++
)
{
scriptStarts
[
loop
]
=
file
->
loadInt
();
// Load offset to script
LOG
(
"scriptStart
:
"
,
scriptStarts
[
loop
]);
LOG
(
"scriptStart"
,
scriptStarts
[
loop
]);
}
...
...
@@ -141,7 +160,7 @@ Scene::Scene (const char * fileName) {
for
(
loop
=
0
;
loop
<
dataItems
;
loop
++
)
{
dataOffsets
[
loop
]
=
file
->
loadInt
();
// Load offset to script
LOG
(
"dataOffsets
:
"
,
dataOffsets
[
loop
]);
LOG
(
"dataOffsets"
,
dataOffsets
[
loop
]);
}
...
...
@@ -159,30 +178,20 @@ Scene::Scene (const char * fileName) {
Scene
::~
Scene
()
{
delete
[]
scriptPages
;
}
ImageInfo
*
Scene
::
FindImage
(
int
dataIndex
)
{
int
loop
;
for
(
loop
=
0
;
loop
<
imageIndex
;
loop
++
)
{
if
(
imageInfos
[
loop
].
dataIndex
==
dataIndex
)
return
imageInfos
+
loop
;
}
delete
[]
pages
;
return
NULL
;
if
(
images
)
delete
images
;
if
(
palettes
)
delete
palettes
;
}
int
Scene
::
play
()
{
SDL_Rect
dst
;
unsigned
int
sceneIndex
=
0
;
ImageInfo
*
imageInfo
;
unsigned
int
pageTime
=
scriptP
ages
[
sceneIndex
].
pageTime
;
SceneImage
*
image
;
unsigned
int
pageTime
=
p
ages
[
sceneIndex
].
pageTime
;
unsigned
int
lastTicks
=
globalTicks
;
int
newpage
=
true
;
int
fadein
=
false
;
...
...
@@ -211,7 +220,7 @@ int Scene::play () {
// Get bg for this page
newpage
=
true
;
pageTime
=
scriptP
ages
[
sceneIndex
].
pageTime
;
pageTime
=
p
ages
[
sceneIndex
].
pageTime
;
}
...
...
@@ -223,24 +232,14 @@ int Scene::play () {
textRect
.
y
=
0
;
textRect
.
w
=
320
;
textRect
.
h
=
200
;
PaletteInfo
*
paletteInfo
=
NULL
;
for
(
int
palette
=
0
;
palette
<
paletteIndex
;
palette
++
)
{
if
(
paletteInfos
[
palette
].
dataIndex
==
scriptPages
[
sceneIndex
].
paletteIndex
)
{
ScenePalette
*
palette
=
palettes
;
paletteInfo
=
&
paletteInfos
[
palette
];
break
;
}
while
(
palette
&&
(
palette
->
id
!=
pages
[
sceneIndex
].
paletteIndex
))
palette
=
palette
->
next
;
}
if
(
paletteInfo
!=
NULL
)
{
if
(
palette
)
{
// usePalette(palette
Info->palette
);
currentPalette
=
palette
Info
->
palette
;
// usePalette(palette);
currentPalette
=
palette
->
palette
;
fadein
=
true
;
}
else
restorePalette
(
screen
);
...
...
@@ -250,17 +249,20 @@ int Scene::play () {
}
// First draw the backgrounds associated with this page
if
(
scriptPages
[
sceneIndex
].
backgrounds
>
0
)
{
if
(
pages
[
sceneIndex
].
backgrounds
>
0
)
{
for
(
int
bg
=
0
;
bg
<
pages
[
sceneIndex
].
backgrounds
;
bg
++
)
{
for
(
int
bg
=
0
;
bg
<
scriptPages
[
sceneIndex
].
backgrounds
;
bg
++
)
{
image
=
images
;
imageInfo
=
FindImage
(
scriptPages
[
sceneIndex
].
bgIndex
[
bg
]);
while
(
image
&&
(
image
->
id
!=
pages
[
sceneIndex
].
bgIndex
[
bg
]))
image
=
image
->
next
;
if
(
image
Info
!=
NULL
)
{
if
(
image
)
{
dst
.
x
=
(
scriptP
ages
[
sceneIndex
].
bgPos
[
bg
]
&
65535
)
*
2
+
(
canvasW
-
320
)
>>
1
;
dst
.
y
=
((
scriptP
ages
[
sceneIndex
].
bgPos
[
bg
]
&
(
~
65535
))
>>
16
)
*
2
+
(
canvasH
-
200
)
>>
1
;
SDL_BlitSurface
(
image
Info
->
image
,
NULL
,
canvas
,
&
dst
);
dst
.
x
=
(
p
ages
[
sceneIndex
].
bgPos
[
bg
]
&
65535
)
*
2
+
(
canvasW
-
320
)
>>
1
;
dst
.
y
=
((
p
ages
[
sceneIndex
].
bgPos
[
bg
]
&
(
~
65535
))
>>
16
)
*
2
+
(
canvasH
-
200
)
>>
1
;
SDL_BlitSurface
(
image
->
image
,
NULL
,
canvas
,
&
dst
);
}
...
...
@@ -274,16 +276,17 @@ int Scene::play () {
int
y
=
0
;
int
extraLineHeight
=
0
;
for
(
int
text
=
0
;
text
<
scriptPages
[
sceneIndex
].
noScriptTexts
;
tex
t
++
)
{
for
(
int
count
=
0
;
count
<
pages
[
sceneIndex
].
nTexts
;
coun
t
++
)
{
Font
*
font
=
NULL
;
SceneText
*
text
=
pages
[
sceneIndex
].
texts
+
count
;
Font
*
font
=
NULL
;
int
xOffset
,
yOffset
;
for
(
int
index
=
0
;
index
<
n
oScript
Fonts
;
index
++
)
{
for
(
int
index
=
0
;
index
<
nFonts
;
index
++
)
{
if
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
fontId
==
scriptFonts
[
index
].
fontI
d
)
{
if
(
text
->
fontId
==
fonts
[
index
].
i
d
)
{
font
=
scriptF
onts
[
index
].
font
;
font
=
f
onts
[
index
].
font
;
continue
;
...
...
@@ -291,31 +294,31 @@ int Scene::play () {
}
if
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
x
!=
-
1
)
{
if
(
text
->
x
!=
-
1
)
{
x
=
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
x
;
y
=
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
y
;
x
=
text
->
x
;
y
=
text
->
y
;
}
if
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
textRect
.
x
!=
-
1
)
{
if
(
text
->
textRect
.
x
!=
-
1
)
{
textRect
=
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
textRect
;
textRect
=
text
->
textRect
;
x
=
0
;
y
=
0
;
}
if
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
extraLineHeight
!=
-
1
)
{
if
(
text
->
extraLineHeight
!=
-
1
)
{
extraLineHeight
=
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
extraLineHeight
;
extraLineHeight
=
text
->
extraLineHeight
;
}
xOffset
=
((
canvasW
-
320
)
>>
1
)
+
textRect
.
x
+
x
;
yOffset
=
((
canvasH
-
200
)
>>
1
)
+
textRect
.
y
+
y
;
switch
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
alignment
)
{
switch
(
text
->
alignment
)
{
case
0
:
// left
...
...
@@ -323,13 +326,13 @@ int Scene::play () {
case
1
:
// right
xOffset
+=
textRect
.
w
-
font
->
getSceneStringWidth
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
text
);
xOffset
+=
textRect
.
w
-
font
->
getSceneStringWidth
(
text
->
text
);
break
;
case
2
:
// center
xOffset
+=
(
textRect
.
w
-
font
->
getSceneStringWidth
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
text
))
>>
1
;
xOffset
+=
(
textRect
.
w
-
font
->
getSceneStringWidth
(
text
->
text
))
>>
1
;
break
;
...
...
@@ -337,11 +340,11 @@ int Scene::play () {
// Drop shadow
font
->
mapPalette
(
0
,
256
,
0
,
1
);
font
->
showSceneString
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
text
,
xOffset
+
1
,
yOffset
+
1
);
font
->
showSceneString
(
text
->
text
,
xOffset
+
1
,
yOffset
+
1
);
font
->
restorePalette
();
// Text itself
font
->
showSceneString
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
text
,
xOffset
,
yOffset
);
font
->
showSceneString
(
text
->
text
,
xOffset
,
yOffset
);
y
+=
extraLineHeight
+
font
->
getHeight
()
/
2
;
...
...
src/scene/scene.h
View file @
411eaa5a
...
...
@@ -64,18 +64,7 @@ enum {
class
Font
;
class
ScriptFont
{
public
:
// This points to any of the available types (already loaded)
Font
*
font
;
// Font id given this font
int
fontId
;
};
class
ScriptText
{
class
SceneText
{
public
:
char
*
text
;
...
...
@@ -86,12 +75,12 @@ class ScriptText {
SDL_Rect
textRect
;
int
extraLineHeight
;
Sc
ript
Text
();
~
Sc
ript
Text
();
Sc
ene
Text
();
~
Sc
ene
Text
();
};
class
Sc
ript
Page
{
class
Sc
ene
Page
{
public
:
int
backgrounds
;
...
...
@@ -100,65 +89,68 @@ class ScriptPage {
// Length of the scene in seconds, or if zero = anim complete, or 256 = user interaction
int
pageTime
;
Sc
riptText
scriptT
exts
[
100
];
int
n
oScript
Texts
;
char
*
music
f
ile
;
Sc
eneText
t
exts
[
100
];
int
nTexts
;
char
*
music
F
ile
;
int
paletteIndex
;
Sc
ript
Page
();
~
Sc
ript
Page
();
Sc
ene
Page
();
~
Sc
ene
Page
();
};
class
ImageInfo
{
class
SceneImage
{
public
:
// SDL_Surface with the image
SceneImage
*
next
;
SDL_Surface
*
image
;
int
id
;
// data index of the image (not the palette) to compare with scripts
int
dataIndex
;
ImageInfo
();
~
ImageInfo
();
SceneImage
(
SceneImage
*
newNext
);
~
SceneImage
();
};
class
PaletteInfo
{
class
ScenePalette
{
public
:
// Palette associated with the image
public
:
ScenePalette
*
next
;
SDL_Color
palette
[
256
];
// data index of the image (not the palette) to compare with scripts
int
dataIndex
;
int
id
;
ScenePalette
(
ScenePalette
*
newNext
);
~
ScenePalette
();
};
class
SceneFont
{
public
:
Font
*
font
;
int
id
;
};
class
Scene
{
private
:
ImageInfo
imageInfos
[
100
];
PaletteInfo
paletteInfos
[
100
];
SceneImage
*
images
;
ScenePalette
*
palettes
;
SceneFont
fonts
[
5
];
int
nFonts
;
unsigned
short
int
scriptItems
;
unsigned
short
int
dataItems
;
signed
long
int
*
scriptStarts
;
signed
long
int
*
dataOffsets
;
int
imageIndex
;
int
paletteIndex
;
// Scripts all information needed to render script pages, text etc
Sc
riptPage
*
scriptP
ages
;
Sc
enePage
*
p
ages
;
void
loadScripts
(
File
*
f
);
void
loadData
(
File
*
f
);
void
loadAni
(
File
*
f
,
int
dataIndex
);
ImageInfo
*
FindImage
(
int
dataIndex
);
public
:
ScriptFont
scriptFonts
[
5
];
int
noScriptFonts
;
void
loadScripts
(
File
*
f
);
void
loadData
(
File
*
f
);
void
loadAni
(
File
*
f
,
int
dataIndex
);
public
:
Scene
(
const
char
*
fileName
);
~
Scene
();
...
...
src/scene/sceneload.cpp
View file @
411eaa5a
This diff is collapsed.
Click to expand it.
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