small tweaks
This commit is contained in:
parent
586008044a
commit
2a42fa475f
9 changed files with 156 additions and 22 deletions
16
Makefile
16
Makefile
|
@ -80,19 +80,22 @@ gfx: imgtool palette
|
||||||
|
|
||||||
# various palette utilities needed
|
# various palette utilities needed
|
||||||
tga2pal:
|
tga2pal:
|
||||||
gcc -o tga2pal Tools/Source/tga2pal.c
|
$(CC) -o tga2pal Tools/Source/tga2pal.c
|
||||||
|
|
||||||
|
wav2loop:
|
||||||
|
$(CC) -o wav2loop Tools/Source/wav2loop.c
|
||||||
|
|
||||||
tga2lmp:
|
tga2lmp:
|
||||||
gcc -o tga2lmp Tools/Source/tga2lmp.c
|
$(CC) -o tga2lmp Tools/Source/tga2lmp.c
|
||||||
|
|
||||||
pal2pal:
|
pal2pal:
|
||||||
gcc -o pal2pal Tools/Source/pal2pal.c
|
$(CC) -o pal2pal Tools/Source/pal2pal.c
|
||||||
|
|
||||||
pal2colormap:
|
pal2colormap:
|
||||||
gcc -o pal2colormap Tools/Source/pal2colormap.c
|
$(CC) -o pal2colormap Tools/Source/pal2colormap.c
|
||||||
|
|
||||||
qfiles:
|
qfiles:
|
||||||
gcc -o qfiles Tools/Source/qfiles.c Tools/Source/cmdlib.c
|
$(CC) -o qfiles Tools/Source/qfiles.c Tools/Source/cmdlib.c
|
||||||
|
|
||||||
palette: pal2colormap pal2pal tga2pal
|
palette: pal2colormap pal2pal tga2pal
|
||||||
if [ ! -d $(GAME)/gfx ];then mkdir $(GAME)/gfx; fi
|
if [ ! -d $(GAME)/gfx ];then mkdir $(GAME)/gfx; fi
|
||||||
|
@ -142,6 +145,9 @@ radiant: update
|
||||||
cd ThirdParty/gtkradiant && scons
|
cd ThirdParty/gtkradiant && scons
|
||||||
Tools/make_launcher.sh ./ThirdParty/gtkradiant/install/ ./radiant.bin radiant
|
Tools/make_launcher.sh ./ThirdParty/gtkradiant/install/ ./radiant.bin radiant
|
||||||
|
|
||||||
|
launcher:
|
||||||
|
Tools/make_launcher.sh "./" "./fteqw -readonly -basedir ./ -netquake -game $(GAME) +exec $(USER).cfg" $(GAME).sh
|
||||||
|
|
||||||
radiant-game: radiant edef
|
radiant-game: radiant edef
|
||||||
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>" > "$(RADIANT_GAME)"
|
echo "<?xml version=\"1.0\" encoding=\"iso-8859-1\" standalone=\"yes\"?>" > "$(RADIANT_GAME)"
|
||||||
echo "<game" >> "$(RADIANT_GAME)"
|
echo "<game" >> "$(RADIANT_GAME)"
|
||||||
|
|
|
@ -77,11 +77,11 @@ void SetQdirFromPath (char *path)
|
||||||
// search for "quake" in path
|
// search for "quake" in path
|
||||||
|
|
||||||
for (c=path ; *c ; c++)
|
for (c=path ; *c ; c++)
|
||||||
if (!Q_strncasecmp (c, "Nuclide-Lite", 12))
|
if (!Q_strncasecmp (c, "NuclideLite", 11))
|
||||||
{
|
{
|
||||||
strncpy (qdir, path, c+13-path);
|
strncpy (qdir, path, c+12-path);
|
||||||
printf ("qdir: %s\n", qdir);
|
printf ("qdir: %s\n", qdir);
|
||||||
c += 13;
|
c += 12;
|
||||||
while (*c)
|
while (*c)
|
||||||
{
|
{
|
||||||
if (*c == '/' || *c == '\\')
|
if (*c == '/' || *c == '\\')
|
||||||
|
@ -95,7 +95,7 @@ void SetQdirFromPath (char *path)
|
||||||
Error ("No gamedir in %s", path);
|
Error ("No gamedir in %s", path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Error ("SeetQdirFromPath: no 'Nuclide' in %s", path);
|
Error ("SeetQdirFromPath: no 'NuclideLite' in %s", path);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *ExpandPath (char *path)
|
char *ExpandPath (char *path)
|
||||||
|
|
128
Tools/Source/wav2loop.c
Normal file
128
Tools/Source/wav2loop.c
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
/* so it's easier to fwrite */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char cuehead[4];
|
||||||
|
int chunk_size;
|
||||||
|
int numcues;
|
||||||
|
int cueid;
|
||||||
|
int cuepos;
|
||||||
|
|
||||||
|
char datahead[4];
|
||||||
|
int chunk_start;
|
||||||
|
int block_start;
|
||||||
|
int sample_offset;
|
||||||
|
} loop_t;
|
||||||
|
|
||||||
|
/* -o enables users to specify at which point in the sample to start */
|
||||||
|
static int sample_offset;
|
||||||
|
|
||||||
|
void process_wav2loop(char *filename)
|
||||||
|
{
|
||||||
|
FILE *fWAV;
|
||||||
|
FILE *fLOOP;
|
||||||
|
size_t szWAV;
|
||||||
|
char *buffer;
|
||||||
|
loop_t loopy;
|
||||||
|
|
||||||
|
fWAV = fopen(filename, "rb");
|
||||||
|
|
||||||
|
if (!fWAV) {
|
||||||
|
fprintf(stderr, "couldn't find %s\n", filename);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get wav file size */
|
||||||
|
fseek(fWAV, 0L, SEEK_END);
|
||||||
|
szWAV = (size_t)ftell(fWAV);
|
||||||
|
fseek(fWAV, 0L, SEEK_SET);
|
||||||
|
|
||||||
|
/* load wav into memory */
|
||||||
|
buffer = (char *)malloc(szWAV);
|
||||||
|
|
||||||
|
if (buffer == NULL) {
|
||||||
|
fprintf(stderr, "error: Memory allocation failed. Exiting.\n");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
fread(buffer, 1, szWAV, fWAV);
|
||||||
|
fclose(fWAV);
|
||||||
|
|
||||||
|
/* this is LAZY, however we're not going to bother writing a full WAV loader LMAO */
|
||||||
|
for (int i = 0; i < (szWAV - 4); i++ ) {
|
||||||
|
if (buffer[i] == 'c')
|
||||||
|
if (buffer[i+1] == 'u')
|
||||||
|
if (buffer[i+2] == 'e')
|
||||||
|
if (buffer[i+3] == ' ') {
|
||||||
|
fprintf(stderr, "wav file %s has cue info already\n", filename);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* this is quite stupid, we're just appending it at the end,
|
||||||
|
we don't even care if there already are other cue marks */
|
||||||
|
fLOOP = fopen(filename, "w+b");
|
||||||
|
fwrite(buffer, 1, szWAV, fLOOP);
|
||||||
|
|
||||||
|
loopy.cuehead[0] = 'c';
|
||||||
|
loopy.cuehead[1] = 'u';
|
||||||
|
loopy.cuehead[2] = 'e';
|
||||||
|
loopy.cuehead[3] = ' ';
|
||||||
|
loopy.chunk_size = 28;
|
||||||
|
loopy.numcues = 1;
|
||||||
|
loopy.cueid = 0;
|
||||||
|
loopy.cuepos = 0;
|
||||||
|
loopy.datahead[0] = 'd';
|
||||||
|
loopy.datahead[1] = 'a';
|
||||||
|
loopy.datahead[2] = 't';
|
||||||
|
loopy.datahead[3] = 'a';
|
||||||
|
loopy.chunk_start = 0;
|
||||||
|
loopy.block_start = 0;
|
||||||
|
loopy.sample_offset = sample_offset;
|
||||||
|
|
||||||
|
/* append our data to the end of the file */
|
||||||
|
fwrite(&loopy, 1, sizeof(loop_t), fLOOP);
|
||||||
|
fclose(fLOOP);
|
||||||
|
|
||||||
|
/* inb4 goto considered harmful */
|
||||||
|
end:
|
||||||
|
free(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int c, ch;
|
||||||
|
|
||||||
|
if (argc <= 1) {
|
||||||
|
fprintf(stderr, "usage: wav2loop [-o offset] file.wav ...\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* by default, we loop at the very start */
|
||||||
|
sample_offset = 0;
|
||||||
|
|
||||||
|
/* process arguments: TODO: add more? probably not */
|
||||||
|
while ((ch = getopt(argc, argv, "o")) != -1) {
|
||||||
|
switch (ch) {
|
||||||
|
case 'o':
|
||||||
|
sample_offset = atoi(argv[optind]);
|
||||||
|
optind++;
|
||||||
|
printf("sample offset: %i\n", sample_offset);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
argc -= optind;
|
||||||
|
argv += optind;
|
||||||
|
|
||||||
|
for (c = 0; c < argc; c++)
|
||||||
|
process_wav2loop(argv[c]);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -14,7 +14,7 @@ build_models()
|
||||||
do
|
do
|
||||||
DIR=$(dirname "$LINE")
|
DIR=$(dirname "$LINE")
|
||||||
cd "$DIR"
|
cd "$DIR"
|
||||||
iqmtool $(basename "$LINE")
|
"$CWD/iqmtool" $(basename "$LINE")
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,5 +10,5 @@ DIR="$1"
|
||||||
COMMAND="$2"
|
COMMAND="$2"
|
||||||
DEST="$3"
|
DEST="$3"
|
||||||
|
|
||||||
printf "#/bin/sh\ncd \"$DIR\"\n$COMMAND\n" > "$DEST"
|
printf "#/bin/sh\ncd \"$DIR\"\n$COMMAND \$*\n" > "$DEST"
|
||||||
chmod +x "$DEST"
|
chmod +x "$DEST"
|
||||||
|
|
|
@ -3,7 +3,7 @@ __weak void Class_Player(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
__weak void Class_Actor(void) {
|
__weak void Class_Actor(void) {
|
||||||
spawnfunc_nsActor();
|
spawnfunc_ncActor();
|
||||||
}
|
}
|
||||||
|
|
||||||
__weak void Class_Rules(void) {
|
__weak void Class_Rules(void) {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
void nsActor::nsActor ( void ) {
|
void ncActor::ncActor ( void ) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsActor::_InternalPostSpawn ( void ) {
|
void ncActor::_InternalPostSpawn ( void ) {
|
||||||
/* monsters are auto-aim by default */
|
/* monsters are auto-aim by default */
|
||||||
SetTakedamage( DAMAGE_AIM );
|
SetTakedamage( DAMAGE_AIM );
|
||||||
SetSolid( SOLID_SLIDEBOX );
|
SetSolid( SOLID_SLIDEBOX );
|
||||||
SetMovetype( MOVETYPE_STEP );
|
SetMovetype( MOVETYPE_STEP );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
class nsActor : ncEntity {
|
class ncActor : ncEntity {
|
||||||
void nsActor( void );
|
void ncActor( void );
|
||||||
|
|
||||||
virtual void _InternalPostSpawn( void );
|
virtual void _InternalPostSpawn( void );
|
||||||
};
|
};
|
||||||
|
|
|
@ -124,7 +124,7 @@ vector ncCamera::GetCameraAngles( void ) {
|
||||||
|
|
||||||
newAngle = ncMath::VecToAngles(newAngle);
|
newAngle = ncMath::VecToAngles(newAngle);
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
newAngle[0] = ncMath::Rint(newAngle[0]);
|
newAngle[0] = ncMath::Rint(newAngle[0]);
|
||||||
newAngle[1] = ncMath::Rint(newAngle[1]);
|
newAngle[1] = ncMath::Rint(newAngle[1]);
|
||||||
newAngle[2] = ncMath::Rint(newAngle[2]);
|
newAngle[2] = ncMath::Rint(newAngle[2]);
|
||||||
|
@ -189,7 +189,7 @@ vector ncCamera::GetCameraOrigin( void ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
newOrigin[0] = ncMath::Rint(newOrigin[0]);
|
newOrigin[0] = ncMath::Rint(newOrigin[0]);
|
||||||
newOrigin[1] = ncMath::Rint(newOrigin[1]);
|
newOrigin[1] = ncMath::Rint(newOrigin[1]);
|
||||||
newOrigin[2] = ncMath::Rint(newOrigin[2]);
|
newOrigin[2] = ncMath::Rint(newOrigin[2]);
|
||||||
|
@ -217,4 +217,4 @@ ncCamera ncCamera::GetLastCamera( void ) {
|
||||||
ncCamera ncCamera::GetVeryNextCamera( void ) {
|
ncCamera ncCamera::GetVeryNextCamera( void ) {
|
||||||
ncCamera nextCamera = GetNextCamera();
|
ncCamera nextCamera = GetNextCamera();
|
||||||
return ncEngine::Find( (ncEntity) world, ::targetname, nextCamera.next);
|
return ncEngine::Find( (ncEntity) world, ::targetname, nextCamera.next);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue