Skip to content

Commit

Permalink
Fixup
Browse files Browse the repository at this point in the history
* add multistage turns
* add gameplay messages
* add selection colors
* add protection indicator
* add switch box arrows
* add survival pass slider
* add diagonal firing
* replace negating FF with forest switch
* fix survival check
* fix elephant attacking
* fix dragon forest attack
* fix wrong tile check on attack
* fix warhorse invincibility
* fix piece placing
* fix switch box cycling
* fix obj loading
* change dragon movement restrictions
* rearrange attack logic
  • Loading branch information
karwler committed Jul 6, 2019
1 parent d2b3a55 commit 0656e30
Show file tree
Hide file tree
Showing 20 changed files with 413 additions and 374 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,4 @@ Other client settings are stored in the "settings.ini" file in the game client's

## To do
- add move indicator
- test firing on fortress
- alternate game modes
20 changes: 6 additions & 14 deletions rsc/data/objects/regular.mtl
Original file line number Diff line number Diff line change
Expand Up @@ -34,55 +34,47 @@ newmtl plains
Ka 0 0 0
Kd 0.157 1 0.157
Ks 0.5 0.5 0.5
Ke 0 0 0
Ke 0.157 1 0.157
Ns 96
d 1

newmtl forest
Ka 0 0 0
Kd 0 0.627 0
Ks 0.5 0.5 0.5
Ke 0 0 0
Ke 0 0.627 0
Ns 96
d 1

newmtl mountain
Ka 0 0 0
Kd 0.471 0.471 0.471
Ks 0.5 0.5 0.5
Ke 0 0 0
Ke 0.471 0.471 0.471
Ns 96
d 1

newmtl water
Ka 0 0 0
Kd 0.157 0.784 1
Ks 0.5 0.5 0.5
Ke 0 0 0
Ke 0.157 0.784 1
Ns 96
d 1

newmtl fortress
Ka 0 0 0
Kd 0.549 0.275 0.078
Ks 0.5 0.5 0.5
Ke 0 0 0
Ns 96
d 1

newmtl rubble
Ka 0 0 0
Kd 0.274, 0.137, 0.039
Ks 0.5 0.5 0.5
Ke 0 0 0
Ke 0.549 0.275 0.078
Ns 96
d 1

newmtl ally
Ka 0 0 0
Kd 1 1 1
Ks 0.5 0.5 0.5
Ke 0 0 0
Ke 1 1 1
Ns 96
d 1

Expand Down
17 changes: 8 additions & 9 deletions rsc/data/objects/regular.obj
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ vt 0.1 0.1
vt 0.9 0.1
vt 0.9 0.9
vt 0.1 0.9
f 1/1/1 6/6/1 2/2/1
f 1/1/1 5/5/1 6/6/1
f 2/2/1 7/7/1 3/3/1
f 2/2/1 6/6/1 7/7/1
f 3/3/1 6/6/1 4/4/1
f 3/3/1 7/7/1 6/6/1
f 4/4/1 5/5/1 1/1/1
f 4/4/1 6/6/1 5/5/1

