Index: Daodan/src/Bink.h
===================================================================
--- Daodan/src/Bink.h	(revision 450)
+++ Daodan/src/Bink.h	(revision 450)
@@ -0,0 +1,66 @@
+//for IDirectSound we need
+//#include <dsound.h>
+//http://ccrma.stanford.edu/software/stk/Misc/dsound.h
+
+typedef struct {
+	uint32_t Width;
+	uint32_t Height;
+	uint32_t FrameCount;
+	uint32_t CurrentFrame;
+	uint32_t LastFrame;
+	uint32_t FPS_Multiplier;
+	uint32_t FPS_Divisor;
+	uint32_t Unknown1;
+	uint32_t Flags;
+	uint32_t Unknown2[65];
+	uint32_t CurrentPlane;
+	void*	 Plane0_Ptr;
+	void*	 Plane1_Ptr;
+	uint32_t Unknown3[2];
+	uint32_t YPlane_Width;
+	uint32_t UnVPlane_Width;
+	uint32_t UnVPlane_Height;
+} BinkStruct;
+
+//_stdcall
+	//opens the bink file
+	BinkStruct CALLBACK *BinkOpen(HANDLE BinkFile, uint32_t Flags);
+	
+	//SoundFunction: This appears to be the function that will be invoked in order to playback the audio. 
+	//MPC passes in BinkOpenDirectSound as the parameter. BinkOpenDirectSound must meet the qualifications to be a SOUND_FUNC 
+	//(contrived for this description).
+	//I renamed SOUND_FUNC to void*
+	int CALLBACK BinkSetSoundSystem(void* SoundFunction, IDirectSound *pDS);
+	
+	//changes the frame the video is on...we dont need it.
+	void CALLBACK BinkGoto(BinkStruct *Bink, uint32_t FrameNumber, uint32_t unknown);
+	
+	//processes the next frame in the Bink file.
+	int CALLBACK BinkDoFrame(BinkStruct *Bink);
+
+	//advance the playback engine to the next frame
+	void CALLBACK BinkNextFrame(BinkStruct *Bink);
+
+	//gracefully closes a Bink file and releases any allocated resources.
+	void CALLBACK BinkClose(BinkStruct *Bink);
+
+/*
+bytes 0-3      video width
+bytes 4-7      video height
+bytes 8-11     frame count
+bytes 12-15    current frame
+bytes 16-19    last frame
+bytes 20-23    frames/second multiplier
+bytes 24-27    frames/second divisor
+bytes 28-31    unknown
+bytes 32-35    flags
+bytes 36-295   unknown
+bytes 296-299  current plane
+bytes 300-303  pointer to plane 0
+bytes 304-307  pointer to plane 1
+bytes 308-315  unknown
+bytes 316-319  Y plane width
+bytes 320-323  Y plane height
+bytes 324-327  U&V plane width
+bytes 328-331  U&V plane height
+*/
Index: Daodan/src/Daodan_BSL.c
===================================================================
--- Daodan/src/Daodan_BSL.c	(revision 449)
+++ Daodan/src/Daodan_BSL.c	(revision 450)
@@ -117,34 +117,60 @@
 uint16_t ONICALL bsl_powerup(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret)
 {
-	char powerup_list[7][16] = {"ammo", "cell", "hypo", "shield", "invis" , "lsi", "bossshield"};
-	int powerup_offset[7] = {    0xE,    0x12,   0x10,   0x24,     0x26,     0x20,  -1};
-	char powerup_type[16] = "\0";
 	int index;
 	if (numargs < 2 || args[1].type != sl_str32) return 1;
 	else if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32);
 	else index = args[0].value_int32;
