Index: Daodan/MSVC/Daodan.c
===================================================================
--- Daodan/MSVC/Daodan.c	(revision 569)
+++ Daodan/MSVC/Daodan.c	(revision 572)
@@ -53,7 +53,5 @@
 bool patch_bsl = true;
 bool patch_cheater = true;
-
-// bool patch_newweapon = true;
-
+bool patch_newweapon = true;
 bool opt_usedaodanbsl = true;
 bool opt_border = true;
@@ -189,9 +187,9 @@
 
 	//Test newweap patch
-//	if (patch_newweapon) {
+	if (patch_newweapon) {
 		
 		//Makes it always say "Recieved weapon_name."
 		//Needs check for loc_4DFC66
-		DDrPatch_NOOP( OniExe + 0x000E4DF8,2);
+		//DDrPatch_NOOP( OniExe + 0x000E4DF8,2);
 
 		//Adds Weapon name and ammo meter to pickup autoprompt
@@ -203,5 +201,5 @@
 		//DDrPatch_Int32( 0x0042E3D5, (int)&DDrDSayColors );
 		//DDrPatch_Int32( 0x0042E3DA, (int)&DDrDSayColors );
-//	}
+	}
 	
 	// Disable loading the vtuneapi.dll
@@ -286,4 +284,6 @@
 			else if (!_stricmp(name, "switch"))
 				M3gResolutionSwitch = !_stricmp(inifile_cleanstr(value), "true");
+			//else if (!_stricmp(name, "devmode"))
+				//turn_dev_mode_on = !_stricmp(inifile_cleanstr(value), "true");
 			else
 				DDrStartupMessage("unrecognised option \"%s\"", name);
@@ -344,4 +344,6 @@
 			else if (!_stricmp(name, "cheater"))
 				patch_cheater = !_stricmp(inifile_cleanstr(value), "true");
+			else if (!_stricmp(name, "newweap"))
+				patch_newweapon = !_stricmp(inifile_cleanstr(value), "true");
 			else
 				DDrStartupMessage("unrecognised patch \"%s\"", name);
@@ -465,8 +467,10 @@
 void DDrConfig()
 {
-/*	if (GetFileAttributes("daodan.ini") == INVALID_FILE_ATTRIBUTES)
-	{
+
+	if (GetFileAttributes("daodan.ini") == INVALID_FILE_ATTRIBUTES)
+	{
+		FILE* fp;
 		DDrStartupMessage("daodan.ini doesn't exist, creating");
-		FILE* fp = fopen("daodan.ini", "w");
+		fp = fopen("daodan.ini", "w");
 		if (fp)
 		{
@@ -478,5 +482,5 @@
 	DDrStartupMessage("parsing daodan.ini...");
 	if (!inifile_read("daodan.ini", DDrIniCallback))
-		DDrStartupMessage("error reading daodan.ini, check your syntax!");*/
+		DDrStartupMessage("error reading daodan.ini, check your syntax!");
 	DDrStartupMessage("finished parsing");
 }
@@ -591,7 +595,7 @@
 	if (patch_cheatsenabled)
 		DDrPatch_MakeJump(ONrPersist_GetWonGame, DDrPersist_GetWonGame);
-//#if 0
+
 	// Windowed mode
-//	if (patch_usedaodangl)
+	if (patch_usedaodangl)
 	{
 	DDrPatch_NOOP((char*)0x004032B7, 6);
@@ -603,9 +607,7 @@
 		DDrPatch_MakeJump(gl_platform_initialize, daodangl_platform_initialize);
 	}
-//#endif
 	// Hacked windowed mode (for when daodangl isn't working properly)
-	//if (patch_windowhack)
-
-	//	DDrWindowHack_Install();
+	else if (patch_windowhack)
+		DDrWindowHack_Install();
 	
 	if (patch_daodaninit)
Index: Daodan/MSVC/Daodan_BSL.c
===================================================================
--- Daodan/MSVC/Daodan_BSL.c	(revision 569)
+++ Daodan/MSVC/Daodan_BSL.c	(revision 572)
@@ -5,5 +5,5 @@
 #include <math.h>
 #include "inifile.h"
