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
877b517e
Commit
877b517e
authored
Apr 12, 2010
by
anotherguest
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Now load animation type 2 full frame.
parent
18861ab3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
109 additions
and
107 deletions
+109
-107
scene.h
src/scene/scene.h
+3
-3
sceneload.cpp
src/scene/sceneload.cpp
+106
-104
No files found.
src/scene/scene.h
View file @
877b517e
...
@@ -87,7 +87,6 @@ class SceneText {
...
@@ -87,7 +87,6 @@ class SceneText {
};
};
class
ScenePage
{
class
ScenePage
{
public
:
public
:
...
@@ -151,7 +150,8 @@ public:
...
@@ -151,7 +150,8 @@ public:
SDL_Surface
*
background
;
SDL_Surface
*
background
;
SceneAnimation
*
next
;
SceneAnimation
*
next
;
int
id
;
int
id
;
int
noSounds
;
char
soundNames
[
16
][
10
];
SceneAnimation
(
SceneAnimation
*
newNext
);
SceneAnimation
(
SceneAnimation
*
newNext
);
~
SceneAnimation
();
~
SceneAnimation
();
};
};
...
@@ -175,7 +175,7 @@ class Scene {
...
@@ -175,7 +175,7 @@ class Scene {
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
);
public
:
public
:
Scene
(
const
char
*
fileName
);
Scene
(
const
char
*
fileName
);
~
Scene
();
~
Scene
();
...
...
src/scene/sceneload.cpp
View file @
877b517e
...
@@ -54,7 +54,7 @@ SL
...
@@ -54,7 +54,7 @@ SL
*/
*/
enum
ANIHeaders
enum
ANIHeaders
{
{
E11AniHeader
=
0x3131
,
E11AniHeader
=
0x3131
,
// Background/start image
E1LAniHeader
=
0x4c31
,
E1LAniHeader
=
0x4c31
,
EPBAniHeader
=
0x4250
,
EPBAniHeader
=
0x4250
,
EFFAniHeader
=
0x4646
,
// Floodfill? or full frame?
EFFAniHeader
=
0x4646
,
// Floodfill? or full frame?
...
@@ -63,7 +63,7 @@ enum ANIHeaders
...
@@ -63,7 +63,7 @@ enum ANIHeaders
ERCAniHeader
=
0x4352
,
ERCAniHeader
=
0x4352
,
ERLAniHeader
=
0x4c52
,
ERLAniHeader
=
0x4c52
,
ERRAniHeader
=
0x5252
,
ERRAniHeader
=
0x5252
,
E_EHeader
=
0x455F
,
E_EHeader
=
0x455F
,
// ANI End
ESquareAniHeader
=
0x5b5d
,
ESquareAniHeader
=
0x5b5d
,
EMXAniHeader
=
0x584d
,
EMXAniHeader
=
0x584d
,
ESTAniHeader
=
0x5453
,
// Sound tag
ESTAniHeader
=
0x5453
,
// Sound tag
...
@@ -71,6 +71,93 @@ enum ANIHeaders
...
@@ -71,6 +71,93 @@ enum ANIHeaders
EPlayListAniHeader
=
0x4C50
EPlayListAniHeader
=
0x4C50
};
};
/*
* $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)
* $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)
* $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
)
{
int
pixels
=
0
;
unsigned
char
*
endpixdata
=
pixdata
+
width
*
height
;
unsigned
char
*
fillstart
=
NULL
;
while
(
size
>
0
)
{
unsigned
char
header
=
f
->
loadChar
();
switch
(
header
)
{
case
0x7F
:
{
unsigned
short
fillWidth
=
f
->
loadShort
();
unsigned
char
fillColor
=
f
->
loadChar
();
fillstart
=
pixdata
;
while
(
fillstart
+
fillWidth
<
endpixdata
)
{
memset
(
fillstart
,
fillColor
,
fillWidth
);
fillstart
+=
width
;
}
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
);
memset
(
pixdata
,
fillColor
,
fillWidth
);
fillstart
=
pixdata
;
while
(
fillstart
+
fillWidth
<
endpixdata
)
{
memset
(
fillstart
,
fillColor
,
fillWidth
);
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
();
fillstart
=
pixdata
;
while
(
fillstart
<
endpixdata
)
{
*
fillstart
=
color
;
fillstart
+=
width
;
}
pixdata
++
;
pixels
++
;
size
--
;
}
}
break
;
}
size
--
;
}
LOG
(
"PL Compacts pixels"
,
pixels
);
}
void
Scene
::
loadAni
(
File
*
f
,
int
dataIndex
)
{
void
Scene
::
loadAni
(
File
*
f
,
int
dataIndex
)
{
unsigned
short
int
aniType
=
f
->
loadShort
();
// should be 0x02
unsigned
short
int
aniType
=
f
->
loadShort
();
// should be 0x02
...
@@ -87,12 +174,13 @@ void Scene::loadAni (File *f, int dataIndex) {
...
@@ -87,12 +174,13 @@ void Scene::loadAni (File *f, int dataIndex) {
if
(
type
==
ESoundListAniHeader
)
{
// SL
if
(
type
==
ESoundListAniHeader
)
{
// SL
/*unsigned short int offset =*/
f
->
loadShort
();
/*unsigned short int offset =*/
f
->
loadShort
();
unsigned
char
noSounds
=
f
->
loadChar
();
animations
->
noSounds
=
f
->
loadChar
();
for
(
loop
=
0
;
loop
<
noSounds
;
loop
++
)
{
for
(
loop
=
0
;
loop
<
animations
->
noSounds
;
loop
++
)
{
char
*
soundName
=
f
->
loadString
();
char
*
soundName
=
f
->
loadString
();
LOG
(
"Soundname "
,
soundName
);
LOG
(
"Soundname "
,
soundName
);
strcpy
(
animations
->
soundNames
[
loop
],
soundName
);
delete
[]
soundName
;
delete
[]
soundName
;
}
}
...
@@ -114,8 +202,6 @@ void Scene::loadAni (File *f, int dataIndex) {
...
@@ -114,8 +202,6 @@ void Scene::loadAni (File *f, int dataIndex) {
palettes
->
palette
[
count
].
r
=
(
buffer
[
count
*
3
]
<<
2
)
+
(
buffer
[
count
*
3
]
>>
4
);
palettes
->
palette
[
count
].
r
=
(
buffer
[
count
*
3
]
<<
2
)
+
(
buffer
[
count
*
3
]
>>
4
);
palettes
->
palette
[
count
].
g
=
(
buffer
[(
count
*
3
)
+
1
]
<<
2
)
+
(
buffer
[(
count
*
3
)
+
1
]
>>
4
);
palettes
->
palette
[
count
].
g
=
(
buffer
[(
count
*
3
)
+
1
]
<<
2
)
+
(
buffer
[(
count
*
3
)
+
1
]
>>
4
);
palettes
->
palette
[
count
].
b
=
(
buffer
[(
count
*
3
)
+
2
]
<<
2
)
+
(
buffer
[(
count
*
3
)
+
2
]
>>
4
);
palettes
->
palette
[
count
].
b
=
(
buffer
[(
count
*
3
)
+
2
]
<<
2
)
+
(
buffer
[(
count
*
3
)
+
2
]
>>
4
);
}
}
delete
[]
buffer
;
delete
[]
buffer
;
...
@@ -132,7 +218,7 @@ void Scene::loadAni (File *f, int dataIndex) {
...
@@ -132,7 +218,7 @@ void Scene::loadAni (File *f, int dataIndex) {
value
=
f
->
loadShort
();
value
=
f
->
loadShort
();
LOG
(
"PL Read block start tag"
,
value
);
LOG
(
"PL Read block start tag"
,
value
);
unsigned
short
int
size
=
f
->
loadShort
();
int
size
=
f
->
loadShort
();
LOG
(
"PL Anim block size"
,
size
);
LOG
(
"PL Anim block size"
,
size
);
nextPos
=
f
->
tell
();
nextPos
=
f
->
tell
();
// next pos is intial position + size and four bytes header
// next pos is intial position + size and four bytes header
...
@@ -149,6 +235,7 @@ void Scene::loadAni (File *f, int dataIndex) {
...
@@ -149,6 +235,7 @@ void Scene::loadAni (File *f, int dataIndex) {
case
E11AniHeader
:
//11
case
E11AniHeader
:
//11
// Skip back size header, this is read by the surface reader
// Skip back size header, this is read by the surface reader
LOG
(
"PL 11 Background Type"
,
1
);
f
->
seek
(
-
2
,
false
);
f
->
seek
(
-
2
,
false
);
animations
->
background
=
f
->
loadSurface
(
SW
,
SH
);
animations
->
background
=
f
->
loadSurface
(
SW
,
SH
);
...
@@ -161,109 +248,25 @@ void Scene::loadAni (File *f, int dataIndex) {
...
@@ -161,109 +248,25 @@ void Scene::loadAni (File *f, int dataIndex) {
case
E1LAniHeader
:
case
E1LAniHeader
:
{
{
LOG
(
"PL 1L Background Type"
,
1
);
int
longvalue
=
f
->
loadInt
();
SDL_Surface
*
surface
;
LOG
(
"PL Anim block value"
,
longvalue
);
unsigned
char
*
pixels
;
pixels
=
new
unsigned
char
[
SW
*
SH
];
while
(
size
)
{
memset
(
pixels
,
0
,
SW
*
SH
);
LoadCompacted
(
size
,
f
,
pixels
,
SW
,
SH
);
size
--
;
animations
->
background
=
createSurface
(
pixels
,
SW
,
SH
);
unsigned
char
header
=
f
->
loadChar
();
delete
[]
pixels
;
LOG
(
"PL 4c31 block header"
,
header
);
// Use the most recently loaded palette
video
.
setPalette
(
palettes
->
palette
);
switch
(
header
)
{
case
0x7F
:
{
unsigned
short
fillWidth
=
f
->
loadShort
();
unsigned
char
fillColor
=
f
->
loadChar
();
LOG
(
"PL Fillblock width"
,
fillWidth
);
LOG
(
"PL Fillblock with color"
,
fillColor
);
size
-=
3
;
}
break
;
case
0xff
:
{
unsigned
char
x
=
f
->
loadChar
();
unsigned
char
y
=
f
->
loadChar
();
LOG
(
"PL block x"
,
x
);
LOG
(
"PL block y"
,
y
);
size
-=
2
;
}
break
;
default
:
//LOG("PL Unknown type", header);
break
;
}
}
}
}
break
;
break
;
case
EFFAniHeader
:
case
EFFAniHeader
:
{
while
(
size
)
{
//LoadCompacted(size, f);
unsigned
char
header
=
f
->
loadChar
();
LOG
(
"PL 4646 block header"
,
header
);
switch
(
header
)
{
case
0x7F
:
{
unsigned
short
fillWidth
=
f
->
loadShort
();
unsigned
char
fillColor
=
f
->
loadChar
();
LOG
(
"PL Fillblock width"
,
fillWidth
);
LOG
(
"PL Fillblock with color"
,
fillColor
);
size
-=
3
;
}
break
;
case
0xff
:
{
unsigned
char
x
=
f
->
loadChar
();
unsigned
char
y
=
f
->
loadChar
();
LOG
(
"PL block x"
,
x
);
LOG
(
"PL block y"
,
y
);
size
-=
2
;
}
break
;
default
:
//LOG("PL Unknown type", header);
break
;
}
size
--
;
}
}
break
;
break
;
case
ERNAniHeader
:
case
ERNAniHeader
:
...
@@ -278,7 +281,6 @@ void Scene::loadAni (File *f, int dataIndex) {
...
@@ -278,7 +281,6 @@ void Scene::loadAni (File *f, int dataIndex) {
case
ESquareAniHeader
:
// ][ Flip??
case
ESquareAniHeader
:
// ][ Flip??
{
{
unsigned
char
header
=
f
->
loadChar
();
unsigned
char
header
=
f
->
loadChar
();
LOG
(
"PL 5b5d block header"
,
header
);
LOG
(
"PL 5b5d block header"
,
header
);
unsigned
short
int
value
=
f
->
loadShort
();
unsigned
short
int
value
=
f
->
loadShort
();
...
...
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