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
Hide 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,84 +381,97 @@ int Scene::play () {
...
@@ -381,84 +381,97 @@ int Scene::play () {
}
else
if
(
pages
[
sceneIndex
].
animIndex
!=
-
1
)
{
}
else
if
(
pages
[
sceneIndex
].
animIndex
!=
-
1
)
{
if
(
currentFrame
==
NULL
)
{
if
(
currentFrame
==
NULL
)
{
animation
=
animations
;
animation
=
animations
;
while
(
animation
&&
(
animation
->
id
!=
pages
[
sceneIndex
].
animIndex
))
animation
=
animation
->
next
;
while
(
animation
&&
(
animation
->
id
!=
pages
[
sceneIndex
].
animIndex
))
animation
=
animation
->
next
;
if
(
animation
&&
animation
->
background
)
{
if
(
animation
&&
animation
->
background
)
{
dst
.
x
=
(
canvasW
-
SW
)
>>
1
;
dst
.
x
=
(
canvasW
-
SW
)
>>
1
;
dst
.
y
=
(
canvasH
-
SH
)
>>
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
);
SDL_BlitSurface
(
animation
->
background
,
NULL
,
canvas
,
&
dst
);
currentFrame
=
animation
->
sceneFrames
;
currentFrame
=
animation
->
sceneFrames
;
SDL_Delay
(
frameDelay
);
SDL_Delay
(
frameDelay
);
}
}
}
else
{
// Upload pixel data to the surface
}
else
{
if
(
SDL_MUSTLOCK
(
animation
->
background
))
SDL_LockSurface
(
animation
->
background
);
// Upload pixel data to the surface
switch
(
currentFrame
->
frameType
)
if
(
SDL_MUSTLOCK
(
animation
->
background
))
SDL_LockSurface
(
animation
->
background
);
{
case
ESquareAniHeader
:
switch
(
currentFrame
->
frameType
)
{
{
loadCompactedMem
(
currentFrame
->
frameSize
,
currentFrame
->
frameData
,(
unsigned
char
*
)
animation
->
background
->
pixels
,
SW
,
SH
);
case
ESquareAniHeader
:
}
break
;
loadCompactedMem
(
currentFrame
->
frameSize
,
currentFrame
->
frameData
,
(
unsigned
char
*
)
animation
->
background
->
pixels
,
SW
,
SH
);
case
EFFAniHeader
:
{
break
;
unsigned
char
*
data
=
currentFrame
->
frameData
;
int
size
=
currentFrame
->
frameSize
;
case
EFFAniHeader
:
loadFFMem
(
size
,
currentFrame
->
frameData
,
(
unsigned
char
*
)
animation
->
background
->
pixels
);
}
break
;
loadFFMem
(
currentFrame
->
frameSize
,
currentFrame
->
frameData
,
(
unsigned
char
*
)
animation
->
background
->
pixels
);
default
:
LOG
(
"Scene::Play unknown type"
,
currentFrame
->
frameType
);
break
;
default
:
LOG
(
"Scene::Play unknown type"
,
currentFrame
->
frameType
);
break
;
}
if
(
SDL_MUSTLOCK
(
animation
->
background
))
SDL_UnlockSurface
(
animation
->
background
);
dst
.
x
=
(
canvasW
-
SW
)
>>
1
;
dst
.
y
=
(
canvasH
-
SH
)
>>
1
;
SDL_BlitSurface
(
animation
->
background
,
NULL
,
canvas
,
&
dst
);
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
;
break
;
}
}
if
(
SDL_MUSTLOCK
(
animation
->
background
))
SDL_UnlockSurface
(
animation
->
background
);
dst
.
x
=
(
canvasW
-
SW
)
>>
1
;
dst
.
y
=
(
canvasH
-
SH
)
>>
1
;
SDL_BlitSurface
(
animation
->
background
,
NULL
,
canvas
,
&
dst
);
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
;
}
}
SDL_Delay
(
frameDelay
);
if
(
currentFrame
==
NULL
&&
animation
->
reverseAnimation
)
{
}
/*prevFrame = 1-prevFrame;
lastFrame
=
currentFrame
;
/*if(prevFrame) {
if
(
prevFrame
)
currentFrame
=
currentFrame
->
prev
;
currentFrame = lastFrame->prev;
else
currentFrame
=
currentFrame
->
next
;
}
else {
SDL_Delay
(
frameDelay
);
currentFrame = lastFrame->next;
}*/
if
(
currentFrame
==
NULL
&&
animation
->
reverseAnimation
)
{
currentFrame
=
NULL
;
//animation->sceneFrames;
}
//prevFrame = 1 - prevFrame;
else
if
(
currentFrame
==
NULL
&&
!
pageTime
&&
!
pages
[
sceneIndex
].
askForYesNo
&&
pages
[
sceneIndex
].
nextPageAfterAnim
)
{
continueToNextPage
=
1
;
/*if(prevFrame) currentFrame = lastFrame->prev;
}
else currentFrame = lastFrame->next;*/
}
currentFrame
=
NULL
;
//animation->sceneFrames;
}
else
if
(
currentFrame
==
NULL
&&
!
pageTime
&&
!
pages
[
sceneIndex
].
askForYesNo
&&
pages
[
sceneIndex
].
nextPageAfterAnim
)
{
continueToNextPage
=
1
;
}
}
}
else
clearScreen
(
0
);
}
else
clearScreen
(
0
);
...
...
src/scene/scene.h
View file @
947aa7ae
...
@@ -231,12 +231,13 @@ class Scene {
...
@@ -231,12 +231,13 @@ class Scene {
// Scripts all information needed to render script pages, text etc
// Scripts all information needed to render script pages, text etc
ScenePage
*
pages
;
ScenePage
*
pages
;
void
loadScripts
(
File
*
f
);
void
loadScripts
(
File
*
f
);
void
loadData
(
File
*
f
);
void
loadData
(
File
*
f
);
void
loadAni
(
File
*
f
,
int
dataIndex
);
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
loadCompactedMem
(
int
size
,
unsigned
char
*
frameData
,
unsigned
char
*
pixdata
,
int
width
,
int
height
);
void
loadFFMem
(
int
size
,
unsigned
char
*
frameData
,
unsigned
char
*
pixdata
);
void
loadFFMem
(
int
size
,
unsigned
char
*
frameData
,
unsigned
char
*
pixdata
);
unsigned
short
int
loadShortMem
(
unsigned
char
**
data
);
public
:
public
:
Scene
(
const
char
*
fileName
);
Scene
(
const
char
*
fileName
);
~
Scene
();
~
Scene
();
...
...
src/scene/sceneload.cpp
View file @
947aa7ae
...
@@ -33,335 +33,261 @@
...
@@ -33,335 +33,261 @@
#include <string.h>
#include <string.h>
void
Scene
::
loadFFMem
(
int
size
,
unsigned
char
*
frameData
,
unsigned
char
*
pixdata
)
{
unsigned
short
int
Scene
::
loadShortMem
(
unsigned
char
**
data
)
{
unsigned
short
int
val
;
val
=
**
data
;
(
*
data
)
++
;
val
+=
((
unsigned
short
)(
**
data
))
<<
8
;
(
*
data
)
++
;
return
val
;
}
void
Scene
::
loadFFMem
(
int
size
,
unsigned
char
*
frameData
,
unsigned
char
*
pixdata
)
{
int
pixels
=
0
;
int
pixels
=
0
;
int
fillWidth
=
0
;
int
fillWidth
=
0
;
unsigned
char
fillColor
=
0
;
unsigned
char
fillColor
=
0
;
int
trans
=
1
;
bool
trans
=
true
;
int
opCodeNo
=
0
;
int
opCodeNo
=
0
;
unsigned
char
*
repeatPos
=
NULL
;
unsigned
char
*
repeatPos
=
NULL
;
unsigned
char
*
startPix
=
pixdata
;
unsigned
char
*
startPix
=
pixdata
;
unsigned
char
*
framestart
=
frameData
;
unsigned
char
*
framestart
=
frameData
;
/*FILE* out = fopen("c:\\output.dat", "wb");
/*FILE* out = fopen("c:\\output.dat", "wb");
fwrite(frameData, size, 1, out);
fwrite(frameData, size, 1, out);
fclose(out);*/
fclose(out);*/
while
(
size
>
0
&&
pixels
<
64000
)
{
while
(
size
>
0
&&
pixels
<
64000
)
{
LOG
(
"PL FF frame offset"
,(
frameData
-
framestart
));
opCodeNo
++
;
LOG
(
"PL FF frame offset"
,
frameData
-
framestart
);
fflush
(
stderr
);
opCodeNo
++
;
unsigned
char
header
=
*
frameData
;
frameData
++
;
fflush
(
stderr
);
unsigned
char
header
=
*
frameData
;
if
(
header
==
0xFF
)
{
frameData
++
;
unsigned
short
skip
=
*
frameData
;
frameData
++
;
skip
+=
((
unsigned
short
)(
*
frameData
))
<<
8
;
frameData
++
;
if
((
header
&
0x7F
)
==
0x7F
)
{
if
(
trans
)
{
skip
+=
255
;
fillWidth
=
loadShortMem
(
&
frameData
);
}
LOG
(
"PL FF 0xff skip"
,
skip
);
if
(
trans
)
fillWidth
+=
255
;
pixels
+=
skip
;
pixdata
+=
skip
;
if
(
header
&
0x80
)
{
size
-=
2
;
trans
=
0
;
LOG
(
"PL FF 0xff skip"
,
fillWidth
);
}
else
if
(
header
==
0x7f
)
{
}
else
{
fillWidth
=
*
frameData
;
frameData
++
;
fillWidth
+=
((
unsigned
short
)(
*
frameData
))
<<
8
;
frameData
++
;
fillColor
=
*
frameData
;
frameData
++
;
if
(
trans
)
{
fillWidth
+=
255
;
}
//fillColor = *frameData;frameData++;
//memset(pixdata, fillColor, fillWidth);
//memset(pixdata, fillColor, fillWidth);
LOG
(
"PL FF 0x7f fillWidth"
,
fillWidth
);
LOG
(
"PL FF 0x7f fillWidth"
,
fillWidth
);
pixels
+=
fillWidth
;
pixdata
+=
fillWidth
;
size
-=
2
;
trans
=
1
;
}
else
if
((
header
&
0xe0
)
==
0xe0
)
{
LOG
(
"PL FF 0xe0 skip"
,
header
);
pixels
+=
header
;
pixdata
+=
header
;
trans
=
0
;
}
else
if
((
header
&
0xA0
)
==
0xA0
)
{
fillWidth
=
(
header
-
0xA0
);
LOG
(
"PL FF 0xa0 fill next op"
,
fillWidth
);
// fill ?
unsigned
char
*
readfill
=
pixdata
-
320
;
for
(
int
col
=
0
;
col
<
fillWidth
;
col
++
)
{
*
pixdata
=
*
readfill
;
pixels
++
;
pixdata
++
;
readfill
++
;
}
trans
=
0
;
}
else
if
((
header
&
0xC0
)
==
0xc0
)
{
fillWidth
=
(
header
-
0xC0
);
LOG
(
"PL FF 0xc0 fillWidth"
,
fillWidth
);
fillColor
=
*
frameData
;
frameData
++
;
memset
(
pixdata
,
fillColor
,
fillWidth
);
pixdata
+=
fillWidth
;
pixels
+=
fillWidth
;
size
--
;
trans
=
0
;
}
}
else
if
(
header
&
0x80
)
{
fillWidth
=
(
header
-
0x80
);
size
-=
2
;
if
(
trans
)
{
LOG
(
"PL FF 0x8? SKIP bytes"
,
fillWidth
);
}
else
if
(
header
)
{
pixels
+=
(
fillWidth
);
pixdata
+=
(
fillWidth
);
fillWidth
=
header
&
0x1F
;
}
else
{
switch
(
header
&
0x60
)
{
LOG
(
"PL FF 0x8? Copy bytes"
,
fillWidth
);
for
(
int
col
=
0
;
col
<
fillWidth
;
col
++
)
{
case
0x00
:
fillColor
=
*
frameData
;
frameData
++
;
*
pixdata
=
fillColor
;
if
(
trans
)
{
pixels
++
;
pixdata
++
;
LOG
(
"PL FF 0x00 SKIP bytes"
,
header
);
size
--
;
}
}
else
{
}
LOG
(
"PL FF 0x00 Copy bytes"
,
header
);
trans
=
1
-
trans
;
}
memcpy
(
pixdata
,
frameData
,
fillWidth
);
else
if
(
header
&
0x40
)
{
fillWidth
=
(
header
-
0x40
);
frameData
+=
fillWidth
;
fillColor
=
*
frameData
;
frameData
++
;
size
-=
fillWidth
;
memset
(
pixdata
,
fillColor
,
fillWidth
);
LOG
(
"PL FF 0x40 fillWidth"
,
fillWidth
);
pixels
+=
fillWidth
;
pixdata
+=
fillWidth
;
size
--
;
trans
=
1
;
}
else
if
(
header
&
0x20
)
{
// fill ?
unsigned
char
*
readfill
=
pixdata
-
320
;
fillWidth
=
header
-
0x20
;
for
(
int
col
=
0
;
col
<
fillWidth
;
col
++
)
{
*
pixdata
=
*
readfill
;
pixels
++
;
pixdata
++
;
readfill
++
;
}
LOG
(
"PL FF Fill 0x20 "
,
(
header
-
0x20
));
trans
=
1
;
}
else
if
(
header
)
{
if
(
trans
)
{
LOG
(
"PL FF 0x0? SKIP bytes"
,
header
);
pixels
+=
(
header
);
pixdata
+=
(
header
);
}
else
{
LOG
(
"PL FF 0x0? Copy bytes"
,
header
);
for
(
int
col
=
0
;
col
<
(
header
);
col
++
)
{
fillColor
=
*
frameData
;
frameData
++
;
*
pixdata
=
fillColor
;
pixels
++
;
pixdata
++
;
size
--
;
}
}
}
break
;
trans
=
1
-
trans
;
case
0x20
:
LOG
(
"PL FF 0x20 fill next op"
,
fillWidth
);
if
(
pixdata
-
320
>=
startPix
)
memcpy
(
pixdata
,
pixdata
-
320
,
fillWidth
);
break
;
case
0x40
:
LOG
(
"PL FF 0x40 fillWidth"
,
fillWidth
);
fillColor
=
*
frameData
;
frameData
++
;
memset
(
pixdata
,
fillColor
,
fillWidth
);
size
--
;
break
;
case
0x60
:
LOG
(
"PL FF 0x60 skip"
,
header
);
break
;
}
}
else
{
}
else
{
size
=
1
;
// end
LOG
(
"PL FF END OF STREAM"
,
size
);
fillWidth
=
0
;
}
size
=
1
;
// end
size
--
;
LOG
(
"PL FF END OF STREAM"
,
size
);
SDL_Rect
dst
;
dst
.
x
=
(
canvasW
-
SW
)
>>
1
;
dst
.
y
=
(
canvasH
-
SH
)
>>
1
;
}
}
LOG
(
"PL FF pixels"
,
pixels
);
pixdata
+=
fillWidth
;
pixels
+=
fillWidth
;
if
(
header
&
0x80
)
trans
=
false
;
else
trans
=
!
trans
;
size
--
;
SDL_Rect
dst
;
dst
.
x
=
(
canvasW
-
SW
)
>>
1
;
dst
.
y
=
(
canvasH
-
SH
)
>>
1
;
}
}
/*
LOG
(
"PL FF pixels"
,
pixels
);
* $0x $... Next x + 1 bytes are 'literals'; each byte colors 1 column (Max val $3F)
}
/*
* $0x $... Next x + 1 bytes are 'literals'; each byte colors 1 column (Max val $3F)
* $4x $yy Next x + 1 columns drawn in color yy (Max value $7E)
* $4x $yy Next x + 1 columns drawn in color yy (Max value $7E)
* $7F $xxxx $yy Next xxxx columns colored with color yy
* $7F $xxxx $yy Next xxxx columns colored with color yy
* $8x Next x + 1 pixels are skipped, they're already the right color (Max val $FE)
* $8x Next x + 1 pixels are skipped, they're already the right color (Max val $FE)
* $FF $xxxx Skip next xxxx pixels of picture, they're already the right color
* $FF $xxxx Skip next xxxx pixels of picture, they're already the right color
*/
*/
void
Scene
::
loadCompacted
(
int
size
,
File
*
f
,
unsigned
char
*
pixdata
,
int
width
,
int
height
)
{
void
Scene
::
loadCompactedMem
(
int
size
,
unsigned
char
*
frameData
,
unsigned
char
*
pixdata
,
int
width
,
int
height
)
{
int
pixels
=
0
;
int
pixels
=
0
;
unsigned
char
*
endpixdata
=
pixdata
+
(
width
*
height
);
int
fillWidth
=
0
;
unsigned
char
*
endpixdata
=
pixdata
+
(
width
*
height
);
unsigned
char
*
fillstart
=
NULL
;
unsigned
char
*
fillstart
=
NULL
;
while
(
size
>
0
)
{
while
(
size
>
0
)
{
unsigned
char
header
=
f
->
loadChar
();
unsigned
char
header
=
*
frameData
;
frameData
++
;
switch
(
header
)
{
switch
(
header
)
{
case
0x7F
:
{
unsigned
short
fillWidth
=
f
->
loadShort
();
case
0x7F
:
unsigned
char
fillColor
=
f
->
loadChar
();
{
fillstart
=
pixdata
;
while
(
fillstart
+
fillWidth
<
endpixdata
)
{
fillWidth
=
loadShortMem
(
&
frameData
);
memset
(
fillstart
,
fillColor
,
fillWidth
);
unsigned
char
fillColor
=
*
frameData
;
fillstart
+=
width
;
frameData
++
;
}
pixdata
+=
fillWidth
;
pixels
+=
fillWidth
;
size
-=
3
;
}
break
;
case
0xff
:
{
unsigned
short
skip
=
f
->
loadShort
();
pixels
+=
skip
;
pixdata
+=
skip
;
size
-=
2
;
}
break
;
default
:
if
(
header
&
0x80
)
{
unsigned
short
skip
=
(
header
-
0x80
)
+
1
;
pixels
+=
skip
;
pixdata
+=
skip
;
}
else
if
(
header
&
0x40
)
{
unsigned
char
fillColor
=
f
->
loadChar
();
unsigned
char
fillWidth
=
((
header
-
0x40
)
+
1
);
fillstart
=
pixdata
;
fillstart
=
pixdata
;
while
(
fillstart
+
fillWidth
<
endpixdata
)
{
while
(
fillstart
+
fillWidth
<
endpixdata
)
{
memset
(
fillstart
,
fillColor
,
fillWidth
);
memset
(
fillstart
,
fillColor
,
fillWidth
);
fillstart
+=
width
;
fillstart
+=
width
;
}
pixdata
+=
fillWidth
;
pixels
+=
fillWidth
;
size
--
;
}
else
{
int
copyWidth
=
(
header
&
0x3f
)
+
1
;
unsigned
char
color
;
for
(
int
col
=
0
;
col
<
copyWidth
;
col
++
)
{
color
=
f
->
loadChar
();
if
(
color
!=
0xff
){
fillstart
=
pixdata
;
while
(
fillstart
<
endpixdata
)
{
*
fillstart
=
color
;
fillstart
+=
width
;
}
}
pixdata
++
;
pixels
++
;
size
--
;
}
}
break
;
}
size
--
;
}
LOG
(
"PL Compacts pixels"
,
pixels
);
}
void
Scene
::
loadCompactedMem
(
int
size
,
unsigned
char
*
frameData
,
unsigned
char
*
pixdata
,
int
width
,
int
height
)
{
int
pixels
=
0
;
unsigned
char
*
endpixdata
=
pixdata
+
(
width
*
height
);
unsigned
char
*
fillstart
=
NULL
;
while
(
size
>
0
)
{
unsigned
char
header
=
*
frameData
;
frameData
++
;
switch
(
header
)
{
case
0x7F
:
{
unsigned
short
fillWidth
=
*
frameData
;
frameData
++
;
fillWidth
+=
((
unsigned
short
)(
*
frameData
))
<<
8
;
frameData
++
;
unsigned
char
fillColor
=
*
frameData
;
frameData
++
;
fillstart
=
pixdata
;
while
(
fillstart
+
fillWidth
<
endpixdata
)
{
memset
(
fillstart
,
fillColor
,
fillWidth
);
fillstart
+=
width
;
}
}
pixdata
+=
fillWidth
;
size
-=
3
;
pixels
+=
fillWidth
;
size
-=
3
;
}
}
break
;
break
;
case
0xff
:
{
case
0xFF
:
unsigned
short
skip
=
*
frameData
;
frameData
++
;
skip
+=
((
unsigned
short
)(
*
frameData
))
<<
8
;
frameData
++
;
fillWidth
=
loadShortMem
(
&
frameData
);
pixels
+=
skip
;
pixdata
+=
skip
;
size
-=
2
;
size
-=
2
;
}
break
;
break
;
default
:
default
:
if
(
header
&
0x80
)
{
unsigned
short
skip
=
(
header
-
0x80
)
+
1
;
if
(
header
&
0x80
)
{
pixels
+=
skip
;
pixdata
+=
skip
;
fillWidth
=
(
header
-
0x80
)
+
1
;
}
else
if
(
header
&
0x40
)
{
}
else
if
(
header
&
0x40
)
{
unsigned
char
fillColor
=
*
frameData
;
frameData
++
;
unsigned
char
fillWidth
=
((
header
-
0x40
)
+
1
);
unsigned
char
fillColor
=
*
frameData
;
frameData
++
;
fillWidth
=
(
header
-
0x40
)
+
1
;
fillstart
=
pixdata
;
fillstart
=
pixdata
;
while
(
fillstart
+
fillWidth
<
endpixdata
)
{
while
(
fillstart
+
fillWidth
<
endpixdata
)
{
memset
(
fillstart
,
fillColor
,
fillWidth
);
memset
(
fillstart
,
fillColor
,
fillWidth
);
fillstart
+=
width
;
fillstart
+=
width
;
}
pixdata
+=
fillWidth
;
pixels
+=
fillWidth
;
size
--
;
}
}
else
{
int
copyWidth
=
(
header
&
0x3f
)
+
1
;
size
--
;
}
else
{
fillWidth
=
(
header
&
0x3F
)
+
1
;
unsigned
char
color
;
unsigned
char
color
;
for
(
int
col
=
0
;
col
<
copyWidth
;
col
++
)
{
for
(
int
col
=
0
;
col
<
fillWidth
;
col
++
)
{
color
=
*
frameData
;
frameData
++
;
if
(
color
!=
0xff
){
color
=
*
frameData
;
frameData
++
;
if
(
color
!=
0xFF
)
{
fillstart
=
pixdata
;
fillstart
=
pixdata
;
while
(
fillstart
<
endpixdata
)
{
while
(
fillstart
<
endpixdata
)
{
*
fillstart
=
color
;
*
fillstart
=
color
;
fillstart
+=
width
;
fillstart
+=
width
;
}
}
}
}
pixdata
++
;
pixdata
++
;
pixels
++
;
size
--
;
size
--
;
}
}
}
pixdata
-=
fillWidth
;
}
break
;
break
;
}
}
pixdata
+=
fillWidth
;
pixels
+=
fillWidth
;
size
--
;
size
--
;
}
}
LOG
(
"PL Compacts pixels"
,
pixels
);
LOG
(
"PL Compacts pixels"
,
pixels
);
}
}
...
@@ -444,15 +370,18 @@ void Scene::loadAni (File *f, int dataIndex) {
...
@@ -444,15 +370,18 @@ void Scene::loadAni (File *f, int dataIndex) {
break
;
break
;
case
E1LAniHeader
:
{
case
E1LAniHeader
:
{
LOG
(
"PL 1L Background Type"
,
0
);
LOG
(
"PL 1L Background Type"
,
0
);
unsigned
char
*
pixels
;
unsigned
char
*
pixels
;
pixels
=
new
unsigned
char
[
SW
*
SH
];
pixels
=
new
unsigned
char
[
SW
*
SH
];
memset
(
pixels
,
0
,
SW
*
SH
);
memset
(
pixels
,
0
,
SW
*
SH
);
loadCompacted
(
size
,
f
,
pixels
,
SW
,
SH
);
unsigned
char
*
frameData
;
frameData
=
f
->
loadBlock
(
size
);
loadCompactedMem
(
size
,
frameData
,
pixels
,
SW
,
SH
);
delete
[]
frameData
;
animations
->
background
=
createSurface
(
pixels
,
SW
,
SH
);
animations
->
background
=
createSurface
(
pixels
,
SW
,
SH
);
delete
[]
pixels
;
delete
[]
pixels
;
// Use the most recently loaded palette
// Use the most recently loaded palette
video
.
setPalette
(
palettes
->
palette
);
video
.
setPalette
(
palettes
->
palette
);
}
}
break
;
break
;
...
...
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