Compare commits
7 commits
Author | SHA1 | Date | |
---|---|---|---|
d0553e6575 | |||
6b5452c923 | |||
5a6bb6e982 | |||
090d4d5d8d | |||
1f70dd7000 | |||
bab758e93f | |||
f55db7a7fd |
4 changed files with 29 additions and 18 deletions
14
README.md
14
README.md
|
@ -1,14 +1,14 @@
|
|||
# Elemental on Command Line
|
||||
This is an elemental combination game written in C, with optional multi-player support.
|
||||
|
||||
## Clients
|
||||
- [PenguinMod client](https://studio.penguinmod.com/?fps=200&clones=Infinity&offscreen&size=850x480#7218964246) for playing the game online with a fancy interface
|
||||
- [Discord client](https://discord.gg/DKZTWyWH3B) for playing the game publicly with other Discord members
|
||||
- [Web client](https://elem.dervland.net/) for a demo of the multiplayer version
|
||||
- [Original client](https://git.dervland.net/elemental/elemental-on-terminal/releases) for developers, administrators, and command line fans
|
||||
|
||||
## Single-player
|
||||
A single-player example pack is provided as an example in ``bin/combos.txt``. This can be customized by the user, although internal limitations require the combination string to be in alphabetical order.
|
||||
|
||||
## Multi-player
|
||||
To set up multi-player mode, create a directory ``../elem_data``. Also, create separate directories for each user that plays.
|
||||
|
||||
The game can now be played with the following syntax, inside your user directory:
|
||||
```sh
|
||||
cd ../your_user_dir
|
||||
../elemental-command-line/bin/elem your_username
|
||||
```
|
||||
To set up multi-player mode, use the guide with the [Web proxy](https://git.dervland.net/elemental/elemental-to-web).
|
|
@ -80,7 +80,7 @@ int inv_handler(const void *key, size_t size, uintptr_t val, void *usr) {
|
|||
if (val2[strlen(val2) - 1] == '\n') {
|
||||
printf("- user:%s suggested %s", key3, val2);
|
||||
} else {
|
||||
printf("- user:%s suggested %s\n", key3, val2);
|
||||
printf("- user:%s suggested %s\n", key3, val2);
|
||||
}
|
||||
|
||||
free(key3);
|
||||
|
@ -103,30 +103,41 @@ int inv_handler(const void *key, size_t size, uintptr_t val, void *usr) {
|
|||
int polls_handler(const void *key, size_t size, uintptr_t val, void *usr) {
|
||||
struct verifier *verified = (struct verifier *)usr;
|
||||
|
||||
if (((char *)val)[strlen(((char *)val)) - 1] == '\n') {
|
||||
((char *)val)[strlen(((char *)val)) - 1] = '\0';
|
||||
char *val2 = (char *)val;
|
||||
char *val3 = malloc(strlen(val2) + 1);
|
||||
strcpy(val3, val2);
|
||||
|
||||
if (val3[strlen(val3) - 1] == '\n') {
|
||||
val3[strlen(val3) - 1] = '\0';
|
||||
}
|
||||
|
||||
if (strncmp(verified->name, key, strlen(verified->name)) == 0 &&
|
||||
strcmp(verified->sugg, (char *)val) == 0)
|
||||
strcmp(verified->sugg, val3) == 0) {
|
||||
free(val3);
|
||||
return -1;
|
||||
}
|
||||
|
||||
free(val3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int success_handler(const void *key, size_t size, uintptr_t val, void *usr) {
|
||||
struct succ *verified = (struct succ *)usr;
|
||||
|
||||
char *val2 = (char*) val;
|
||||
char *val2 = (char *)val;
|
||||
char *val3 = malloc(strlen(val2) + 1);
|
||||
strcpy(val3, val2);
|
||||
|
||||
if ((char *)val != verified->sugg && val2[strlen(val2) - 1] == '\n') {
|
||||
val2[strlen(val2) - 1] = '\0';
|
||||
if (val3[strlen(val3) - 1] == '\n') {
|
||||
val3[strlen(val3) - 1] = '\0';
|
||||
}
|
||||
|
||||
if (strcmp(verified->sugg, (char *)val) == 0) {
|
||||
if (strcmp(verified->sugg, val3) == 0) {
|
||||
verified->points[0]++;
|
||||
}
|
||||
|
||||
free(val3);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ void init_tables(hashmap *elements, hashmap *inv, hashmap *polls,
|
|||
load_elements(elements_rev, combo_file, 3) ||
|
||||
load_elements(elements_rev, "bin/" combo_file, 3);
|
||||
|
||||
load_elements(polls, "../elem_data/" poll_file, 2);
|
||||
load_elements(polls, "../elem_data/" poll_file, 3);
|
||||
|
||||
if (!do_inv)
|
||||
return;
|
||||
|
|
4
wrap.sh
4
wrap.sh
|
@ -1,6 +1,6 @@
|
|||
make
|
||||
CC=x86_64-w64-mingw32-gcc BIN=bin/elem.exe make
|
||||
CC=i686-w64-mingw32-gcc BIN=bin/elem_32.exe make
|
||||
strip --strip-all bin/elem
|
||||
rm elem.tar.gz
|
||||
tar -cvf elem.tar.gz bin
|
||||
strip --strip-all bin/elem
|
||||
tar -cvf elem.tar.gz bin
|
Loading…
Reference in a new issue