-
+#include "Flatline.h"
 #include "Daodan_BSL.h"
 #include "Flatline_BSL.h"
@@ -201,5 +201,5 @@
 	ret->type = sl_int32;
 
-	if (numargs >= 2) {
+	if (args[1].value_int32) {
 		*health = args[1].value_int32;
 	}
@@ -265,7 +265,14 @@
 }
 uint16_t ONICALL bsl_location(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret) {
-	int index;
+	int index, i;
 	float* loc;
 	Character* Chr;
+		numargs = 0;
+	for(i = 0; args[i].type < sl_void; i++)
+	{
+		numargs++;
+	}
+
+
 	if (numargs < 2) return 1;
 	if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32);
@@ -273,16 +280,22 @@
 	if (index == -1) index = args[0].value_int32;
 	Chr = ONgGameState->CharacterStorage;
-	
-	if (!strcmp(args[1].value_str32,"X") || !strcmp(args[1].value_str32,"x"))
-	loc = &(Chr[index].Position.X);
-	else if (!strcmp(args[1].value_str32,"Y") || !strcmp(args[1].value_str32,"y"))
-	loc = &(Chr[index].Position.Y);
-	else if (!strcmp(args[1].value_str32,"Z") || !strcmp(args[1].value_str32,"z"))
-	loc = &(Chr[index].Position.Z);
+	if(numargs == 3)
+	{
+		if (!strcmp(args[1].value_str32,"X") || !strcmp(args[1].value_str32,"x"))
+			loc = &(Chr[index].Position.X);
+		else if (!strcmp(args[1].value_str32,"Y") || !strcmp(args[1].value_str32,"y"))
+			loc = &(Chr[index].Position.Y);
+		else if (!strcmp(args[1].value_str32,"Z") || !strcmp(args[1].value_str32,"z"))
+			loc = &(Chr[index].Position.Z);
+	}
 	else if (numargs == 4) {
-		//currently broken. crashes oni.
-		Chr[index].Position.X = args[1].value_float;
-		Chr[index].Position.Y = args[2].value_float;
-		Chr[index].Position.Z = args[3].value_float;
+		ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]);
+		Chr[index].Location.X = args[1].value_float;
+		Chr[index].Location.Y = args[2].value_float;
+		Chr[index].Location.Z = args[3].value_float;
+		if(Active)
+		{
+			Active->PhyContext->Position = Chr[index].Location;
+		}
 		ret->value_float = 1;
 		ret->type = sl_float;
@@ -348,4 +361,5 @@
 	int index;
 	char* name;
+
 	if (numargs == 0) index = 0;
 	else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32);
@@ -381,5 +395,10 @@
 	RGBA color;
 	RGBA shade;
-	
+	int i;
+	numargs = 0;
+	for(i = 0; args[i].type < sl_void; i++)
+	{
+		numargs++;
+	}
 	if(numargs == 0) return 0;
 	if(numargs > 1 ) color.R = (char)args[1].value_int32;
@@ -492,5 +511,5 @@
 	}
 	Active->Input.Current.Actions1 = Active->Input.Current.Actions1 | Input1;
-	Active->Input.Current.Actions2 = Active->Input.Current.Actions1 | Input2;
+	Active->Input.Current.Actions2 = Active->Input.Current.Actions2 | Input2;
 	if( Input1 + Input2 == 0 ) {
 		DDrConsole_PrintF("Func \"%s\", File \"%s\", Line %d: semantic error, \"%s\": No valid keys given.", callinfo->name, callinfo->calllocation, callinfo->linenumber, callinfo->name);
@@ -856,4 +875,5 @@
 
 }
+
 void* TSrTest = 0;
 uint16_t ONICALL new_text(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], int* dontuse1, int* dontuse2, sl_arg* ret)
@@ -861,6 +881,12 @@
 	void* TSFFTahoma;
 	int returnval;
