git-svn-id: https://svn.eduke32.com/eduke32@1614 1a8010ca-5511-0410-912e-c29ae57300e0

This commit is contained in:
terminx 2010-03-14 11:15:53 +00:00
parent 99c1dddf65
commit 150678ce7b
2 changed files with 13 additions and 26 deletions

View file

@ -87,9 +87,8 @@ uint16_t findpage(uint16_t framenumber)
// //
//**************************************************************************** //****************************************************************************
void loadpage(uint16_t pagenumber, uint16_t *pagepointer) void loadpage(uint16_t pagenumber, uint16_t **pagepointer)
{ {
int32_t size;
uint8_t * buffer; uint8_t * buffer;
CheckAnimStarted("loadpage"); CheckAnimStarted("loadpage");
@ -97,20 +96,12 @@ void loadpage(uint16_t pagenumber, uint16_t *pagepointer)
if (anim->curlpnum != pagenumber) if (anim->curlpnum != pagenumber)
{ {
anim->curlpnum = pagenumber; anim->curlpnum = pagenumber;
buffer += 0xb00 + (pagenumber*0x10000); buffer += 0xb00 + (pagenumber*IMAGEBUFFERSIZE);
size = sizeof(lp_descriptor); anim->curlp = &anim->LpArray[pagenumber];
/*
Bmemcpy(&anim->curlp,buffer,size);
// JBF: why didn't this get read from the LpArray[] table? buffer += sizeof(lp_descriptor) + sizeof(uint16_t);
anim->curlp.baseRecord = B_LITTLE16(anim->curlp.baseRecord);
anim->curlp.nRecords = B_LITTLE16(anim->curlp.nRecords);
anim->curlp.nBytes = B_LITTLE16(anim->curlp.nBytes);
*/
Bmemcpy(&anim->curlp, &anim->LpArray[pagenumber], size);
buffer += size + sizeof(uint16_t); *pagepointer = (uint16_t *)buffer;
Bmemcpy(pagepointer,buffer,anim->curlp.nBytes+(anim->curlp.nRecords*2));
} }
} }
@ -214,23 +205,18 @@ void renderframe(uint16_t framenumber, uint16_t *pagepointer)
uint8_t *ppointer; uint8_t *ppointer;
CheckAnimStarted("renderframe"); CheckAnimStarted("renderframe");
destframe = framenumber - anim->curlp.baseRecord; destframe = framenumber - anim->curlp->baseRecord;
for (i = 0; i < destframe; i++) for (i = 0; i < destframe; i++)
{
offset += B_LITTLE16(pagepointer[i]); offset += B_LITTLE16(pagepointer[i]);
}
ppointer = (uint8_t *)pagepointer; ppointer = (uint8_t *)pagepointer;
ppointer+=anim->curlp.nRecords*2+offset; ppointer+=anim->curlp->nRecords*2+offset;
if (ppointer[1]) if (ppointer[1])
{
ppointer += (4 + B_LITTLE16(((uint16_t *)ppointer)[1]) + (B_LITTLE16(((uint16_t *)ppointer)[1]) & 1)); ppointer += (4 + B_LITTLE16(((uint16_t *)ppointer)[1]) + (B_LITTLE16(((uint16_t *)ppointer)[1]) & 1));
}
else else
{
ppointer+=4; ppointer+=4;
}
CPlayRunSkipDump((uint8_t *)ppointer, (uint8_t *)anim->imagebuffer); CPlayRunSkipDump((uint8_t *)ppointer, (uint8_t *)anim->imagebuffer);
} }
@ -246,7 +232,7 @@ void renderframe(uint16_t framenumber, uint16_t *pagepointer)
void drawframe(uint16_t framenumber) void drawframe(uint16_t framenumber)
{ {
CheckAnimStarted("drawframe"); CheckAnimStarted("drawframe");
loadpage(findpage(framenumber), anim->thepage); loadpage(findpage(framenumber), &anim->thepage);
renderframe(framenumber, anim->thepage); renderframe(framenumber, anim->thepage);
} }

View file

@ -88,15 +88,16 @@ typedef struct
#pragma pack(pop) #pragma pack(pop)
#define IMAGEBUFFERSIZE 0x10000
typedef struct typedef struct
{ {
uint16_t framecount; // current frame of anim uint16_t framecount; // current frame of anim
lpfileheader lpheader; // file header will be loaded into this structure lpfileheader lpheader; // file header will be loaded into this structure
lp_descriptor LpArray[256]; // arrays of large page structs used to find frames lp_descriptor LpArray[256]; // arrays of large page structs used to find frames
uint16_t curlpnum; // initialize to an invalid Large page number uint16_t curlpnum; // initialize to an invalid Large page number
lp_descriptor curlp; // header of large page currently in memory lp_descriptor * curlp; // header of large page currently in memory
uint16_t thepage[0x8000]; // buffer where current large page is loaded uint16_t * thepage; // buffer where current large page is loaded
uint8_t imagebuffer[0x10000]; // buffer where anim frame is decoded uint8_t imagebuffer[IMAGEBUFFERSIZE]; // buffer where anim frame is decoded
uint8_t * buffer; uint8_t * buffer;
uint8_t pal[768]; uint8_t pal[768];
int32_t currentframe; int32_t currentframe;