Merge branch 'master' into cleanup

Conflicts:
	CHANGELOG
	src/g_combat.c
	src/g_func.c
	src/g_items.c
This commit is contained in:
Yamagi Burmeister 2013-01-05 12:34:59 +01:00
commit 6e48d1aa2a
24 changed files with 320 additions and 153 deletions

View file

@ -1,3 +1,11 @@
The Reckoning 1.08 to 1.09
- Port 'The Reckoning' to Mac OS X.
The Reckoning 1.07 to 1.08
- Port 'The Reckoning' to Windows.
- Use randk() instead of rand(), a better PNRG.
- Fix some potential problems found by scan-build.
The Reckoning 1.06 to 1.07 The Reckoning 1.06 to 1.07
- Port the new savegame system from baseq2 - Port the new savegame system from baseq2
- Reorder the files to reflect the new structure of baseq2 - Reorder the files to reflect the new structure of baseq2

100
Makefile
View file

@ -2,7 +2,7 @@
# Makefile for the xatrix game module for Quake II # # Makefile for the xatrix game module for Quake II #
# # # #
# Just type "make" to compile the # # Just type "make" to compile the #
# - The Reckoning Game (game.so) # # - The Reckoning Game (game.so / game.dll) #
# # # #
# Dependencies: # # Dependencies: #
# - None, but you need a Quake II to play. # # - None, but you need a Quake II to play. #
@ -10,28 +10,32 @@
# Yamagi Quake II ist recommended. # # Yamagi Quake II ist recommended. #
# # # #
# Platforms: # # Platforms: #
# - Linux #
# - FreeBSD # # - FreeBSD #
# - Linux #
# - Windows #
# ----------------------------------------------------- # # ----------------------------------------------------- #
# Check the OS type # Detect the OS
ifdef SystemRoot
OSTYPE := Windows
else
OSTYPE := $(shell uname -s) OSTYPE := $(shell uname -s)
endif
# Some plattforms call it "amd64" and some "x86_64" # Detect the architecture
ifeq ($(OSTYPE), Windows)
# At this time only i386 is supported on Windows
ARCH := i386
else
# Some platforms call it "amd64" and some "x86_64"
ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/amd64/x86_64/) ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/amd64/x86_64/)
endif
# Refuse all other plattforms as a firewall against PEBKAC # Refuse all other platforms as a firewall against PEBKAC
# (You'll need some #ifdef for your unsupported plattform!) # (You'll need some #ifdef for your unsupported plattform!)
ifneq ($(ARCH),i386) ifeq ($(findstring $(ARCH), i386 x86_64 sparc64 ia64),)
ifneq ($(ARCH),x86_64)
$(error arch $(ARCH) is currently not supported) $(error arch $(ARCH) is currently not supported)
endif endif
endif
# ----------
# The compiler
CC := gcc
# ---------- # ----------
@ -53,13 +57,22 @@ CC := gcc
# -fPIC for position independend code. # -fPIC for position independend code.
# #
# -MMD to generate header dependencies. # -MMD to generate header dependencies.
ifeq ($(OSTYPE), Darwin)
CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \ CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \
-fPIC -Wall -pipe -g -MMD -Wall -pipe -g -arch i386 -arch x86_64
else
CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \
-Wall -pipe -g -MMD
endif
# ---------- # ----------
# Base LDFLAGS. # Base LDFLAGS.
ifeq ($(OSTYPE), Darwin)
LDFLAGS := -shared -arch i386 -arch x86_64
else
LDFLAGS := -shared LDFLAGS := -shared
endif
# ---------- # ----------
@ -68,23 +81,59 @@ all: xatrix
# ---------- # ----------
# When make is invoked by "make VERBOSE=1" print
# the compiler and linker commands.
ifdef VERBOSE
Q :=
else
Q := @
endif
# ----------
# Phony targets
.PHONY : all clean xatrix
# ----------
# Cleanup # Cleanup
ifeq ($(OSTYPE), Windows)
clean: clean:
@echo "===> CLEAN" @echo "===> CLEAN"
@rm -Rf build release @-rmdir /S /Q release build
else
clean:
@echo "===> CLEAN"
${Q}rm -Rf build release
endif
# ---------- # ----------
# The xatrix game # The xatrix game
ifeq ($(OSTYPE), Windows)
xatrix: xatrix:
@echo '===> Building game.so' @echo "===> Building game.dll"
@mkdir -p release/ ${Q}tools/mkdir.exe -p release
${MAKE} release/game.dll
build/%.o: %.c
@echo "===> CC $<"
${Q}tools/mkdir.exe -p $(@D)
${Q}$(CC) -c $(CFLAGS) -o $@ $<
else
xatrix:
@echo "===> Building game.so"
${Q}mkdir -p release
$(MAKE) release/game.so $(MAKE) release/game.so
build/%.o: %.c build/%.o: %.c
@echo '===> CC $<' @echo "===> CC $<"
@mkdir -p $(@D) ${Q}mkdir -p $(@D)
@$(CC) -c $(CFLAGS) -o $@ $< ${Q}$(CC) -c $(CFLAGS) -o $@ $<
release/game.so : CFLAGS += -fPIC
endif
# ---------- # ----------
@ -140,6 +189,7 @@ XATRIX_OBJS_ = \
src/player/weapon.o \ src/player/weapon.o \
src/savegame/savegame.o \ src/savegame/savegame.o \
src/shared/flash.o \ src/shared/flash.o \
src/shared/rand.o \
src/shared/shared.o src/shared/shared.o
# ---------- # ----------
@ -159,8 +209,14 @@ XATRIX_DEPS= $(XATRIX_OBJS:.o=.d)
# ---------- # ----------
ifeq ($(OSTYPE), Windows)
release/game.dll : $(XATRIX_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(LDFLAGS) -o $@ $(XATRIX_OBJS)
else
release/game.so : $(XATRIX_OBJS) release/game.so : $(XATRIX_OBJS)
@echo '===> LD $@' @echo "===> LD $@"
@$(CC) $(LDFLAGS) -o $@ $(XATRIX_OBJS) ${Q}$(CC) $(LDFLAGS) -o $@ $(XATRIX_OBJS)
endif
# ---------- # ----------

28
README
View file

@ -4,10 +4,36 @@ fixed, this version should run much more stable than the the old
SDK version. It must be used with the "Yamagi Quake II Client". SDK version. It must be used with the "Yamagi Quake II Client".
For more information visit http://www.yamagi.org/quake2. For more information visit http://www.yamagi.org/quake2.
Installation: Installation for FreeBSD, Linux and OpenBSD:
--------------------------------------------
1. Type "make" or "gmake" to compile the game.so. 1. Type "make" or "gmake" to compile the game.so.
2. Create a subdirectory xatrix/ in your quake2 directory. 2. Create a subdirectory xatrix/ in your quake2 directory.
3. Copy pak0.pak and videos/ from the the Reckoning CD to 3. Copy pak0.pak and videos/ from the the Reckoning CD to
the newly created directory xatrix/. the newly created directory xatrix/.
4. Copy release/game.so to xatrix/. 4. Copy release/game.so to xatrix/.
5. Start the game with "./quake2 +set game xatrix" 5. Start the game with "./quake2 +set game xatrix"
Installation for OS X:
----------------------
1. Create a subdirectory xatrix/ in your quake2 directory.
2. Copy pak0.pak and videos/ from the the Reckoning CD to
the newly created directory xatrix/.
3. Copy game.dll from the zip-archive to xatrix/.
4. Start the game with "quake2 +set game xatrix"
If you want to compile 'xatrix' for OS X from source, please take a
look at the "Installation" section of the README of the Yamagi Quake II
client. In the same file the integration into an app-bundle is
explained.
Installation for Windows:
-------------------------
1. Create a subdirectory xatrix\ in your quake2 directory.
2. Copy pak0.pak and videos\ from the the Reckoning CD to
the newly created directory xatrix\.
3. Copy game.dll from the zip-archive to xatrix/.
4. Start the game with "quake2.exe +set game xatrix"
If you want to compile 'xatrix' for Windows from source, please take a
look at the "Installation" section of the README of the Yamagi Quake II
client. There's descripted how to setup the build environment.

View file

@ -16,7 +16,6 @@ UpdateChaseCam(edict_t *ent)
vec3_t forward, right; vec3_t forward, right;
trace_t trace; trace_t trace;
int i; int i;
vec3_t oldgoal;
vec3_t angles; vec3_t angles;
if (!ent) if (!ent)
@ -42,7 +41,6 @@ UpdateChaseCam(edict_t *ent)
targ = ent->client->chase_target; targ = ent->client->chase_target;
VectorCopy(targ->s.origin, ownerv); VectorCopy(targ->s.origin, ownerv);
VectorCopy(ent->s.origin, oldgoal);
ownerv[2] += targ->viewheight; ownerv[2] += targ->viewheight;

View file

@ -155,11 +155,11 @@ Killed(edict_t *targ, edict_t *inflictor, edict_t *attacker,
void void
SpawnDamage(int type, vec3_t origin, vec3_t normal, int damage) SpawnDamage(int type, vec3_t origin, vec3_t normal, int damage)
{ {
gi.WriteByte(svc_temp_entity); gi.WriteByte (svc_temp_entity);
gi.WriteByte(type); gi.WriteByte (type);
gi.WritePosition(origin); gi.WritePosition (origin);
gi.WriteDir(normal); gi.WriteDir (normal);
gi.multicast(origin, MULTICAST_PVS); gi.multicast (origin, MULTICAST_PVS);
} }
/* /*

View file

@ -543,10 +543,7 @@ plat_blocked(edict_t *self, edict_t *other)
if (other) if (other)
{ {
/* Hack for entity without it's origin near the model */ /* Hack for entity without it's origin near the model */
vec3_t save; VectorMA (other->absmin, 0.5, other->size, other->s.origin);
VectorCopy(other->s.origin, save);
VectorMA(other->absmin, 0.5, other->size, other->s.origin);
BecomeExplosion1(other); BecomeExplosion1(other);
} }
@ -1382,6 +1379,9 @@ door_use(edict_t *self, edict_t *other /* unused */, edict_t *activator)
edict_t *ent; edict_t *ent;
if (!self)
return;
if (self->flags & FL_TEAMSLAVE) if (self->flags & FL_TEAMSLAVE)
{ {
return; return;
@ -1579,10 +1579,7 @@ door_blocked(edict_t *self, edict_t *other)
if (other) if (other)
{ {
/* Hack for entitiy without their origin near the model */ /* Hack for entitiy without their origin near the model */
vec3_t save; VectorMA (other->absmin, 0.5, other->size, other->s.origin);
VectorCopy(other->s.origin, save);
VectorMA(other->absmin, 0.5, other->size, other->s.origin);
BecomeExplosion1(other); BecomeExplosion1(other);
} }
@ -2109,10 +2106,7 @@ train_blocked(edict_t *self, edict_t *other)
if (other) if (other)
{ {
/* Hack for entity without an origin near the model */ /* Hack for entity without an origin near the model */
vec3_t save; VectorMA (other->absmin, 0.5, other->size, other->s.origin);
VectorCopy(other->s.origin, save);
VectorMA(other->absmin, 0.5, other->size, other->s.origin);
BecomeExplosion1(other); BecomeExplosion1(other);
} }
@ -2809,10 +2803,7 @@ door_secret_blocked(edict_t *self, edict_t *other)
if (other) if (other)
{ {
/* Hack for entities without their origin near the model */ /* Hack for entities without their origin near the model */
vec3_t save; VectorMA (other->absmin, 0.5, other->size, other->s.origin);
VectorCopy(other->s.origin, save);
VectorMA(other->absmin, 0.5, other->size, other->s.origin);
BecomeExplosion1(other); BecomeExplosion1(other);
} }

View file

@ -141,7 +141,7 @@ DoRespawn(edict_t *ent)
{ {
} }
choice = rand() % count; choice = count ? randk() % count : 0;
for (count = 0, ent = master; count < choice; ent = ent->chain, count++) for (count = 0, ent = master; count < choice; ent = ent->chain, count++)
{ {

View file

@ -120,6 +120,9 @@ GetGameAPI(game_import_t *import)
globals.edict_size = sizeof(edict_t); globals.edict_size = sizeof(edict_t);
/* Initalize the PRNG */
randk_seed();
return &globals; return &globals;
} }

View file

@ -79,12 +79,6 @@ void dabeam_hit (edict_t *self)
vec3_t start; vec3_t start;
vec3_t end; vec3_t end;
trace_t tr; trace_t tr;
int count;
if (self->spawnflags & 0x80000000)
count = 8;
else
count = 4;
ignore = self; ignore = self;
VectorCopy (self->s.origin, start); VectorCopy (self->s.origin, start);

View file

@ -494,7 +494,6 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
{ {
int i, e; int i, e;
edict_t *check, *block; edict_t *check, *block;
vec3_t mins, maxs;
pushed_t *p; pushed_t *p;
vec3_t org, org2, move2, forward, right, up; vec3_t org, org2, move2, forward, right, up;
vec3_t realmins, realmaxs; vec3_t realmins, realmaxs;
@ -512,13 +511,6 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
move[i] = 0.125 * (int)temp; move[i] = 0.125 * (int)temp;
} }
// find the bounding box
for (i=0 ; i<3 ; i++)
{
mins[i] = pusher->absmin[i] + move[i];
maxs[i] = pusher->absmax[i] + move[i];
}
// we need this for pushing things later // we need this for pushing things later
VectorSubtract (vec3_origin, amove, org); VectorSubtract (vec3_origin, amove, org);
AngleVectors (org, forward, right, up); AngleVectors (org, forward, right, up);

View file

@ -396,15 +396,6 @@ speed default is 1000
void use_target_blaster (edict_t *self, edict_t *other, edict_t *activator) void use_target_blaster (edict_t *self, edict_t *other, edict_t *activator)
{ {
int effect;
if (self->spawnflags & 2)
effect = 0;
else if (self->spawnflags & 1)
effect = EF_HYPERBLASTER;
else
effect = EF_BLASTER;
fire_blaster (self, self->s.origin, self->movedir, self->dmg, self->speed, EF_BLASTER, MOD_TARGET_BLASTER); fire_blaster (self, self->s.origin, self->movedir, self->dmg, self->speed, EF_BLASTER, MOD_TARGET_BLASTER);
gi.sound (self, CHAN_VOICE, self->noise_index, 1, ATTN_NORM, 0); gi.sound (self, CHAN_VOICE, self->noise_index, 1, ATTN_NORM, 0);
} }

View file

@ -687,6 +687,9 @@ void fire_rail (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick
int mask; int mask;
qboolean water; qboolean water;
if (!self)
return;
VectorMA (start, 8192, aimdir, end); VectorMA (start, 8192, aimdir, end);
VectorCopy (start, from); VectorCopy (start, from);
ignore = self; ignore = self;
@ -1041,7 +1044,6 @@ void heat_think (edict_t *self)
edict_t *target = NULL; edict_t *target = NULL;
edict_t *aquire = NULL; edict_t *aquire = NULL;
vec3_t vec; vec3_t vec;
vec3_t oldang;
int len; int len;
int oldlen = 0; int oldlen = 0;
@ -1078,11 +1080,8 @@ void heat_think (edict_t *self)
if (aquire != NULL) if (aquire != NULL)
{ {
VectorCopy (self->s.angles, oldang);
VectorSubtract (aquire->s.origin, self->s.origin, vec); VectorSubtract (aquire->s.origin, self->s.origin, vec);
vectoangles (vec, self->s.angles); vectoangles (vec, self->s.angles);
VectorNormalize (vec); VectorNormalize (vec);
VectorCopy (vec, self->movedir); VectorCopy (vec, self->movedir);
VectorScale (vec, 500, self->velocity); VectorScale (vec, 500, self->velocity);

View file

@ -505,7 +505,7 @@ extern edict_t *g_edicts;
#define LLOFS(x) (size_t)&(((level_locals_t *)NULL)->x) #define LLOFS(x) (size_t)&(((level_locals_t *)NULL)->x)
#define CLOFS(x) (size_t)&(((gclient_t *)NULL)->x) #define CLOFS(x) (size_t)&(((gclient_t *)NULL)->x)
#define random() ((rand () & 0x7fff) / ((float)0x7fff)) #define random() ((randk() & 0x7fff) / ((float)0x7fff))
#define crandom() (2.0 * (random() - 0.5)) #define crandom() (2.0 * (random() - 0.5))
extern cvar_t *maxentities; extern cvar_t *maxentities;

View file

@ -35,7 +35,12 @@ typedef enum {false, true} qboolean;
#define MAX_TOKEN_CHARS 128 /* max length of an individual token */ #define MAX_TOKEN_CHARS 128 /* max length of an individual token */
#define MAX_QPATH 64 /* max length of a quake game pathname */ #define MAX_QPATH 64 /* max length of a quake game pathname */
#ifdef _WIN32
#define MAX_OSPATH 256 /* max length of a filesystem pathname (same as MAX_PATH) */
#else
#define MAX_OSPATH 128 /* max length of a filesystem pathname */ #define MAX_OSPATH 128 /* max length of a filesystem pathname */
#endif
/* */ /* */
/* per-level limits */ /* per-level limits */
@ -178,6 +183,8 @@ void Com_sprintf(char *dest, int size, char *fmt, ...);
void Com_PageInMemory(byte *buffer, int size); void Com_PageInMemory(byte *buffer, int size);
char *strlwr ( char *s );
/* ============================================= */ /* ============================================= */
/* portable case insensitive compare */ /* portable case insensitive compare */
@ -209,6 +216,14 @@ void Info_RemoveKey(char *s, char *key);
void Info_SetValueForKey(char *s, char *key, char *value); void Info_SetValueForKey(char *s, char *key, char *value);
qboolean Info_Validate(char *s); qboolean Info_Validate(char *s);
/* ============================================= */
/* Random number generator */
int randk(void);
float frandk(void);
float crandk(void);
void randk_seed(void);
/* /*
* ============================================================== * ==============================================================
* *
@ -221,7 +236,6 @@ extern int curtime; /* time returned by last Sys_Milliseconds */
int Sys_Milliseconds(void); int Sys_Milliseconds(void);
void Sys_Mkdir(char *path); void Sys_Mkdir(char *path);
void Sys_Rmdir(char *path);
char *strlwr(char *s); char *strlwr(char *s);
/* large block stack allocation routines */ /* large block stack allocation routines */

View file

@ -479,7 +479,6 @@ qboolean Boss2_CheckAttack (edict_t *self)
vec3_t temp; vec3_t temp;
float chance; float chance;
trace_t tr; trace_t tr;
qboolean enemy_infront;
int enemy_range; int enemy_range;
float enemy_yaw; float enemy_yaw;
@ -498,7 +497,6 @@ qboolean Boss2_CheckAttack (edict_t *self)
return false; return false;
} }
enemy_infront = infront(self, self->enemy);
enemy_range = range(self, self->enemy); enemy_range = range(self, self->enemy);
VectorSubtract (self->enemy->s.origin, self->s.origin, temp); VectorSubtract (self->enemy->s.origin, self->s.origin, temp);
enemy_yaw = vectoyaw(temp); enemy_yaw = vectoyaw(temp);

View file

@ -511,12 +511,6 @@ void jorg_firebullet (edict_t *self)
void jorg_attack(edict_t *self) void jorg_attack(edict_t *self)
{ {
vec3_t vec;
float range;
VectorSubtract (self->enemy->s.origin, self->s.origin, vec);
range = VectorLength (vec);
if (random() <= 0.75) if (random() <= 0.75)
{ {
gi.sound (self, CHAN_VOICE, sound_attack1, 1, ATTN_NORM,0); gi.sound (self, CHAN_VOICE, sound_attack1, 1, ATTN_NORM,0);
@ -551,7 +545,6 @@ qboolean Jorg_CheckAttack (edict_t *self)
vec3_t temp; vec3_t temp;
float chance; float chance;
trace_t tr; trace_t tr;
qboolean enemy_infront;
int enemy_range; int enemy_range;
float enemy_yaw; float enemy_yaw;
@ -570,7 +563,6 @@ qboolean Jorg_CheckAttack (edict_t *self)
return false; return false;
} }
enemy_infront = infront(self, self->enemy);
enemy_range = range(self, self->enemy); enemy_range = range(self, self->enemy);
VectorSubtract (self->enemy->s.origin, self->s.origin, temp); VectorSubtract (self->enemy->s.origin, self->s.origin, temp);
enemy_yaw = vectoyaw(temp); enemy_yaw = vectoyaw(temp);

View file

@ -588,16 +588,9 @@ void makron_sight(edict_t *self, edict_t *other)
void makron_attack(edict_t *self) void makron_attack(edict_t *self)
{ {
vec3_t vec;
float range;
float r; float r;
r = random(); r = random();
VectorSubtract (self->enemy->s.origin, self->s.origin, vec);
range = VectorLength (vec);
if (r <= 0.3) if (r <= 0.3)
self->monsterinfo.currentmove = &makron_move_attack3; self->monsterinfo.currentmove = &makron_move_attack3;
else if (r <= 0.6) else if (r <= 0.6)
@ -697,7 +690,6 @@ qboolean Makron_CheckAttack (edict_t *self)
vec3_t temp; vec3_t temp;
float chance; float chance;
trace_t tr; trace_t tr;
qboolean enemy_infront;
int enemy_range; int enemy_range;
float enemy_yaw; float enemy_yaw;
@ -716,7 +708,6 @@ qboolean Makron_CheckAttack (edict_t *self)
return false; return false;
} }
enemy_infront = infront(self, self->enemy);
enemy_range = range(self, self->enemy); enemy_range = range(self, self->enemy);
VectorSubtract (self->enemy->s.origin, self->s.origin, temp); VectorSubtract (self->enemy->s.origin, self->s.origin, temp);
enemy_yaw = vectoyaw(temp); enemy_yaw = vectoyaw(temp);

View file

@ -212,7 +212,7 @@ void roam_goal (edict_t *self)
vec3_t end; vec3_t end;
edict_t *ent; edict_t *ent;
vec3_t dang; vec3_t dang;
int len, oldlen, whichi, i; int len, oldlen, i;
vec3_t vec; vec3_t vec;
vec3_t whichvec; vec3_t whichvec;
@ -227,7 +227,6 @@ void roam_goal (edict_t *self)
gi.linkentity (ent); gi.linkentity (ent);
oldlen = 0; oldlen = 0;
whichi = 0;
for (i=0; i<12; i++) for (i=0; i<12; i++)
{ {
@ -1116,8 +1115,6 @@ void fixbot_fire_welder (edict_t *self)
{ {
vec3_t start; vec3_t start;
vec3_t forward, right, up; vec3_t forward, right, up;
vec3_t end;
vec3_t dir;
vec3_t vec; vec3_t vec;
float r; float r;
@ -1132,10 +1129,6 @@ void fixbot_fire_welder (edict_t *self)
AngleVectors (self->s.angles, forward, right, up); AngleVectors (self->s.angles, forward, right, up);
G_ProjectSource (self->s.origin, vec, forward, right, start); G_ProjectSource (self->s.origin, vec, forward, right, start);
VectorCopy (self->enemy->s.origin, end);
VectorSubtract (end, start, dir);
gi.WriteByte (svc_temp_entity); gi.WriteByte (svc_temp_entity);
gi.WriteByte (TE_WELDING_SPARKS); gi.WriteByte (TE_WELDING_SPARKS);
gi.WriteByte (10); gi.WriteByte (10);

View file

@ -160,7 +160,6 @@ void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer)
int sorted[MAX_CLIENTS]; int sorted[MAX_CLIENTS];
int sortedscores[MAX_CLIENTS]; int sortedscores[MAX_CLIENTS];
int score, total; int score, total;
int picnum;
int x, y; int x, y;
gclient_t *cl; gclient_t *cl;
edict_t *cl_ent; edict_t *cl_ent;
@ -203,7 +202,6 @@ void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer)
cl = &game.clients[sorted[i]]; cl = &game.clients[sorted[i]];
cl_ent = g_edicts + 1 + sorted[i]; cl_ent = g_edicts + 1 + sorted[i];
picnum = gi.imageindex ("i_fixme");
x = (i>=6) ? 160 : 0; x = (i>=6) ? 160 : 0;
y = 32 + 32 * (i%6); y = 32 + 32 * (i%6);
@ -367,11 +365,9 @@ G_SetStats
void G_SetStats (edict_t *ent) void G_SetStats (edict_t *ent)
{ {
gitem_t *item; gitem_t *item;
int index, cells; int index, cells = 0;
int power_armor_type; int power_armor_type;
cells = 0;
// //
// health // health
// //

View file

@ -1571,24 +1571,20 @@ void weapon_ionripper_fire (edict_t *ent)
vec3_t offset; vec3_t offset;
vec3_t tempang; vec3_t tempang;
int damage; int damage;
int kick;
if (deathmatch->value) if (deathmatch->value)
{ {
// tone down for deathmatch // tone down for deathmatch
damage = 30; damage = 30;
kick = 40;
} }
else else
{ {
damage = 50; damage = 50;
kick = 60;
} }
if (is_quad) if (is_quad)
{ {
damage *= 4; damage *= 4;
kick *= 4;
} }
VectorCopy (ent->client->v_angle, tempang); VectorCopy (ent->client->v_angle, tempang);

View file

@ -66,8 +66,14 @@
*/ */
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
#define OS "FreeBSD" #define OS "FreeBSD"
#elif defined(__APPLE__)
#define OS "MacOS X"
#elif defined(__OpenBSD__)
#define OS "OpenBSD"
#elif defined(__linux__) #elif defined(__linux__)
#define OS "Linux" #define OS "Linux"
#elif defined(_WIN32)
#define OS "Windows"
#else #else
#define OS "Unknown" #define OS "Unknown"
#endif #endif
@ -76,6 +82,10 @@
#define ARCH "i386" #define ARCH "i386"
#elif defined(__x86_64__) #elif defined(__x86_64__)
#define ARCH "amd64" #define ARCH "amd64"
#elif defined(__ia64__)
#define ARCH "ia64"
#elif defined(__sparc__)
#define ARCH "sparc64"
#else #else
#define ARCH "unknown" #define ARCH "unknown"
#endif #endif

97
src/shared/rand.c Normal file
View file

@ -0,0 +1,97 @@
/*
* KISS PRNG (c) 2011 Shinobu
*
* This file was optained from zuttobenkyou.wordpress.com
* and modified by the Yamagi Quake II developers.
*
* LICENSE: Public domain
*
* =======================================================================
*
* KISS PRNG, as devised by Dr. George Marsaglia
*
* =======================================================================
*/
#include <stdint.h>
#define QSIZE 0x200000
#define CNG (cng = 6906969069ULL * cng + 13579)
#define XS (xs ^= (xs << 13), xs ^= (xs >> 17), xs ^= (xs << 43))
#define KISS (B64MWC() + CNG + XS)
static uint64_t QARY[QSIZE];
static int j;
static uint64_t carry;
static uint64_t xs;
static uint64_t cng;
uint64_t
B64MWC(void)
{
uint64_t t, x;
j = (j + 1) & (QSIZE - 1);
x = QARY[j];
t = (x << 28) + carry;
carry = (x >> 36) - (t < x);
return QARY[j] = t - x;
}
/*
* Generate a pseudorandom
* integer >0.
*/
int
randk(void)
{
int r;
r = (int)KISS;
r = (r < 0) ? (r * -1) : r;
return r;
}
/*
* Generate a pseudorandom
* signed float between
* 0 and 1.
*/
float
frandk(void)
{
return (randk()&32767)* (1.0/32767);
}
/* Generate a pseudorandom
* float between -1 and 1.
*/
float
crandk(void)
{
return (randk()&32767)* (2.0/32767) - 1;
}
/*
* Seeds the PRNG
*/
void
randk_seed(void)
{
uint64_t i;
/* Seed QARY[] with CNG+XS: */
for (i = 0; i < QSIZE; i++)
{
QARY[i] = CNG + XS;
}
/* Run through several rounds
to warm up the state */
for (i = 0; i < 256; i++)
{
randk();
}
}

View file

@ -6,6 +6,8 @@
* ======================================================================= * =======================================================================
*/ */
#include <ctype.h>
#include "../header/shared.h" #include "../header/shared.h"
#define DEG2RAD(a) (a * M_PI) / 180.0F #define DEG2RAD(a) (a * M_PI) / 180.0F
@ -773,8 +775,8 @@ BigShort(short l)
short short
LittleShort(short l) LittleShort(short l)
{return {
_LittleShort(l); return _LittleShort(l);
} }
int int
@ -875,6 +877,7 @@ Swap_Init(void)
_LittleLong = LongNoSwap; _LittleLong = LongNoSwap;
_BigFloat = FloatSwap; _BigFloat = FloatSwap;
_LittleFloat = FloatNoSwap; _LittleFloat = FloatNoSwap;
Com_Printf("Byte ordering: little endian\n\n");
} }
else else
{ {
@ -885,7 +888,11 @@ Swap_Init(void)
_LittleLong = LongSwap; _LittleLong = LongSwap;
_BigFloat = FloatNoSwap; _BigFloat = FloatNoSwap;
_LittleFloat = FloatSwap; _LittleFloat = FloatSwap;
Com_Printf("Byte ordering: big endian\n\n");
} }
if (LittleShort(*(short *)swaptest) != 1)
assert("Error in the endian conversion!");
} }
/* /*
@ -1085,13 +1092,29 @@ Com_sprintf(char *dest, int size, char *fmt, ...)
if ((len >= size) || (len == size)) if ((len >= size) || (len == size))
{ {
Com_Printf("Com_sprintf: overflow\n"); Com_Printf("Com_sprintf: overflow\n");
len = size - 1;
dest = NULL;
return;
} }
bigbuffer[size - 1] = '\0'; bigbuffer[size - 1] = '\0';
strcpy(dest, bigbuffer); strcpy(dest, bigbuffer);
} }
char *
strlwr ( char *s )
{
char *p = s;
while ( *s )
{
*s = tolower( *s );
s++;
}
return ( p );
}
/* /*
* ===================================================================== * =====================================================================
* *
@ -1313,4 +1336,3 @@ Info_SetValueForKey(char *s, char *key, char *value)
*s = 0; *s = 0;
} }

BIN
tools/mkdir.exe Normal file

Binary file not shown.