Skip to content

Commit

Permalink
Merge pull request #42 from AssassinTee/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
AssassinTee authored Oct 18, 2020
2 parents eb94842 + 93f9865 commit 53bddd6
Show file tree
Hide file tree
Showing 224 changed files with 10,815 additions and 8,725 deletions.
27 changes: 12 additions & 15 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build

on: [push]
on: [push, pull_request]

jobs:
build-cmake:
Expand Down Expand Up @@ -40,12 +40,8 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
with:
submodules: true

- name: Prepare Linux
if: contains(matrix.os, 'ubuntu')
Expand All @@ -57,7 +53,7 @@ jobs:
if: contains(matrix.os, 'macOS')
run: |
brew update
brew install pkg-config freetype sdl2
brew install pkg-config sdl2
- name: Build in debug mode
env: ${{ matrix.env }}
Expand Down Expand Up @@ -107,12 +103,8 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Checkout submodules
shell: bash
run: |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
with:
submodules: true

- name: Checkout bam
uses: actions/checkout@v2
Expand All @@ -133,7 +125,7 @@ jobs:
if: contains(matrix.os, 'macOS')
run: |
brew update
brew install freetype sdl2
brew install sdl2
cd bam
./make_unix.sh
Expand All @@ -152,3 +144,8 @@ jobs:
run: ./bam/bam conf=release all
- name: Test release
run: ./build/x86_64/release/teeworlds_srv shutdown

- name: Create MacOS app using make_release.py
if: contains(matrix.os, 'macOS')
run: |
sudo python3 scripts/make_release.py master osx
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ versionsrv*
.settings
.vs
.vscode
*.vcxproj
*.vcxproj.filters
compile_commands.json
cscope.files
cscope.out
Expand All @@ -60,6 +62,7 @@ CPackConfig.cmake
CPackSourceConfig.cmake
Debug
Makefile
RelWithDebInfo
Release
_CPack_Packages/
build.ninja
Expand Down
20 changes: 16 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ else()
message(FATAL_ERROR "Couldn't parse version from src/game/version.h")
endif()

if(POLICY CMP0017)
cmake_policy(SET CMP0017 NEW)
endif()

if(POLICY CMP0072)
cmake_policy(SET CMP0072 OLD)
endif()
Expand Down Expand Up @@ -311,7 +315,7 @@ if(NOT CMAKE_CROSSCOMPILING)
endif()
find_package(ZLIB)
find_package(Crypto)
find_package(OwnFreetype)
find_package(Freetype)
find_package(Git)
find_package(GTest)
find_package(Pnglite)
Expand Down Expand Up @@ -396,14 +400,13 @@ endif()