-	TMrInstance_GetDataPtr( 'TSFF', "Tahoma", &TSFFTahoma);
+
+	if(!TSrTest){
+		TMrInstance_GetDataPtr( 'TSFF', "Tahoma", &TSFFTahoma);
 	returnval = TSrContext_New( TSFFTahoma, 7, 1, 1,  0, &TSrTest);
+	}
+	DDrPatch_MakeCall(0x004FBCEA, DDrText_Hook);
+	
+	*dontuse2 = 1;
 	return 0;
 }
@@ -883,5 +909,5 @@
 	SLrScript_Command_Register_ReturnType("d_getindex","Converts a character's name to its index", "ai_name:string", sl_int32, bsl_nametoindex);
 	SLrScript_Command_Register_ReturnType("d_health","Gets or sets a character's health", "[ai_name:string | script_id:int] [newhealth:int]", sl_str32, bsl_health);
-	SLrScript_Command_Register_ReturnType("d_regen","Gets or sets a character's health", "[ai_name:string | script_id:int] [newhealth:int]", sl_str32, bsl_regen);
+	SLrScript_Command_Register_ReturnType("d_regen","Gets or sets a character's regeneration abilities", "[ai_name:string | script_id:int] [newhealth:int]", sl_str32, bsl_regen);
 	SLrScript_Command_Register_ReturnType("d_maxhealth","Gets or sets a character's maximum health", "[ai_name:string | script_id:int] [newmaxhealth:int] [scalehealth:bool]", sl_str32, bsl_maxhealth);
 	SLrScript_Command_Register_ReturnType("d_powerup","Gets or sets a character's powerups", "[ai_name:string | script_id:int] powerup:string", sl_int32, bsl_powerup);
@@ -889,5 +915,5 @@
 	SLrScript_Command_Register_ReturnType("d_holdkey","Makes a character hold a key", "[ai_name:string | script_id:int] frames:int keys:string", sl_int32, bsl_holdkey);
 	SLrScript_Command_Register_ReturnType("d_isheld","Checks if player is holding a key", "[ai_name:string | script_id:int] [keys:string]", sl_int32, bsl_isheld);
-	SLrScript_Command_Register_ReturnType("d_location","Returns the X, Y or Z coord of a character", "ai_name:string | script_id:int xyz:string [newlocation:float]", sl_float, bsl_location);
+	SLrScript_Command_Register_ReturnType("d_location","Returns the X, Y or Z coord of a character", "", sl_float, bsl_location);
 	SLrScript_Command_Register_ReturnType("d_distance","Returns the distance between two characters", "ai_name:string | script_id:int ai_name:string | script_id:int", sl_float, bsl_distance);
 	SLrScript_Command_Register_Void("d_waitforkey","Waits for a keypress from the player", "key:string", bsl_waitforkey);
@@ -900,5 +926,6 @@
 
 	SLrScript_Command_Register_Void("sprintf", "C-style sprintf.", "", bsl_sprintf);
-	SLrScript_Command_Register_ReturnType("st", "prints to console in color", "text:string color1:int color2:int", sl_void, bsl_dprintcolored);
+	SLrScript_Command_Register_ReturnType("st", "prints to console in color", "", sl_void, bsl_dprintcolored);
+	SLrScript_Command_Register_ReturnType("d_dprint", "prints to console in color", "", sl_void, bsl_dprintcolored);
 	
 	//Flatline
Index: Daodan/MSVC/Daodan_Cheater.h
===================================================================
--- Daodan/MSVC/Daodan_Cheater.h	(revision 569)
+++ Daodan/MSVC/Daodan_Cheater.h	(revision 572)
@@ -46,5 +46,5 @@
 
 extern oniCheatCode DDr_CheatTable[];
-
+extern int turn_dev_mode_on;
 uint8_t ONICALL DDrCheater(uint32_t cheat);
 void __stdcall FallingFrames(void* Ebp);
Index: Daodan/MSVC/Daodan_Utility.c
===================================================================
--- Daodan/MSVC/Daodan_Utility.c	(revision 569)
+++ Daodan/MSVC/Daodan_Utility.c	(revision 572)
@@ -88,5 +88,6 @@
 }
 	
