Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ build/
*.lmp
*.png
*.exe
*.config
*.swp
70 changes: 63 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,63 @@
#
# $Log:$
#

OSFLAG:=
ifeq ($(OS),Windows_NT)
RM = del /Q /F
OSFLAG += -D WIN32
ifeq ($(PROCESSOR_ARCHITECTURE),AMD64)
OSFLAG += -D AMD64
endif
ifeq ($(PROCESSOR_ARCHITECTURE),x86)
OSFLAG += -D IA32
endif
else
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
OSFLAG += -D LINUX
endif
ifeq ($(UNAME_S),Darwin)
OSFLAG += -D OSX
endif
UNAME_P := $(shell uname -p)
ifeq ($(UNAME_P),x86_64)
OSFLAG += -D AMD64
endif
ifneq ($(filter %86,$(UNAME_P)),)
OSFLAG += -D IA32
endif
ifneq ($(filter arm%,$(UNAME_P)),)
OSFLAG += -D ARM
endif
endif

CC=gcc # gcc or g++
RAYLIB_PATH=C:/raylib
RAYLIB_LIB=$(RAYLIB_PATH)/MinGW/i686-w64-mingw32/lib
CFLAGS=-g #-g -DNORMALUNIX -DLINUX # -DUSEASM
LDFLAGS=-I$(RAYLIB_PATH)/raylib/src -L$(RAYLIB_PATH)/MinGW/i686-w64-mingw32/lib
LIBS=-lraylib -lopengl32 -lgdi32 -lwinmm


RAYLIB_PATH:=
RAYLIB_INCLUDE:=
RAYLIB_LIB:=
ifeq ($(OS),Windows_NT)
RAYLIB_PATH=C:/raylib
RAYLIB_INCLUDE=$(RAYLIB_PATH)/raylib/src
RAYLIB_LIB=$(RAYLIB_PATH)/MinGW/i686-w64-mingw32/lib
else
ifeq ($(UNAME_S),Darwin)
RAYLIB_PATH=/usr/local/var/homebrew/linked/raylib
RAYLIB_INCLUDE=$(RAYLIB_PATH)/include
RAYLIB_LIB=$(RAYLIB_PATH)/lib
else
$(error unknown raylib path)
endif
endif

CFLAGS=-g $(OSFLAG) # -DNORMALUNIX
LDFLAGS=-I$(RAYLIB_INCLUDE) -L$(RAYLIB_LIB)
LIBS=-lraylib
ifeq ($(OS),Windows_NT)
LIBS += -lopengl32 -lgdi32 -lwinmm
endif

# subdirectory for objects
SRC=src
Expand Down Expand Up @@ -82,7 +133,12 @@ OBJS= \
all: $(O)/doom

