Example #1
0
void G_DoLoadGame(void)
{
    int i;
    int a, b, c;
    char savestr[SAVESTRINGSIZE];
    char vcheck[VERSIONSIZE], readversion[VERSIONSIZE];

    gameaction = ga_nothing;

    SV_OpenRead(savename);

    free(savename);
    savename = NULL;

    // Skip the description field
    SV_Read(savestr, SAVESTRINGSIZE);

    memset(vcheck, 0, sizeof(vcheck));
    DEH_snprintf(vcheck, VERSIONSIZE, "version %i", HERETIC_VERSION);
    SV_Read(readversion, VERSIONSIZE);

    if (strncmp(readversion, vcheck, VERSIONSIZE) != 0)
    {                           // Bad version
        return;
    }
    gameskill = SV_ReadByte();
    gameepisode = SV_ReadByte();
    gamemap = SV_ReadByte();
    for (i = 0; i < MAXPLAYERS; i++)
    {
        playeringame[i] = SV_ReadByte();
    }
    // Load a base level
    G_InitNew(gameskill, gameepisode, gamemap);

    // Create leveltime
    a = SV_ReadByte();
    b = SV_ReadByte();
    c = SV_ReadByte();
    leveltime = (a << 16) + (b << 8) + c;

    // De-archive all the modifications
    P_UnArchivePlayers();
    P_UnArchiveWorld();
    P_UnArchiveThinkers();
    P_UnArchiveSpecials();

    if (SV_ReadByte() != SAVE_GAME_TERMINATOR)
    {                           // Missing savegame termination marker
        I_Error("Bad savegame");
    }
}
Example #2
0
static void SV_ReadPlayer(player_t *pl)
{
	int     temp[3];

	SV_ReadLong();
	pl->playerstate = SV_ReadLong();
	SV_Read(temp, 8);
	pl->plr->viewz = SV_ReadLong();
	pl->plr->viewheight = SV_ReadLong();
	pl->plr->deltaviewheight = SV_ReadLong();
	pl->bob = SV_ReadLong();

	pl->health = SV_ReadLong();
	pl->armorpoints = SV_ReadLong();
	pl->armortype = SV_ReadLong();

	SV_Read(pl->powers, NUMPOWERS * 4);
	SV_Read(pl->cards, NUMCARDS * 4);
	pl->backpack = SV_ReadLong();

	SV_Read(pl->frags, 4 * 4);
	pl->readyweapon = SV_ReadLong();
	pl->pendingweapon = SV_ReadLong();

	SV_Read(pl->weaponowned, NUMWEAPONS * 4);
	SV_Read(pl->ammo, NUMAMMO * 4);
	SV_Read(pl->maxammo, NUMAMMO * 4);

	pl->attackdown = SV_ReadLong();
	pl->usedown = SV_ReadLong();

	pl->cheats = SV_ReadLong();

	pl->refire = SV_ReadLong();

	pl->killcount = SV_ReadLong();
	pl->itemcount = SV_ReadLong();
	pl->secretcount = SV_ReadLong();

	SV_ReadLong();

	pl->damagecount = SV_ReadLong();
	pl->bonuscount = SV_ReadLong();

	SV_ReadLong();

	pl->plr->extralight = SV_ReadLong();
	pl->plr->fixedcolormap = SV_ReadLong();
	pl->colormap = SV_ReadLong();
	SV_Read(pl->psprites, NUMPSPRITES * sizeof(pspdef_t));

	pl->didsecret = SV_ReadLong();
}
Example #3
0
//==========================================================================
// SV_ReadTexArchive
//==========================================================================
void SV_ReadTexArchive(texarchive_t * arc)
{
	int     i;

	arc->count = SV_ReadShort();
	for(i = 0; i < arc->count; i++)
	{
		SV_Read(arc->table[i].name, 8);
		arc->table[i].name[8] = 0;
	}
}
Example #4
0
uint32_t SV_ReadLong(void)
{
    uint32_t result;
    SV_Read(&result, sizeof(int));
    return LONG(result);
}
Example #5
0
uint16_t SV_ReadWord(void)
{
    uint16_t result;
    SV_Read(&result, sizeof(unsigned short));
    return SHORT(result);
}
Example #6
0
byte SV_ReadByte(void)
{
    byte result;
    SV_Read(&result, sizeof(byte));
    return result;
}
Example #7
0
static void SV_ReadMobj(mobj_t *mo)
{
	// List: thinker links.
	SV_ReadLong();
	SV_ReadLong();
	SV_ReadLong();

	// Info for drawing: position.
	mo->x = SV_ReadLong();
	mo->y = SV_ReadLong();
	mo->z = SV_ReadLong();

	// More list: links in sector (if needed)
	SV_ReadLong();
	SV_ReadLong();

	//More drawing info: to determine current sprite.
	mo->angle = SV_ReadLong();	// orientation
	mo->sprite = SV_ReadLong();	// used to find patch_t and flip value
	mo->frame = SV_ReadLong();	// might be ORed with FF_FULLBRIGHT

	// Interaction info, by BLOCKMAP.
	// Links in blocks (if needed).
	SV_ReadLong();
	SV_ReadLong();
	SV_ReadLong();

	// The closest interval over all contacted Sectors.
	mo->floorz = SV_ReadLong();
	mo->ceilingz = SV_ReadLong();

	// For movement checking.
	mo->radius = SV_ReadLong();
	mo->height = SV_ReadLong();

	// Momentums, used to update position.
	mo->momx = SV_ReadLong();
	mo->momy = SV_ReadLong();
	mo->momz = SV_ReadLong();

	// If == validcount, already checked.
	mo->valid = SV_ReadLong();

	mo->type = SV_ReadLong();
	SV_ReadLong();				// &mobjinfo[mobj->type]

	mo->tics = SV_ReadLong();	// state tic counter
	mo->state = (state_t *) SV_ReadLong();
	mo->flags = SV_ReadLong();
	mo->health = SV_ReadLong();

	// Movement direction, movement generation (zig-zagging).
	mo->movedir = SV_ReadLong();	// 0-7
	mo->movecount = SV_ReadLong();	// when 0, select a new dir

	// Thing being chased/attacked (or NULL),
	// also the originator for missiles.
	SV_ReadLong();

	// Reaction time: if non 0, don't attack yet.
	// Used by player to freeze a bit after teleporting.
	mo->reactiontime = SV_ReadLong();

	// If >0, the target will be chased
	// no matter what (even if shot)
	mo->threshold = SV_ReadLong();

	// Additional info record for player avatars only.
	// Only valid if type == MT_PLAYER
	mo->player = (player_t *) SV_ReadLong();

	// Player number last looked for.
	mo->lastlook = SV_ReadLong();

	// For nightmare respawn.
	SV_Read(&mo->spawnpoint, 10);

	// Thing being chased/attacked for tracers.
	SV_ReadLong();
}