Revision: 2618
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2618&view=rev
Author:   rorthomas
Date:     2012-05-21 22:56:21 +0000 (Mon, 21 May 2012)
Log Message:
-----------
renamed

Modified Paths:
--------------
    trunk/source/CMakeLists.txt

Added Paths:
-----------
    trunk/source/tdr2js/
    trunk/source/tdr2js/CMakeLists.txt
    trunk/source/tdr2js/main.cpp

Removed Paths:
-------------
    trunk/source/tdr2js/CMakeLists.txt
    trunk/source/tdr2js/main.cpp
    trunk/source/twodreplay/

Modified: trunk/source/CMakeLists.txt
===================================================================
--- trunk/source/CMakeLists.txt 2012-05-21 22:54:48 UTC (rev 2617)
+++ trunk/source/CMakeLists.txt 2012-05-21 22:56:21 UTC (rev 2618)
@@ -14,10 +14,10 @@
   add_subdirectory(configurator)
 ENDIF()
 
-set(ROR_BUILD_TWODREPLAY "TRUE" CACHE BOOL "build the twodreplay")
+set(ROR_BUILD_TWODREPLAY "TRUE" CACHE BOOL "build the tdr2js tool thatcan 
convert 2d replays")
 
 IF(ROR_BUILD_TWODREPLAY)
-  add_subdirectory(twodreplay)
+  add_subdirectory(tdr2js)
 ENDIF()
 
 IF(ROR_BUILD_UPDATER)

Deleted: trunk/source/tdr2js/CMakeLists.txt
===================================================================
--- trunk/source/twodreplay/CMakeLists.txt      2012-05-21 22:42:04 UTC (rev 
2616)
+++ trunk/source/tdr2js/CMakeLists.txt  2012-05-21 22:56:21 UTC (rev 2618)
@@ -1,100 +0,0 @@
-project(RoR_TDR2JS)
-
-#setup libraries
-macro(setup_lib name)
-   if(ROR_USE_${name})
-      include_directories(${${name}_INCLUDE_DIRS})
-      link_directories   (${${name}_LIBRARY_DIRS})
-      add_definitions("-DUSE_${name}")
-      set(optional_libs ${optional_libs} ${${name}_LIBRARIES})
-      #message(STATUS "${name} Enabled:      \tYES")
-      #message(STATUS "${name}_INCLUDE_DIRS: \t${${name}_INCLUDE_DIRS}")
-      #if(${${name}_LIBRARY_DIRS})
-      #   message(STATUS "${name}_LIBRARY_DIRS: \t${${name}_LIBRARY_DIRS}")
-      #endif(${${name}_LIBRARY_DIRS})
-      #message(STATUS "${name}_LIBRARIES:    \t${${name}_LIBRARIES}")
-   else()
-          #message(STATUS "${name} Enabled:      \tNO")
-   endif(ROR_USE_${name})
-endmacro(setup_lib)
-
-if(WIN32)
-       # use precompiled stuff
-       set(wxWidgets_INCLUDE_DIRS 
"${ROR_DEPENDENCIES_DIR}/includes/${ARCH_DIR}/WxWidgets" CACHE PATH "The 
wxWidgets include path to use")
-       set(wxWidgets_LIBRARY_DIRS 
"${ROR_DEPENDENCIES_DIR}/libs/${ARCH_DIR}/WxWidgets/Release" CACHE PATH "The 
wxWidgets lib path to use")
-       set(wxWidgets_LIBRARIES    
"wxbase29u.lib;wxmsw29u_core.lib;wxmsw29u_html.lib;wxbase29u_net.lib;wxmsw29u_adv.lib;wxpng.lib;wxtiff.lib;wxjpeg.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;"
 CACHE STRING "The wxWidgets lib to link against")
-       add_definitions("-D_UNICODE -D_CRT_SECURE_NO_WARNINGS -DUNICODE")
-       include_directories(${wxWidgets_INCLUDE_DIRS})
-       link_directories (${wxWidgets_LIBRARY_DIRS})
-else(WIN32)
-       # find wxwidgets
-       SET(wxWidgets_USE_UNICODE ON)
-       FIND_PACKAGE(wxWidgets REQUIRED COMPONENTS base core html net adv)
-       include( ${wxWidgets_USE_FILE} )
-       #include_directories(${wxWidgets_INCLUDE_DIRS})
-       #add_definitions("-D${wxWidgets_DEFINITIONS}" ${wxWidgets_CXX_FLAGS})
-       #link_directories (${wxWidgets_LIB_DIR})
-endif(WIN32)
-
-IF(WIN32)
-   include_directories(${Boost_INCLUDE_DIRS})
-   link_directories   (${Boost_LIBRARY_DIRS})
-   include_directories(${PThread_INCLUDE_DIRS})
-   link_directories   (${PThread_LIBRARY_DIRS})
-
-   set(OS_LIBS "${PThread_LIBRARIES};dinput8.lib;dxguid.lib")
-   set(OS_SOURCE "icon.rc")
-
-   # disable some annoying VS warnings:
-   # warning C4244: 'initializing' : conversion from 'const float' to 'int', 
possible loss of data
-   # warning C4305: 'initializing' : truncation from 'double' to 'const float'
-   add_definitions("/wd4305 /wd4244")
-
-
-   #now: delay loading for opencl
-   if(ROR_USE_OPENCL)
-      set(CMAKE_EXE_LINKER_FLAGS_DEBUG          
"${CMAKE_EXE_LINKER_FLAGS_DEBUG}          /DELAYLOAD:OpenCL.dll")
-      set(CMAKE_EXE_LINKER_FLAGS_RELEASE        
"${CMAKE_EXE_LINKER_FLAGS_RELEASE}        /DELAYLOAD:OpenCL.dll")
-      set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL     
"${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}     /DELAYLOAD:OpenCL.dll")
-      set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO 
"${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /DELAYLOAD:OpenCL.dll")
-      set(OS_LIBS ${OS_LIBS} Delayimp.lib)
-   endif(ROR_USE_OPENCL)
-   
-   setup_lib(CRASHRPT)
-ELSEIF(UNIX)
-   find_package(PkgConfig)
-   PKG_CHECK_MODULES  (GTK gtk+-2.0 REQUIRED)
-   INCLUDE_DIRECTORIES(${GTK_INCLUDE_DIRS})
-
-   PKG_CHECK_MODULES  (Ogre OGRE REQUIRED)
-   PKG_CHECK_MODULES  (Ois OIS REQUIRED)
-
-   set(OS_LIBS "")
-
-ENDIF(WIN32)
-
-setup_lib(OPENCL)
-setup_lib(OPENAL)
-
-include_directories(${Ogre_INCLUDE_DIRS})
-link_directories   (${Ogre_LIBRARY_DIRS})
-include_directories(${Ois_INCLUDE_DIRS})
-link_directories   (${Ois_LIBRARY_DIRS})
-include_directories(${RoR_SOURCE_DIR}/source/protocol)
-
-add_definitions("-DNOOGRE -D_UNICODE")
-include_directories(../main/)
-include_directories(../main/gameplay/)
-include_directories(../main/physics)
-
-FILE(GLOB sources "*.cpp")
-FILE(GLOB headers "*.h")
-
-IF(WIN32)
-       add_executable(twodreplay WIN32 ${sources} ${headers} ${OS_SOURCE} 
../main/utils/Settings.cpp ../main/utils/errorutils.cpp ../main/utils/utils.cpp)
-       TARGET_LINK_LIBRARIES(twodreplay Version.lib)
-ELSE(WIN32)
-       add_executable(twodreplay ${sources} ${headers} ${OS_SOURCE} 
../main/utils/Settings.cpp ../main/utils/errorutils.cpp ../main/utils/utils.cpp)
-ENDIF(WIN32)
-
-TARGET_LINK_LIBRARIES(twodreplay ${Ogre_LIBRARIES} ${Ois_LIBRARIES} ${OS_LIBS} 
${optional_libs} ${wxWidgets_LIBRARIES})

Copied: trunk/source/tdr2js/CMakeLists.txt (from rev 2617, 
trunk/source/twodreplay/CMakeLists.txt)
===================================================================
--- trunk/source/tdr2js/CMakeLists.txt                          (rev 0)
+++ trunk/source/tdr2js/CMakeLists.txt  2012-05-21 22:56:21 UTC (rev 2618)
@@ -0,0 +1,5 @@
+project(RoR_TDR2JS)
+
+include_directories(${RoR_Main_SOURCE_DIR}/gameplay/)
+
+add_executable(tdr2js main.cpp)

Deleted: trunk/source/tdr2js/main.cpp
===================================================================
--- trunk/source/twodreplay/main.cpp    2012-05-21 22:42:04 UTC (rev 2616)
+++ trunk/source/tdr2js/main.cpp        2012-05-21 22:56:21 UTC (rev 2618)
@@ -1,153 +0,0 @@
-/*
-This source file is part of Rigs of Rods
-Copyright 2005-2012 Pierre-Michel Ricordel
-Copyright 2007-2012 Thomas Fischer
-
-For more information, see http://www.rigsofrods.com/
-
-Rigs of Rods is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License version 3, as
-published by the Free Software Foundation.
-
-Rigs of Rods is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
-*/
-#include "TwoDReplay.h"
-
-#include "BeamData.h"
-
-using namespace Ogre;
-
-const char colors[10][8] = {
-               "#FF4848",
-               "#5757FF",
-               "#1FCB4A",
-               "#BABA21",
-               "#FF800D",
-               "#892EE4",
-               "#1F88A7",
-               "#990099",
-               "#B9264F",
-               "#06DCFB"
-};
-
-int main(int argc, char**argv)
-{
-       if(argc != 2)
-       {
-               printf("usage: %s <file.tdr>\n", argv[0]);
-               return 1;
-       }
-       FILE *file = fopen(argv[1], "r");
-       if(!file)
-       {
-               printf("error opening file: %s\n", argv[1]);
-               return 1;
-       }
-
-       char fnout[1024]="";
-       strncpy(fnout, argv[1], 1024);
-       strcat(fnout, ".js");
-       FILE *fileo = fopen(fnout, "w");
-       if(!fileo)
-       {
-               printf("error opening ouput file: %s\n", fnout);
-               return 1;
-       }
-       fprintf(fileo, "var data = [\n");
-
-       // first: read and compare header
-
-       r2d_file_header_t header;
-       fread(&header, 1, sizeof(header), file);
-
-       if(strncmp(header.fileformat, R2DFILEFORMAT, 8))
-       {
-               printf("unsupported file format: %s\n", header.fileformat);
-               printf("supported fileformat: %s\n", R2DFILEFORMAT);
-               return 1;
-       }
-       printf("loaded file with %d rigs:\n", header.num_rigs);
-
-       int wheel_count[MAX_TRUCKS];
-
-       for(int t=0; t<header.num_rigs; t++)
-       {
-               r2d_file_wheel_setup_t ws;
-               r2d_file_rig_t rig;
-               fread(&rig, 1, sizeof(rig), file);
-               printf(" %d %s / %s / %s / wheels:%d\n", rig.num, rig.name, 
rig.filename, rig.hash, rig.num_wheels);
-               wheel_count[t] = rig.num_wheels;
-               for(int w=0; w < rig.num_wheels; w++)
-               {
-                       fread(&ws, 1, sizeof(ws), file);
-                       printf("  wheel %d : width: %g, radius:%g, type:%d\n", 
w, ws.width, ws.radius, ws.type);
-               }
-       }
-
-       long header_pos = ftell(file);
-       // done parsing header, now to the data
-
-       // read all data
-       int entries = 0;
-       r2d_file_entry_t entry;
-       while(!feof(file))
-       {
-               fread(&entry, 1, sizeof(entry), file);
-               entries++;
-               printf("got entry: rig:%d, time:%gs, frame:%ld, type:%d\n", 
entry.rignum, (float)entry.time_ms/1000.0f, entry.physframe, entry.type);
-               fprintf(fileo, "\t{ ");
-               fprintf(fileo, "type: %d, ", entry.type);
-               fprintf(fileo, "rignum: %d, ", entry.rignum);
-               fprintf(fileo, "time_ms: %ld, ", entry.time_ms);
-               fprintf(fileo, "physframe: %ld, ", entry.physframe);
-               fprintf(fileo, "\n");
-               
-
-               r2d_memory_structure_rig_t st;
-               st.entry = entry;
-
-               if(entry.type == R2DTYPE_FRAME)
-               {
-                       r2d_file_frame_t frame;
-                       fread(&frame, 1, sizeof(frame), file);
-                       fprintf(fileo, "\t\tframe: {");
-                       fprintf(fileo, "brake: %g, ", frame.brake);
-                       fprintf(fileo, "steering: %g, ", frame.steering);
-                       fprintf(fileo, "accel: %g, ", frame.accel);
-                       fprintf(fileo, "clutch: %g, ", frame.clutch);
-                       fprintf(fileo, "gear: %d, ", frame.gear);
-                       fprintf(fileo, "gearMode: %d, ", frame.gearMode);
-                       fprintf(fileo, "pbrake: %d, \n", frame.pbrake);
-                       fprintf(fileo, "\t\t\twheels: { \n");
-
-                       r2d_file_wheel_frame_t wf;
-                       for(int w=0; w < wheel_count[entry.rignum]; w++)
-                       {
-                               fread(&wf, 1, sizeof(wf), file);
-                               fprintf(fileo, "\t\t\t\t%d: { ", w);
-                               fprintf(fileo, "x: %g, ", wf.wheel_pos[0]);
-                               fprintf(fileo, "y: %g, ", wf.wheel_pos[1]);
-                               fprintf(fileo, "z: %g, ", wf.wheel_pos[2]);
-                               fprintf(fileo, "dir: %g, ", wf.wheel_direction);
-                               fprintf(fileo, "slip: %g, ", wf.wheel_slip);
-                               fprintf(fileo, "speed: %g", wf.wheel_speed);
-                               fprintf(fileo, " },\n");
-                       }
-                       fprintf(fileo, "\t\t\t},\n");
-                       fprintf(fileo, "\t\t},\n");
-               }
-               fprintf(fileo, "\t}, \n");
-       }
-       fclose(file);
-       fprintf(fileo, "];\n");
-       fprintf(fileo, "var data_size = %d\n", entries);
-       fclose(fileo);
-       printf("done, saved as file %s\n", fnout);
-       return 0;
-}

Copied: trunk/source/tdr2js/main.cpp (from rev 2617, 
trunk/source/twodreplay/main.cpp)
===================================================================
--- trunk/source/tdr2js/main.cpp                                (rev 0)
+++ trunk/source/tdr2js/main.cpp        2012-05-21 22:56:21 UTC (rev 2618)
@@ -0,0 +1,153 @@
+/*
+This source file is part of Rigs of Rods
+Copyright 2005-2012 Pierre-Michel Ricordel
+Copyright 2007-2012 Thomas Fischer
+
+For more information, see http://www.rigsofrods.com/
+
+Rigs of Rods is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 3, as
+published by the Free Software Foundation.
+
+Rigs of Rods is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Rigs of Rods.  If not, see <http://www.gnu.org/licenses/>.
+*/
+#include "TwoDReplay.h"
+
+//#include "BeamData.h" // we dont want that here for these consts
+
+#define MAX_TRUCKS 64
+
+const char colors[10][8] = {
+               "#FF4848",
+               "#5757FF",
+               "#1FCB4A",
+               "#BABA21",
+               "#FF800D",
+               "#892EE4",
+               "#1F88A7",
+               "#990099",
+               "#B9264F",
+               "#06DCFB"
+};
+
+int main(int argc, char**argv)
+{
+       if(argc != 2)
+       {
+               printf("usage: %s <file.tdr>\n", argv[0]);
+               return 1;
+       }
+       FILE *file = fopen(argv[1], "r");
+       if(!file)
+       {
+               printf("error opening file: %s\n", argv[1]);
+               return 1;
+       }
+
+       char fnout[1024]="";
+       strncpy(fnout, argv[1], 1024);
+       strcat(fnout, ".js");
+       FILE *fileo = fopen(fnout, "w");
+       if(!fileo)
+       {
+               printf("error opening ouput file: %s\n", fnout);
+               return 1;
+       }
+       fprintf(fileo, "var data = [\n");
+
+       // first: read and compare header
+
+       r2d_file_header_t header;
+       fread(&header, 1, sizeof(header), file);
+
+       if(strncmp(header.fileformat, R2DFILEFORMAT, 8))
+       {
+               printf("unsupported file format: %s\n", header.fileformat);
+               printf("supported fileformat: %s\n", R2DFILEFORMAT);
+               return 1;
+       }
+       printf("loaded file with %d rigs:\n", header.num_rigs);
+
+       int wheel_count[MAX_TRUCKS];
+
+       for(int t=0; t<header.num_rigs; t++)
+       {
+               r2d_file_wheel_setup_t ws;
+               r2d_file_rig_t rig;
+               fread(&rig, 1, sizeof(rig), file);
+               printf(" %d %s / %s / %s / wheels:%d\n", rig.num, rig.name, 
rig.filename, rig.hash, rig.num_wheels);
+               wheel_count[t] = rig.num_wheels;
+               for(int w=0; w < rig.num_wheels; w++)
+               {
+                       fread(&ws, 1, sizeof(ws), file);
+                       printf("  wheel %d : width: %g, radius:%g, type:%d\n", 
w, ws.width, ws.radius, ws.type);
+               }
+       }
+
+       long header_pos = ftell(file);
+       // done parsing header, now to the data
+
+       // read all data
+       int entries = 0;
+       r2d_file_entry_t entry;
+       while(!feof(file))
+       {
+               fread(&entry, 1, sizeof(entry), file);
+               entries++;
+               printf("got entry: rig:%d, time:%gs, frame:%ld, type:%d\n", 
entry.rignum, (float)entry.time_ms/1000.0f, entry.physframe, entry.type);
+               fprintf(fileo, "\t{ ");
+               fprintf(fileo, "type: %d, ", entry.type);
+               fprintf(fileo, "rignum: %d, ", entry.rignum);
+               fprintf(fileo, "time_ms: %ld, ", entry.time_ms);
+               fprintf(fileo, "physframe: %ld, ", entry.physframe);
+               fprintf(fileo, "\n");
+               
+
+               r2d_memory_structure_rig_t st;
+               st.entry = entry;
+
+               if(entry.type == R2DTYPE_FRAME)
+               {
+                       r2d_file_frame_t frame;
+                       fread(&frame, 1, sizeof(frame), file);
+                       fprintf(fileo, "\t\tframe: {");
+                       fprintf(fileo, "brake: %g, ", frame.brake);
+                       fprintf(fileo, "steering: %g, ", frame.steering);
+                       fprintf(fileo, "accel: %g, ", frame.accel);
+                       fprintf(fileo, "clutch: %g, ", frame.clutch);
+                       fprintf(fileo, "gear: %d, ", frame.gear);
+                       fprintf(fileo, "gearMode: %d, ", frame.gearMode);
+                       fprintf(fileo, "pbrake: %d, \n", frame.pbrake);
+                       fprintf(fileo, "\t\t\twheels: { \n");
+
+                       r2d_file_wheel_frame_t wf;
+                       for(int w=0; w < wheel_count[entry.rignum]; w++)
+                       {
+                               fread(&wf, 1, sizeof(wf), file);
+                               fprintf(fileo, "\t\t\t\t%d: { ", w);
+                               fprintf(fileo, "x: %g, ", wf.wheel_pos[0]);
+                               fprintf(fileo, "y: %g, ", wf.wheel_pos[1]);
+                               fprintf(fileo, "z: %g, ", wf.wheel_pos[2]);
+                               fprintf(fileo, "dir: %g, ", wf.wheel_direction);
+                               fprintf(fileo, "slip: %g, ", wf.wheel_slip);
+                               fprintf(fileo, "speed: %g", wf.wheel_speed);
+                               fprintf(fileo, " },\n");
+                       }
+                       fprintf(fileo, "\t\t\t},\n");
+                       fprintf(fileo, "\t\t},\n");
+               }
+               fprintf(fileo, "\t}, \n");
+       }
+       fclose(file);
+       fprintf(fileo, "];\n");
+       fprintf(fileo, "var data_size = %d\n", entries);
+       fclose(fileo);
+       printf("done, saved as file %s\n", fnout);
+       return 0;
+}

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to