simplified macro config stuff, just have FRED_INTERNAL now
This commit is contained in:
parent
41bb4cf977
commit
ab502e75b4
|
@ -11,8 +11,6 @@
|
|||
|
||||
#include "4coder_custom.h"
|
||||
|
||||
#include "4ed_config.h"
|
||||
|
||||
#define BUFFER_EXPERIMENT_SCALPEL 0
|
||||
|
||||
#include "4ed_meta.h"
|
||||
|
@ -28,8 +26,6 @@
|
|||
#include "4ed_rendering.h"
|
||||
#include "4ed.h"
|
||||
|
||||
#include "4ed_internal.h"
|
||||
|
||||
#include "4tech_table.cpp"
|
||||
|
||||
#define FCPP_LEXER_IMPLEMENTATION
|
||||
|
|
52
4ed_config.h
52
4ed_config.h
|
@ -1,52 +0,0 @@
|
|||
/*
|
||||
* Mr. 4th Dimention - Allen Webster
|
||||
*
|
||||
* 13.11.2014
|
||||
*
|
||||
* Application layer build target
|
||||
*
|
||||
*/
|
||||
|
||||
// TOP
|
||||
|
||||
#ifdef FRED_NOT_PACKAGE
|
||||
|
||||
#define FRED_INTERNAL 1
|
||||
#define FRED_SLOW 1
|
||||
|
||||
#define FRED_PRINT_DEBUG 1
|
||||
#define FRED_PRINT_DEBUG_FILE_LINE 0
|
||||
#define FRED_PROFILING 1
|
||||
#define FRED_PROFILING_OS 0
|
||||
#define FRED_FULL_ERRORS 0
|
||||
|
||||
#else
|
||||
|
||||
#define FRED_SLOW 0
|
||||
#define FRED_INTERNAL 0
|
||||
|
||||
#define FRED_PRINT_DEBUG 0
|
||||
#define FRED_PRINT_DEBUG_FILE_LINE 0
|
||||
#define FRED_PROFILING 0
|
||||
#define FRED_PROFILING_OS 0
|
||||
#define FRED_FULL_ERRORS 0
|
||||
|
||||
#endif
|
||||
|
||||
#if FRED_INTERNAL == 0
|
||||
#undef FRED_PRINT_DEBUG
|
||||
#define FRED_PRINT_DEBUG 0
|
||||
#undef FRED_PROFILING
|
||||
#define FRED_PROFILING 0
|
||||
#undef FRED_PROFILING_OS
|
||||
#define FRED_PROFILING_OS 0
|
||||
#endif
|
||||
|
||||
#if FRED_PRINT_DEBUG == 0
|
||||
#undef FRED_PRINT_DEBUG_FILE_LINE
|
||||
#define FRED_PRINT_DEBUG_FILE_LINE 0
|
||||
#undef FRED_PRINT_DEBUG_FILE_LINE
|
||||
#define FRED_PROFILING_OS 0
|
||||
#endif
|
||||
|
||||
// BOTTOM
|
|
@ -1,24 +0,0 @@
|
|||
/*
|
||||
* Mr. 4th Dimention - Allen Webster
|
||||
*
|
||||
* 16.05.2015
|
||||
*
|
||||
* Fascilities available for development but not intended for shipping.
|
||||
*
|
||||
*/
|
||||
|
||||
// TOP
|
||||
|
||||
#if FRED_INTERNAL == 1
|
||||
|
||||
struct Sys_Bubble : public Bubble{
|
||||
i32 line_number;
|
||||
char *file_name;
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#endif
|
||||
|
||||
// BOTTOM
|
||||
|
47
4ed_math.cpp
47
4ed_math.cpp
|
@ -9,17 +9,16 @@
|
|||
|
||||
// TOP
|
||||
|
||||
#define C_MATH 1
|
||||
|
||||
/*
|
||||
* Scalar operators
|
||||
*/
|
||||
|
||||
#define C_MATH 1
|
||||
|
||||
#define DEG_TO_RAD 0.0174533f
|
||||
|
||||
#if C_MATH
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
inline f32
|
||||
ABS(f32 x){
|
||||
|
@ -27,7 +26,6 @@ ABS(f32 x){
|
|||
return x;
|
||||
}
|
||||
|
||||
#if C_MATH
|
||||
inline f32
|
||||
MOD(f32 x, i32 m){
|
||||
f32 whole, frac;
|
||||
|
@ -428,39 +426,6 @@ rotate(Vec2 v, real32 theta_degrees){
|
|||
return result;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* Coordinates
|
||||
*/
|
||||
|
||||
struct Matrix2{
|
||||
Vec2 x_axis;
|
||||
Vec2 y_axis;
|
||||
};
|
||||
|
||||
internal Matrix2
|
||||
invert(Vec2 x_axis, Vec2 y_axis){
|
||||
Matrix2 result = {};
|
||||
real32 det = 1.f / (x_axis.x*y_axis.y - x_axis.y*y_axis.x);
|
||||
result.x_axis.x = y_axis.y*det;
|
||||
result.y_axis.x = -y_axis.x*det;
|
||||
result.x_axis.y = -x_axis.y*det;
|
||||
result.y_axis.y = x_axis.x*det;
|
||||
return result;
|
||||
}
|
||||
|
||||
internal Matrix2
|
||||
invert(Matrix2 m){
|
||||
Matrix2 result = {};
|
||||
real32 det = 1.f / (m.x_axis.x*m.y_axis.y - m.x_axis.y*m.y_axis.x);
|
||||
result.x_axis.x = m.y_axis.y*det;
|
||||
result.y_axis.x = -m.y_axis.x*det;
|
||||
result.x_axis.y = -m.x_axis.y*det;
|
||||
result.y_axis.y = m.x_axis.x*det;
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Lerps, Clamps, Thresholds, Etc
|
||||
*/
|
||||
|
@ -509,7 +474,7 @@ clamp(f32 a, f32 n, f32 z){
|
|||
*/
|
||||
|
||||
// TODO(allen): Convert colors to Vec4
|
||||
inline internal u32
|
||||
inline u32
|
||||
color_blend(u32 a, real32 t, u32 b){
|
||||
union{
|
||||
u8 byte[4];
|
||||
|
@ -527,7 +492,7 @@ color_blend(u32 a, real32 t, u32 b){
|
|||
return R.comp;
|
||||
}
|
||||
|
||||
internal Vec3
|
||||
inline Vec3
|
||||
unpack_color3(u32 color){
|
||||
Vec3 result;
|
||||
result.r = ((color >> 16) & 0xFF) / 255.f;
|
||||
|
@ -536,7 +501,7 @@ unpack_color3(u32 color){
|
|||
return result;
|
||||
}
|
||||
|
||||
internal Vec4
|
||||
inline Vec4
|
||||
unpack_color4(u32 color){
|
||||
Vec4 result;
|
||||
result.a = ((color >> 24) & 0xFF) / 255.f;
|
||||
|
@ -546,7 +511,7 @@ unpack_color4(u32 color){
|
|||
return result;
|
||||
}
|
||||
|
||||
internal u32
|
||||
inline u32
|
||||
pack_color4(Vec4 color){
|
||||
u32 result =
|
||||
((u8)(color.a * 255) << 24) |
|
||||
|
|
47
4ed_meta.h
47
4ed_meta.h
|
@ -57,57 +57,23 @@ raw_ptr_dif(void *a, void *b) { return (i32)((u8*)a - (u8*)b); }
|
|||
#define S_(X) S(X)
|
||||
#define S__LINE__ S_(__LINE__)
|
||||
|
||||
#if FRED_PRINT_DEBUG == 1
|
||||
internal void
|
||||
_OutDbgStr(u8*);
|
||||
# include <stdio.h>
|
||||
# if FRED_PRINT_DEBUG_FILE_LINE
|
||||
# define FredDbg(con, size, ...) {_OutDbgStr((u8*)("FILE:"__FILE__"LINE:"S__LINE__"\n")); char msg[size]; sprintf(msg, __VA_ARGS__); _OutDbgStr((u8*)msg);}
|
||||
# else
|
||||
# define FredDbg(con, size, ...) {char msg[size]; sprintf(msg, __VA_ARGS__); _OutDbgStr((u8*)msg);}
|
||||
# endif
|
||||
#elif FRED_PRINT_DEBUG == 2
|
||||
# include <stdio.h>
|
||||
# if FRED_PRINT_DEBUG_FILE_LINE
|
||||
# define FredDbg(con, size, ...) {fprintf((con)->log, ("FILE:"__FILE__"LINE:"S__LINE__"\n")); fprintf(__VA_ARGS__);}
|
||||
# else
|
||||
# define FredDbg(con, size, ...) {fprintf((con)->log, __VA_ARGS__);}
|
||||
# endif
|
||||
#else
|
||||
# define FredDbg(con, size, ...)
|
||||
#endif
|
||||
|
||||
#if FRED_INTERNAL && FRED_FULL_ERRORS
|
||||
# include <stdio.h>
|
||||
# define FatalErrorFormat(alt, size, ...) {char msg[size]; sprintf(msg, __VA_ARGS__); FatalError(msg);}
|
||||
#else
|
||||
# define FatalErrorFormat(alt, size, ...) {FatalError(alt);}
|
||||
#endif
|
||||
|
||||
#if FRED_SLOW
|
||||
#if FRED_INTERNAL || FRED_KEEP_ASSERT
|
||||
# define Assert(c) assert(c)
|
||||
#else
|
||||
# define Assert(c)
|
||||
#endif
|
||||
|
||||
#define TentativeAssert(c) Assert(c)
|
||||
#define NotImplemented Assert(!"This is not implemented yet!")
|
||||
|
||||
#define FatalError(message) system_fatal_error((u8*)message)
|
||||
|
||||
#define AllowLocal(name) (void)name
|
||||
#ifndef ArrayCount
|
||||
#define ArrayCount(array) (sizeof(array)/sizeof(array[0]))
|
||||
# define ArrayCount(array) (sizeof(array)/sizeof(array[0]))
|
||||
#endif
|
||||
#define OffsetOfStruct(S,c) ((i64)(& ((S*)0)->c ))
|
||||
#define OffsetOfPtr(s,c) ((i64)((char*)(&(s)->c) - (char*)(s)))
|
||||
|
||||
#define Swap(T,a,b) do{ T t = a; a = b; b = t; } while(0)
|
||||
|
||||
#ifndef literal
|
||||
#define literal(s) s, (sizeof(s)-1)
|
||||
#endif
|
||||
|
||||
#define Min(a,b) (((a)<(b))?(a):(b))
|
||||
#define Max(a,b) (((a)>(b))?(a):(b))
|
||||
|
||||
|
@ -184,15 +150,6 @@ LargeRoundUp(i32 x, i32 granularity){
|
|||
#define Bit_30 (1 << 30)
|
||||
#define Bit_31 (1 << 31)
|
||||
|
||||
#define Byte_0 (0xFFU)
|
||||
#define Byte_1 (0xFFU << 8)
|
||||
#define Byte_2 (0xFFU << 16)
|
||||
#define Byte_3 (0xFFU << 24)
|
||||
#define Byte_4 (0xFFU << 32)
|
||||
#define Byte_5 (0xFFU << 40)
|
||||
#define Byte_6 (0xFFU << 48)
|
||||
#define Byte_7 (0xFFU << 56)
|
||||
|
||||
#define bytes(n) (n)
|
||||
#define Kbytes(n) ((n) << 10)
|
||||
#define Mbytes(n) ((n) << 20)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
@echo off
|
||||
|
||||
REM "build_exp.bat" /Zi
|
||||
"build_all.bat" /DFRED_SUPER /DFRED_NOT_PACKAGE /Zi
|
||||
"build_all.bat" /DFRED_SUPER /DFRED_INTERNAL /Zi
|
||||
REM "build_all.bat" /O2 /Zi
|
||||
|
|
|
@ -8,7 +8,7 @@ pushd W:\4ed\code
|
|||
|
||||
..\meta\readmegen
|
||||
|
||||
call "build_all.bat" /O2
|
||||
call "build_all.bat" /O2 /DFRED_KEEP_ASSERT
|
||||
copy ..\build\4ed.exe ..\current_dist\4coder\*
|
||||
copy ..\build\4ed.pdb ..\current_dist\4coder\*
|
||||
copy ..\build\4ed_app.dll ..\current_dist\4coder\*
|
||||
|
@ -20,7 +20,7 @@ del ..\current_dist\SUPERREADME.txt
|
|||
del ..\current_dist\4coder\basic.cpp
|
||||
del ..\current_dist\4coder\.4coder_settings
|
||||
|
||||
call "build_all.bat" /O2 /DFRED_SUPER
|
||||
call "build_all.bat" /O2 /DFRED_SUPER /DFRED_KEEP_ASSERT
|
||||
copy ..\build\4ed.exe ..\current_dist_super\4coder\*
|
||||
copy ..\build\4ed.pdb ..\current_dist_super\4coder\*
|
||||
copy ..\build\4ed_app.dll ..\current_dist_super\4coder\*
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#undef exec_command_keep_stack
|
||||
#undef clear_parameters
|
||||
|
||||
#include "4ed_config.h"
|
||||
|
||||
#include "4ed_meta.h"
|
||||
|
||||
#define FCPP_FORBID_MALLOC
|
||||
|
@ -27,8 +25,6 @@
|
|||
#include "4ed_mem.cpp"
|
||||
#include "4ed_math.cpp"
|
||||
|
||||
#include "4ed_dll_reader.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "4ed_system.h"
|
||||
|
@ -38,10 +34,17 @@
|
|||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
|
||||
#include "4ed_dll_reader.cpp"
|
||||
#include "4ed_internal.h"
|
||||
#include "system_shared.h"
|
||||
|
||||
#if FRED_INTERNAL
|
||||
|
||||
struct Sys_Bubble : public Bubble{
|
||||
i32 line_number;
|
||||
char *file_name;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#define FPS 60
|
||||
#define frame_useconds (1000000 / FPS)
|
||||
|
||||
|
@ -70,6 +73,11 @@ struct Thread_Group{
|
|||
|
||||
#define UseWinDll 1
|
||||
|
||||
#if UseWinDll == 0
|
||||
#include "4ed_dll_reader.h"
|
||||
#include "4ed_dll_reader.cpp"
|
||||
#endif
|
||||
|
||||
struct Control_Keys{
|
||||
b8 l_ctrl;
|
||||
b8 r_ctrl;
|
||||
|
@ -1166,7 +1174,7 @@ Win32LoadSystemCode(){
|
|||
win32vars.system->acquire_lock = system_acquire_lock;
|
||||
win32vars.system->release_lock = system_release_lock;
|
||||
|
||||
#ifdef FRED_NOT_PACKAGE
|
||||
#ifdef FRED_INTERNAL
|
||||
win32vars.system->internal_sentinel = INTERNAL_system_sentinel;
|
||||
win32vars.system->internal_get_thread_states = INTERNAL_get_thread_states;
|
||||
win32vars.system->internal_debug_message = INTERNAL_system_debug_message;
|
||||
|
@ -1790,11 +1798,6 @@ UpdateLoop(LPVOID param){
|
|||
return(0);
|
||||
}
|
||||
|
||||
// TODO(allen): What is this doing here?
|
||||
#ifndef FRED_NOT_PACKAGE
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
|
||||
#define GL_DEBUG_OUTPUT 0x92E0
|
||||
|
||||
|
@ -1923,7 +1926,7 @@ int main(int argc, char **argv){
|
|||
|
||||
#ifdef FRED_SUPER
|
||||
char *custom_file_default = "4coder_custom.dll";
|
||||
char *custom_file;
|
||||
char *custom_file = 0;
|
||||
if (win32vars.settings.custom_dll) custom_file = win32vars.settings.custom_dll;
|
||||
else custom_file = custom_file_default;
|
||||
|
||||
|
@ -1940,7 +1943,7 @@ int main(int argc, char **argv){
|
|||
|
||||
if (win32vars.custom_api.get_alpha_4coder_version == 0 ||
|
||||
win32vars.custom_api.get_alpha_4coder_version(MAJOR, MINOR, PATCH) == 0){
|
||||
printf("Error: application and custom version numbers don't match");
|
||||
OutputDebugStringA("Error: application and custom version numbers don't match");
|
||||
return 22;
|
||||
}
|
||||
win32vars.custom_api.get_bindings = (Get_Binding_Data_Function*)
|
||||
|
|
Loading…
Reference in New Issue