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
947aa7ae
Commit
947aa7ae
authored
Jun 26, 2010
by
alistert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplified Scene animation loading.
parent
9a3017d7
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
303 additions
and
360 deletions
+303
-360
scene.cpp
src/scene/scene.cpp
+82
-69
scene.h
src/scene/scene.h
+7
-6
sceneload.cpp
src/scene/sceneload.cpp
+214
-285
No files found.
src/scene/scene.cpp
View file @
947aa7ae
...
...
@@ -381,7 +381,8 @@ int Scene::play () {
}
else
if
(
pages
[
sceneIndex
].
animIndex
!=
-
1
)
{
if
(
currentFrame
==
NULL
)
{
if
(
currentFrame
==
NULL
)
{
animation
=
animations
;
while
(
animation
&&
(
animation
->
id
!=
pages
[
sceneIndex
].
animIndex
))
...
...
@@ -391,32 +392,38 @@ int Scene::play () {
dst
.
x
=
(
canvasW
-
SW
)
>>
1
;
dst
.
y
=
(
canvasH
-
SH
)
>>
1
;
frameDelay
=
1000
/
(
pages
[
sceneIndex
].
animSpeed
>>
8
);
frameDelay
=
1000
/
(
pages
[
sceneIndex
].
animSpeed
>>
8
);
SDL_BlitSurface
(
animation
->
background
,
NULL
,
canvas
,
&
dst
);
currentFrame
=
animation
->
sceneFrames
;
SDL_Delay
(
frameDelay
);
}
}
else
{
}
else
{
// Upload pixel data to the surface
if
(
SDL_MUSTLOCK
(
animation
->
background
))
SDL_LockSurface
(
animation
->
background
);
switch
(
currentFrame
->
frameType
)
{
switch
(
currentFrame
->
frameType
)
{
case
ESquareAniHeader
:
{
loadCompactedMem
(
currentFrame
->
frameSize
,
currentFrame
->
frameData
,(
unsigned
char
*
)
animation
->
background
->
pixels
,
SW
,
SH
);
}
loadCompactedMem
(
currentFrame
->
frameSize
,
currentFrame
->
frameData
,
(
unsigned
char
*
)
animation
->
background
->
pixels
,
SW
,
SH
);
break
;
case
EFFAniHeader
:
{
unsigned
char
*
data
=
currentFrame
->
frameData
;
int
size
=
currentFrame
->
frameSize
;
loadFFMem
(
size
,
currentFrame
->
frameData
,
(
unsigned
char
*
)
animation
->
background
->
pixels
)
;
}
break
;
loadFFMem
(
currentFrame
->
frameSize
,
currentFrame
->
frameData
,
(
unsigned
char
*
)
animation
->
background
->
pixels
)
;
break
;
default
:
LOG
(
"Scene::Play unknown type"
,
currentFrame
->
frameType
);
break
;
}
if
(
SDL_MUSTLOCK
(
animation
->
background
))
SDL_UnlockSurface
(
animation
->
background
);
...
...
@@ -425,39 +432,45 @@ int Scene::play () {
dst
.
y
=
(
canvasH
-
SH
)
>>
1
;
SDL_BlitSurface
(
animation
->
background
,
NULL
,
canvas
,
&
dst
);
if
(
currentFrame
->
soundId
!=
-
1
&&
animation
->
noSounds
>
0
)
{
if
(
currentFrame
->
soundId
!=
-
1
&&
animation
->
noSounds
>
0
)
{
LOG
(
"PLAY SOUND NAME"
,
animation
->
soundNames
[
currentFrame
->
soundId
-
1
]);
// Search for matching sound
for
(
int
y
=
0
;
y
<
nSounds
;
y
++
)
{
if
(
!
strcmp
(
animation
->
soundNames
[
currentFrame
->
soundId
-
1
],
sounds
[
y
].
name
))
{
playSound
(
y
);
break
;
}
}
}
lastFrame
=
currentFrame
;
if
(
prevFrame
)
{
currentFrame
=
currentFrame
->
prev
;
}
else
{
currentFrame
=
currentFrame
->
next
;
}
if
(
prevFrame
)
currentFrame
=
currentFrame
->
prev
;
else
currentFrame
=
currentFrame
->
next
;
SDL_Delay
(
frameDelay
);
if
(
currentFrame
==
NULL
&&
animation
->
reverseAnimation
)
{
/*prevFrame = 1-prevFrame;
/*if(prevFrame
) {
currentFrame = lastFrame->prev;
}
else {
currentFrame = lastFrame->next
;
}
*/
if
(
currentFrame
==
NULL
&&
animation
->
reverseAnimation
)
{
//prevFrame = 1 - prevFrame;
/*if(prevFrame) currentFrame = lastFrame->prev
;
else currentFrame = lastFrame->next;
*/
currentFrame
=
NULL
;
//animation->sceneFrames;
}
else
if
(
currentFrame
==
NULL
&&
!
pageTime
&&
!
pages
[
sceneIndex
].
askForYesNo
&&
pages
[
sceneIndex
].
nextPageAfterAnim
)
{
}
else
if
(
currentFrame
==
NULL
&&
!
pageTime
&&
!
pages
[
sceneIndex
].
askForYesNo
&&
pages
[
sceneIndex
].
nextPageAfterAnim
)
{
continueToNextPage
=
1
;
}
}
}
else
clearScreen
(
0
);
...
...
src/scene/scene.h
View file @
947aa7ae
...
...
@@ -234,9 +234,10 @@ class Scene {
void
loadScripts
(
File
*
f
);
void
loadData
(
File
*
f
);
void
loadAni
(
File
*
f
,
int
dataIndex
);
void
loadCompacted
(
int
size
,
File
*
f
,
unsigned
char
*
pixdata
,
int
width
,
int
height
);
void
loadCompactedMem
(
int
size
,
unsigned
char
*
frameData
,
unsigned
char
*
pixdata
,
int
width
,
int
height
);
void
loadFFMem
(
int
size
,
unsigned
char
*
frameData
,
unsigned
char
*
pixdata
);
void
loadCompactedMem
(
int
size
,
unsigned
char
*
frameData
,
unsigned
char
*
pixdata
,
int
width
,
int
height
);
void
loadFFMem
(
int
size
,
unsigned
char
*
frameData
,
unsigned
char
*
pixdata
);
unsigned
short
int
loadShortMem
(
unsigned
char
**
data
);
public
:
Scene
(
const
char
*
fileName
);
~
Scene
();
...
...
src/scene/sceneload.cpp
View file @
947aa7ae
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