-void ONICALL DDrWeapon2Message(int* weapon, void* output_ptr) {
+void ONICALL DDrWeapon2Message(int* weapon, void* output_ptr) 
+{
 	char buffer[128] = {0};
 	char* weapon_string = (char*)(*(weapon + 1)+0x5C);
@@ -107,5 +108,6 @@
 
 
-void ONICALL DDrMake_Weapon_Message(char* weapon_string, char* output_ptr) {
+void ONICALL DDrMake_Weapon_Message(char* weapon_string, char* output_ptr) 
+{
 	char* weapon_msg = NULL;	//The normal "You have recieved X" message.
 	char weapon_name[64] = {'\0'};	//The stripped weapon name
@@ -125,2 +127,19 @@
 	
 }
+	typedef struct
+	{
+		uint16_t x;
+		uint16_t y;
+		
+	} IMtPoint2D;
+		IMtPoint2D Point = {256, 250};
+		extern void* TSrTest;
+void ONICALL DDrText_Hook()
+{
+	if(TSrTest)
+	{
+		TSrContext_DrawText(TSrTest, "FINALLY THIS BLOODY TEXT THING WORKS\n Gotta call it at the right point...", 128, 0, &Point);	
+	}
+COrConsole_StatusLine_Display();
+
+}
Index: Daodan/MSVC/Daodan_Utility.h
===================================================================
--- Daodan/MSVC/Daodan_Utility.h	(revision 569)
+++ Daodan/MSVC/Daodan_Utility.h	(revision 572)
@@ -12,3 +12,4 @@
 void ONICALL DDrMake_Weapon_Message(char* weapon_string, char* output_ptr);
 void ONICALL DDrWeapon2Message(int* weapon, void* output_ptr);
+void ONICALL DDrText_Hook();
 #endif
Index: Daodan/MSVC/Flatline.c
===================================================================
--- Daodan/MSVC/Flatline.c	(revision 569)
+++ Daodan/MSVC/Flatline.c	(revision 572)
@@ -506,5 +506,10 @@
 	return -1;
 }
-
+	typedef struct
+	{
+		uint16_t x;
+		uint16_t y;
+		
+	} IMtPoint2D;
 static flatline_packet cache_input = {0};
 extern void* TSrTest;
@@ -562,6 +567,9 @@
 	if( TSrTest )
 	{
-	OniRectangle TextRect = { 20, 20, 50, 50 };
-		TSrContext_DrawText(TSrTest, "Testing woohoo", 0xFF, 0, &TextRect);
+//		OniRectangle TextRect = { 128, 128, 256, 256 };
+		IMtPoint2D Point = {50, 50};
+		//TSrContext_DrawText(TSrTest, "Testing woohoo", 255, 0, &Point);
+		TSrContext_DrawText(TSrTest, "WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW", 255, 0, &Point);	
+		
 	}
 	if(!(server_started || client_connected)) return ONgGameState;
Index: Daodan/MSVC/Oni_Symbols.c
===================================================================
--- Daodan/MSVC/Oni_Symbols.c	(revision 569)
+++ Daodan/MSVC/Oni_Symbols.c	(revision 572)
@@ -130,5 +130,5 @@
 DefFunc( COrMessage_Print						, 0x004304B0 );
 DefFunc( COrTextArea_Print						, 0x00431340 );
-
+DefFunc( COrConsole_StatusLine_Display			, 0x00431E70 );
 DefFunc( ONiGameState_FindAutoPromptMessage		, 0x004FDBE0 );
 DefFunc( ONiMain								, 0x004d3280 );
Index: Daodan/MSVC/Oni_Symbols.h
===================================================================
--- Daodan/MSVC/Oni_Symbols.h	(revision 569)
+++ Daodan/MSVC/Oni_Symbols.h	(revision 572)
@@ -105,5 +105,5 @@
 
 typedef int ( *_COrMessage_Print)(char* Message, char* Key, void* noidea);
-
+typedef void ( *_COrConsole_StatusLine_Display)();
 typedef int16_t ( *_TMrInstance_GetDataPtr)(int tag, char* name, void* pointer);
 typedef char*	( *_TMrInstance_GetInstanceName)(void* InstancePointer);
@@ -122,5 +122,5 @@
 ExtFunc(SLrGlobalVariable_Register_Float);
 ExtFunc(SLrGlobalVariable_Register_String);
-
+ExtFunc(COrConsole_StatusLine_Display);
 
 extern _UUrMachineTime_High UUrMachineTime_High;
Index: Daodan/MSVC/daodan_gl.c
===================================================================
--- Daodan/MSVC/daodan_gl.c	(revision 569)
+++ Daodan/MSVC/daodan_gl.c	(revision 572)
@@ -5,5 +5,9 @@
 #include "Oni_Persistence.h"
 #include "Daodan_Utility.h"
-
+#include <gl/gl.h>
+#include <gl/glu.h>
+#include "gl/wglext.h"		//WGL extensions
+#include "gl/glext.h"		//GL extensions
+#include "Daodan_Win32.h"
 #include "BFW_Utility.h"
 
@@ -45,7 +49,7 @@
 	{ 1920, 1440, 0, 0 },
 };
-
-short daodan_resdepths[] = { 16, 32 };
-
+//Just going to always use 32 bits for now...
+//short daodan_resdepths[] = { 16, 32 };
+short daodan_resdepths[] = { 32 };
 DEVMODE orig_devmode, cur_devmode, new_devmode;
 
@@ -83,14 +87,14 @@
 {
 	unsigned int vmodes = 0;
-	unsigned int screen_x = orig_devmode.dmPelsWidth;
-	unsigned int screen_y = orig_devmode.dmPelsHeight;
+	unsigned int screen_x = GetSystemMetrics(SM_CXSCREEN);
+	unsigned int screen_y = GetSystemMetrics(SM_CYSCREEN);
 	
 	uint16_t i, j;
 	
 	DDrStartupMessage("listing display modes");
-	
+	/*
 	if (!M3gResolutionSwitch)
 		daodan_resdepths[0] = orig_devmode.dmBitsPerPel;
-	
+	*/
 	for (i = 0; i < builtin_depths; i ++)
 	{
@@ -192,33 +196,4 @@
 	return 1;
 }
-
-void daodan_set_gamma(float gamma)
-{
-	WORD ramp[3][256];
-	int i;
-
-	if (!gl_gamma_ramp_valid)
-		return;
-
-	gamma = (1.0f - gamma) * 1.2f + 0.4f;
-
-	for (i = 0; i < 256; i++) 
-	{
-		int value = (int)(pow(gl_gamma_ramp[i] / 65535.0f, gamma) * 65535.0f);
-
-		if (value < 0)
-			value = 0;
-		else if (value > 65535)
-			value = 65535;
-
-		ramp[0][i] = ramp[1][i] = ramp[2][i] = value;
-	}
-	
-	if (gl_api->wglSetDeviceGammaRamp3DFX)
-		gl_api->wglSetDeviceGammaRamp3DFX(gl_eng->HDC, ramp);
-	else
-		SetDeviceGammaRamp(gl_eng->HDC, ramp);
-}
-
 int ONICALL daodangl_platform_initialize()
 {
@@ -265,8 +240,8 @@
 			gl_gamma_ramp_valid = 1;
 	}
-	
+	/*
 	if (gl_gamma_ramp_valid)
 		daodan_set_gamma(ONrPersist_GetGamma());  
-	else
+	else*/
 		DDrStartupMessage("gamma adjustment not supported");
 	
Index: Daodan/MSVC/daodan_gl.h
===================================================================
--- Daodan/MSVC/daodan_gl.h	(revision 569)
+++ Daodan/MSVC/daodan_gl.h	(revision 572)
@@ -15,4 +15,4 @@
 void daodan_set_gamma(float gamma);
 int ONICALL daodangl_platform_initialize();
-
+ daodan_init_msaa();
 #endif