if(TARGET_OS STREQUAL "windows")
set(PLATFORM_CLIENT)
set(PLATFORM_CLIENT_LIBS opengl32 glu32 winmm)
set(PLATFORM_CLIENT_LIBS opengl32 winmm)
set(PLATFORM_LIBS ws2_32) # Windows sockets
elseif(TARGET_OS STREQUAL "mac")
find_library(CARBON Carbon)
find_library(COCOA Cocoa)
find_library(OPENGL OpenGL)
set(PLATFORM_CLIENT
src/osxlaunch/client.h
src/osxlaunch/client.m
)
set(PLATFORM_CLIENT_LIBS ${COCOA} ${OPENGL})
Expand All @@ -412,7 +415,7 @@ else()
set(PLATFORM_CLIENT)
find_package(OpenGL)
find_package(X11)
set(PLATFORM_CLIENT_LIBS ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY} ${X11_X11_LIB})
set(PLATFORM_CLIENT_LIBS ${OPENGL_gl_LIBRARY} ${X11_X11_LIB})
set(PLATFORM_CLIENT_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR} ${X11_X11_INCLUDE_PATH})
if(TARGET_OS STREQUAL "linux")
set(PLATFORM_LIBS rt) # clock_gettime for glibc < 2.17
Expand Down Expand Up @@ -886,6 +889,7 @@ set(EXPECTED_DATA
editor/automap/desert_main.json
editor/automap/grass_doodads.json
editor/automap/grass_main.json
editor/automap/jungle_deathtiles.json
editor/automap/jungle_main.json
editor/automap/winter_main.json
editor/background.png
Expand Down Expand Up @@ -1135,6 +1139,7 @@ set(EXPECTED_DATA
ui/icons/friend.png
ui/icons/level.png
ui/icons/menu.png
ui/icons/network.png
ui/icons/sidebar.png
ui/icons/timer_clock.png
ui/icons/tools.png
Expand Down Expand Up @@ -1326,6 +1331,8 @@ set_src(ENGINE_SHARED GLOB src/engine/shared
huffman.h
jobs.cpp
jobs.h
jsonwriter.cpp
jsonwriter.h
kernel.cpp
linereader.cpp
linereader.h
Expand Down Expand Up @@ -1359,6 +1366,7 @@ set(ENGINE_GENERATED_SHARED src/generated/nethash.cpp src/generated/protocol.cpp
set_src(GAME_SHARED GLOB src/game
collision.cpp
collision.h
commands.h
gamecore.cpp
gamecore.h
layers.cpp
Expand Down Expand Up @@ -1459,7 +1467,9 @@ if(CLIENT)
components/menus_callback.cpp
components/menus_demo.cpp
components/menus_ingame.cpp
components/menus_listbox.cpp
components/menus_popups.cpp
components/menus_scrollregion.cpp
components/menus_settings.cpp
components/menus_start.cpp
components/motd.cpp
Expand Down Expand Up @@ -1707,9 +1717,11 @@ add_custom_target(everything DEPENDS ${TARGETS_OWN})

if(GTEST_FOUND OR DOWNLOAD_GTEST)
set_src(TESTS GLOB src/test
datafile.cpp
fs.cpp
git_revision.cpp
hash.cpp
jsonwriter.cpp
storage.cpp
str.cpp
test.cpp
Expand Down
30 changes: 18 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# catch64
![GitHub Actions](https://github.com/AssassinTee/catch64/workflows/Build/badge.svg)
[![release version](https://img.shields.io/github/release/AssassinTee/catch64.svg?style=flat)](https://github.com/AssassinTee/catch64/releases)
![Teeworlds version](https://img.shields.io/badge/Teeworlds-0.7.4-brightgreen.svg)
[![Actions Status](https://github.com/AssassinTee/catch64/workflows/All%20OS/badge.svg)](https://github.com/AssassinTee/catch64/actions)
[![release version](https://img.shields.io/badge/releases-Unix%20%7C%20Windows%20%7C%20MacOS-brightgreen)](https://github.com/AssassinTee/catch64/releases)
![Teeworlds version](https://img.shields.io/badge/Teeworlds-0.7.5-brightgreen.svg)
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/AssassinTee/catch64/issues)
> _"0.7.4 - Now supports more skins"_

![Nice](https://i.imgur.com/nhr0NEl.png)
![haha](https://i.imgur.com/PNYZgvm.png)

## Description
catch64 is a -Mod for the retro-multiplayergame [Teeworlds](www.teeworlds.com).
Expand Down Expand Up @@ -48,13 +50,17 @@ sudo brew install cmake freetype sdl2

## Variables

| command | default | min | max | description |
| ----------------------- | ------- | --- | ---- | ---------------------------------- |
| sv_allow_pickups | 0 | 0 | 1 | Spawn hearts and shields |
| sv_allow_weapon_pickups | 0 | 0 | 1 | Spawn weapons |
| sv_selfkill_cooldown | 15 | 3 | 9999 | Cooldown after selfkill |
| sv_win_bonus | 5 | 0 | 9999 | Bonus for winning a round |
| sv_min_grenade_damage | 4 | 0 | 6 | Minimum damage required for a kill |
| command | default | min | max | description |
| ------------------------- | ------- | --- | ---- | ----------------------------------- |
| sv_allow_pickups | 0 | 0 | 1 | Spawn hearts and shields |
| sv_allow_weapon_pickups | 0 | 0 | 1 | Spawn weapons |
| sv_selfkill_cooldown | 15 | 3 | 9999 | Cooldown after selfkill |
| sv_win_bonus | 5 | 0 | 9999 | Bonus for winning a round |
| sv_min_grenade_damage | 4 | 0 | 6 | Minimum damage required for a kill |
| sv_laser_jump | 1 | 0 | 1 | Activate laser jumping |
| sv_laser_explosion_damage | 4 | 0 | 6 | Explosion damage of laser jump |
| sv_random_spawn | 1 | 0 | 1 | Activates random spawns |
| sv_random_spawn_tries | 100 | 0 | 9999 | Tries for players to spawn randomly |

## Contributing

Expand All @@ -69,4 +75,4 @@ This project is licensed under the default Teeworlds license - see [license.txt]

## Great Thanks to

* Teeworlds devs for creating this game <3
* CircleCI integration is awesome, thank you Teeworlds devs!
2 changes: 0 additions & 2 deletions bam.lua
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ function GenerateLinuxSettings(settings, conf, arch, compiler)
-- Client
settings.link.libs:Add("X11")
settings.link.libs:Add("GL")
settings.link.libs:Add("GLU")
BuildClient(settings)

-- Content
Expand Down Expand Up @@ -273,7 +272,6 @@ function GenerateWindowsSettings(settings, conf, target_arch, compiler)
settings.link.extrafiles:Add(icons.client)
settings.link.extrafiles:Add(manifests.client)
settings.link.libs:Add("opengl32")
settings.link.libs:Add("glu32")
settings.link.libs:Add("winmm")
BuildClient(settings)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion configure.lua
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ function OptCCompiler(name, default_driver, default_c, default_cxx, desc)
-- no need todo anything if we have a driver
-- TODO: test if we can find the compiler
else
if ExecuteSilent("g++ -v") == 0 then
if ExecuteSilent("g++ -v") == 0 and ((arch ~= "amd64" and arch ~= "ia64") or CTestCompile(settings, "int main(){return 0;}", "-m64")) then
option.driver = "gcc"
elseif ExecuteSilent("cl") == 0 then
option.driver = "cl"
Expand Down
5 changes: 4 additions & 1 deletion datasrc/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ class CNetObjHandler
lines += ['\t{']

for item in network.Objects:
for line in item.emit_validate():
base_item = None
if item.base:
base_item = next(i for i in network.Objects if i.name == item.base)
for line in item.emit_validate(base_item):
lines += ["\t" + line]
lines += ['\t']
lines += ['\t}']
Expand Down
7 changes: 7 additions & 0 deletions datasrc/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ def FileList(format, num):
image_toolicons = Image("toolicons", "ui/icons/tools.png", 1)
image_arrowicons = Image("arrowicons", "ui/icons/arrows.png", 1)
image_friendicons = Image("friendicons", "ui/icons/friend.png", 1)
image_networkicons = Image("networkicons", "ui/icons/network.png", 1)
image_levelicons = Image("levelicons", "ui/icons/level.png", 1)
image_sidebaricons = Image("sidebaricons", "ui/icons/sidebar.png", 1)
image_chatwhisper = Image("chatwhisper", "ui/icons/chat_whisper.png", 1)
Expand All @@ -271,6 +272,7 @@ def FileList(format, num):
container.images.Add(image_toolicons)
container.images.Add(image_arrowicons)
container.images.Add(image_friendicons)
container.images.Add(image_networkicons)
container.images.Add(image_levelicons)
container.images.Add(image_sidebaricons)
container.images.Add(image_chatwhisper)
Expand Down Expand Up @@ -308,6 +310,7 @@ def FileList(format, num):
set_soundicons = SpriteSet("guiicons", image_soundicons, 1, 2)
set_arrowicons = SpriteSet("arrowicons", image_arrowicons, 4, 3)
set_friendicons = SpriteSet("friendicons", image_friendicons, 2, 2)
set_networkicons = SpriteSet("networkicons", image_networkicons, 1, 2)
set_levelicons = SpriteSet("levelicons", image_levelicons, 4, 4)
set_sidebaricons = SpriteSet("sidebaricons", image_sidebaricons, 4, 2)
set_timerclock = SpriteSet("timerclock", image_timerclock, 1, 2)
Expand All @@ -333,6 +336,7 @@ def FileList(format, num):
container.spritesets.Add(set_toolicons)
container.spritesets.Add(set_arrowicons)
container.spritesets.Add(set_friendicons)
container.spritesets.Add(set_networkicons)
container.spritesets.Add(set_levelicons)
container.spritesets.Add(set_sidebaricons)
container.spritesets.Add(set_timerclock)
Expand Down Expand Up @@ -536,6 +540,9 @@ def FileList(format, num):
container.sprites.Add(Sprite("friend_x_a", set_friendicons, 1,0,1,1))
container.sprites.Add(Sprite("friend_x_b", set_friendicons, 1,1,1,1))

container.sprites.Add(Sprite("network_good", set_networkicons, 0,0,1,1))
container.sprites.Add(Sprite("network_bad", set_networkicons, 0,1,1,1))

container.sprites.Add(Sprite("level_a_on", set_levelicons, 0,0,1,1))
container.sprites.Add(Sprite("level_a_a", set_levelicons, 0,1,1,1))
container.sprites.Add(Sprite("level_a_b", set_levelicons, 0,2,1,1))
Expand Down
26 changes: 17 additions & 9 deletions datasrc/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,15 @@ def emit_declaration(self):
lines += ["\t"+line for line in v.emit_declaration()]
lines += ["};"]
return lines
def emit_validate(self):
def emit_validate(self, base_item):
lines = ["case %s:" % self.enum_name]
lines += ["{"]
lines += ["\t%s *pObj = (%s *)pData;"%(self.struct_name, self.struct_name)]
lines += ["\tconst %s *pObj = (const %s *)pData;"%(self.struct_name, self.struct_name)]
lines += ["\tif(sizeof(*pObj) != Size) return -1;"]
for v in self.variables:
variables = self.variables
if base_item:
variables += base_item.variables
for v in variables:
lines += ["\t"+line for line in v.emit_validate()]
lines += ["\treturn 0;"]
lines += ["}"]
Expand Down Expand Up @@ -285,8 +288,9 @@ def emit_declaration(self):


class NetVariable:
def __init__(self, name):
def __init__(self, name, default=None):
self.name = name
self.default = None if default is None else str(default)
def emit_declaration(self):
return []
def emit_validate(self):
Expand Down Expand Up @@ -318,13 +322,16 @@ class NetIntAny(NetVariable):
def emit_declaration(self):
return ["int %s;"%self.name]
def emit_unpack(self):
return ["pMsg->%s = pUnpacker->GetInt();" % self.name]
if self.default is None:
return ["pMsg->%s = pUnpacker->GetInt();" % self.name]
else:
return ["pMsg->%s = pUnpacker->GetIntOrDefault(%s);" % (self.name, self.default)]
def emit_pack(self):
return ["pPacker->AddInt(%s);" % self.name]

class NetIntRange(NetIntAny):
def __init__(self, name, min, max):
NetIntAny.__init__(self,name)
def __init__(self, name, min, max, default=None):
NetIntAny.__init__(self,name,default=default)
self.min = str(min)
self.max = str(max)
def emit_validate(self):
Expand All @@ -351,8 +358,9 @@ def emit_unpack_check(self):
return ["if(!CheckFlag(\"%s\", pMsg->%s, %s)) break;"%(self.name, self.name, self.mask)]

class NetBool(NetIntRange):
def __init__(self, name):
NetIntRange.__init__(self,name,0,1)
def __init__(self, name, default=None):
default = None if default is None else int(default)
NetIntRange.__init__(self,name,0,1,default=default)

class NetTick(NetIntRange):
def __init__(self, name):
Expand Down
Loading

0 comments on commit 53bddd6

Please sign in to comment.