f 5/5/2 10/10/2 6/6/2
f 5/5/2 9/9/2 10/10/2
f 6/6/2 11/11/2 7/7/2
f 6/6/2 10/10/2 11/11/2
f 7/7/2 12/12/2 8/8/2
f 7/7/2 11/11/2 12/12/2
f 8/8/2 9/9/2 5/5/2
f 8/8/2 12/12/2 9/9/2
12 changes: 6 additions & 6 deletions src/engine/fileSys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ uint8 FileSys::readFace(const char* str, Blueprint& obj, const array<ushort, Ver
uint8 v = 0, e = 0;
for (char* end; *str && v < face.size();) {
if (int n = int(strtol(str, &end, 0)); end != str) {
face[v][e] = resolveObjId(n, sizes[e] + begins[e]) - begins[e];
face[v][e] = resolveObjId(n, begins[e], sizes[e]);
str = end;
e++;
} else if (*str == '/') {
Expand Down Expand Up @@ -220,11 +220,11 @@ uint8 FileSys::readFace(const char* str, Blueprint& obj, const array<ushort, Ver
return fill;
}

ushort FileSys::resolveObjId(int id, ushort size) {
if (ushort pid = ushort(id - 1); id > 0 && pid < size)
return pid;
if (ushort eid = size + ushort(id); id < 0 && eid < size)
return eid;
ushort FileSys::resolveObjId(int id, ushort ofs, ushort size) {
if (ushort pid = id - ofs; id > 0 && pid <= size)
return pid - 1;
if (id < 0 && -id <= size)
return size - id;
return size;
}

Expand Down
31 changes: 2 additions & 29 deletions src/engine/fileSys.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,7 @@ enum FileType : uint8 {
FTYPE_OTH = 0x4,
FTYPE_STD = FTYPE_REG | FTYPE_DIR
};

inline constexpr FileType operator~(FileType a) {
return FileType(~uint8(a));
}

inline constexpr FileType operator&(FileType a, FileType b) {
return FileType(uint8(a) & uint8(b));
}

inline constexpr FileType operator&=(FileType& a, FileType b) {
return a = FileType(uint8(a) & uint8(b));
}

inline constexpr FileType operator^(FileType a, FileType b) {
return FileType(uint8(a) ^ uint8(b));
}

inline constexpr FileType operator^=(FileType& a, FileType b) {
return a = FileType(uint8(a) ^ uint8(b));
}

inline constexpr FileType operator|(FileType a, FileType b) {
return FileType(uint8(a) | uint8(b));
}

inline constexpr FileType operator|=(FileType& a, FileType b) {
return a = FileType(uint8(a) | uint8(b));
}
ENUM_OPERATIONS(FileType, uint8)

// handles all filesystem interactions
class FileSys {
Expand Down Expand Up @@ -133,7 +106,7 @@ class FileSys {

private:
static uint8 readFace(const char* str, Blueprint& obj, const array<ushort, Vertex::size>& begins);
static ushort resolveObjId(int id, ushort size);
static ushort resolveObjId(int id, ushort ofs, ushort size);
static void fillUpObj(uint8& fill, Blueprint& obj);

static int setWorkingDir();
Expand Down
29 changes: 1 addition & 28 deletions src/engine/scene.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,34 +60,7 @@ struct Keyframe {

Keyframe(float time, Change change, const vec3& pos = vec3(), const vec3& rot = vec3());
};

inline constexpr Keyframe::Change operator~(Keyframe::Change a) {
return Keyframe::Change(~uint8(a));
}

inline constexpr Keyframe::Change operator&(Keyframe::Change a, Keyframe::Change b) {
return Keyframe::Change(uint8(a) & uint8(b));
}

inline constexpr Keyframe::Change operator&=(Keyframe::Change& a, Keyframe::Change b) {
return a = Keyframe::Change(uint8(a) & uint8(b));
}

inline constexpr Keyframe::Change operator^(Keyframe::Change a, Keyframe::Change b) {
return Keyframe::Change(uint8(a) ^ uint8(b));
}

inline constexpr Keyframe::Change operator^=(Keyframe::Change& a, Keyframe::Change b) {
return a = Keyframe::Change(uint8(a) ^ uint8(b));
}

inline constexpr Keyframe::Change operator|(Keyframe::Change a, Keyframe::Change b) {
return Keyframe::Change(uint8(a) | uint8(b));
}

inline constexpr Keyframe::Change operator|=(Keyframe::Change& a, Keyframe::Change b) {
return a = Keyframe::Change(uint8(a) | uint8(b));
}
ENUM_OPERATIONS(Keyframe::Change, uint8)

// a sequence of keyframes applied to an object
class Animation {
Expand Down
Loading

0 comments on commit 0656e30

Please sign in to comment.