-	int i;
-	
-	for(i = 0; i < 6; i++) 
-	{
-		if(!strcmp(args[1].value_str32,powerup_list[i])) 
-		{
-			sprintf(powerup_type,"%s",powerup_list[i]);
-				break;
+	void* returnval;
+	bool is_lsi = 0;
+	Character* Chr = ONgGameState + 0x1260;
+	if(!strcmp(args[1].value_str32,"ammo")) 
+	{
+		returnval = &(Chr[index].Inventory_.AmmoUsed);
+	}
+	else if(!strcmp(args[1].value_str32,"hypo")) 
+	{
+		returnval = &(Chr[index].Inventory_.HypoUsed);
+	}
+	else if(!strcmp(args[1].value_str32,"cells")) 
+	{
+		returnval = &(Chr[index].Inventory_.CellsUsed);
+	}
+	else if(!strcmp(args[1].value_str32,"invis")) 
+	{
+		returnval = &(Chr[index].Inventory_.CloakUsed);
+	}
+	else if(!strcmp(args[1].value_str32,"shield")) 
+	{
+		returnval = &(Chr[index].Inventory_.ShieldUsed);
+	}
+	else if(!strcmp(args[1].value_str32,"lsi")) 
+	{
+		returnval = &(Chr[index].Inventory_.hasLSI);
+		is_lsi = 1;
+	}
+	else if(!strcmp(args[1].value_str32,"bossshield")) 
+	{
+		ret->value_int32 = Chr[index].Flags & char_bossshield;
+		ret->type = sl_int32;
+		if (numargs >=3) {
+			if (Chr[index].Flags & char_bossshield) Chr[index].Flags = Chr[index].Flags & ~char_bossshield;
+			else Chr[index].Flags = Chr[index].Flags | char_bossshield;
 		}
-	}
-	
+		return 0;
+	}
+	else return 1;
 	//todo, add setting
 	
-	if (powerup_type[0] == 0) return 1;
-	Character* Chr = ONgGameState + 0x1260;
-	void* returnval = &(Chr[index]) + 0x194 + powerup_offset[i];
-	//*returnval = (int)Inv 
-	if (numargs >= 2) 
-	{
-		//*health = args[1].value_int32;
-	}
-	ret->value_int32 = (int)*(uint16_t*)returnval;
-	ret->type = sl_int32;
+	if(is_lsi) ret->value_int32 = (int)*(bool*)returnval;
+	else	ret->value_int32 = *(int*)returnval;
+	ret->type = sl_int32;
+
+	if (numargs >= 3) 
+	{
+		if(is_lsi) *(bool*)returnval = args[2].value_int32;
+		else *(int*)returnval = args[2].value_int32;
+	}
+	
+	
 	return 0;
 }
@@ -195,15 +221,16 @@
 	//broken...not only does it sometimes blam, but it returns a string when i want an int so i can study it :<
 	int index;
-	if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32);
-	else index = args[0].value_int32;
-	
-
-	if(ONrGetActiveCharacter(ONgGameState + 0x1260 + index * 0x16A0)) return 1;
-
-	int attacker= (int)(ONrGetActiveCharacter(ONgGameState + 0x1260 + index * 0x16A0) + 0x120);
-	ret->type = sl_int32;
-	ret->value_int32 = attacker;
-	return 0;
-}
+	if (numargs == 0) index = 0;
+	else	if (args[0].type == sl_str32) index = DDrGetCharacterIndexFromName(args[0].value_str32);
+	else index = args[0].value_int32;
+	
+	Character* Chr = ONgGameState + 0x1260;
+	ActiveCharacter* Active = (ActiveCharacter*)ONrGetActiveCharacter(&Chr[index]);
+	if ((int)Active == 0) return 1;
+	ret->value_int32 = Active->LastDamageSourceCharacter;
+	ret->type = sl_int32;
+	return 0;
+}
+
 
 
@@ -272,4 +299,11 @@
 	return 0;
 }
+
+uint16_t ONICALL bsl_getactiveoffset(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret)
+{
+	DDrConsole_PrintF("Character: 0x%x",(int)ONgGameState + 0x1260);
+	DDrConsole_PrintF("ActiveChar: 0x%x",(int)ONrGetActiveCharacter((void*)((int)ONgGameState + 0x1260)));
+	return 0;
+}
 /*
 uint16_t ONICALL bsl_sprintf(sl_callinfo* callinfo, uint32_t numargs, sl_arg args[], void* dontuse1, void* dontuse2, sl_arg* ret)
@@ -371,12 +405,18 @@
 	SLrScript_Command_Register_ReturnType("d_powerup","Gets or sets a character's powerups", "ai_name:str|script_id:int powerup:str", sl_int32, bsl_powerup);
 	//broken. sometimes crashes, and sometimes returns a string... : /
-	SLrScript_Command_Register_ReturnType("d_getattacker","Gets the last person to hurt a character", "[ai_name:string | script_id:int]", sl_int32, bsl_chrname);
-	
+	SLrScript_Command_Register_ReturnType("d_getattacker","Gets the last person to hurt a character", "[ai_name:string | script_id:int]", sl_int32, bsl_getattacker);
+	
+	SLrScript_Command_Register_ReturnType("d_active","Gets the last person to hurt a character", "[ai_name:string | script_id:int]", sl_int32, bsl_getactiveoffset);
+
 	SLrScript_Command_Register_ReturnType("sprintf", "C-style sprintf.", "format:string arg1 arg2 ...", sl_str32, bsl_sprintf);
 	SLrScript_Command_Register_ReturnType("dprintcolor", "prints to console in color", "text:string [color: r b g] [color: r b g]", sl_void, bsl_dprintcolored);
-}
-
+
+
+
+	SLrScript_Command_Register_ReturnType("d_dprint", "prints to console in color", "text:string [color: r b g] [color: r b g]", sl_void, bsl_dprintcolored);
+}
 void SLrDaodan_Patch()
 {
 	DDrPatch_Int32(OniExe + 0x000f3755, (int)cinematic_start_patch);
 }
+
