bool SceneTutorial25::Init()
{
    glBlendFunc(GL_SRC_ALPHA,GL_ONE);                   // Set The Blending Function For Translucency
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);               // This Will Clear The Background Color To Black
    glClearDepth(1.0);                                  // Enables Clearing Of The Depth Buffer
    glDepthFunc(GL_LESS);                               // The Type Of Depth Test To Do
    glEnable(GL_DEPTH_TEST);                            // Enables Depth Testing
    glShadeModel(GL_SMOOTH);                            // Enables Smooth Color Shading
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);  // Really Nice Perspective Calculations
    
    
    _cameraPosition.Set(0, 1.5, 10);
    _cameraRotation.Set(0, 0, 0);
    _cameraScale.Set(1.0f, 1.0f, 1.0f);

    maxver = 0;                                           // Sets Max Vertices To 0 By Default
    LoadObject("data/sphere.txt", morph1);
    LoadObject("data/torus.txt", morph2);
    LoadObject("data/tube.txt", morph3);
    
    for( int i = 0; i < morph1._points.size(); i ++ ) {
        float x = RandomRangeDouble(-7, 7);
        float y = RandomRangeDouble(-7, 7);
        float z = RandomRangeDouble(-7, 7);
        morph4._points.push_back( Vector3( x, y, z ) );
    }

    LoadObject("data/sphere.txt", helper);                 // Load sphere.txt Object Into Helper (Used As Starting Point)
    sour = dest = &morph1;                                  // Source & Destination Are Set To Equal First Object (morph1)

    return true;
}
Beispiel #2
0
/* PycDict */
void PycDict::load(PycData* stream, PycModule* mod)
{
    PycRef<PycObject> key, val;
    for (;;) {
        key = LoadObject(stream, mod);
        if (key == Pyc_NULL)
            break;
        val = LoadObject(stream, mod);
        m_keys.push_back(key);
        m_values.push_back(val);
    }
}
Beispiel #3
0
void C_API Program::MenuCallback(int value)
{
	char * file_path;

	switch (value)
	{
	case _OPEN_CODE:
		{
			if ((file_path = OpenFileDialog(0, OPEN_FILE, "Wavefront Object Files (*.obj)", "*.obj")) == NULL)
			{
				break;
			}
			else
			{
				LoadObject(file_path);
			}
			break;
		}
	case _EXIT_CODE:
		{
			exit(0);
			break;
		}
	default:
		{
			m_LoadedObj.nDrawByGroupID = value;
			break;
		}
	} // End of switch (value)

	glutPostRedisplay();
}
void clutl::LoadVersionedBinary(ReadBuffer& in, void* object, const clcpp::Type* type)
{
	ChunkHeader header(in);
	LoadObject(in, (char*)object, type, header.data_size, header.type_hash);

	// TODO: verify position
}
Beispiel #5
0
void LFSR::Load(istream& stream)
{
	LoadObject(m_Modulus,stream);
	m_Coeff.Load(stream);
	m_InitialState.Load(stream);
	m_State.Load(stream);
}
Beispiel #6
0
bool CEditableObject::Load(const char* fname)
{
	AnsiString ext=ExtractFileExt(fname);
    ext=ext.LowerCase();
    if 	(ext==".lwo")    		return Import_LWO(fname,false);
    else return LoadObject(fname);
}
//*****************************************************************************
//		初期化・解放
//*****************************************************************************
//------------------------------------------------------
//	コンストラクタ
//------------------------------------------------------
iex3DObj::iex3DObj( char* filename )
{
	if( LoadObject(filename) == FALSE ) return;
	for( int i=0 ; i<16 ; i++ ) Param[i] = 0;

	bLoad = TRUE;
}
Beispiel #8
0
static void SuperSonicManager_Load()
{
	ObjectMaster* obj = LoadObject((LoadObj)0, 2, SuperSonicManager_Main);
	if (obj)
		obj->DeleteSub = SuperSonicManager_Delete;

	SetMusic();
}
void
nsHTMLSharedObjectElement::StartObjectLoad(PRBool aNotify)
{
  nsCAutoString type;
  GetTypeAttrValue(type);

  nsAutoString uri;
  if (!GetAttr(kNameSpaceID_None, URIAttrName(), uri)) {
    // Be sure to call the nsIURI version if we have no attribute
    // That handles the case where no URI is specified. An empty string would
    // get interpreted as the page itself, instead of absence of URI.
    LoadObject(nsnull, aNotify, type);
  }
  else {
    LoadObject(uri, aNotify, type);
  }
}
void
nsHTMLObjectElement::StartObjectLoad(PRBool aNotify)
{
  nsAutoString type;
  GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
  NS_ConvertUTF16toUTF8 ctype(type);

  nsAutoString uri;
  if (GetAttr(kNameSpaceID_None, nsGkAtoms::data, uri)) {
    LoadObject(uri, aNotify, ctype);
  }
  else {
    // Be sure to call the nsIURI version if we have no attribute
    // That handles the case where no URI is specified. An empty string would
    // get interpreted as the page itself, instead of absence of URI.
    LoadObject(nsnull, aNotify, ctype);
  }
}
Beispiel #11
0
GameObject::GameObject(LoadObj flags, int index)
{
	objData = LoadObject(flags, index, CallMain);
	if (!objData)
	{
		objData->DisplaySub = CallDisplay;
		objData->DeleteSub = CallDelete;
		objData->Data2 = this;
	}
	initFromObj = false;
}
Beispiel #12
0
/* PycTuple */
void PycTuple::load(PycData* stream, PycModule* mod)
{
    if (type() == TYPE_SMALL_TUPLE)
        m_size = stream->getByte();
    else
        m_size = stream->get32();

    m_values.resize(m_size);
    for (int i=0; i<m_size; i++)
        m_values[i] = LoadObject(stream, mod);
}
bool FileContent::Open(const wxString &filename)
{
    wxFileInputStream store(filename);
    LoadObject(store);

    if ( store.GetLastError() != wxSTREAM_NO_ERROR )
        return false;

    SetModified(false);
    NotifyObservers(0);
    return true;
}
Beispiel #14
0
bool NOX_MAP::Scale(bool on)
{
 if( ScaleSurface )
 {
	ScaleSurface->Destroy();
	ScaleSurface = NULL;
 }
 scaleOn = on;
 if( on )
	LoadObject("NPC",&ScaleSurface);
return(true);
}
void
HTMLSharedObjectElement::StartObjectLoad(bool aNotify)
{
  // BindToTree can call us asynchronously, and we may be removed from the tree
  // in the interim
  if (!IsInComposedDoc() || !OwnerDoc()->IsActive()) {
    return;
  }

  LoadObject(aNotify);
  SetIsNetworkCreated(false);
}
void InitIndicators()
{
	if (IndicatorInstance == nullptr)
	{
		auto object = LoadObject(LoadObj_UnknownB, 8, Indicator_Main);

		object->DisplaySub = Indicator_Display;
		object->DeleteSub = Indicator_Delete;

		IndicatorInstance = object;
	}
}
Beispiel #17
0
Object *InitObject(char *objfile)
{
	int nf;
	Object *obj;
		
	if((obj = LoadObject(objfile)) != NULL){
		SetConnectivity(obj);

		for(nf=0; nf < obj->nFaces; nf++)
			CalculatePlane(obj, nf);
	}

	return obj;
}
Beispiel #18
0
nsresult
HTMLObjectElement::UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
                             bool aNotify)
{
  nsresult rv = nsGenericHTMLFormElement::UnsetAttr(aNameSpaceID,
                                                    aAttribute, aNotify);
  NS_ENSURE_SUCCESS(rv, rv);

  // See comment in SetAttr
  if (aNotify && IsInComposedDoc() && mIsDoneAddingChildren &&
      aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::data) {
    return LoadObject(aNotify, true);
  }

  return NS_OK;
}
Beispiel #19
0
void PycModule::loadFromFile(const char* filename)
{
    PycFile in(filename);
    if (!in.isOpen()) {
        fprintf(stderr, "Error opening file %s\n", filename);
        return;
    }
    setVersion(in.get32());
    if (!isValid()) {
        fprintf(stderr, "Bad MAGIC!\n");
        return;
    }
    in.get32(); // Timestamp -- who cares?

    if (verCompare(3, 3) >= 0)
        in.get32(); // Size parameter added in Python 3.3

    m_code = LoadObject(&in, this).cast<PycCode>();
}
nsresult
HTMLSharedObjectElement::SetAttr(int32_t aNameSpaceID, nsIAtom *aName,
                                 nsIAtom *aPrefix, const nsAString &aValue,
                                 bool aNotify)
{
  nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aName, aPrefix,
                                              aValue, aNotify);
  NS_ENSURE_SUCCESS(rv, rv);

  // if aNotify is false, we are coming from the parser or some such place;
  // we'll get bound after all the attributes have been set, so we'll do the
  // object load from BindToTree/DoneAddingChildren.
  // Skip the LoadObject call in that case.
  // We also don't want to start loading the object when we're not yet in
  // a document, just in case that the caller wants to set additional
  // attributes before inserting the node into the document.
  if (aNotify && IsInComposedDoc() && mIsDoneAddingChildren &&
      aNameSpaceID == kNameSpaceID_None && aName == URIAttrName()) {
    return LoadObject(aNotify, true);
  }

  return NS_OK;
}
nsresult
nsHTMLObjectElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom *aName,
                             nsIAtom *aPrefix, const nsAString &aValue,
                             PRBool aNotify)
{
  // If we plan to call LoadObject, we want to do it first so that the
  // object load kicks off _before_ the reflow triggered by the SetAttr.  But if
  // aNotify is false, we are coming from the parser or some such place; we'll
  // get bound after all the attributes have been set, so we'll do the
  // object load from BindToTree/DoneAddingChildren.
  // Skip the LoadObject call in that case.
  // We also don't want to start loading the object when we're not yet in
  // a document, just in case that the caller wants to set additional
  // attributes before inserting the node into the document.
  if (aNotify && IsInDoc() && mIsDoneAddingChildren &&
      aNameSpaceID == kNameSpaceID_None && aName == nsGkAtoms::data) {
    nsAutoString type;
    GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
    LoadObject(aValue, aNotify, NS_ConvertUTF16toUTF8(type), PR_TRUE);
  }

  return nsGenericHTMLFormElement::SetAttr(aNameSpaceID, aName, aPrefix,
                                           aValue, aNotify);
}
Beispiel #22
0
/* PycList */
void PycList::load(PycData* stream, PycModule* mod)
{
    m_size = stream->get32();
    for (int i=0; i<m_size; i++)
        m_values.push_back(LoadObject(stream, mod));
}
Beispiel #23
0
void CFileLoader::LoadObjectTypes(const char *filename)
{
    int fp = CFileMgr::OpenFile(filename, "rb");
    const char* line;
    int32_t path;
    size_t in_section = 0; /* section id */
    struct 
    {
        size_t section;
        char name[5];
    } sections[] = 
    {
        {0, "end"},
        {1, "objs"},
        {2, "tobj"},
        {3, "weap"},
        {4, "hier"},
        {5, "anim"},
        {6, "cars"},
        {7, "peds"}, 
        {8, "path"},
        {9, "2dfx"},
        {10,"txdp"}
    };
    while ((line = CFileLoader::LoadLine(fp)))
    {
        /* skip empty lines and comments */
        if (line[0] == '\0' || line[0] == '#')
        {
            continue;
        }
        if (in_section == 0)
        {
            for (size_t i = 0; i < ELEMS_COUNT(sections); i++)
            {
                if (!strncmp(line, sections[i].name, strlen(sections[i].name)))
                {
                    in_section = sections[i].section;
                }
            }
            /* if we changed section skip the current line which only denotes section name */
            if (in_section != 0)
            {
                line = CFileLoader::LoadLine((int)fp);
            }
        }
        switch (in_section)
        {
            case 1:
                LoadObject(line);
            break;
            case 2:
                LoadTimeObject();
            break;
            case 3:
                LoadWeaponObject();
            break;
            case 4:
                LoadClumpObject();
            break;
            case 5:
                LoadAnimatedClumpObject();
            break;
            case 6:
                LoadVehicleObject();
            break;
            case 7:
                LoadPedObject();
            break;
            case 8:
                static size_t path_type = -1;
                if (path == -1)
                {
                    path = 0;
                    LoadPathHeader(line, &path_type);
                }
                else
                {
                    switch (path_type)
                    {
                        case 0:
                            LoadPedPathNode();
                        break;
                        case 1:
                            LoadCarPathNode();
                        break;
                        case 2:
                            LoadCarPathNode();
                        break;
                    }
                    path++;
                    if (path == 12)
                    {
                        path = -1;
                    }
                }
            break;
            case 9:
                Load2dEffect();
            break;
            case 10:
                LoadTXDParent();
            break;
            default:
                continue;
            break;
        }
    }
    CFileMgr::CloseFile(fp);
}
Beispiel #24
0
id0_boolean_t	LoadTheGame(BE_FILE_T file)
{
	id0_unsigned_t	i,x,y;
	objtype		/**obj,*/*prev,*next,*followed;
	id0_unsigned_t	compressed,expanded;
	id0_unsigned_t	id0_far *map,tile;
	memptr		bigbuffer;

	// (REFKEEN) Reading fields one-by-one in a cross-platform manner
	if (!LoadGameState(file, &gamestate))
	//if (!CA_FarRead(file,(void id0_far *)&gamestate,sizeof(gamestate)))
		return(false);

	SetupGameLevel ();		// load in and cache the base old level

	expanded = mapwidth * mapheight * 2;
	MM_GetPtr (&bigbuffer,expanded);

	for (i = 0;i < 3;i+=2)	// Read planes 0 and 2
	{
		if (BE_Cross_readInt16LE(file, &compressed) != 2)
		//if (!CA_FarRead(file,(id0_byte_t id0_far *)&compressed,sizeof(compressed)) )
		{
			MM_FreePtr (&bigbuffer);
			return(false);
		}

		if (BE_Cross_readInt16LEBuffer(file, bigbuffer, compressed) != compressed)
		//if (!CA_FarRead(file,(id0_byte_t id0_far *)bigbuffer,compressed) )
		{
			MM_FreePtr (&bigbuffer);
			return(false);
		}

		CA_RLEWexpand ((id0_unsigned_t id0_huge *)bigbuffer,
			(id0_unsigned_t id0_huge *)mapsegs[i],expanded,RLETAG);
	}

	MM_FreePtr (&bigbuffer);
//
// copy the wall data to a data segment array again, to handle doors and
// bomb walls that are allready opened
//
	memset (tilemap,0,sizeof(tilemap));
	memset (actorat,0,sizeof(actorat));
	map = mapsegs[0];
	for (y=0;y<mapheight;y++)
		for (x=0;x<mapwidth;x++)
		{
			tile = *map++;
			if (tile<NUMFLOORS)
			{
				tilemap[x][y] = tile;
				if (tile>0)
					actorat[x][y] = tile;
					//(id0_unsigned_t)actorat[x][y] = tile;
			}
		}


	// Read the object list back in - assumes at least one object in list

	InitObjList ();
	newobj = player;
	while (true)
	{
		prev = newobj->prev;
		next = newobj->next;
		// (REFKEEN) Reading fields one-by-one in a cross-platform manner
		if (!LoadObject(file, newobj))
		//if (!CA_FarRead(file,(void id0_far *)newobj,sizeof(objtype)))
			return(false);
		followed = newobj->next;
		newobj->prev = prev;
		newobj->next = next;
		actorat[newobj->tilex][newobj->tiley] = COMPAT_OBJ_CONVERT_OBJ_PTR_TO_DOS_PTR(newobj);	// drop a new marker
		//actorat[newobj->tilex][newobj->tiley] = newobj;	// drop a new marker

		if (followed)
			GetNewObj (false);
		else
			break;
	}

	return(true);
}
Beispiel #25
0
/* PycSet */
void PycSet::load(PycData* stream, PycModule* mod)
{
    m_size = stream->get32();
    for (int i=0; i<m_size; i++)
        m_values.insert(LoadObject(stream, mod));
}
Beispiel #26
0
void __fastcall LoadGame(bool firstflag)
{
	int v1; // esi
	int v2; // edi
	int v5; // ebx
	int v6; // eax
	int v7; // eax
	int v8; // ecx
	bool v9; // sf
	unsigned char v10; // of
	int *v11; // esi
	int *v12; // esi
	int i; // esi
	int *v14; // esi
	int *v15; // esi
	int j; // esi
	int *v17; // esi
	int *v18; // esi
	int k; // esi
	int l; // esi
	signed int v21; // esi
	int m; // esi
	int v23; // esi
	int *v24; // esi
	int *v25; // esi
	int n; // esi
	int *v27; // esi
	char *v29; // edi
	char *v30; // edi
	char *v31; // edi
	char *v32; // edi
	int (*v33)[112]; // ebx
	_DWORD *v34; // edi
	char *v35; // edi
	char *v36; // edi
	char *v37; // edi
	char *v38; // edi
	signed int v39; // ebx
	bool *v40; // edi
	char *v41; // edi
	int v42; // esi
	char dst[260]; // [esp+0h] [ebp-120h]
	int len; // [esp+104h] [ebp-1Ch]
	int v46; // [esp+108h] [ebp-18h]
	int v47; // [esp+10Ch] [ebp-14h]
	void *ptr; // [esp+110h] [ebp-10h]
	int v49; // [esp+114h] [ebp-Ch]
	int from_save; // [esp+118h] [ebp-8h]
	int quest_num; // [esp+11Ch] [ebp-4h]

	FreeGameMem();
	pfile_remove_temp_files();
	pfile_get_game_name(dst);
	ptr = pfile_read(dst, &len);
	tbuff = ptr;
	if ( ILoad_2() != 'RETL' )
		TermMsg("Invalid save file");
	setlevel = OLoad();
	setlvlnum = ILoad();
	currlevel = ILoad();
	leveltype = ILoad();
	v1 = ILoad();
	v2 = ILoad();
	invflag = OLoad();
	chrflag = OLoad();
	v5 = ILoad();
	v47 = ILoad();
	v49 = ILoad();
	v6 = ILoad();
	quest_num = 0;
	v46 = v6;
	do
	{
		*(int *)((char *)glSeedTbl + quest_num) = ILoad_2();
		v7 = ILoad();
		v8 = quest_num;
		quest_num += 4;
		v10 = __OFSUB__(quest_num, 68);
		v9 = quest_num - 68 < 0;
		*(int *)((char *)gnLevelTypeTbl + v8) = v7;
	}
	while ( v9 ^ v10 );
	LoadPlayer(myplr);
	quest_num = 0;
	do
		LoadQuest(quest_num++);
	while ( quest_num < 16 );
	quest_num = 0;
	do
		LoadPortal(quest_num++);
	while ( quest_num < 4 );
	LoadGameLevel(firstflag, 4);
	SyncInitPlr(myplr);
	SyncPlrAnim(myplr);
	ViewX = v1;
	numitems = v47;
	nummissiles = v49;
	ViewY = v2;
	nummonsters = v5;
	nobjects = v46;
	v11 = monstkills;
	do
	{
		*v11 = ILoad_2();
		++v11;
	}
	while ( (signed int)v11 < (signed int)&monstkills[200] );
	if ( leveltype )
	{
		v12 = monstactive;
		do
		{
			*v12 = ILoad();
			++v12;
		}
		while ( (signed int)v12 < (signed int)&monstactive[200] );
		for ( i = 0; i < nummonsters; ++i )
			LoadMonster(monstactive[i]);
		v14 = missileactive;
		do
		{
			*v14 = BLoad();
			++v14;
		}
		while ( (signed int)v14 < (signed int)&missileactive[125] );
		v15 = missileavail;
		do
		{
			*v15 = BLoad();
			++v15;
		}
		while ( (signed int)v15 < (signed int)&missileavail[125] );
		for ( j = 0; j < nummissiles; ++j )
			LoadMissile(missileactive[j]);
		v17 = objectactive;
		do
		{
			*v17 = BLoad();
			++v17;
		}
		while ( (signed int)v17 < (signed int)&objectactive[127] );
		v18 = objectavail;
		do
		{
			*v18 = BLoad();
			++v18;
		}
		while ( (signed int)v18 < (signed int)&objectavail[127] );
		for ( k = 0; k < nobjects; ++k )
			LoadObject(objectactive[k]);
		for ( l = 0; l < nobjects; ++l )
			SyncObjectAnim(objectactive[l]);
		numlights = ILoad();
		v21 = 0;
		do
			lightactive[v21++] = BLoad();
		while ( v21 < 32 );
		for ( m = 0; m < numlights; ++m )
			LoadLighting((unsigned char)lightactive[m]);
		visionid = ILoad();
		v23 = 0;
		numvision = ILoad();
		if ( numvision > 0 )
		{
			do
				LoadVision(v23++);
			while ( v23 < numvision );
		}
	}
	v24 = itemactive;
	do
	{
		*v24 = BLoad();
		++v24;
	}
	while ( (signed int)v24 < (signed int)&itemactive[127] );
	v25 = itemavail;
	do
	{
		*v25 = BLoad();
		++v25;
	}
	while ( (signed int)v25 < (signed int)&itemavail[127] );
	for ( n = 0; n < numitems; ++n )
		LoadItem(itemactive[n]);
	v27 = UniqueItemFlag;
	do
	{
		*v27 = OLoad();
		++v27;
	}
	while ( (signed int)v27 < (signed int)&UniqueItemFlag[128] );
	quest_num = 0;
	do
	{
		from_save = 112;
		v29 = (char *)dTransVal + quest_num;
		do
		{
			*v29 = BLoad();
			v29 += 112;
			--from_save;
		}
		while ( from_save );
		++quest_num;
	}
	while ( quest_num < 112 );
	quest_num = 0;
	do
	{
		from_save = 112;
		v30 = (char *)dFlags + quest_num;
		do
		{
			*v30 = BLoad();
			v30 += 112;
			--from_save;
		}
		while ( from_save );
		++quest_num;
	}
	while ( quest_num < 112 );
	quest_num = 0;
	do
	{
		from_save = 112;
		v31 = (char *)dPlayer + quest_num;
		do
		{
			*v31 = BLoad();
			v31 += 112;
			--from_save;
		}
		while ( from_save );
		++quest_num;
	}
	while ( quest_num < 112 );
	quest_num = 0;
	do
	{
		from_save = 112;
		v32 = (char *)dItem + quest_num;
		do
		{
			*v32 = BLoad();
			v32 += 112;
			--from_save;
		}
		while ( from_save );
		++quest_num;
	}
	while ( quest_num < 112 );
	if ( leveltype )
	{
		v33 = dMonster;
		do
		{
			v34 = (unsigned int *)v33;
			from_save = 112;
			do
			{
				*v34 = ILoad();
				v34 += 112;
				--from_save;
			}
			while ( from_save );
			v33 = (int (*)[112])((char *)v33 + 4);
		}
		while ( (signed int)v33 < (signed int)dMonster[1] );
		quest_num = 0;
		do
		{
			from_save = 112;
			v35 = (char *)dDead + quest_num;
			do
			{
				*v35 = BLoad();
				v35 += 112;
				--from_save;
			}
			while ( from_save );
			++quest_num;
		}
		while ( quest_num < 112 );
		quest_num = 0;
		do
		{
			from_save = 112;
			v36 = (char *)dObject + quest_num;
			do
			{
				*v36 = BLoad();
				v36 += 112;
				--from_save;
			}
			while ( from_save );
			++quest_num;
		}
		while ( quest_num < 112 );
		quest_num = 0;
		do
		{
			from_save = 112;
			v37 = (char *)dTransVal + quest_num;
			do
			{
				*v37 = BLoad();
				v37 += 112;
				--from_save;
			}
			while ( from_save );
			++quest_num;
		}
		while ( quest_num < 112 );
		quest_num = 0;
		do
		{
			from_save = 112;
			v38 = (char *)dTransVal2 + quest_num;
			do
			{
				*v38 = BLoad();
				v38 += 112;
				--from_save;
			}
			while ( from_save );
			++quest_num;
		}
		while ( quest_num < 112 );
		v39 = 0;
		do
		{
			v40 = (bool *)automapview + v39;
			from_save = 40;
			do
			{
				*v40 = OLoad();
				v40 += 40;
				--from_save;
			}
			while ( from_save );
			++v39;
		}
		while ( v39 < 40 );
		quest_num = 0;
		do
		{
			from_save = 112;
			v41 = (char *)dMissile + quest_num;
			do
			{
				*v41 = BLoad();
				v41 += 112;
				--from_save;
			}
			while ( from_save );
			++quest_num;
		}
		while ( quest_num < 112 );
	}
	numpremium = ILoad();
	premiumlevel = ILoad();
	v42 = 0;
	do
		LoadPremium(v42++);
	while ( v42 < 6 );
	automapflag = OLoad();
	AutoMapScale = ILoad();
	mem_free_dbg(ptr);
	AutomapZoomReset();
	ResyncQuests();
	if ( leveltype )
		ProcessLightList();
	RedoPlayerVision();
	ProcessVisionList();
	missiles_process_charge();
	ResetPal();
	SetCursor(CURSOR_HAND);
	gbProcessPlayers = 1;
}
Beispiel #27
0
void __cdecl LoadLevel()
{
	int i; // esi
	int j; // esi
	char dst[260]; // [esp+Ch] [ebp-10Ch]
	int len; // [esp+110h] [ebp-8h]
	void *LoadBuff; // [esp+114h] [ebp-4h]

	GetPermLevelNames(dst);
	LoadBuff = pfile_read(dst, &len);
	tbuff = LoadBuff;

	if ( leveltype )
	{
		for(i = 0; i < 112; i++)
		{
			for(j = 0; j < 112; j++)
			{
				dDead[j][i] = BLoad(); /* check */
			}
		}

		SetDead();
	}

	nummonsters = ILoad();
	numitems = ILoad();
	nobjects = ILoad();

	if ( leveltype )
	{
		for(i = 0; i < 200; i++)
			monstactive[i] = ILoad();

		for(i = 0; i < nummonsters; i++)
			LoadMonster(monstactive[i]);

		for(i = 0; i < 127; i++)
			objectactive[i] = BLoad();

		for(i = 0; i < 127; i++)
			objectavail[i] = BLoad();

		for(i = 0; i < nobjects; i++)
			LoadObject(objectactive[i]);

		for(i = 0; i < nobjects; i++)
			SyncObjectAnim(objectactive[i]);
	}

	for(i = 0; i < 127; i++)
		itemactive[i] = BLoad();

	for(i = 0; i < 127; i++)
		itemavail[i] = BLoad();

	for(i = 0; i < numitems; i++)
		LoadItem(itemactive[i]);

	for(i = 0; i < 112; i++)
	{
		for(j = 0; j < 112; j++)
		{
			dFlags[j][i] = BLoad();
		}
	}

	for(i = 0; i < 112; i++)
	{
		for(j = 0; j < 112; j++)
		{
			dItem[j][i] = BLoad();
		}
	}

	if ( leveltype )
	{
		for(i = 0; i < 112; i++)
		{
			for(j = 0; j < 112; j++)
			{
				dMonster[j][i] = ILoad();
			}
		}

		for(i = 0; i < 112; i++)
		{
			for(j = 0; j < 112; j++)
			{
				dObject[j][i] = BLoad();
			}
		}

		for(i = 0; i < 112; i++)
		{
			for(j = 0; j < 112; j++)
			{
				dTransVal[j][i] = BLoad();
			}
		}

		for(i = 0; i < 112; i++)
		{
			for(j = 0; j < 112; j++)
			{
				dTransVal2[j][i] = BLoad();
			}
		}

		for(i = 0; i < 40; i++)
		{
			for(j = 0; j < 40; j++)
			{
				automapview[j][i] = OLoad();
			}
		}

		for(i = 0; i < 112; i++)
		{
			for(j = 0; j < 112; j++)
			{
				dMissile[j][i] = 0;
			}
		}
	}

	AutomapZoomReset();
	ResyncQuests();
	SyncPortals();
	dolighting = 1;

	for(i = 0; i < 4; i++)
	{
		if ( plr[i].plractive && currlevel == plr[i].plrlevel )
			LightList[plr[i]._plid]._lunflag = 1;
	}

	mem_free_dbg(LoadBuff);
}
Beispiel #28
0
id0_boolean_t
LoadGame(BE_FILE_T file)
{
	id0_word_t    i/*,j,size*/;
	//objtype *o;
	//id0_int_t orgx,orgy;
	objtype         *prev,*next,*followed;
	id0_unsigned_t        compressed,expanded;
	memptr  bigbuffer;

	// (REFKEEN) Reading fields one-by-one in a cross-platform manner
	if (!LoadGameState(file, &gamestate))
	//if (!CA_FarRead(file,(void id0_far *)&gamestate,sizeof(gamestate)))
		return(false);

// drop down a cache level and mark everything, so when the option screen
// is exited it will be cached

	ca_levelbit >>= 1;
	ca_levelnum--;

	SetupGameLevel (false);         // load in and cache the base old level
	titleptr[ca_levelnum] = levelnames[mapon];

	ca_levelbit <<= 1;
	ca_levelnum ++;

	expanded = mapwidth * mapheight * 2;
	MM_GetPtr (&bigbuffer,expanded);

	for (i = 0;i < 3;i++)   // Read all three planes of the map
	{
		if (BE_Cross_readInt16LE(file, &compressed) != 2)
		//if (!CA_FarRead(file,(id0_byte_t id0_far *)&compressed,sizeof(compressed)) )
		{
			MM_FreePtr (&bigbuffer);
			return(false);
		}

		if (BE_Cross_readInt16LEBuffer(file, bigbuffer, compressed) != compressed)
		//if (!CA_FarRead(file,(id0_byte_t id0_far *)bigbuffer,compressed) )
		{
			MM_FreePtr (&bigbuffer);
			return(false);
		}

		CA_RLEWexpand ((id0_unsigned_t id0_huge *)bigbuffer,
			(id0_unsigned_t id0_huge *)mapsegs[i],compressed,RLETAG);
	}

	MM_FreePtr (&bigbuffer);

	// Read the object list back in - assumes at least one object in list

	InitObjArray ();
	newobj = player;
	prev = newobj->prev;
	next = newobj->next;
	// (REFKEEN) Reading fields one-by-one in a cross-platform manner
	if (!LoadObject(file, newobj))
	//if (!CA_FarRead(file,(void id0_far *)newobj,sizeof(objtype)))
		return(false);
	newobj->prev = prev;
	newobj->next = next;
	newobj->needtoreact = true;
	newobj->sprite = NULL;
	newobj = scoreobj;
	while (true)
	{
		prev = newobj->prev;
		next = newobj->next;
		// And again
		if (!LoadObject(file, newobj))
		//if (!CA_FarRead(file,(void id0_far *)newobj,sizeof(objtype)))
			return(false);
		followed = newobj->next;
		newobj->prev = prev;
		newobj->next = next;
		newobj->needtoreact = true;
		newobj->sprite = NULL;

		if (followed)
			GetNewObj (false);
		else
			break;
	}

	scoreobj->temp1 = scoreobj->temp2 = -1;             // force score to be updated
	scoreobj->temp3 = -1;                   // and flower power
	scoreobj->temp4 = -1;                   // and lives
#if 0
	*((id0_long_t *)&(scoreobj->temp1)) = -1;             // force score to be updated
	scoreobj->temp3 = -1;                   // and flower power
	scoreobj->temp4 = -1;                   // and lives
#endif

	return(true);
}
Beispiel #29
0
void ObjectMan::LoadObjects()
{
	ifstream enlistments(ENLISTMENTS);
	
	if(!enlistments.is_open())
	{
		cout << "Bad models.enlistments file:" << endl
			<< "\tMake sure you have a models.enlistments file in your models "
			<< "directory that contains the names of each object. Leave off the "
			<< "file extension. Textures should have the same name." << endl;
		return;
	}

	cout << "Loading Objects:" << endl;

	while(enlistments.good())
	{
		string line;
		getline(enlistments, line);

		if (line.find("#") == 0 || line.empty())
		{
			// Comment or empty line in enlistments - skip over it
			continue;
		}

		string obj_id;
		string filename;
		float tx, ty, tz, rx, ry, rz, sx, sy, sz;
		string parent_id;

		istringstream iss(line);
		iss >> obj_id;
		iss >> filename;
		iss >> tx;
		iss >> ty;
		iss >> tz;
		iss >> rx;
		iss >> ry;
		iss >> rz;
		iss >> sx;
		iss >> sy;
		iss >> sz;
		iss >> parent_id;

		bool collidable = false;
		if (filename.find("::") != string::npos)
		{
			collidable = true;
			filename = filename.substr(0, filename.find("::"));
		}

		Geometry* obj = LoadObject(obj_id, filename, collidable, parent_id);

		cout << "\t\tTransformations...";

		obj->Translate(tx, ty, tz);
		obj->Rotate(rx, ry, rz);
		obj->Scale(sx, sy, sz);

		cout << "DONE." << endl;

		LoadTexture(obj_id, filename);
	}

	cout << "Loading Complete." << endl << endl;
}
Beispiel #30
0
id0_boolean_t	LoadTheGame(BE_FILE_T file)
{
	id0_unsigned_t	i,x,y;
	objtype		/**obj,*/*prev,*next,*followed;
	id0_unsigned_t	compressed,expanded;
	id0_unsigned_t	id0_far *map,tile;
	memptr		bigbuffer;

	screenpage = 0;
	FreeUpMemory();

	playstate = ex_loadedgame;
	// load the sky and ground colors
	// REFKEEN - But not before converting from original 16-bit pointers (reusing i variable)
	if (BE_Cross_readInt16LE(file, &i) != 2)
	//if (!CA_FarRead(file,(void id0_far *)&skycolor,sizeof(skycolor)))
		return(false);
	skycolor = GetSkyGndColorPtrFromDOSPointer(i);
	if (BE_Cross_readInt16LE(file, &i) != 2)
	//if (!CA_FarRead(file,(void id0_far *)&groundcolor,sizeof(groundcolor)))
		return(false);
	groundcolor = GetSkyGndColorPtrFromDOSPointer(i);

	if (BE_Cross_readInt16LE(file, &FreezeTime) != 2)
	//if (!CA_FarRead(file,(void id0_far *)&FreezeTime,sizeof(FreezeTime)))
		return(false);

	// (REFKEEN) Reading fields one-by-one in a cross-platform manner
	if (!LoadGameState(file, &gamestate))
	//if (!CA_FarRead(file,(void id0_far *)&gamestate,sizeof(gamestate)))
		return(false);

	if (BE_Cross_read_boolean_From16LE(file, &EASYMODEON) != 2)
	//if (!CA_FarRead(file,(void id0_far *)&EASYMODEON,sizeof(EASYMODEON)))
		return(false);

	SetupGameLevel ();		// load in and cache the base old level

	// (REFKEEN) DIFFERENCE FROM VANILLA CATACOMB ADVENTURES:
	// Don't do this check, we've already opened the file anyway
	// and this can lead to unexpected behaviors!
#if 0
	if (!FindRewritableFile(Filename,"SAVE GAME",-1))
		Quit("Error: Can't find saved game file!");
#endif

	expanded = mapwidth * mapheight * 2;
	MM_GetPtr (&bigbuffer,expanded);

	for (i = 0;i < 3;i+=2)	// Read planes 0 and 2
	{
		if (BE_Cross_readInt16LE(file, &compressed) != 2)
		//if (!CA_FarRead(file,(id0_byte_t id0_far *)&compressed,sizeof(compressed)) )
		{
			MM_FreePtr (&bigbuffer);
			return(false);
		}

		if (BE_Cross_readInt16LEBuffer(file, bigbuffer, compressed) != compressed)
		//if (!CA_FarRead(file,(id0_byte_t id0_far *)bigbuffer,compressed) )
		{
			MM_FreePtr (&bigbuffer);
			return(false);
		}

		CA_RLEWexpand ((id0_unsigned_t id0_huge *)bigbuffer,
			(id0_unsigned_t id0_huge *)mapsegs[i],expanded,RLETAG);
	}

	MM_FreePtr (&bigbuffer);
//
// copy the wall data to a data segment array again, to handle doors and
// bomb walls that are allready opened
//
	memset (tilemap,0,sizeof(tilemap));
	memset (actorat,0,sizeof(actorat));
	map = mapsegs[0];
	for (y=0;y<mapheight;y++)
		for (x=0;x<mapwidth;x++)
		{
			tile = *map++;
			if (tile<NUMFLOORS)
			{
				if (tile != INVISIBLEWALL)
					tilemap[x][y] = tile;
				if (tile>0)
					actorat[x][y] = tile;
					//(id0_unsigned_t)actorat[x][y] = tile;
			}
		}


	// Read the object list back in - assumes at least one object in list

	InitObjList ();
	newobj = player;
	while (true)
	{
		prev = newobj->prev;
		next = newobj->next;
		// (REFKEEN) Reading fields one-by-one in a cross-platform manner
		if (!LoadObject(file, newobj))
		//if (!CA_FarRead(file,(void id0_far *)newobj,sizeof(objtype)))
			return(false);
		followed = newobj->next;
		newobj->prev = prev;
		newobj->next = next;
		actorat[newobj->tilex][newobj->tiley] = COMPAT_OBJ_CONVERT_OBJ_PTR_TO_DOS_PTR(newobj);	// drop a new marker
		//actorat[newobj->tilex][newobj->tiley] = newobj;	// drop a new marker

		if (followed)
			GetNewObj (false);
		else
			break;
	}

	return(true);
}