mirror of
https://github.com/yquake2/3zb2.git
synced 2024-11-21 19:40:59 +00:00
Merge pull request #5 from NeonKnightOA/cleanup
Refactoring to match the current yq2 projects.
This commit is contained in:
commit
7b46fb5269
39 changed files with 143 additions and 116 deletions
|
@ -22,9 +22,9 @@ string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
|||
add_definitions(-DOSTYPE="${CMAKE_SYSTEM_NAME}")
|
||||
|
||||
# Architecture string
|
||||
string(REGEX REPLACE "amd64" "x86_64" ARCH ${CMAKE_SYSTEM_PROCESSOR})
|
||||
string(REGEX REPLACE "i.86" "i386" ARCH ${ARCH})
|
||||
string(REGEX REPLACE "^arm.*" "arm" ARCH ${ARCH})
|
||||
string(REGEX REPLACE "amd64" "x86_64" ARCH "${CMAKE_SYSTEM_PROCESSOR}")
|
||||
string(REGEX REPLACE "i.86" "i386" ARCH "${ARCH}")
|
||||
string(REGEX REPLACE "^arm.*" "arm" ARCH "${ARCH}")
|
||||
add_definitions(-DARCH="${ARCH}")
|
||||
|
||||
# Linker Flags
|
||||
|
@ -35,10 +35,10 @@ else()
|
|||
endif()
|
||||
|
||||
set(3zb2-Source
|
||||
src/bot_fire.c
|
||||
src/bot_func.c
|
||||
src/bot_za.c
|
||||
src/bot.c
|
||||
src/bot/fire.c
|
||||
src/bot/func.c
|
||||
src/bot/za.c
|
||||
src/bot/bot.c
|
||||
src/g_chase.c
|
||||
src/g_cmds.c
|
||||
src/g_combat.c
|
||||
|
@ -57,25 +57,25 @@ set(3zb2-Source
|
|||
src/g_turret.c
|
||||
src/g_utils.c
|
||||
src/g_weapon.c
|
||||
src/m_move.c
|
||||
src/p_client.c
|
||||
src/p_hud.c
|
||||
src/p_menu.c
|
||||
src/p_trail.c
|
||||
src/p_view.c
|
||||
src/p_weapon.c
|
||||
src/q_shared.c
|
||||
src/monster/move.c
|
||||
src/player/client.c
|
||||
src/player/hud.c
|
||||
src/player/menu.c
|
||||
src/player/trail.c
|
||||
src/player/view.c
|
||||
src/player/weapon.c
|
||||
src/shared/shared.c
|
||||
)
|
||||
|
||||
set(3zb2-Header
|
||||
src/bot.h
|
||||
src/botstr.h
|
||||
src/g_ctf.h
|
||||
src/g_local.h
|
||||
src/game.h
|
||||
src/m_player.h
|
||||
src/p_menu.h
|
||||
src/q_shared.h
|
||||
src/header/bot.h
|
||||
src/header/botstr.h
|
||||
src/header/ctf.h
|
||||
src/header/game.h
|
||||
src/header/local.h
|
||||
src/header/menu.h
|
||||
src/header/player.h
|
||||
src/header/shared.h
|
||||
)
|
||||
|
||||
# Build the 3zb2 dynamic library
|
||||
|
|
91
Makefile
91
Makefile
|
@ -1,12 +1,12 @@
|
|||
# ----------------------------------------------------- #
|
||||
# Makefile for the 3zb2game module for Quake II #
|
||||
# Makefile for the 3zb2 game module for Quake II #
|
||||
# #
|
||||
# Just type "make" to compile the #
|
||||
# - The Reckoning Game (game.so / game.dll) #
|
||||
# - 3rd. Zigock Bot Game (game.so) #
|
||||
# #
|
||||
# Dependencies: #
|
||||
# - None, but you need a Quake II to play. #
|
||||
# While in theorie every one should work #
|
||||
# While in theorie every client should work #
|
||||
# Yamagi Quake II ist recommended. #
|
||||
# #
|
||||
# Platforms: #
|
||||
|
@ -23,12 +23,12 @@ OSTYPE := Windows
|
|||
else
|
||||
OSTYPE := $(shell uname -s)
|
||||
endif
|
||||
|
||||
|
||||
# Special case for MinGW
|
||||
ifneq (,$(findstring MINGW,$(OSTYPE)))
|
||||
OSTYPE := Windows
|
||||
endif
|
||||
|
||||
|
||||
# Detect the architecture
|
||||
ifeq ($(OSTYPE), Windows)
|
||||
ifdef PROCESSOR_ARCHITEW6432
|
||||
|
@ -43,12 +43,23 @@ else
|
|||
ARCH := $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/')
|
||||
endif
|
||||
|
||||
# Detect the compiler
|
||||
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
|
||||
COMPILER := clang
|
||||
COMPILERVER := $(shell $(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/')
|
||||
else ifeq ($(shell $(CC) -v 2>&1 | grep -c -E "(gcc version|gcc-Version)"), 1)
|
||||
COMPILER := gcc
|
||||
COMPILERVER := $(shell $(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/')
|
||||
else
|
||||
COMPILER := unknown
|
||||
endif
|
||||
|
||||
# ----------
|
||||
|
||||
# Base CFLAGS.
|
||||
# Base CFLAGS.
|
||||
#
|
||||
# -O2 are enough optimizations.
|
||||
#
|
||||
#
|
||||
# -fno-strict-aliasing since the source doesn't comply
|
||||
# with strict aliasing rules and it's next to impossible
|
||||
# to get it there...
|
||||
|
@ -73,6 +84,22 @@ endif
|
|||
|
||||
# ----------
|
||||
|
||||
# Switch of some annoying warnings.
|
||||
ifeq ($(COMPILER), clang)
|
||||
# -Wno-missing-braces because otherwise clang complains
|
||||
# about totally valid 'vec3_t bla = {0}' constructs.
|
||||
CFLAGS += -Wno-missing-braces
|
||||
else ifeq ($(COMPILER), gcc)
|
||||
# GCC 8.0 or higher.
|
||||
ifeq ($(shell test $(COMPILERVER) -ge 80000; echo $$?),0)
|
||||
# -Wno-format-truncation and -Wno-format-overflow
|
||||
# because GCC spams about 50 false positives.
|
||||
CFLAGS += -Wno-format-truncation -Wno-format-overflow
|
||||
endif
|
||||
endif
|
||||
|
||||
# ----------
|
||||
|
||||
# Defines the operating system and architecture
|
||||
CFLAGS += -DOSTYPE=\"$(OSTYPE)\" -DARCH=\"$(ARCH)\"
|
||||
|
||||
|
@ -80,11 +107,11 @@ CFLAGS += -DOSTYPE=\"$(OSTYPE)\" -DARCH=\"$(ARCH)\"
|
|||
|
||||
# Base LDFLAGS.
|
||||
ifeq ($(OSTYPE), Darwin)
|
||||
LDFLAGS := -shared -arch i386 -arch x86_64
|
||||
LDFLAGS := -shared -arch i386 -arch x86_64
|
||||
else ifeq ($(OSTYPE), Windows)
|
||||
LDFLAGS := -shared -static-libgcc
|
||||
else
|
||||
LDFLAGS := -shared
|
||||
LDFLAGS := -shared -lm
|
||||
endif
|
||||
|
||||
# ----------
|
||||
|
@ -104,12 +131,12 @@ Q := @
|
|||
endif
|
||||
|
||||
# ----------
|
||||
|
||||
|
||||
# Phony targets
|
||||
.PHONY : all clean 3zb2
|
||||
|
||||
# ----------
|
||||
|
||||
|
||||
# Cleanup
|
||||
clean:
|
||||
@echo "===> CLEAN"
|
||||
|
@ -122,33 +149,33 @@ ifeq ($(OSTYPE), Windows)
|
|||
3zb2:
|
||||
@echo "===> Building game.dll"
|
||||
${Q}mkdir -p release
|
||||
${MAKE} release/game.dll
|
||||
|
||||
build/%.o: %.c
|
||||
@echo "===> CC $<"
|
||||
${Q}mkdir -p $(@D)
|
||||
${Q}$(CC) -c $(CFLAGS) -o $@ $<
|
||||
$(MAKE) release/game.dll
|
||||
else ifeq ($(OSTYPE), Darwin)
|
||||
3zb2:
|
||||
@echo "===> Building game.dylib"
|
||||
${Q}mkdir -p release
|
||||
$(MAKE) release/game.dylib
|
||||
else
|
||||
3zb2:
|
||||
@echo "===> Building game.so"
|
||||
${Q}mkdir -p release
|
||||
$(MAKE) release/game.so
|
||||
|
||||
release/game.so : CFLAGS += -fPIC
|
||||
endif
|
||||
|
||||
build/%.o: %.c
|
||||
@echo "===> CC $<"
|
||||
${Q}mkdir -p $(@D)
|
||||
${Q}$(CC) -c $(CFLAGS) -o $@ $<
|
||||
|
||||
release/game.so : CFLAGS += -fPIC
|
||||
endif
|
||||
|
||||
# ----------
|
||||
|
||||
3ZB2_OBJS_ = \
|
||||
src/bot.o \
|
||||
src/bot_fire.o \
|
||||
src/bot_func.o \
|
||||
src/bot_za.o \
|
||||
src/bot/bot.o \
|
||||
src/bot/fire.o \
|
||||
src/bot/func.o \
|
||||
src/bot/za.o \
|
||||
src/g_chase.o \
|
||||
src/g_cmds.o \
|
||||
src/g_combat.o \
|
||||
|
@ -166,14 +193,14 @@ endif
|
|||
src/g_trigger.o \
|
||||
src/g_utils.o \
|
||||
src/g_weapon.o \
|
||||
src/m_move.o \
|
||||
src/p_client.o \
|
||||
src/p_hud.o \
|
||||
src/p_menu.o \
|
||||
src/p_trail.o \
|
||||
src/p_view.o \
|
||||
src/p_weapon.o \
|
||||
src/q_shared.o
|
||||
src/monster/move.o \
|
||||
src/player/client.o \
|
||||
src/player/hud.o \
|
||||
src/player/menu.o \
|
||||
src/player/trail.o \
|
||||
src/player/view.o \
|
||||
src/player/weapon.o \
|
||||
src/shared/shared.o
|
||||
|
||||
# ----------
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "g_local.h"
|
||||
#include "m_player.h"
|
||||
#include "bot.h"
|
||||
#include "../header/local.h"
|
||||
#include "../header/player.h"
|
||||
#include "../header/bot.h"
|
||||
|
||||
void droptofloor (edict_t *ent);
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "bot.h"
|
||||
#include "q_shared.h"
|
||||
#include "m_player.h"
|
||||
#include "../header/bot.h"
|
||||
#include "../header/shared.h"
|
||||
#include "../header/player.h"
|
||||
|
||||
//======================================================================
|
||||
//aim決定
|
|
@ -1,5 +1,5 @@
|
|||
#include "bot.h"
|
||||
#include "m_player.h"
|
||||
#include "../header/bot.h"
|
||||
#include "../header/player.h"
|
||||
|
||||
|
||||
qboolean Get_YenPos(char *Buff,int *curr)
|
|
@ -1,6 +1,6 @@
|
|||
#include "bot.h"
|
||||
#include "q_shared.h"
|
||||
#include "m_player.h"
|
||||
#include "../header/bot.h"
|
||||
#include "../header/shared.h"
|
||||
#include "../header/player.h"
|
||||
|
||||
qboolean pickup_pri;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "g_local.h"
|
||||
#include "header/local.h"
|
||||
|
||||
void UpdateChaseCam(edict_t *ent)
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "g_local.h"
|
||||
#include "m_player.h"
|
||||
#include "bot.h"
|
||||
#include "header/local.h"
|
||||
#include "header/player.h"
|
||||
#include "header/bot.h"
|
||||
|
||||
char *ClientTeam (edict_t *ent)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// g_combat.c
|
||||
|
||||
#include "g_local.h"
|
||||
#include "bot.h"
|
||||
#include "header/local.h"
|
||||
#include "header/bot.h"
|
||||
/*
|
||||
============
|
||||
CanDamage
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "g_local.h"
|
||||
#include "bot.h"
|
||||
#include "header/local.h"
|
||||
#include "header/bot.h"
|
||||
|
||||
typedef struct ctfgame_s
|
||||
{
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "g_local.h"
|
||||
#include "bot.h"
|
||||
#include "header/local.h"
|
||||
#include "header/bot.h"
|
||||
|
||||
void SpawnItem3 (edict_t *ent, gitem_t *item);
|
||||
/*
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "g_local.h"
|
||||
#include "bot.h"
|
||||
#include "g_ctf.h"
|
||||
#include "header/local.h"
|
||||
#include "header/bot.h"
|
||||
#include "header/ctf.h"
|
||||
|
||||
qboolean Pickup_Weapon (edict_t *ent, edict_t *other);
|
||||
void Use_Weapon (edict_t *ent, gitem_t *inv);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#include "g_local.h"
|
||||
#include "bot.h"
|
||||
#include "header/local.h"
|
||||
#include "header/bot.h"
|
||||
|
||||
game_locals_t game;
|
||||
level_locals_t level;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// g_misc.c
|
||||
|
||||
#include "g_local.h"
|
||||
#include "bot.h"
|
||||
#include "header/local.h"
|
||||
#include "header/bot.h"
|
||||
|
||||
/*QUAKED func_group (0 0 0) ?
|
||||
Used to group brushes together just for editor convenience.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "g_local.h"
|
||||
#include "bot.h"
|
||||
#include "header/local.h"
|
||||
#include "header/bot.h"
|
||||
|
||||
//
|
||||
// monster weapons
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// g_phys.c
|
||||
|
||||
#include "g_local.h"
|
||||
#include "header/local.h"
|
||||
|
||||
/*
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#include "g_local.h"
|
||||
#include "bot.h"
|
||||
#include "header/local.h"
|
||||
#include "header/bot.h"
|
||||
|
||||
field_t fields[] = {
|
||||
{"classname", FOFS(classname), F_LSTRING},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#include "g_local.h"
|
||||
#include "bot.h"
|
||||
#include "header/local.h"
|
||||
#include "header/bot.h"
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
#include "g_local.h"
|
||||
#include "bot.h"
|
||||
#include "header/local.h"
|
||||
#include "header/bot.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "g_local.h"
|
||||
#include "header/local.h"
|
||||
|
||||
/*QUAKED target_temp_entity (1 0 0) (-8 -8 -8) (8 8 8)
|
||||
Fire an origin based temp entity event to the clients.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "g_local.h"
|
||||
#include "header/local.h"
|
||||
|
||||
|
||||
void InitTrigger (edict_t *self)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// g_utils.c -- misc utility functions for game module
|
||||
|
||||
#include "g_local.h"
|
||||
#include "header/local.h"
|
||||
|
||||
|
||||
void G_ProjectSource (vec3_t point, vec3_t distance, vec3_t forward, vec3_t right, vec3_t result)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "g_local.h"
|
||||
#include "bot.h"
|
||||
#include "header/local.h"
|
||||
#include "header/bot.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef BOTHEAD
|
||||
#define BOTHEAD
|
||||
#include "g_local.h"
|
||||
#include "../header/local.h"
|
||||
|
||||
//general func
|
||||
void player_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point);
|
|
@ -1,6 +1,6 @@
|
|||
// g_local.h -- local definitions for game module
|
||||
|
||||
#include "q_shared.h"
|
||||
#include "shared.h"
|
||||
|
||||
#ifndef G_LOCAL
|
||||
#define G_LOCAL
|
||||
|
@ -12,7 +12,7 @@
|
|||
#include "game.h"
|
||||
|
||||
//ZOID
|
||||
#include "p_menu.h"
|
||||
#include "menu.h"
|
||||
//ZOID
|
||||
|
||||
// the "gameversion" client command will print this plus compile date
|
||||
|
@ -1252,6 +1252,6 @@ struct edict_s
|
|||
};
|
||||
|
||||
//ZOID
|
||||
#include "g_ctf.h"
|
||||
#include "ctf.h"
|
||||
//ZOID
|
||||
#endif
|
|
@ -1,6 +1,6 @@
|
|||
// m_move.c -- monster movement
|
||||
|
||||
#include "g_local.h"
|
||||
#include "../header/local.h"
|
||||
|
||||
#define STEPSIZE 18
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "g_local.h"
|
||||
#include "m_player.h"
|
||||
#include "bot.h"
|
||||
#include "../header/local.h"
|
||||
#include "../header/player.h"
|
||||
#include "../header/bot.h"
|
||||
|
||||
int cumsindex;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include "g_local.h"
|
||||
#include "bot.h"
|
||||
#include "../header/local.h"
|
||||
#include "../header/bot.h"
|
||||
|
||||
/*
|
||||
======================================================================
|
|
@ -1,4 +1,4 @@
|
|||
#include "g_local.h"
|
||||
#include "../header/local.h"
|
||||
|
||||
void PMenu_Open(edict_t *ent, pmenu_t *entries, int cur, int num)
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
#include "g_local.h"
|
||||
#include "../header/local.h"
|
||||
|
||||
|
||||
/*
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "g_local.h"
|
||||
#include "m_player.h"
|
||||
#include "bot.h"
|
||||
#include "../header/local.h"
|
||||
#include "../header/player.h"
|
||||
#include "../header/bot.h"
|
||||
|
||||
|
||||
static edict_t *current_player;
|
|
@ -1,8 +1,8 @@
|
|||
// g_weapon.c
|
||||
|
||||
#include "g_local.h"
|
||||
#include "m_player.h"
|
||||
#include "bot.h"
|
||||
#include "../header/local.h"
|
||||
#include "../header/player.h"
|
||||
#include "../header/bot.h"
|
||||
|
||||
qboolean is_quad;
|
||||
// RAFAEL
|
|
@ -1,4 +1,4 @@
|
|||
#include "q_shared.h"
|
||||
#include "../header/shared.h"
|
||||
|
||||
#define DEG2RAD( a ) ( a * M_PI ) / 180.0F
|
||||
|
Loading…
Reference in a new issue