Beispiel #1
0
static id0_boolean_t LoadObject(BE_FILE_T file, objtype *o)
{
	id0_int_t dummy;
	// for active enum (anonymous type)
	id0_int_t activeint;
	// BACKWARD COMPATIBILITY
	id0_longword_t statedosfarptr;
	// Just tells if "o->next" is zero or not
	id0_int_t isnext;
	// Now reading
	size_t BE_Cross_read_classtype_From16LE(BE_FILE_T fp, classtype *ptr);
	size_t BE_Cross_read_dirtype_From16LE(BE_FILE_T fp, dirtype *ptr);
	if ((BE_Cross_readInt16LE(file, &o->ticcount) != 2)
	    || (BE_Cross_readInt32LE(file, &statedosfarptr) != 4) // BACKWARD COMPATIBILITY
	    || (BE_Cross_readInt32LE(file, &o->x) != 4)
	    || (BE_Cross_readInt32LE(file, &o->y) != 4)
	    || (BE_Cross_readInt16LE(file, &o->viewx) != 2)
	    || (BE_Cross_readInt16LE(file, &o->tilex) != 2)
	    || (BE_Cross_readInt16LE(file, &o->tiley) != 2)
	    || (BE_Cross_readInt16LE(file, &o->viewheight) != 2)
	    || (BE_Cross_readInt16LE(file, &o->size) != 2)
	    // No need to read prev pointer as-is,
	    // this is ignored on loading. So read dummy value.
	    // Furthermore, all we need to know about next on loading is
	    // if it's zero or not.
	    || (BE_Cross_readInt16LE(file, &isnext) != 2) // next
	    || (BE_Cross_readInt8LEBuffer(file, &dummy, 2) != 2) // prev
	    //
	    || (BE_Cross_readInt16LE(file, &activeint) != 2)
	    || (BE_Cross_read_classtype_From16LE(file, &o->obclass) != 2)
	    || (BE_Cross_readInt8LE(file, &o->flags) != 1)
	    || (BE_Cross_readInt8LE(file, &dummy) != 1) // Padding due to word alignment in original code
	    || (BE_Cross_readInt32LE(file, &o->distance) != 4)
	    || (BE_Cross_read_dirtype_From16LE(file, &o->dir) != 2)
	    || (BE_Cross_readInt16LE(file, &o->angle) != 2)
	    || (BE_Cross_readInt16LE(file, &o->hitpoints) != 2)
	    || (BE_Cross_readInt32LE(file, &o->speed) != 4)
	    || (BE_Cross_readInt32LE(file, &o->xl) != 4)
	    || (BE_Cross_readInt32LE(file, &o->xh) != 4)
	    || (BE_Cross_readInt32LE(file, &o->yl) != 4)
	    || (BE_Cross_readInt32LE(file, &o->yh) != 4)
	    || (BE_Cross_readInt16LE(file, &o->temp1) != 2)
	    || (BE_Cross_readInt16LE(file, &o->temp2) != 2)
	)
	{
		return false;
	}
	o->active = (activetype)activeint;
	o->state = RefKeen_GetObjStatePtrFromDOSPointer(statedosfarptr);
	// HACK: All we need to know is if next was originally NULL or not
	o->next = isnext ? o : NULL;
	return true;
}
Beispiel #2
0
static id0_boolean_t LoadObject(BE_FILE_T file, objtype *o)
{
	id0_int_t dummy;
	// for active enum (anonymous type)
	id0_int_t activeint;
	// BACKWARD COMPATIBILITY
	id0_word_t statedosoffset;
	// Just tells if "o->next" is zero or not
	id0_int_t isnext;
	// Now reading
	size_t BE_Cross_read_classtype_From16LE(BE_FILE_T fp, classtype *ptr);
	if ((BE_Cross_read_classtype_From16LE(file, &o->obclass) != 2)
	    || (BE_Cross_readInt16LE(file, &activeint) != 2)
	    || (BE_Cross_read_boolean_From16LE(file, &o->needtoreact) != 2)
	    || (BE_Cross_read_boolean_From16LE(file, &o->needtoclip) != 2)
	    || (BE_Cross_readInt16LE(file, &o->nothink) != 2)
	    || (BE_Cross_readInt16LE(file, &o->x) != 2)
	    || (BE_Cross_readInt16LE(file, &o->y) != 2)
	    || (BE_Cross_readInt16LE(file, &o->xdir) != 2)
	    || (BE_Cross_readInt16LE(file, &o->ydir) != 2)
	    || (BE_Cross_readInt16LE(file, &o->xmove) != 2)
	    || (BE_Cross_readInt16LE(file, &o->ymove) != 2)
	    || (BE_Cross_readInt16LE(file, &o->xspeed) != 2)
	    || (BE_Cross_readInt16LE(file, &o->yspeed) != 2)
	    || (BE_Cross_readInt16LE(file, &o->ticcount) != 2)
	    || (BE_Cross_readInt16LE(file, &o->ticadjust) != 2)
	    || (BE_Cross_readInt16LE(file, &statedosoffset) != 2) // BACKWARD COMPATIBILITY
	    || (BE_Cross_readInt16LE(file, &o->shapenum) != 2)
	    || (BE_Cross_readInt16LE(file, &o->left) != 2)
	    || (BE_Cross_readInt16LE(file, &o->top) != 2)
	    || (BE_Cross_readInt16LE(file, &o->right) != 2)
	    || (BE_Cross_readInt16LE(file, &o->bottom) != 2)
	    || (BE_Cross_readInt16LE(file, &o->midx) != 2)
	    || (BE_Cross_readInt16LE(file, &o->tileleft) != 2)
	    || (BE_Cross_readInt16LE(file, &o->tiletop) != 2)
	    || (BE_Cross_readInt16LE(file, &o->tileright) != 2)
	    || (BE_Cross_readInt16LE(file, &o->tilebottom) != 2)
	    || (BE_Cross_readInt16LE(file, &o->tilemidx) != 2)
	    || (BE_Cross_readInt16LE(file, &o->hitnorth) != 2)
	    || (BE_Cross_readInt16LE(file, &o->hiteast) != 2)
	    || (BE_Cross_readInt16LE(file, &o->hitsouth) != 2)
	    || (BE_Cross_readInt16LE(file, &o->hitwest) != 2)
	    || (BE_Cross_readInt16LE(file, &o->temp1) != 2)
	    || (BE_Cross_readInt16LE(file, &o->temp2) != 2)
	    || (BE_Cross_readInt16LE(file, &o->temp3) != 2)
	    || (BE_Cross_readInt16LE(file, &o->temp4) != 2)
	    // No need to read sprite, prev pointers as-is,
	    // these are ignored on loading. So read dummy value.
	    // Furthermore, all we need to know about next on loading is
	    // if it's zero or not.
	    || (BE_Cross_readInt16LE(file, &dummy) != 2) // sprite
	    || (BE_Cross_readInt16LE(file, &isnext) != 2) // next
	    || (BE_Cross_readInt16LE(file, &dummy) != 2) // prev
	)
	{
		return false;
	}
	o->active = (activetype)activeint;
	o->state = RefKeen_GetObjStatePtrFromDOSPointer(statedosoffset);
	// ANOTHER SPECIAL CASE (for almost all creatures as flowers)
	o->temp2stateptr = RefKeen_GetObjStatePtrFromDOSPointer(o->temp2);
	// HACK: All we need to know is if next was originally NULL or not
	o->next = isnext ? o : NULL;
	return true;
}