Change how GIT revision information is handled

Add Cook to SCAN
Prelim CCharAnimTime
This commit is contained in:
Phillip Stephens 2016-01-04 16:48:10 -08:00
parent 769a20d9dc
commit 106cb940d3
3 changed files with 71 additions and 4 deletions

View File

@ -78,7 +78,7 @@ endif()
unset(GIT_EXECUTABLE CACHE) unset(GIT_EXECUTABLE CACHE)
find_package(Git) find_package(Git)
if(GIT_FOUND) if(GIT_FOUND)
message("git found: ${GIT_EXECUTABLE}") message(STATUS "Found GIT: ${GIT_EXECUTABLE}")
# Get the current working branch # Get the current working branch
execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" OUTPUT_VARIABLE GIT_BRANCH OUTPUT_STRIP_TRAILING_WHITESPACE )
@ -86,6 +86,12 @@ if(GIT_FOUND)
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%h WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%h WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT_HASH_FULL OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse HEAD WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT_HASH_FULL OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%ad WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT_DATE OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%ad WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GIT_COMMIT_DATE OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_SOURCE_DIR}/version.h) message(STATUS "Unable to find GIT, commit information will not be available")
set(GIT_BRANCH "")
set(GIT_COMMIT_HASH "")
set(GIT_COMMIT_HASH_FULL "")
set(GIT_COMMIT_DATE "")
endif() endif()
configure_file(${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_SOURCE_DIR}/version.h)

View File

@ -1,6 +1,7 @@
#ifndef _DNAMP1_SCAN_HPP_ #ifndef _DNAMP1_SCAN_HPP_
#define _DNAMP1_SCAN_HPP_ #define _DNAMP1_SCAN_HPP_
#include <Athena/FileWriter.hpp>
#include "../DNACommon/DNACommon.hpp" #include "../DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp" #include "DNAMP1.hpp"
@ -195,6 +196,17 @@ struct SCAN : BigYAML
return true; return true;
} }
static bool Cook(const HECL::ProjectPath& inPath, const HECL::ProjectPath& outPath)
{
SCAN scan;
FILE* fp = HECL::Fopen(inPath.getAbsolutePath().c_str(), _S("rb"));
scan.fromYAMLFile(fp);
fclose(fp);
Athena::io::FileWriter ws(outPath.getAbsolutePath());
scan.write(ws);
return true;
}
static void Name(const SpecBase& dataSpec, static void Name(const SpecBase& dataSpec,
PAKEntryReadStream& rs, PAKEntryReadStream& rs,
PAKRouter<PAKBridge>& pakRouter, PAKRouter<PAKBridge>& pakRouter,

View File

@ -6,8 +6,57 @@ namespace Retro
class CCharAnimTime class CCharAnimTime
{ {
}; float m_time;
int m_unk; // enum?
public:
CCharAnimTime(float time)
: m_time(time),
m_unk(m_time != 0.0 ? 0 : 2)
{
}
bool EqualsZero()
{
if (m_unk == 1 || m_unk == 2 || m_unk == 3)
return false;
return (m_time == 0.0);
}
bool GreaterThanZero()
{
if (EqualsZero())
return false;
return (m_time != 0.0);
}
#if 0
bool operator>=(const CCharAnimTime& other)
{
if (*this == other)
return true;
return (*this > other);
}
bool operator<=(const CCharAnimTime& other)
{
if (*this == other)
return true;
return (*this < other);
}
void operator*=(const CCharAnimTime& other)
{ *this = *this * other; }
void operator+=(const CCharAnimTime& other)
{ *this = *this + other; }
void operator+(const CCharAnimTime& other)
{
}
#endif
};
} }
#endif // __RETRO_CCHARANIMTIME_HPP__ #endif // __RETRO_CCHARANIMTIME_HPP__