1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-12-24 17:10:36 +00:00

charstyle format depending on vernum

This commit is contained in:
Zeno Rogue 2019-05-22 00:21:22 +02:00
parent 1b93ecd5a3
commit ba91bea71c
2 changed files with 18 additions and 23 deletions

View File

@ -38,30 +38,25 @@ struct charstyle_old {
};
void hread(hstream& hs, charstyle& cs) {
charstyle_old cso;
hread_raw(hs, cso);
cs.charid = cso.charid;
cs.skincolor = cso.skincolor;
cs.haircolor = cso.haircolor;
cs.dresscolor = cso.dresscolor;
cs.swordcolor = cs.eyecolor = cso.swordcolor;
if(cs.charid < 4) cs.eyecolor = 0;
cs.dresscolor2 = cso.dresscolor2;
cs.uicolor = cso.uicolor;
cs.lefthanded = cso.lefthanded;
// before 0xA61A there was no eyecolor
if(hs.vernum < 0xA61A) {
charstyle_old cso;
hread_raw(hs, cso);
cs.charid = cso.charid;
cs.skincolor = cso.skincolor;
cs.haircolor = cso.haircolor;
cs.dresscolor = cso.dresscolor;
cs.swordcolor = cs.eyecolor = cso.swordcolor;
if(cs.charid < 4) cs.eyecolor = 0;
cs.dresscolor2 = cso.dresscolor2;
cs.uicolor = cso.uicolor;
cs.lefthanded = cso.lefthanded;
}
else hread_raw(hs, cs);
}
void hwrite(hstream& hs, const charstyle& cs) {
charstyle_old cso;
cso.charid = cs.charid;
cso.skincolor = cs.skincolor;
cso.haircolor = cs.haircolor;
cso.dresscolor = cs.dresscolor;
cso.swordcolor = cs.charid >= 4 ? cs.eyecolor : cs.swordcolor;
cso.dresscolor2 = cs.dresscolor2;
cso.uicolor = cs.uicolor;
cso.lefthanded = cs.lefthanded;
hwrite_raw(hs, cso);
hwrite_raw(hs, cs);
}
// void hread(hstream& hs, charstyle& cs) { hread_raw(hs, cs); }

View File

@ -2,8 +2,8 @@
// It is quite chaotic.
// version numbers
#define VER "11.0y"
#define VERNUM_HEX 0xA619
#define VER "11.0z"
#define VERNUM_HEX 0xA61A
#include <stdarg.h>
#include "hyper_function.h"