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
59956ced
Commit
59956ced
authored
Mar 04, 2010
by
alistert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed cutscene text positioning in higher resolutions.
parent
c1b3814a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
116 additions
and
60 deletions
+116
-60
scene.cpp
src/scene.cpp
+116
-60
No files found.
src/scene.cpp
View file @
59956ced
...
...
@@ -734,6 +734,7 @@ int Scene::play () {
SDL_Rect
textRect
=
{
0
,
0
,
320
,
200
};
while
(
true
)
{
if
(
loop
(
NORMAL_LOOP
)
==
E_QUIT
)
return
E_QUIT
;
if
(
controls
.
release
(
C_ESCAPE
))
{
...
...
@@ -741,7 +742,9 @@ int Scene::play () {
return
E_NONE
;
}
SDL_Delay
(
T_FRAME
);
int
upOrLeft
=
(
controls
.
release
(
C_UP
)
||
controls
.
release
(
C_LEFT
));
if
((
sceneIndex
>
0
&&
upOrLeft
)
||
controls
.
release
(
C_RIGHT
)
||
controls
.
release
(
C_DOWN
)
||
controls
.
release
(
C_ENTER
)
||
((
globalTicks
-
lastTicks
)
>=
pageTime
*
1000
&&
pageTime
!=
256
&&
pageTime
!=
0
))
{
...
...
@@ -801,75 +804,128 @@ int Scene::play () {
}
else
{
clearScreen
(
0
);
}
if
(
fadein
)
{
fadein
=
false
;
firstPE
=
new
FadeInPaletteEffect
(
250
,
firstPE
);
}
// Draw the texts associated with this page
int
x
=
0
;
int
y
=
0
;
int
extralineheight
=
0
;
for
(
int
text
=
0
;
text
<
scriptPages
[
sceneIndex
].
noScriptTexts
;
text
++
)
{
Font
*
font
=
NULL
;
for
(
int
index
=
0
;
index
<
noScriptFonts
;
index
++
)
{
if
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
fontId
==
scriptFonts
[
index
].
fontId
)
{
switch
(
scriptFonts
[
index
].
fontType
)
{
case
EFONT2Type
:
font
=
font2
;
break
;
case
EFONTBIGType
:
font
=
fontbig
;
break
;
case
EFONTINYType
:
font
=
fontiny
;
break
;
case
EFONTMN1Type
:
font
=
fontmn1
;
break
;
case
EFONTMN2Type
:
font
=
fontmn2
;
break
;
int
extraLineHeight
=
0
;
for
(
int
text
=
0
;
text
<
scriptPages
[
sceneIndex
].
noScriptTexts
;
text
++
)
{
Font
*
font
=
NULL
;
int
xOffset
,
yOffset
;
for
(
int
index
=
0
;
index
<
noScriptFonts
;
index
++
)
{
if
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
fontId
==
scriptFonts
[
index
].
fontId
)
{
switch
(
scriptFonts
[
index
].
fontType
)
{
case
EFONT2Type
:
font
=
font2
;
break
;
case
EFONTBIGType
:
font
=
fontbig
;
break
;
case
EFONTINYType
:
font
=
fontiny
;
break
;
case
EFONTMN1Type
:
font
=
fontmn1
;
break
;
case
EFONTMN2Type
:
font
=
fontmn2
;
break
;
}
continue
;
}
}
if
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
x
!=
-
1
)
{
x
=
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
x
;
y
=
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
y
;
}
continue
;
if
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
textRect
.
x
!=
-
1
)
{
textRect
=
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
textRect
;
x
=
0
;
y
=
0
;
}
}
if
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
x
!=
-
1
)
{
x
=
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
x
;
y
=
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
y
;
}
if
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
extraLineHeight
!=
-
1
)
{
extraLineHeight
=
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
extraLineHeight
;
if
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
textRect
.
x
!=
-
1
)
{
textRect
=
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
textRect
;
x
=
0
;
y
=
0
;
}
if
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
extraLineHeight
!=
-
1
)
{
extralineheight
=
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
extraLineHeight
;
}
switch
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
alignment
)
{
case
0
:
// left
font
->
showString
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
text
,
textRect
.
x
+
x
,
textRect
.
y
+
y
);
break
;
case
1
:
// right
{
int
width
=
font
->
getStringWidth
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
text
);
font
->
showString
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
text
,
textRect
.
x
+
textRect
.
w
-
width
,
textRect
.
y
+
y
);
}
break
;
case
2
:
// center
{
int
width
=
font
->
getStringWidth
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
text
)
/
2
;
font
->
showString
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
text
,
textRect
.
x
+
(
textRect
.
w
/
2
)
-
width
,
textRect
.
y
+
y
);
}
break
;
xOffset
=
((
screenW
-
320
)
>>
1
)
+
textRect
.
x
;
yOffset
=
((
screenH
-
200
)
>>
1
)
+
textRect
.
y
+
y
;
switch
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
alignment
)
{
case
0
:
// left
xOffset
+=
x
;
break
;
case
1
:
// right
xOffset
+=
textRect
.
w
-
font
->
getStringWidth
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
text
);
break
;
case
2
:
// center
xOffset
+=
(
textRect
.
w
-
font
->
getStringWidth
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
text
))
>>
1
;
break
;
}
y
+=
(
extralineheight
+
font
->
getHeight
()
/
2
);
// Drop shadow
font
->
mapPalette
(
0
,
256
,
0
,
1
);
font
->
showString
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
text
,
xOffset
+
1
,
yOffset
+
1
);
font
->
restorePalette
();
// Text itself
font
->
showString
(
scriptPages
[
sceneIndex
].
scriptTexts
[
text
].
text
,
xOffset
,
yOffset
);
y
+=
extraLineHeight
+
font
->
getHeight
()
/
2
;
}
// Fade in from black
if
(
fadein
)
{
fadein
=
false
;
firstPE
=
new
FadeInPaletteEffect
(
250
,
firstPE
);
clearScreen
(
0
);
}
}
...
...
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