clean:
del *.o *.exe /s
ifeq ($(OS),Windows_NT)
-$(RM) $(O)\*.o /s
else
$(rm -f *.o)
$(rm -f $(O)/*.o)
endif

$(O)/doom: $(OBJS) $(O)/i_main.o
$(CC) $(CFLAGS) $(LDFLAGS) $(OBJS) $(O)/i_main.o \
Expand All @@ -93,4 +149,4 @@ $(O)/%.o: $(SRC)/%.c

#############################################################
#
#############################################################
#############################################################
34 changes: 34 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash


wad_file="DOOM.WAD"
expected_md5="c4fe9fd920207691a9f493668e0a2083"
if [[ ! -f "$wad_file" ]];then
wget "https://archive.org/download/The_Ultimate_Doom/The_Ultimate_Doom.zip" 2>/dev/null;
downloaded_zip="The_Ultimate_Doom.zip";
if [[ ! -f "$downloaded_zip" ]];then
echo "Could not find downloaded zip file.";
fi
unzipped_other=$(yes | unzip "$downloaded_zip" 2>/dev/null |grep -i 'inflating:' | cut -d : -f 2 | grep -v "$wad_file");
rm -f "DOOM.EXE";
download_md5=$(md5 -q "$wad_file");
rm -f "$downloaded_zip";
if [[ "$expected_md5" != "$download_md5" ]]; then
rm -f "$wad_file";
echo "Downloaded wad file does not match expected md5 hash";
fi
fi

doom_exe="./build/doom";
if [[ ! -f "$doom_exe" ]];then
yes | rm -f ./build/*.o 2>/dev/null
mkdir -p ./build
make
fi

if [[ ! -f "$doom_exe" ]];then
echo "Could not find doom executable ${doom_exe}.";
else
${doom_exe} -config ./doom.config
fi

10 changes: 5 additions & 5 deletions src/am_map.c
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ void AM_doFollowPlayer(void)
//
void AM_updateLightLev(void)
{
static nexttic = 0;
static int nexttic = 0;
//static int litelevels[] = { 0, 3, 5, 6, 6, 7, 7, 7 };
static int litelevels[] = { 0, 4, 7, 10, 12, 14, 15, 15 };
static int litelevelscnt = 0;
Expand Down Expand Up @@ -856,9 +856,9 @@ AM_clipMline
TOP =8
};

register outcode1 = 0;
register outcode2 = 0;
register outside;
register int outcode1 = 0;
register int outcode2 = 0;
register int outside;

fpoint_t tmp;
int dx;
Expand Down Expand Up @@ -989,7 +989,7 @@ AM_drawFline
register int ay;
register int d;

static fuck = 0;
static int fuck = 0;

// For debugging only
if ( fl->a.x < 0 || fl->a.x >= f_w
Expand Down
10 changes: 7 additions & 3 deletions src/d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static const char rcsid[] = "$Id: d_main.c,v 1.8 1997/02/03 22:45:09 b1 Exp $";
#define FGCOLOR 8
#define R_OK 0

#ifdef NORMALUNIX
#if defined(LINUX) || defined(OSX)
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
Expand All @@ -40,7 +40,11 @@ static const char rcsid[] = "$Id: d_main.c,v 1.8 1997/02/03 22:45:09 b1 Exp $";
#include <fcntl.h>
#endif

#ifdef OSX
#include <sys/uio.h>
#else
#include <io.h>
#endif


#include "doomdef.h"
Expand Down Expand Up @@ -152,7 +156,7 @@ int eventtail;
void D_PostEvent (event_t* ev)
{
events[eventhead] = *ev;
eventhead = (++eventhead)&(MAXEVENTS-1);
eventhead = (1+eventhead)&(MAXEVENTS-1);
}


Expand All @@ -169,7 +173,7 @@ void D_ProcessEvents (void)
&& (W_CheckNumForName("map01")<0) )
return;

for ( ; eventtail != eventhead ; eventtail = (++eventtail)&(MAXEVENTS-1) )
for ( ; eventtail != eventhead ; eventtail = (1+eventtail)&(MAXEVENTS-1) )
{
ev = &events[eventtail];
if (M_Responder (ev))
Expand Down
2 changes: 1 addition & 1 deletion src/d_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ unsigned NetbufferChecksum (void)
c = 0x1234567;

// FIXME -endianess?
#ifdef NORMALUNIX
#if defined(LINUX) || defined(OSX)
return 0; // byte order problems
#endif

Expand Down
11 changes: 10 additions & 1 deletion src/i_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,27 @@ rcsid[] = "$Id: m_bbox.c,v 1.1 1997/02/03 22:45:10 b1 Exp $";


// For some odd reason...
#ifndef ntohl
#define ntohl(x) \
((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
(((unsigned long int)(x) & 0x0000ff00U) << 8) | \
(((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
(((unsigned long int)(x) & 0xff000000U) >> 24)))
#endif

#ifndef ntohs
#define ntohs(x) \
((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
(((unsigned short int)(x) & 0xff00) >> 8))) \
(((unsigned short int)(x) & 0xff00) >> 8)))
#endif

#ifndef htonl
#define htonl(x) ntohl(x)
#endif

#ifndef htons
#define htons(x) ntohs(x)
#endif

void NetSend (void);
boolean NetListen (void);
Expand Down
2 changes: 1 addition & 1 deletion src/p_spec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ int EV_DoDonut(line_t* line)
s2 = getNextSector(s1->lines[0],s1);
for (i = 0;i < s2->linecount;i++)
{
if ((!s2->lines[i]->flags & ML_TWOSIDED) ||
if (!(s2->lines[i]->flags & ML_TWOSIDED) ||
(s2->lines[i]->backsector == s1))
continue;
s3 = s2->lines[i]->backsector;
Expand Down
2 changes: 2 additions & 0 deletions src/tables.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@
#ifdef LINUX
#include <math.h>
#else
#ifndef PI
#define PI 3.141592657
#endif
#endif


#include "m_fixed.h"
Expand Down
22 changes: 16 additions & 6 deletions src/w_wad.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,25 @@ rcsid[] = "$Id: w_wad.c,v 1.5 1997/02/03 16:47:57 b1 Exp $";
#include <fcntl.h>
#include <sys/stat.h>

#ifdef NORMALUNIX
#if defined(LINUX) || defined(OSX)
#include <ctype.h>
#include <sys/types.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>
#include <fcntl.h>
#include <alloca.h>
#include <stdlib.h>

#ifdef LINUX
#include <malloc.h>
#endif

#ifndef O_BINARY
#define O_BINARY 0
#endif

#endif

#include "doomtype.h"
#include "m_swap.h"
#include "i_system.h"
Expand Down Expand Up @@ -67,10 +75,12 @@ void** lumpcache;

#define strcmpi strcasecmp

// void strupr (char* s)
// {
// while (*s) { *s = toupper(*s); s++; }
// }
#ifdef OSX
void strupr (char* s)
{
while (*s) { *s = toupper(*s); s++; }
}
#endif

int file_length (int handle)
{
Expand Down