mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-18 15:32:33 +00:00
allow archiving/unarchiving of skin_t userdata in netgames
This commit is contained in:
parent
d91d9bf7fc
commit
e8256e2b43
1 changed files with 12 additions and 0 deletions
|
@ -989,6 +989,7 @@ enum
|
||||||
ARCH_MAPHEADER,
|
ARCH_MAPHEADER,
|
||||||
ARCH_SKINCOLOR,
|
ARCH_SKINCOLOR,
|
||||||
ARCH_MOUSE,
|
ARCH_MOUSE,
|
||||||
|
ARCH_SKIN,
|
||||||
|
|
||||||
ARCH_TEND=0xFF,
|
ARCH_TEND=0xFF,
|
||||||
};
|
};
|
||||||
|
@ -1017,6 +1018,7 @@ static const struct {
|
||||||
{META_MAPHEADER, ARCH_MAPHEADER},
|
{META_MAPHEADER, ARCH_MAPHEADER},
|
||||||
{META_SKINCOLOR, ARCH_SKINCOLOR},
|
{META_SKINCOLOR, ARCH_SKINCOLOR},
|
||||||
{META_MOUSE, ARCH_MOUSE},
|
{META_MOUSE, ARCH_MOUSE},
|
||||||
|
{META_SKIN, ARCH_SKIN},
|
||||||
{NULL, ARCH_NULL}
|
{NULL, ARCH_NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1338,6 +1340,13 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
|
||||||
WRITEUINT8(save_p, m == &mouse ? 1 : 2);
|
WRITEUINT8(save_p, m == &mouse ? 1 : 2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ARCH_SKIN:
|
||||||
|
{
|
||||||
|
skin_t *skin = *((skin_t **)lua_touserdata(gL, myindex));
|
||||||
|
WRITEUINT8(save_p, ARCH_SKIN);
|
||||||
|
WRITEUINT8(save_p, skin - skins); // UINT8 because MAXSKINS is only 32
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
WRITEUINT8(save_p, ARCH_NULL);
|
WRITEUINT8(save_p, ARCH_NULL);
|
||||||
return 2;
|
return 2;
|
||||||
|
@ -1584,6 +1593,9 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
|
||||||
case ARCH_MOUSE:
|
case ARCH_MOUSE:
|
||||||
LUA_PushUserdata(gL, READUINT16(save_p) == 1 ? &mouse : &mouse2, META_MOUSE);
|
LUA_PushUserdata(gL, READUINT16(save_p) == 1 ? &mouse : &mouse2, META_MOUSE);
|
||||||
break;
|
break;
|
||||||
|
case ARCH_SKIN:
|
||||||
|
LUA_PushUserdata(gL, &skins[READUINT8(save_p)], META_SKIN);
|
||||||
|
break;
|
||||||
case ARCH_TEND:
|
case ARCH_TEND:
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue