Skip to content

Commit

Permalink
updated to ff22
Browse files Browse the repository at this point in the history
libnspr4.dll is no longer needed
added room.getCollisionA() returns a Int16Array ( flat optimized array )
included build lib ziped up in dependencies/libs/release/js_static.zip - needs to be unziped in that folder for building
  • Loading branch information
bobode committed Sep 15, 2013
1 parent c5ea277 commit b29d1d2
Show file tree
Hide file tree
Showing 75 changed files with 5,680 additions and 4,347 deletions.
2 changes: 1 addition & 1 deletion D2BS.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#define XP_WIN

#define D2BS_VERSION "1.5.1787" //uptodate with d branch 1765 ff 20b
#define D2BS_VERSION "1.5.1789" //uptodate with d branch 1765 ff 20b

#include <windows.h>
#include <vector>
Expand Down
7 changes: 6 additions & 1 deletion D2BS.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
<IgnoreImportLibrary Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</IgnoreImportLibrary>
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">C:\Program Files %28x86%29\boost\boost_1_46_1;$(ProgramFiles)\boost;$(IncludePath);$(SolutionDir)\Engine;$(SolutionDir)\Engine\dependencies\include</IncludePath>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Midl>
Expand Down Expand Up @@ -159,7 +160,7 @@
<Culture>0x0407</Culture>
</ResourceCompile>
<Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;shlwapi.lib;advapi32.lib;dbghelp.lib;Winmm.lib;dependencies\libs\release\js_static.lib;dependencies\libs\release\libnspr4.lib</AdditionalDependencies>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;shlwapi.lib;advapi32.lib;dbghelp.lib;Winmm.lib;dependencies\libs\release\js_static.lib</AdditionalDependencies>
<SuppressStartupBanner>true</SuppressStartupBanner>
<ModuleDefinitionFile>
</ModuleDefinitionFile>
Expand Down Expand Up @@ -320,12 +321,16 @@ XCOPY "$(ProjectDir)resources" "$(OutDir)release-pkg"
<ClCompile Include="Map\Diablo_II\LevelMap.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\bob-18_ff20\Pipe.h" />
<ClInclude Include="..\bob-18_ff20\Socket.h" />
<ClInclude Include="..\bob-18_ff20\Stream.h" />
<ClInclude Include="D2BS.h" />
<ClInclude Include="Constants.h" />
<ClInclude Include="D2Helpers.h" />
<ClInclude Include="D2Ptrs.h" />
<ClInclude Include="D2Skills.h" />
<ClInclude Include="D2Structs.h" />
<ClInclude Include="dependencies\include\jsfriendapi.h" />
<ClInclude Include="JSProfile.h" />
<ClInclude Include="Patch.h" />
<ClInclude Include="D2Intercepts.h" />
Expand Down
12 changes: 12 additions & 0 deletions D2BS.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,18 @@
<ClInclude Include="Profile.h">
<Filter>Spidermonkey Engine\Core\C</Filter>
</ClInclude>
<ClInclude Include="..\bob-18_ff20\Stream.h">
<Filter>Spidermonkey Engine\Core\C</Filter>
</ClInclude>
<ClInclude Include="..\bob-18_ff20\Socket.h">
<Filter>Spidermonkey Engine\Core\API</Filter>
</ClInclude>
<ClInclude Include="..\bob-18_ff20\Pipe.h">
<Filter>Spidermonkey Engine\Core\API</Filter>
</ClInclude>
<ClInclude Include="dependencies\include\jsfriendapi.h">
<Filter>Spidermonkey Engine\Engine Imports</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="dependencies\include\jsproto.tbl">
Expand Down
3 changes: 3 additions & 0 deletions D2Helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ DWORD GetPlayerArea(void)

Level* GetLevel(DWORD dwLevelNo)
{
if (!GameReady())
return nullptr;

AutoCriticalRoom* cRoom = new AutoCriticalRoom;
Level* pLevel = D2CLIENT_GetPlayerUnit()->pAct->pMisc->pLevelFirst;

Expand Down
Binary file modified Debug/D2BS.exe
Binary file not shown.
80 changes: 80 additions & 0 deletions JSRoom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,87 @@ JSAPI_FUNC(room_getPresetUnits)
delete cRoom;
return JS_TRUE;
}
JSAPI_FUNC(room_getCollisionTypeArray)
{
Room2* pRoom2 = (Room2*)JS_GetPrivate(cx, JS_THIS_OBJECT(cx, vp));
if(!pRoom2)
return JS_TRUE;

JSObject* jsobjy = JS_NewInt16Array(cx, (pRoom2->dwSizeX * 5) * (pRoom2->dwSizeY*5));
JS_AddRoot(cx, &jsobjy);
if(!jsobjy)
return JS_TRUE;

bool bAdded = FALSE;
CollMap* pCol = NULL;

AutoCriticalRoom* cRoom = new AutoCriticalRoom;

if(!pRoom2->pRoom1)
{
bAdded = TRUE;
D2COMMON_AddRoomData(D2CLIENT_GetPlayerUnit()->pAct, pRoom2->pLevel->dwLevelNo, pRoom2->dwPosX, pRoom2->dwPosY, D2CLIENT_GetPlayerUnit()->pPath->pRoom1);
}

if(pRoom2->pRoom1)
pCol = pRoom2->pRoom1->Coll;

if(!pCol)
{
JS_RemoveRoot(cx, &jsobjy);
if(bAdded)
D2COMMON_RemoveRoomData(D2CLIENT_GetPlayerUnit()->pAct, pRoom2->pLevel->dwLevelNo, pRoom2->dwPosX, pRoom2->dwPosY, D2CLIENT_GetPlayerUnit()->pPath->pRoom1);
delete cRoom;
return JS_TRUE;
}

int x = pCol->dwPosGameX - pRoom2->pLevel->dwPosX * 5;
int y = pCol->dwPosGameY - pRoom2->pLevel->dwPosY * 5;
int nCx = pCol->dwSizeGameX;
int nCy = pCol->dwSizeGameY;

int nLimitX = x + nCx;
int nLimitY = y + nCy;

int nCurrentArrayY = NULL;

WORD* p = pCol->pMapStart;
JS_BeginRequest(cx);
for(int j = y; j < nLimitY; j++)
{


int nCurrentArrayX = 0;
for (int i = x; i < nLimitX; i++)
{
jsval nNode = INT_TO_JSVAL(*p);

if(!JS_SetElement(cx, jsobjy, nCurrentArrayY * nCx +nCurrentArrayX, &nNode))
{
if(bAdded)
D2COMMON_RemoveRoomData(D2CLIENT_GetPlayerUnit()->pAct, pRoom2->pLevel->dwLevelNo, pRoom2->dwPosX, pRoom2->dwPosY, D2CLIENT_GetPlayerUnit()->pPath->pRoom1);
JS_RemoveRoot(cx, &jsobjy);
JS_EndRequest(cx);
delete cRoom;
return JS_TRUE;
}

nCurrentArrayX++;
p++;
}
nCurrentArrayY++;
}

if(bAdded)
D2COMMON_RemoveRoomData(D2CLIENT_GetPlayerUnit()->pAct, pRoom2->pLevel->dwLevelNo, pRoom2->dwPosX, pRoom2->dwPosY, D2CLIENT_GetPlayerUnit()->pPath->pRoom1);

JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(jsobjy));
JS_RemoveRoot(cx, &jsobjy);
JS_EndRequest(cx);
delete cRoom;
return JS_TRUE;

}
JSAPI_FUNC(room_getCollision)
{
Room2* pRoom2 = (Room2*)JS_GetPrivate(cx, JS_THIS_OBJECT(cx, vp));
Expand Down
2 changes: 2 additions & 0 deletions JSRoom.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ JSAPI_PROP(room_getProperty);
JSAPI_FUNC(room_getNext);
JSAPI_FUNC(room_getPresetUnits);
JSAPI_FUNC(room_getCollision);
JSAPI_FUNC(room_getCollisionTypeArray);
JSAPI_FUNC(room_getNearby);
JSAPI_FUNC(room_getStat);
JSAPI_FUNC(room_getFirst);
Expand Down Expand Up @@ -50,6 +51,7 @@ static JSFunctionSpec room_methods[] = {
JS_FS("reveal", room_reveal, 1, FUNCTION_FLAGS),
JS_FS("getPresetUnits", room_getPresetUnits, 0, FUNCTION_FLAGS),
JS_FS("getCollision", room_getCollision, 0, FUNCTION_FLAGS),
JS_FS("getCollisionA", room_getCollisionTypeArray, 0, FUNCTION_FLAGS),
JS_FS("getNearby", room_getNearby, 0, FUNCTION_FLAGS),
JS_FS("getStat", room_getStat, 0, FUNCTION_FLAGS),
JS_FS("getFirst", room_getFirst, 0, FUNCTION_FLAGS),
Expand Down
4 changes: 2 additions & 2 deletions Map/Diablo_II/ActMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ ActMap::ActMap(const Level* level)
if(!level->pRoom2First)
D2COMMON_InitLevel(const_cast<Level *> (level));

Room2* room = level->pRoom2First;
cachedLevel = room->pLevel;
//Room2* room = level->pRoom2First; //unused
//cachedLevel = room->pLevel;

posX = (level->dwPosX == -1 ? 0 : level->dwPosX * 5);
posY = (level->dwPosY == -1 ? 0 : level->dwPosY * 5);
Expand Down
Binary file added Release/D2BS.exe
Binary file not shown.
3 changes: 1 addition & 2 deletions ScriptEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,7 @@ JSBool contextCallback(JSContext* cx, uintN contextOp)
JSOPTION_TYPE_INFERENCE|
JSOPTION_ION|
JSOPTION_VAROBJFIX|
JSOPTION_ALLOW_XML|
JSOPTION_MOAR_XML|
JSOPTION_ASMJS|
JSOPTION_STRICT);

//JS_SetGCZeal(cx, 2, 1);
Expand Down
Empty file removed dependencies/include/.mkdir.done
Empty file.
Empty file.
58 changes: 0 additions & 58 deletions dependencies/include/ds/BitArray.h

This file was deleted.

Empty file.
5 changes: 1 addition & 4 deletions dependencies/include/js-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
and installed along with jsapi.h. */

/* Define to 1 if SpiderMonkey should support multi-threaded clients. */
#define JS_THREADSAFE 1
/* #undef JS_THREADSAFE */

/* Define to 1 if SpiderMonkey should include ctypes support. */
/* #undef JS_HAS_CTYPES */
Expand Down Expand Up @@ -62,7 +62,4 @@
correct. */
#define JS_METHODJIT 1

/* Define to 1 to enable support for E4X (ECMA-357), 0 to disable it. */
#define JS_HAS_XML_SUPPORT 1

#endif /* js_config_h___ */
Loading

0 comments on commit b29d1d2

Please sign in to comment.