blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 5
146
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
7
| license_type
stringclasses 2
values | repo_name
stringlengths 6
79
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 4
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.07k
426M
⌀ | star_events_count
int64 0
27
| fork_events_count
int64 0
12
| gha_license_id
stringclasses 3
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 6
values | src_encoding
stringclasses 26
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 1
class | length_bytes
int64 20
6.28M
| extension
stringclasses 20
values | content
stringlengths 20
6.28M
| authors
listlengths 1
16
| author_lines
listlengths 1
16
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4da9782727fde9f85cad95604e645a1eeeb83082 | 84ca111e2739d866aac5f779824afd1f0bcf2842 | /UpdateManager.h | 631820f69a1b2e57b2452b5e2b7670bf35361b7a | []
| no_license | radtek/photoupload | 0193989c016d35de774315acc562598ddb1ccf40 | 0291fd9fbed728aa07e1bebb578da58906fa0b8e | refs/heads/master | 2020-09-27T13:13:47.706353 | 2009-09-24T22:20:11 | 2009-09-24T22:20:11 | 226,525,120 | 1 | 0 | null | 2019-12-07T14:15:57 | 2019-12-07T14:15:56 | null | UTF-8 | C++ | false | false | 263 | h | #pragma once
class UpdateManager
{
public:
UpdateManager(void);
virtual ~UpdateManager(void);
public:
static const CString GetVersionsQueryString();
HRESULT StartUpdate(/*GUID *newClsId = 0*/);
private:
static UINT UpdateProc(LPVOID);
};
| [
"[email protected]"
]
| [
[
[
1,
16
]
]
]
|
a3f339f86c252753492a71e2b6369215a65215ea | 03f06dde16b4b08989eefa144ebc2c7cc21e95ad | /tags/0.3/WinProf/FunctionTreeView.h | 1e51718e773843517c518e2f5204801bafaa7cb8 | []
| no_license | BackupTheBerlios/winprof-svn | c3d557c72d7bc0306cb6bd7fd5ac189e5c277251 | 21ab1356cf6d16723f688734c995c7743bbde852 | refs/heads/master | 2021-01-25T05:35:44.550759 | 2005-06-23T11:51:27 | 2005-06-23T11:51:27 | 40,824,500 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,179 | h | // FunctionTreeView.h : interface of the CFunctionTreeView class
//
#pragma once
#include <hash_map>
#include "SymbolManager.h"
class CWinProfDoc;
class CFunctionTreeView : public CTreeView
{
protected: // create from serialization only
CFunctionTreeView();
DECLARE_DYNCREATE(CFunctionTreeView)
// Attributes
public:
CWinProfDoc* GetDocument();
// Operations
public:
// Overrides
public:
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // called first time after construct
public:
void FillTheTree();
// Implementation
public:
virtual ~CFunctionTreeView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
private:
// Generated message map functions
protected:
DECLARE_MESSAGE_MAP()
protected:
public:
afx_msg void OnTvnSelchanged(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnTvnDeleteitem(NMHDR *pNMHDR, LRESULT *pResult);
};
#ifndef _DEBUG // debug version in FunctionTreeView.cpp
inline CWinProfDoc* CFunctionTreeView::GetDocument()
{ return reinterpret_cast<CWinProfDoc*>(m_pDocument); }
#endif
| [
"landau@f5a2dbeb-61f3-0310-bb71-ba092b21bc01"
]
| [
[
[
1,
55
]
]
]
|
6c98f7c6f0a314350cbbf8b1bffc43a693c2ddff | a2904986c09bd07e8c89359632e849534970c1be | /topcoder/ShorterSuperSum.cpp | 674a2218191f0be36b9fd431a7081003b3f0cb86 | []
| no_license | naturalself/topcoder_srms | 20bf84ac1fd959e9fbbf8b82a93113c858bf6134 | 7b42d11ac2cc1fe5933c5bc5bc97ee61b6ec55e5 | refs/heads/master | 2021-01-22T04:36:40.592620 | 2010-11-29T17:30:40 | 2010-11-29T17:30:40 | 444,669 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,236 | cpp | // BEGIN CUT HERE
// END CUT HERE
#line 5 "ShorterSuperSum.cpp"
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
#define forv(i, v) for (int i = 0; i < (int)(v.size()); ++i)
#define fors(i, s) for (int i = 0; i < (int)(s.length()); ++i)
#define all(a) a.begin(), a.end()
class ShorterSuperSum {
public:
int calculate(int k, int n) {
int ret=0;
if(k == 0){
return n;
}else{
while(n != 0){
ret += calculate(k-1,n);
n--;
}
}
return ret;
}
// BEGIN CUT HERE
public:
void run_test(int Case) { if ((Case == -1) || (Case == 0)) test_case_0(); if ((Case == -1) || (Case == 1)) test_case_1(); if ((Case == -1) || (Case == 2)) test_case_2(); if ((Case == -1) || (Case == 3)) test_case_3(); }
private:
template <typename T> string print_array(const vector<T> &V) { ostringstream os; os << "{ "; for (typename vector<T>::const_iterator iter = V.begin(); iter != V.end(); ++iter) os << '\"' << *iter << "\","; os << " }"; return os.str(); }
void verify_case(int Case, const int &Expected, const int &Received) { cerr << "Test Case #" << Case << "..."; if (Expected == Received) cerr << "PASSED" << endl; else { cerr << "FAILED" << endl; cerr << "\tExpected: \"" << Expected << '\"' << endl; cerr << "\tReceived: \"" << Received << '\"' << endl; } }
void test_case_0() { int Arg0 = 1; int Arg1 = 3; int Arg2 = 6; verify_case(0, Arg2, calculate(Arg0, Arg1)); }
void test_case_1() { int Arg0 = 2; int Arg1 = 3; int Arg2 = 10; verify_case(1, Arg2, calculate(Arg0, Arg1)); }
void test_case_2() { int Arg0 = 4; int Arg1 = 10; int Arg2 = 2002; verify_case(2, Arg2, calculate(Arg0, Arg1)); }
void test_case_3() { int Arg0 = 10; int Arg1 = 10; int Arg2 = 167960; verify_case(3, Arg2, calculate(Arg0, Arg1)); }
// END CUT HERE
};
// BEGIN CUT HERE
int main() {
ShorterSuperSum ___test;
___test.run_test(-1);
}
// END CUT HERE
| [
"shin@CF-7AUJ41TT52JO.(none)"
]
| [
[
[
1,
69
]
]
]
|
caac840348dc664c48b6d066c259f274c4d5d913 | 41aafaf2fc329d82af50ecff758ccf82064bb73e | /ookNet/ookSSLServer.cpp | d2b8e59065e75483a6fa83556c2a5dd16eb5ed64 | []
| no_license | base851/ookLibs | 6ec038aaa66f86dac973e7adc153170a9e5f2dee | b116048277d4adc385078faa2319cf7727a83e11 | refs/heads/master | 2021-01-20T04:32:37.770110 | 2011-07-19T05:30:02 | 2011-07-19T05:30:02 | 2,070,005 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,785 | cpp | /*
Copyright © 2011, Ted Biggs
All rights reserved.
http://tbiggs.com
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Neither the name of Ted Biggs, nor the names of his
contributors may be used to endorse or promote products
derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#include "ookLibs/ookNet/ookSSLServer.h"
ookSSLServer::ookSSLServer(int iPort, base_method mthd)
: _iPort(iPort), _context(_io_service, mthd)
{
_dispatcher.RegisterObserver(new ookMsgObserver<ookSSLServer, ookTextMessage>(this, &ookSSLServer::HandleMsg));
}
ookSSLServer::~ookSSLServer()
{
try
{
this->Stop();
}
catch (...)
{
}
}
void ookSSLServer::AddVerifyPath(string path)
{
boost::system::error_code err;
_context.add_verify_path(path, err);
if(err)
throw err;
}
void ookSSLServer::LoadVerifyFile(string filename)
{
boost::system::error_code err;
_context.load_verify_file(filename, err);
if(err)
throw err;
}
void ookSSLServer::SetOptions(int opt)
{
boost::system::error_code err;
_context.set_options(opt, err);
if(err)
throw err;
}
void ookSSLServer::SetPasswordCallback()
{
boost::system::error_code err;
_context.set_password_callback(boost::bind(&ookSSLServer::PasswordCB, this), err);
if(err)
throw err;
}
string ookSSLServer::PasswordCB() const
{
return "";
}
void ookSSLServer::SetVerifyMode(int mode)
{
boost::system::error_code err;
_context.set_verify_mode(mode, err);
if(err)
throw err;
}
void ookSSLServer::UseCertificateChainFile(string filename)
{
boost::system::error_code err;
_context.use_certificate_chain_file(filename, err);
if(err)
throw err;
}
void ookSSLServer::UseCertificateFile(string filename, base_file_format frmt=asio::ssl::context_base::pem)
{
boost::system::error_code err;
_context.use_certificate_file(filename, frmt, err);
if(err)
throw err;
}
void ookSSLServer::UsePrivateKeyFile(string filename, base_file_format frmt=asio::ssl::context_base::pem)
{
boost::system::error_code err;
_context.use_private_key_file(filename, frmt, err);
if(err)
throw err;
}
void ookSSLServer::UseRSAPrivateKeyFile(string filename, base_file_format frmt=asio::ssl::context_base::pem)
{
boost::system::error_code err;
_context.use_rsa_private_key_file(filename, frmt, err);
if(err)
throw err;
}
void ookSSLServer::UseTmpDHFile(string filename)
{
boost::system::error_code err;
_context.use_tmp_dh_file(filename, err);
if(err)
throw err;
}
ssl_thread_ptr ookSSLServer::GetServerThread(ssl_socket_ptr sock)
{
ssl_thread_ptr thrd(new ookSSLServerThread(sock, &_dispatcher));
//Save off the server thread to our list
_vServerThreads.push_back(thrd);
return thrd;
}
vector<ssl_thread_ptr>& ookSSLServer::GetServerThreads()
{
return _vServerThreads;
}
void ookSSLServer::CleanServerThreads()
{
int iSize = _vServerThreads.size();
for(int i=0; i < iSize; i++)
{
bool bDoErase = false;
try
{
if(_vServerThreads[i] == NULL)
bDoErase = true;
else if(!_vServerThreads[i]->IsRunning())
bDoErase = true;
}
catch(...) //If something freaky happens we can trash it
{
bDoErase = true;
}
if(bDoErase)
{
_vServerThreads.erase(_vServerThreads.begin() + i);
i--; //We want to back this up one so that we stay in the same
//position in the loop. Everything just shifted left one slot.
iSize--; //The size of the container just went down by one
}
}
}
void ookSSLServer::HandleMsg(ookTextMessage* msg)
{
cout << "Received message: " << msg->GetMsg() << endl;
}
void ookSSLServer::Run()
{
try
{
tcp::acceptor accptr(_io_service, tcp::endpoint(tcp::v4(), _iPort));
//Now that the context and acceptor are initialized, we can start the io service
//_io_service.run();
while(this->IsRunning())
{
boost::system::error_code err;
ssl_socket_ptr sock = boost::shared_ptr<ssl_socket>(new ssl_socket(_io_service, _context));
accptr.accept(sock->lowest_layer(), err);
asio::ip::tcp::endpoint remote_ep = sock->lowest_layer().remote_endpoint();
cout << "Accepted new client from " << remote_ep.address().to_string() << endl;
if(!err)
{
//Declare a server thread and start it up
ssl_thread_ptr thrd = this->GetServerThread(sock);
thrd->Start();
}
}
//_io_service.stop();
}
catch (std::exception& e)
{
std::cerr << "Something bad happened in ookSSLServer::Run: " << e.what() << "\n";
}
catch(...)
{
std::cerr << "Oh noes! Unknown error in ookSSLServer::Run()" << endl;
}
} | [
"[email protected]"
]
| [
[
[
1,
248
]
]
]
|
c0c387abb6ef0153ce628bc365b1e61f520e9e92 | a0253037fb4d15a9f087c4415da58253998b453e | /lib/t_obj/obj.cpp | 49c82ad627f298e7b4a293811f6b00f44c9370cb | []
| no_license | thomas41546/Spario | a792746ca3e12c7c3fb2deb57ceb05196f5156a0 | 4aca33f9679515abce208eb1ee28d8bc6987cba0 | refs/heads/master | 2021-01-25T06:36:40.111835 | 2010-07-03T04:16:45 | 2010-07-03T04:16:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,338 | cpp | #include "obj.h"
Obj::Obj(Vector iPos, Vector ivelocity,Vector iDim,Vector imapblock,int iID,int itype){
Obj::Init(iPos,ivelocity,iDim,imapblock,iID,itype);
}
Obj::Obj(){
Obj::Init(Vector(0,0),Vector(0,0),Vector(0,0),Vector(BLOCK_SIZE,BLOCK_SIZE),0,STATIC);
}
void Obj::Init(Vector iPos, Vector ivelocity,Vector iDim,Vector imapblock,int iID,int itype){
Obj::Pos = iPos;
Obj::LastPos = iPos;
Obj::Velocity = ivelocity;
Obj::LastVelocity = ivelocity;
Obj::MapBlock = imapblock;
Obj::Dim = iDim;
Obj::Type = itype;
Obj::Id = iID;
Obj::Sprite = iID;
Obj::LastSpriteChange = 0;
Obj::AirHeight = 0;
Obj::SpriteIt = 0;
Obj::LastSpriteIt = 0.0;
if(itype == MOB || itype == PLAYER){
Obj::AllocSpriteMap();
}
else{
Obj::SpriteMap = NULL;
}
}
void Obj::AllocSpriteMap(){
if(Obj::SpriteMap == NULL)
Obj::SpriteMap = (struct SSpriteMap *)calloc(sizeof(struct SSpriteMap),1);
}
void Obj::DeAllocSpriteMap(){
if(Obj::SpriteMap != NULL)
delete Obj::SpriteMap;
}
bool objSorter(const Obj &f1, const Obj &f2) { //physics engine process priority
return (f1.Type < f2.Type);
};
| [
"[email protected]"
]
| [
[
[
1,
46
]
]
]
|
b4bc69273445decb65397c21ab3bcc8c4b94c293 | 5d35825d03fbfe9885316ec7d757b7bcb8a6a975 | /inc/OptionsSelector.h | 9b6be0b24ee346974dd62195bff281f78d823fa5 | []
| no_license | jjzhang166/3D-Landscape-linux | ce887d290b72ebcc23386782dd30bdd198db93ef | 4f87eab887750e3dc5edcb524b9e1ad99977bd94 | refs/heads/master | 2023-03-15T05:24:40.303445 | 2010-03-25T00:23:43 | 2010-03-25T00:23:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 688 | h | #ifndef OPTIONSSELECTOR_H
#define OPTIONSSELECTOR_H
#include <QPainter>
#include <QMouseEvent>
#include <cmath>
#include "CheckBox.h"
//#include "Button2D.h"
#include "IconButton.h"
#include "Dialog2D.h"
class OptionsSelector : public Dialog2D
{
public:
OptionsSelector(QSize mainWidgetSize);
virtual ~OptionsSelector();
void createCheckBox();
CheckBox *checkBox;
void render(QPainter *painter);
void processMouseEvent(QMouseEvent *e);
bool mouseActive;
IconButton *okB, *cancelB;
virtual void resetDialogState();
void resize(QSize size);
QSize mainWidgetSize;
};
#endif //OPTIONSSELECTOR_H
| [
"[email protected]"
]
| [
[
[
1,
39
]
]
]
|
2b572f2a518700b6dc984610bf2543e48c68759b | ce2a953f667d34cc56d7ce1adc057504e6b0eabe | /Jepg/io_oper.h | 8b2645787d20b3e7543d6d4d12ea7f2e4a53789e | []
| no_license | JCWu/jpeg-decoder | 915cd44cf193628cf86a55cf882a6860b8bcc063 | 14e042ae7cd3724102cf625b75bc10b5693ace19 | refs/heads/master | 2021-01-10T16:32:56.438281 | 2010-12-14T14:39:28 | 2010-12-14T14:39:28 | 36,046,023 | 1 | 0 | null | null | null | null | ISO-8859-7 | C++ | false | false | 419 | h | /** io_oper
* ΚδΘλ³ιΟσ²γ
*/
#ifndef IO_OPER_H_
#define IO_OPER_H_
#include <string>
class io_oper
{
public:
virtual ~io_oper() = 0;
virtual void Seek(unsigned int offset) = 0;
virtual unsigned int Read(void *buffer, unsigned int size) = 0;
virtual unsigned int Tell() const = 0;
virtual unsigned int GetSize() const = 0;
};
io_oper* IStreamFromFile(std::wstring fname);
#endif
| [
"[email protected]@c774a4f1-b9b9-ec5f-4c86-73bda70207c7"
]
| [
[
[
1,
22
]
]
]
|
dd5897349ad0d901e032356b7a60ea2ae6dcc99b | 5bbdc0c6e34ce0f6273d6844840c1108895c083b | /NS2Torrent/dllmain.cpp | 7dff547b22fc0ac67c5fb74b33acc0851d14fcb6 | []
| no_license | tsuckow/ns2torrent | 7e6622a8f99cdf2cc944d4f5e636818c754c3775 | c3ae6e257dc3647272846f5fd3c898337ed67480 | refs/heads/master | 2016-09-06T10:03:54.740731 | 2011-01-24T07:32:50 | 2011-01-24T07:32:50 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 831 | cpp | // dllmain.cpp : Defines the entry point for the DLL application.
#include "stdafx.h"
//#include "NS_IOModule.h"
//#include "SavedVariables.h"
#include <luabind/tag_function.hpp>
//#include "PathStringConverter.h"
#include "NS2Torrent.h"
BOOL APIENTRY DllMain(HMODULE hModule,DWORD ul_reason_for_call, LPVOID lpReserved){
switch (ul_reason_for_call){
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
extern "C" __declspec(dllexport) int luaopen_NS2Torrent(lua_State* L){
using namespace luabind;
open(L);
module(L,"NS2Torrent")[
//def("myFunc", &luaopen)
NS2Torrent::RegisterClass()
];
//push our module onto the stack tobe our return value
lua_getglobal(L, "NS2Torrent");
return 1;
}
| [
"tsuckow"
]
| [
[
[
1,
37
]
]
]
|
df7ad51ce6f4974a44801fd30e59eb58b003992f | 478570cde911b8e8e39046de62d3b5966b850384 | /apicompatanamdw/bcdrivers/mw/classicui/uifw/apps/S60_SDK3.1/bctestmisc/inc/bctestmisccontainer.h | fa4a6751dbf940e94bfd1c4cbdbad6a4c35d6cfc | []
| no_license | SymbianSource/oss.FCL.sftools.ana.compatanamdw | a6a8abf9ef7ad71021d43b7f2b2076b504d4445e | 1169475bbf82ebb763de36686d144336fcf9d93b | refs/heads/master | 2020-12-24T12:29:44.646072 | 2010-11-11T14:03:20 | 2010-11-11T14:03:20 | 72,994,432 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,931 | h | /*
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description: container
*
*/
#ifndef C_CBCTESTMISCCONTAINER_H
#define C_CBCTESTMISCCONTAINER_H
#include <coecntrl.h>
/**
* container class
*/
class CBCTestMiscContainer: public CCoeControl
{
public: // constructor and destructor
/**
* C++ default constructor
*/
CBCTestMiscContainer();
/**
* Destructor
*/
virtual ~CBCTestMiscContainer();
/**
* Symbian 2nd constructor
*/
void ConstructL( const TRect& aRect );
/**
* Set component control, and container will own the control
* @param aControl pointer to a control.
*/
void SetControlL( CCoeControl* aControl );
/**
* Delete control
*/
void ResetControl();
/**
* Return count of component controls
*/
TInt CountComponentControls() const;
/**
* Return pointer to component control specified by index
* @param aIndex, a index to specify a component control
*/
CCoeControl* ComponentControl( TInt aIndex ) const;
private: // from CCoeControl
/**
* From CCoeControl, Draw.
* Fills the window's rectangle.
* @param aRect Region of the control to be (re)drawn.
*/
void Draw( const TRect& aRect ) const;
private: // data
/**
* Pointer to component control.
* own
*/
CCoeControl* iControl;
};
#endif // C_CBCTEST_MISCCONTAINER_H | [
"none@none"
]
| [
[
[
1,
87
]
]
]
|
0a374b8b2b2c4fd45ef8aeb8f37c56302f2997ca | e95784c83b6cec527f3292d2af4f2ee9b257a0b7 | /GV/Drivers/ServoMotor.cpp | d3f8374bf2cb96a232d0836db60a37a61dd87ab6 | []
| no_license | ehaskins/scoe-robotics-onboard-controller | 5e6818cb469c512a4429aa6ccb96478b89c9ce6f | f44887f79cf89c9ff85963e515381199c9b2b2d7 | refs/heads/master | 2020-06-06T12:53:54.350781 | 2011-05-01T00:26:17 | 2011-05-01T00:26:17 | 32,115,864 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 111 | cpp | /*
* ServoMotor.cpp
*
* Created on: Apr 26, 2011
* Author: Nick
*/
#include "ServoMotor.h"
| [
"[email protected]"
]
| [
[
[
1,
8
]
]
]
|
dad36fb14ae8bb10bd3775b01a8d0e9ffaeabcdc | 4d5ee0b6f7be0c3841c050ed1dda88ec128ae7b4 | /src/nvimage/openexr/src/ImathTest/testColor.cpp | 7702e564aef9af944eaca69b573462a0caced022 | []
| no_license | saggita/nvidia-mesh-tools | 9df27d41b65b9742a9d45dc67af5f6835709f0c2 | a9b7fdd808e6719be88520e14bc60d58ea57e0bd | refs/heads/master | 2020-12-24T21:37:11.053752 | 2010-09-03T01:39:02 | 2010-09-03T01:39:02 | 56,893,300 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 7,130 | cpp | ///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002, Industrial Light & Magic, a division of Lucas
// Digital Ltd. LLC
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Industrial Light & Magic nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////
#include <testColor.h>
#include "ImathColor.h"
#include "ImathColorAlgo.h"
#include "ImathLimits.h"
#include "ImathMath.h"
#include <iostream>
#include <assert.h>
using namespace std;
void
testColor ()
{
cout << "Testing functions in ImathColor.h & ImathColorAlgo.h" << endl;
cout << "rgb2packed -> packed2rgb" << endl;
const float epsilon = Imath::limits< float >::epsilon();
Imath::PackedColor packed;
Imath::C3c in3( 52, 128, 254 );
Imath::C3c out3;
packed = Imath::rgb2packed( in3 );
Imath::packed2rgb( packed, out3 );
assert ( in3 == out3 );
Imath::C4c testConstructor1;
Imath::C4c testConstructor2( testConstructor1 );
testConstructor1 = testConstructor2; // use these so the compiler doesn't emit a warning
Imath::C4c testConstructor3( 52, 128, 254, 127 );
Imath::C4c A( testConstructor3 );
Imath::C4c B;
Imath::C4f X, Y, tmp;
packed = Imath::rgb2packed( A );
Imath::packed2rgb( packed, B );
assert ( A == B );
cout << "Imath::Color4 * f" << endl;
assert ( ( Imath::C4f( 0.330f, 0.710f, 0.010f, 0.999f ) * 0.999f ) ==
Imath::C4f( 0.330f * 0.999f,
0.710f * 0.999f,
0.010f * 0.999f,
0.999f * 0.999f ) );
cout << "Imath::Color4 / f" << endl;
assert ( ( Imath::C4f( 0.330f, 0.710f, 0.010f, 0.999f ) / 0.999f ) ==
Imath::C4f( 0.330f / 0.999f,
0.710f / 0.999f,
0.010f / 0.999f,
0.999f / 0.999f ) );
cout << "Assignment and comparison" << endl;
B = A;
assert( B == A );
assert( !( B != A ) );
X = Y = Imath::C4f( 0.123f, -0.420f, 0.501f, 0.998f );
X *= 0.001f;
assert( Imath::Math<float>::fabs( ( Y.r * 0.001f ) - X.r ) <= epsilon &&
Imath::Math<float>::fabs( ( Y.g * 0.001f ) - X.g ) <= epsilon &&
Imath::Math<float>::fabs( ( Y.b * 0.001f ) - X.b ) <= epsilon &&
Imath::Math<float>::fabs( ( Y.a * 0.001f ) - X.a ) <= epsilon );
X = Y = Imath::C4f( 0.123f, -0.420f, 0.501f, 0.998f );
X /= -1.001f;
assert( Imath::Math<float>::fabs( ( Y.r / -1.001f ) - X.r ) <= epsilon &&
Imath::Math<float>::fabs( ( Y.g / -1.001f ) - X.g ) <= epsilon &&
Imath::Math<float>::fabs( ( Y.b / -1.001f ) - X.b ) <= epsilon &&
Imath::Math<float>::fabs( ( Y.a / -1.001f ) - X.a ) <= epsilon );
Y = Imath::C4f( 0.998f, -0.001f, 0.501f, 1.001f );
X = Imath::C4f( 0.011f, -0.420f, -0.501f, 0.998f );
tmp = X + Y;
assert( Imath::Math<float>::fabs( ( X.r + Y.r ) - tmp.r ) <= epsilon &&
Imath::Math<float>::fabs( ( X.g + Y.g ) - tmp.g ) <= epsilon &&
Imath::Math<float>::fabs( ( X.b + Y.b ) - tmp.b ) <= epsilon &&
Imath::Math<float>::fabs( ( X.a + Y.a ) - tmp.a ) <= epsilon );
tmp = X - Y;
assert( Imath::Math<float>::fabs( ( X.r - Y.r ) - tmp.r ) <= epsilon &&
Imath::Math<float>::fabs( ( X.g - Y.g ) - tmp.g ) <= epsilon &&
Imath::Math<float>::fabs( ( X.b - Y.b ) - tmp.b ) <= epsilon &&
Imath::Math<float>::fabs( ( X.a - Y.a ) - tmp.a ) <= epsilon );
tmp = X * Y;
assert( Imath::Math<float>::fabs( ( X.r * Y.r ) - tmp.r ) <= epsilon &&
Imath::Math<float>::fabs( ( X.g * Y.g ) - tmp.g ) <= epsilon &&
Imath::Math<float>::fabs( ( X.b * Y.b ) - tmp.b ) <= epsilon &&
Imath::Math<float>::fabs( ( X.a * Y.a ) - tmp.a ) <= epsilon );
tmp = X / Y;
//
// epsilon doesn't work here.
//
assert( Imath::Math<float>::fabs( ( X.r / Y.r ) - tmp.r ) <= 1e-5f &&
Imath::Math<float>::fabs( ( X.g / Y.g ) - tmp.g ) <= 1e-5f &&
Imath::Math<float>::fabs( ( X.b / Y.b ) - tmp.b ) <= 1e-5f &&
Imath::Math<float>::fabs( ( X.a / Y.a ) - tmp.a ) <= 1e-5f );
tmp = X;
tmp += Y;
assert( Imath::Math<float>::fabs( ( X.r + Y.r ) - tmp.r ) <= epsilon &&
Imath::Math<float>::fabs( ( X.g + Y.g ) - tmp.g ) <= epsilon &&
Imath::Math<float>::fabs( ( X.b + Y.b ) - tmp.b ) <= epsilon &&
Imath::Math<float>::fabs( ( X.a + Y.a ) - tmp.a ) <= epsilon );
tmp = X;
tmp -= Y;
assert( Imath::Math<float>::fabs( ( X.r - Y.r ) - tmp.r ) <= epsilon &&
Imath::Math<float>::fabs( ( X.g - Y.g ) - tmp.g ) <= epsilon &&
Imath::Math<float>::fabs( ( X.b - Y.b ) - tmp.b ) <= epsilon &&
Imath::Math<float>::fabs( ( X.a - Y.a ) - tmp.a ) <= epsilon );
tmp = X;
tmp *= Y;
assert( Imath::Math<float>::fabs( ( X.r * Y.r ) - tmp.r ) <= epsilon &&
Imath::Math<float>::fabs( ( X.g * Y.g ) - tmp.g ) <= epsilon &&
Imath::Math<float>::fabs( ( X.b * Y.b ) - tmp.b ) <= epsilon &&
Imath::Math<float>::fabs( ( X.a * Y.a ) - tmp.a ) <= epsilon );
tmp = X;
tmp /= Y;
//
// epsilon doesn't work here.
//
assert( Imath::Math<float>::fabs( ( X.r / Y.r ) - tmp.r ) <= 1e-5f &&
Imath::Math<float>::fabs( ( X.g / Y.g ) - tmp.g ) <= 1e-5f &&
Imath::Math<float>::fabs( ( X.b / Y.b ) - tmp.b ) <= 1e-5f &&
Imath::Math<float>::fabs( ( X.a / Y.a ) - tmp.a ) <= 1e-5f );
cout << "ok\n" << endl;
}
| [
"castano@0f2971b0-9fc2-11dd-b4aa-53559073bf4c"
]
| [
[
[
1,
192
]
]
]
|
daf61f662480ff6769490ccbae52e37027dffbf6 | 42cb8a28233be1cb744c9fd06f1d9655807b78b9 | /win32networkserver/NetWork.h | dfd591a3079e7f135823e0871f351a1f45b4ef7f | []
| no_license | BladeSmithJohn/win32networkserver | 3603a6bddaf6740575e32e682054d12093c63b5a | b66144d48a720da30a131eb0793e84d90cb0e6f8 | refs/heads/master | 2016-09-05T16:48:59.806469 | 2009-04-01T02:30:06 | 2009-04-01T02:30:06 | 33,292,716 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,905 | h | #ifndef _NET_WORK_H
#define _NET_WORK_H
#include "HeadFile.h"
#ifdef WIN32
#ifdef _DLL_EXPORTS_
#define DLLENTRY __declspec(dllexport)
#include <windows.h>
#else
#define DLLENTRY __declspec(dllimport)
#endif //#ifdef _DLL_EXPORTS_
#else
#define DLLENTRY
#endif //#ifdef WIN32
#pragma warning (disable:4251)
namespace HelpMng
{
/****************************************************
* Name : ReleaseNetWork()
* Desc : 释放class NetWork的相关资源
****************************************************/
void ReleaseNetWork();
class DLLENTRY NetWork
{
friend void ReleaseNetWork();
public:
/****************************************************
* Name : InitReource()
* Desc : 对相关全局及静态资源进行初始化
* 该方法由DllMain()方法调用, 开发者不能调用
* 该方法; 否则会造成内存泄露
****************************************************/
static void InitReource();
NetWork()
: m_hSock(INVALID_SOCKET)
{}
virtual ~NetWork() {}
/****************************************************
* Name : Init()
* Desc : 对网络模块进行初始化
****************************************************/
virtual BOOL Init(
const char *szIp //要启动服务的本地地址, NULL 则采用默认地址
, int nPort //要启动服务的端口
) = 0;
/****************************************************
* Name : Close()
* Desc : 关闭网络模块
****************************************************/
virtual void Close() = 0;
/****************************************************
* Name : SendData()
* Desc : TCP模式的发送数据
****************************************************/
virtual BOOL SendData(const char * szData, int nDataLen, SOCKET hSock = INVALID_SOCKET);
/****************************************************
* Name : SendData()
* Desc : UDP模式的数据发送
****************************************************/
virtual BOOL SendData(const IP_ADDR& PeerAddr, const char * szData, int nLen);
/****************************************************
* Name : GetRecvData()
* Desc : 从接收队列中取出一个接收数据
****************************************************/
virtual void *GetRecvData(DWORD* const pQueLen);
/****************************************************
* Name : Connect()
* Desc : 连接到指定的服务器, 客户端网络模块需实现该函数
****************************************************/
virtual BOOL Connect(
const char *szIp
, int nPort
, const char *szData = NULL //连接成功后发送的第一份数据
, int nLen = 0 //数据的长度
);
/*************************************************
* Name : GetSocket()
* Desc :
***********************************************/
SOCKET GetSocket()const { return m_hSock; }
protected:
SOCKET m_hSock;
static HANDLE s_hCompletion; //完成端口句柄
static HANDLE *s_pThreads; //在完成端口上工作的线程
static UINT WINAPI WorkThread(LPVOID lpParam);
/****************************************************
* Name : IOCompletionProc()
* Desc : IO完成后的回调函数
****************************************************/
virtual void IOCompletionProc(BOOL bSuccess, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped) = 0;
private:
static BOOL s_bInit; //是否已进行初始化工作
/****************************************************
* Name : ReleaseReource()
* Desc : 对相关全局和静态资源进行释放
****************************************************/
static void ReleaseReource();
};
}
#endif //#ifndef _NET_WORK_H | [
"[email protected]@8dc1211a-1e63-11de-a958-c9a343b5b891"
]
| [
[
[
1,
119
]
]
]
|
f08559289291aa30b183a913bc2980ea7aa8461b | 9310fd7bac6871c98b216a2e081b19e9232c14ed | /lib/agr/tests/include/TestMovementRecogniser.h | c8ab90a14519f090a6d7d59f4037135a67cb36ad | []
| no_license | baloo/wiidrums | 1345525c759a2325274ddbfe182a9549c6c4e325 | ed3832d4f91cd9932bfeb321b8aa57340a502d48 | refs/heads/master | 2016-09-09T18:19:06.403352 | 2009-05-21T02:04:09 | 2009-05-21T02:04:09 | 179,309 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 952 | h | /**
* \file TestMovementRecogniser.h
* \brief Declaraction for testing cVocabulary
* \date 01/03/08
*/
#ifndef _TESTMOVEMENTRECOGNITION_H_
#define _TESTMOVEMENTRECOGNITION_H_
#include <cppunit/extensions/HelperMacros.h>
namespace AGR {
class cMovementRecogniser; // forward declaration
}
/**
* \classe cTestMovementRecogniser
* \brief Test class for cMovementRecogniser
* To be used with CPPUnit
*/
class cTestMovementRecogniser : public CPPUNIT_NS::TestFixture
{
CPPUNIT_TEST_SUITE(cTestMovementRecogniser);
CPPUNIT_TEST( uninitialised );
CPPUNIT_TEST( initialisation );
CPPUNIT_TEST( manualRecognition );
CPPUNIT_TEST( automaticRecognition );
CPPUNIT_TEST_SUITE_END();
public:
virtual void setUp();
virtual void tearDown();
void uninitialised();
void initialisation();
void manualRecognition();
void automaticRecognition();
protected:
};
#endif // _TESTMOVEMENTRECOGNITION_H_
| [
"[email protected]"
]
| [
[
[
1,
44
]
]
]
|
85c608a91a60f026e61e2823aa221e8410b1a22d | 8103a6a032f7b3ec42bbf7a4ad1423e220e769e0 | /Prominence/XInputController.h | 47a26a9402c25711ddcf8d093eaa0d1bf51e83c3 | []
| no_license | wgoddard/2d-opengl-engine | 0400bb36c2852ce4f5619f8b5526ba612fda780c | 765b422277a309b3d4356df2e58ee8db30d91914 | refs/heads/master | 2016-08-08T14:28:07.909649 | 2010-06-17T19:13:12 | 2010-06-17T19:13:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 356 | h | #pragma once
#include "InputDevice.h"
namespace Prominence {
class XInputController :
public InputDevice
{
public:
XInputController(void);
~XInputController(void);
bool GetAKey();
bool GetBKey();
bool GeyXKey();
bool GetYKey();
void GetDirection(int &MagX, int &MagY);
bool GetLKey();
bool GetRKey();
};
} | [
"William@18b72257-4ce5-c346-ae33-905a28f88ba6"
]
| [
[
[
1,
23
]
]
]
|
9ea6b9a721aa1a1679fe5203db93425863462da2 | 037faae47a5b22d3e283555e6b5ac2a0197faf18 | /pcsx2/x86/iR3000Atables.cpp | 7bea96d1c3605a9e705e12fde94d68f958447d4d | []
| no_license | isabella232/pcsx2-sourceforge | 6e5aac8d0b476601bfc8fa83ded66c1564b8c588 | dbb2c3a010081b105a8cba0c588f1e8f4e4505c6 | refs/heads/master | 2023-03-18T22:23:15.102593 | 2008-11-17T20:10:17 | 2008-11-17T20:10:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 47,135 | cpp | /* Pcsx2 - Pc Ps2 Emulator
* Copyright (C) 2002-2008 Pcsx2 Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
// stop compiling if NORECBUILD build (only for Visual Studio)
#if !(defined(_MSC_VER) && defined(PCSX2_NORECBUILD))
extern "C" {
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <assert.h>
#include <malloc.h>
#include "PS2Etypes.h"
#if defined(_WIN32)
#include <windows.h>
#endif
#include "System.h"
#include "Memory.h"
#include "Misc.h"
#include "Vif.h"
#include "VU.h"
#include "R3000A.h"
#include "PsxMem.h"
#include "ix86/ix86.h"
#include "iCore.h"
#include "iR3000A.h"
extern void psxLWL();
extern void psxLWR();
extern void psxSWL();
extern void psxSWR();
extern int g_psxWriteOk;
extern u32 g_psxMaxRecMem;
}
// R3000A instruction implementation
#define REC_FUNC(f) \
void psx##f(); \
static void rpsx##f() { \
MOV32ItoM((uptr)&psxRegs.code, (u32)psxRegs.code); \
_psxFlushCall(FLUSH_EVERYTHING); \
/*MOV32ItoM((u32)&psxRegs.pc, (u32)pc);*/ \
CALLFunc((uptr)psx##f); \
PSX_DEL_CONST(_Rt_); \
/* branch = 2; */\
}
////
void rpsxADDIU_const()
{
g_psxConstRegs[_Rt_] = g_psxConstRegs[_Rs_] + _Imm_;
}
// adds a constant to sreg and puts into dreg
void rpsxADDconst(int dreg, int sreg, u32 off, int info)
{
if (sreg) {
if (sreg == dreg) {
ADD32ItoM((uptr)&psxRegs.GPR.r[dreg], off);
} else {
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[sreg]);
if (off) ADD32ItoR(EAX, off);
MOV32RtoM((uptr)&psxRegs.GPR.r[dreg], EAX);
}
}
else {
MOV32ItoM((uptr)&psxRegs.GPR.r[dreg], off);
}
}
void rpsxADDIU_(int info)
{
// Rt = Rs + Im
if (!_Rt_) return;
rpsxADDconst(_Rt_, _Rs_, _Imm_, info);
}
PSXRECOMPILE_CONSTCODE1(ADDIU);
void rpsxADDI() { rpsxADDIU(); }
//// SLTI
void rpsxSLTI_const()
{
g_psxConstRegs[_Rt_] = *(int*)&g_psxConstRegs[_Rs_] < _Imm_;
}
void rpsxSLTconst(int info, int dreg, int sreg, int imm)
{
XOR32RtoR(EAX, EAX);
CMP32ItoM((uptr)&psxRegs.GPR.r[sreg], imm);
SETL8R(EAX);
MOV32RtoM((uptr)&psxRegs.GPR.r[dreg], EAX);
}
void rpsxSLTI_(int info) { rpsxSLTconst(info, _Rt_, _Rs_, _Imm_); }
PSXRECOMPILE_CONSTCODE1(SLTI);
//// SLTIU
void rpsxSLTIU_const()
{
g_psxConstRegs[_Rt_] = g_psxConstRegs[_Rs_] < _ImmU_;
}
void rpsxSLTUconst(int info, int dreg, int sreg, int imm)
{
XOR32RtoR(EAX, EAX);
CMP32ItoM((uptr)&psxRegs.GPR.r[sreg], imm);
SETB8R(EAX);
MOV32RtoM((uptr)&psxRegs.GPR.r[dreg], EAX);
}
void rpsxSLTIU_(int info) { rpsxSLTUconst(info, _Rt_, _Rs_, (s32)_Imm_); }
PSXRECOMPILE_CONSTCODE1(SLTIU);
//// ANDI
void rpsxANDI_const()
{
g_psxConstRegs[_Rt_] = g_psxConstRegs[_Rs_] & _ImmU_;
}
void rpsxANDconst(int info, int dreg, int sreg, u32 imm)
{
if (imm) {
if (sreg == dreg) {
AND32ItoM((uptr)&psxRegs.GPR.r[dreg], imm);
} else {
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[sreg]);
AND32ItoR(EAX, imm);
MOV32RtoM((uptr)&psxRegs.GPR.r[dreg], EAX);
}
} else {
MOV32ItoM((uptr)&psxRegs.GPR.r[dreg], 0);
}
}
void rpsxANDI_(int info) { rpsxANDconst(info, _Rt_, _Rs_, _ImmU_); }
PSXRECOMPILE_CONSTCODE1(ANDI);
//// ORI
void rpsxORI_const()
{
g_psxConstRegs[_Rt_] = g_psxConstRegs[_Rs_] | _ImmU_;
}
void rpsxORconst(int info, int dreg, int sreg, u32 imm)
{
if (imm) {
if (sreg == dreg) {
OR32ItoM((uptr)&psxRegs.GPR.r[dreg], imm);
}
else {
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[sreg]);
OR32ItoR (EAX, imm);
MOV32RtoM((uptr)&psxRegs.GPR.r[dreg], EAX);
}
}
else {
if( dreg != sreg ) {
MOV32MtoR(ECX, (uptr)&psxRegs.GPR.r[sreg]);
MOV32RtoM((uptr)&psxRegs.GPR.r[dreg], ECX);
}
}
}
void rpsxORI_(int info) { rpsxORconst(info, _Rt_, _Rs_, _ImmU_); }
PSXRECOMPILE_CONSTCODE1(ORI);
void rpsxXORI_const()
{
g_psxConstRegs[_Rt_] = g_psxConstRegs[_Rs_] ^ _ImmU_;
}
void rpsxXORconst(int info, int dreg, int sreg, u32 imm)
{
if( imm == 0xffffffff ) {
if( dreg == sreg ) {
NOT32M((uptr)&psxRegs.GPR.r[dreg]);
}
else {
MOV32MtoR(ECX, (uptr)&psxRegs.GPR.r[sreg]);
NOT32R(ECX);
MOV32RtoM((uptr)&psxRegs.GPR.r[dreg], ECX);
}
}
else if (imm) {
if (sreg == dreg) {
XOR32ItoM((uptr)&psxRegs.GPR.r[dreg], imm);
}
else {
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[sreg]);
XOR32ItoR(EAX, imm);
MOV32RtoM((uptr)&psxRegs.GPR.r[dreg], EAX);
}
}
else {
if( dreg != sreg ) {
MOV32MtoR(ECX, (uptr)&psxRegs.GPR.r[sreg]);
MOV32RtoM((uptr)&psxRegs.GPR.r[dreg], ECX);
}
}
}
void rpsxXORI_(int info) { rpsxXORconst(info, _Rt_, _Rs_, _ImmU_); }
PSXRECOMPILE_CONSTCODE1(XORI);
void rpsxLUI()
{
if(!_Rt_) return;
_psxOnWriteReg(_Rt_);
_psxDeleteReg(_Rt_, 0);
PSX_SET_CONST(_Rt_);
g_psxConstRegs[_Rt_] = psxRegs.code << 16;
}
void rpsxADDU_const()
{
g_psxConstRegs[_Rd_] = g_psxConstRegs[_Rs_] + g_psxConstRegs[_Rt_];
}
void rpsxADDU_consts(int info) { rpsxADDconst(_Rd_, _Rt_, g_psxConstRegs[_Rs_], info); }
void rpsxADDU_constt(int info)
{
info |= PROCESS_EE_SET_S(EEREC_T);
rpsxADDconst(_Rd_, _Rs_, g_psxConstRegs[_Rt_], info);
}
void rpsxADDU_(int info)
{
if (_Rs_ && _Rt_) {
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rs_]);
ADD32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rt_]);
} else if (_Rs_) {
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rs_]);
} else if (_Rt_) {
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rt_]);
} else {
XOR32RtoR(EAX, EAX);
}
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
PSXRECOMPILE_CONSTCODE0(ADDU);
void rpsxADD() { rpsxADDU(); }
void rpsxSUBU_const()
{
g_psxConstRegs[_Rd_] = g_psxConstRegs[_Rs_] - g_psxConstRegs[_Rt_];
}
void rpsxSUBU_consts(int info)
{
MOV32ItoR(EAX, g_psxConstRegs[_Rs_]);
SUB32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rt_]);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
void rpsxSUBU_constt(int info) { rpsxADDconst(_Rd_, _Rs_, -(int)g_psxConstRegs[_Rt_], info); }
void rpsxSUBU_(int info)
{
// Rd = Rs - Rt
if (!_Rd_) return;
if( _Rd_ == _Rs_ ) {
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rt_]);
SUB32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
else {
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rs_]);
SUB32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rt_]);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
}
PSXRECOMPILE_CONSTCODE0(SUBU);
void rpsxSUB() { rpsxSUBU(); }
void rpsxLogicalOp(int info, int op)
{
if( _Rd_ == _Rs_ || _Rd_ == _Rt_ ) {
int vreg = _Rd_ == _Rs_ ? _Rt_ : _Rs_;
MOV32MtoR(ECX, (uptr)&psxRegs.GPR.r[vreg]);
LogicalOp32RtoM((uptr)&psxRegs.GPR.r[_Rd_], ECX, op);
if( op == 3 )
NOT32M((uptr)&psxRegs.GPR.r[_Rd_]);
}
else {
MOV32MtoR(ECX, (uptr)&psxRegs.GPR.r[_Rs_]);
LogicalOp32MtoR(ECX, (uptr)&psxRegs.GPR.r[_Rt_], op);
if( op == 3 )
NOT32R(ECX);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], ECX);
}
}
void rpsxAND_const()
{
g_psxConstRegs[_Rd_] = g_psxConstRegs[_Rs_] & g_psxConstRegs[_Rt_];
}
void rpsxAND_consts(int info) { rpsxANDconst(info, _Rd_, _Rt_, g_psxConstRegs[_Rs_]); }
void rpsxAND_constt(int info) { rpsxANDconst(info, _Rd_, _Rs_, g_psxConstRegs[_Rt_]); }
void rpsxAND_(int info) { rpsxLogicalOp(info, 0); }
PSXRECOMPILE_CONSTCODE0(AND);
void rpsxOR_const()
{
g_psxConstRegs[_Rd_] = g_psxConstRegs[_Rs_] | g_psxConstRegs[_Rt_];
}
void rpsxOR_consts(int info) { rpsxORconst(info, _Rd_, _Rt_, g_psxConstRegs[_Rs_]); }
void rpsxOR_constt(int info) { rpsxORconst(info, _Rd_, _Rs_, g_psxConstRegs[_Rt_]); }
void rpsxOR_(int info) { rpsxLogicalOp(info, 1); }
PSXRECOMPILE_CONSTCODE0(OR);
//// XOR
void rpsxXOR_const()
{
g_psxConstRegs[_Rd_] = g_psxConstRegs[_Rs_] ^ g_psxConstRegs[_Rt_];
}
void rpsxXOR_consts(int info) { rpsxXORconst(info, _Rd_, _Rt_, g_psxConstRegs[_Rs_]); }
void rpsxXOR_constt(int info) { rpsxXORconst(info, _Rd_, _Rs_, g_psxConstRegs[_Rt_]); }
void rpsxXOR_(int info) { rpsxLogicalOp(info, 2); }
PSXRECOMPILE_CONSTCODE0(XOR);
//// NOR
void rpsxNOR_const()
{
g_psxConstRegs[_Rd_] = ~(g_psxConstRegs[_Rs_] | g_psxConstRegs[_Rt_]);
}
void rpsxNORconst(int info, int dreg, int sreg, u32 imm)
{
if( imm ) {
if( dreg == sreg ) {
OR32ItoM((uptr)&psxRegs.GPR.r[dreg], imm);
NOT32M((uptr)&psxRegs.GPR.r[dreg]);
}
else {
MOV32MtoR(ECX, (uptr)&psxRegs.GPR.r[sreg]);
OR32ItoR(ECX, imm);
NOT32R(ECX);
MOV32RtoM((uptr)&psxRegs.GPR.r[dreg], ECX);
}
}
else {
if( dreg == sreg ) {
NOT32M((uptr)&psxRegs.GPR.r[dreg]);
}
else {
MOV32MtoR(ECX, (uptr)&psxRegs.GPR.r[sreg]);
NOT32R(ECX);
MOV32RtoM((uptr)&psxRegs.GPR.r[dreg], ECX);
}
}
}
void rpsxNOR_consts(int info) { rpsxNORconst(info, _Rd_, _Rt_, g_psxConstRegs[_Rs_]); }
void rpsxNOR_constt(int info) { rpsxNORconst(info, _Rd_, _Rs_, g_psxConstRegs[_Rt_]); }
void rpsxNOR_(int info) { rpsxLogicalOp(info, 3); }
PSXRECOMPILE_CONSTCODE0(NOR);
//// SLT
void rpsxSLT_const()
{
g_psxConstRegs[_Rd_] = *(int*)&g_psxConstRegs[_Rs_] < *(int*)&g_psxConstRegs[_Rt_];
}
void rpsxSLT_consts(int info)
{
XOR32RtoR(EAX, EAX);
CMP32ItoM((uptr)&psxRegs.GPR.r[_Rt_], g_psxConstRegs[_Rs_]);
SETG8R(EAX);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
void rpsxSLT_constt(int info) { rpsxSLTconst(info, _Rd_, _Rs_, g_psxConstRegs[_Rt_]); }
void rpsxSLT_(int info)
{
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rs_]);
CMP32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rt_]);
SETL8R (EAX);
AND32ItoR(EAX, 0xff);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
PSXRECOMPILE_CONSTCODE0(SLT);
//// SLTU
void rpsxSLTU_const()
{
g_psxConstRegs[_Rd_] = g_psxConstRegs[_Rs_] < g_psxConstRegs[_Rt_];
}
void rpsxSLTU_consts(int info)
{
XOR32RtoR(EAX, EAX);
CMP32ItoM((uptr)&psxRegs.GPR.r[_Rt_], g_psxConstRegs[_Rs_]);
SETA8R(EAX);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
void rpsxSLTU_constt(int info) { rpsxSLTUconst(info, _Rd_, _Rs_, g_psxConstRegs[_Rt_]); }
void rpsxSLTU_(int info)
{
// Rd = Rs < Rt (unsigned)
if (!_Rd_) return;
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rs_]);
CMP32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rt_]);
SBB32RtoR(EAX, EAX);
NEG32R (EAX);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
PSXRECOMPILE_CONSTCODE0(SLTU);
//// MULT
void rpsxMULT_const()
{
u64 res = (s64)((s64)*(int*)&g_psxConstRegs[_Rs_] * (s64)*(int*)&g_psxConstRegs[_Rt_]);
MOV32ItoM((uptr)&psxRegs.GPR.n.hi, (u32)((res >> 32) & 0xffffffff));
MOV32ItoM((uptr)&psxRegs.GPR.n.lo, (u32)(res & 0xffffffff));
}
void rpsxMULTsuperconst(int info, int sreg, int imm, int sign)
{
// Lo/Hi = Rs * Rt (signed)
MOV32ItoR(EAX, imm);
if( sign ) IMUL32M ((uptr)&psxRegs.GPR.r[sreg]);
else MUL32M ((uptr)&psxRegs.GPR.r[sreg]);
MOV32RtoM((uptr)&psxRegs.GPR.n.lo, EAX);
MOV32RtoM((uptr)&psxRegs.GPR.n.hi, EDX);
}
void rpsxMULTsuper(int info, int sign)
{
// Lo/Hi = Rs * Rt (signed)
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rs_]);
if( sign ) IMUL32M ((uptr)&psxRegs.GPR.r[_Rt_]);
else MUL32M ((uptr)&psxRegs.GPR.r[_Rt_]);
MOV32RtoM((uptr)&psxRegs.GPR.n.lo, EAX);
MOV32RtoM((uptr)&psxRegs.GPR.n.hi, EDX);
}
void rpsxMULT_consts(int info) { rpsxMULTsuperconst(info, _Rt_, g_psxConstRegs[_Rs_], 1); }
void rpsxMULT_constt(int info) { rpsxMULTsuperconst(info, _Rs_, g_psxConstRegs[_Rt_], 1); }
void rpsxMULT_(int info) { rpsxMULTsuper(info, 1); }
PSXRECOMPILE_CONSTCODE3(MULT, 1);
//// MULTU
void rpsxMULTU_const()
{
u64 res = (u64)((u64)g_psxConstRegs[_Rs_] * (u64)g_psxConstRegs[_Rt_]);
MOV32ItoM((uptr)&psxRegs.GPR.n.hi, (u32)((res >> 32) & 0xffffffff));
MOV32ItoM((uptr)&psxRegs.GPR.n.lo, (u32)(res & 0xffffffff));
}
void rpsxMULTU_consts(int info) { rpsxMULTsuperconst(info, _Rt_, g_psxConstRegs[_Rs_], 0); }
void rpsxMULTU_constt(int info) { rpsxMULTsuperconst(info, _Rs_, g_psxConstRegs[_Rt_], 0); }
void rpsxMULTU_(int info) { rpsxMULTsuper(info, 0); }
PSXRECOMPILE_CONSTCODE3(MULTU, 1);
//// DIV
void rpsxDIV_const()
{
u32 lo, hi;
if (g_psxConstRegs[_Rt_] != 0) {
lo = *(int*)&g_psxConstRegs[_Rs_] / *(int*)&g_psxConstRegs[_Rt_];
hi = *(int*)&g_psxConstRegs[_Rs_] % *(int*)&g_psxConstRegs[_Rt_];
MOV32ItoM((uptr)&psxRegs.GPR.n.hi, hi);
MOV32ItoM((uptr)&psxRegs.GPR.n.lo, lo);
}
}
void rpsxDIVsuperconsts(int info, int sign)
{
u32 imm = g_psxConstRegs[_Rs_];
if( imm ) {
// Lo/Hi = Rs / Rt (signed)
MOV32MtoR(ECX, (uptr)&psxRegs.GPR.r[_Rt_]);
CMP32ItoR(ECX, 0);
j8Ptr[0] = JE8(0);
MOV32ItoR(EAX, imm);
if( sign ) {
CDQ();
IDIV32R (ECX);
}
else {
XOR32RtoR( EDX, EDX );
DIV32R(ECX);
}
MOV32RtoM((uptr)&psxRegs.GPR.n.lo, EAX);
MOV32RtoM((uptr)&psxRegs.GPR.n.hi, EDX);
x86SetJ8(j8Ptr[0]);
}
else {
XOR32RtoR(EAX, EAX);
MOV32RtoM((uptr)&psxRegs.GPR.n.hi, EAX);
MOV32RtoM((uptr)&psxRegs.GPR.n.lo, EAX);
}
}
void rpsxDIVsuperconstt(int info, int sign)
{
u32 imm = g_psxConstRegs[_Rt_];
if( imm ) {
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rs_]);
MOV32ItoR(ECX, imm);
//CDQ();
if( sign ) {
CDQ();
IDIV32R (ECX);
}
else {
XOR32RtoR( EDX, EDX );
DIV32R(ECX);
}
MOV32RtoM((uptr)&psxRegs.GPR.n.lo, EAX);
MOV32RtoM((uptr)&psxRegs.GPR.n.hi, EDX);
}
}
void rpsxDIVsuper(int info, int sign)
{
// Lo/Hi = Rs / Rt (signed)
MOV32MtoR(ECX, (uptr)&psxRegs.GPR.r[_Rt_]);
CMP32ItoR(ECX, 0);
j8Ptr[0] = JE8(0);
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rs_]);
if( sign ) {
CDQ();
IDIV32R (ECX);
}
else {
XOR32RtoR( EDX, EDX );
DIV32R(ECX);
}
MOV32RtoM((uptr)&psxRegs.GPR.n.lo, EAX);
MOV32RtoM((uptr)&psxRegs.GPR.n.hi, EDX);
x86SetJ8(j8Ptr[0]);
}
void rpsxDIV_consts(int info) { rpsxDIVsuperconsts(info, 1); }
void rpsxDIV_constt(int info) { rpsxDIVsuperconstt(info, 1); }
void rpsxDIV_(int info) { rpsxDIVsuper(info, 1); }
PSXRECOMPILE_CONSTCODE3(DIV, 1);
//// DIVU
void rpsxDIVU_const()
{
u32 lo, hi;
if (g_psxConstRegs[_Rt_] != 0) {
lo = g_psxConstRegs[_Rs_] / g_psxConstRegs[_Rt_];
hi = g_psxConstRegs[_Rs_] % g_psxConstRegs[_Rt_];
MOV32ItoM((uptr)&psxRegs.GPR.n.hi, hi);
MOV32ItoM((uptr)&psxRegs.GPR.n.lo, lo);
}
}
void rpsxDIVU_consts(int info) { rpsxDIVsuperconsts(info, 0); }
void rpsxDIVU_constt(int info) { rpsxDIVsuperconstt(info, 0); }
void rpsxDIVU_(int info) { rpsxDIVsuper(info, 0); }
PSXRECOMPILE_CONSTCODE3(DIVU, 1);
//// LoadStores
#ifdef PCSX2_VIRTUAL_MEM
// VM load store functions (fastest)
//#define REC_SLOWREAD
//#define REC_SLOWWRITE
int _psxPrepareReg(int gprreg)
{
return 0;
}
static u32 s_nAddMemOffset = 0;
#define SET_HWLOC() { \
x86SetJ8(j8Ptr[0]); \
SHR32ItoR(ECX, 3); \
if( s_nAddMemOffset ) ADD32ItoR(ECX, s_nAddMemOffset); \
} \
int rpsxSetMemLocation(int regs, int mmreg)
{
s_nAddMemOffset = 0;
MOV32MtoR( ECX, (int)&psxRegs.GPR.r[ regs ] );
if ( _Imm_ != 0 ) ADD32ItoR( ECX, _Imm_ );
SHL32ItoR(ECX, 3);
j8Ptr[0] = JS8(0);
SHR32ItoR(ECX, 3);
AND32ItoR(ECX, 0x1fffff); // 2Mb
return 1;
}
void recLoad32(u32 bit, u32 sign)
{
int mmreg = -1;
#ifdef REC_SLOWREAD
_psxFlushConstReg(_Rs_);
#else
if( PSX_IS_CONST1( _Rs_ ) ) {
// do const processing
int ineax = 0;
_psxOnWriteReg(_Rt_);
mmreg = EAX;
switch(bit) {
case 8: ineax = psxRecMemConstRead8(mmreg, g_psxConstRegs[_Rs_]+_Imm_, sign); break;
case 16:
assert( (g_psxConstRegs[_Rs_]+_Imm_) % 2 == 0 );
ineax = psxRecMemConstRead16(mmreg, g_psxConstRegs[_Rs_]+_Imm_, sign);
break;
case 32:
assert( (g_psxConstRegs[_Rs_]+_Imm_) % 4 == 0 );
ineax = psxRecMemConstRead32(mmreg, g_psxConstRegs[_Rs_]+_Imm_);
break;
}
if( _Rt_ ) MOV32RtoM( (int)&psxRegs.GPR.r[ _Rt_ ], EAX );
}
else
#endif
{
int dohw;
int mmregs = _psxPrepareReg(_Rs_);
_psxOnWriteReg(_Rt_);
_psxDeleteReg(_Rt_, 0);
dohw = rpsxSetMemLocation(_Rs_, mmregs);
switch(bit) {
case 8:
if( sign ) MOVSX32Rm8toROffset(EAX, ECX, PS2MEM_PSX_+s_nAddMemOffset);
else MOVZX32Rm8toROffset(EAX, ECX, PS2MEM_PSX_+s_nAddMemOffset);
break;
case 16:
if( sign ) MOVSX32Rm16toROffset(EAX, ECX, PS2MEM_PSX_+s_nAddMemOffset);
else MOVZX32Rm16toROffset(EAX, ECX, PS2MEM_PSX_+s_nAddMemOffset);
break;
case 32:
MOV32RmtoROffset(EAX, ECX, PS2MEM_PSX_+s_nAddMemOffset);
break;
}
if( dohw ) {
j8Ptr[1] = JMP8(0);
SET_HWLOC();
switch(bit) {
case 8:
CALLFunc( (int)psxRecMemRead8 );
if( sign ) MOVSX32R8toR(EAX, EAX);
else MOVZX32R8toR(EAX, EAX);
break;
case 16:
CALLFunc( (int)psxRecMemRead16 );
if( sign ) MOVSX32R16toR(EAX, EAX);
else MOVZX32R16toR(EAX, EAX);
break;
case 32:
CALLFunc( (int)psxRecMemRead32 );
break;
}
x86SetJ8(j8Ptr[1]);
}
if( _Rt_ )
MOV32RtoM( (int)&psxRegs.GPR.r[ _Rt_ ], EAX );
}
}
void rpsxLB() { recLoad32(8, 1); }
void rpsxLBU() { recLoad32(8, 0); }
void rpsxLH() { recLoad32(16, 1); }
void rpsxLHU() { recLoad32(16, 0); }
void rpsxLW() { recLoad32(32, 0); }
extern void rpsxMemConstClear(u32 mem);
// check if mem is executable, and clear it
__declspec(naked) void rpsxWriteMemClear()
{
_asm {
mov edx, ecx
shr edx, 14
and dl, 0xfc
add edx, psxRecLUT
test dword ptr [edx], 0xffffffff
jnz Clear32
ret
Clear32:
// recLUT[mem>>16] + (mem&0xfffc)
mov edx, dword ptr [edx]
mov eax, ecx
and eax, 0xfffc
// edx += 2*eax
shl eax, 1
add edx, eax
cmp dword ptr [edx], 0
je ClearRet
sub esp, 4
mov dword ptr [esp], edx
call psxRecClearMem
add esp, 4
ClearRet:
ret
}
}
extern u32 s_psxBlockCycles;
void recStore(int bit)
{
#ifdef REC_SLOWWRITE
_psxFlushConstReg(_Rs_);
#else
if( PSX_IS_CONST1( _Rs_ ) ) {
u8* pjmpok;
u32 addr = g_psxConstRegs[_Rs_]+_Imm_;
int doclear = 0;
if( !(addr & 0x10000000) ) {
// check g_psxWriteOk
CMP32ItoM((uptr)&g_psxWriteOk, 0);
pjmpok = JE8(0);
}
switch(bit) {
case 8:
if( PSX_IS_CONST1(_Rt_) ) doclear = psxRecMemConstWrite8(addr, MEM_PSXCONSTTAG|(_Rt_<<16));
else {
_psxMoveGPRtoR(EAX, _Rt_);
doclear = psxRecMemConstWrite8(addr, EAX);
}
break;
case 16:
assert( (addr)%2 == 0 );
if( PSX_IS_CONST1(_Rt_) ) doclear = psxRecMemConstWrite16(addr, MEM_PSXCONSTTAG|(_Rt_<<16));
else {
_psxMoveGPRtoR(EAX, _Rt_);
doclear = psxRecMemConstWrite16(addr, EAX);
}
break;
case 32:
assert( (addr)%4 == 0 );
if( PSX_IS_CONST1(_Rt_) ) doclear = psxRecMemConstWrite32(addr, MEM_PSXCONSTTAG|(_Rt_<<16));
else {
_psxMoveGPRtoR(EAX, _Rt_);
doclear = psxRecMemConstWrite32(addr, EAX);
}
break;
}
if( !(addr & 0x10000000) ) {
if( doclear ) rpsxMemConstClear((addr)&~3);
x86SetJ8(pjmpok);
}
}
else
#endif
{
int dohw;
int mmregs = _psxPrepareReg(_Rs_);
dohw = rpsxSetMemLocation(_Rs_, mmregs);
CMP32ItoM((uptr)&g_psxWriteOk, 0);
u8* pjmpok = JE8(0);
if( PSX_IS_CONST1( _Rt_ ) ) {
switch(bit) {
case 8: MOV8ItoRmOffset(ECX, g_psxConstRegs[_Rt_], PS2MEM_PSX_+s_nAddMemOffset); break;
case 16: MOV16ItoRmOffset(ECX, g_psxConstRegs[_Rt_], PS2MEM_PSX_+s_nAddMemOffset); break;
case 32: MOV32ItoRmOffset(ECX, g_psxConstRegs[_Rt_], PS2MEM_PSX_+s_nAddMemOffset); break;
}
}
else {
switch(bit) {
case 8:
MOV8MtoR(EAX, (int)&psxRegs.GPR.r[ _Rt_ ]);
MOV8RtoRmOffset(ECX, EAX, PS2MEM_PSX_+s_nAddMemOffset);
break;
case 16:
MOV16MtoR(EAX, (int)&psxRegs.GPR.r[ _Rt_ ]);
MOV16RtoRmOffset(ECX, EAX, PS2MEM_PSX_+s_nAddMemOffset);
break;
case 32:
MOV32MtoR(EAX, (int)&psxRegs.GPR.r[ _Rt_ ]);
MOV32RtoRmOffset(ECX, EAX, PS2MEM_PSX_+s_nAddMemOffset);
break;
}
}
if( s_nAddMemOffset ) ADD32ItoR(ECX, s_nAddMemOffset);
CMP32MtoR(ECX, (uptr)&g_psxMaxRecMem);
j8Ptr[1] = JAE8(0);
if( bit < 32 ) AND8ItoR(ECX, 0xfc);
CALLFunc((u32)rpsxWriteMemClear);
if( dohw ) {
j8Ptr[2] = JMP8(0);
SET_HWLOC();
if( PSX_IS_CONST1(_Rt_) ) {
switch(bit) {
case 8: MOV8ItoR(EAX, g_psxConstRegs[_Rt_]); break;
case 16: MOV16ItoR(EAX, g_psxConstRegs[_Rt_]); break;
case 32: MOV32ItoR(EAX, g_psxConstRegs[_Rt_]); break;
}
}
else {
switch(bit) {
case 8: MOV8MtoR(EAX, (int)&psxRegs.GPR.r[ _Rt_ ]); break;
case 16: MOV16MtoR(EAX, (int)&psxRegs.GPR.r[ _Rt_ ]); break;
case 32: MOV32MtoR(EAX, (int)&psxRegs.GPR.r[ _Rt_ ]); break;
}
}
if( s_nAddMemOffset != 0 ) ADD32ItoR(ECX, s_nAddMemOffset);
// some type of hardware write
switch(bit) {
case 8: CALLFunc( (int)psxRecMemWrite8 ); break;
case 16: CALLFunc( (int)psxRecMemWrite16 ); break;
case 32: CALLFunc( (int)psxRecMemWrite32 ); break;
}
x86SetJ8(j8Ptr[2]);
}
x86SetJ8(j8Ptr[1]);
x86SetJ8(pjmpok);
}
}
void rpsxSB() { recStore(8); }
void rpsxSH() { recStore(16); }
void rpsxSW() { recStore(32); }
REC_FUNC(LWL);
REC_FUNC(LWR);
REC_FUNC(SWL);
REC_FUNC(SWR);
#else
// TLB loadstore functions (slower
REC_FUNC(LWL);
REC_FUNC(LWR);
REC_FUNC(SWL);
REC_FUNC(SWR);
static void rpsxLB()
{
_psxDeleteReg(_Rs_, 1);
_psxOnWriteReg(_Rt_);
_psxDeleteReg(_Rt_, 0);
MOV32MtoR(X86ARG1, (uptr)&psxRegs.GPR.r[_Rs_]);
if (_Imm_) ADD32ItoR(X86ARG1, _Imm_);
_callFunctionArg1((uptr)psxMemRead8, X86ARG1|MEM_X86TAG, 0);
if (_Rt_) {
MOVSX32R8toR(EAX, EAX);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rt_], EAX);
}
PSX_DEL_CONST(_Rt_);
}
static void rpsxLBU()
{
_psxDeleteReg(_Rs_, 1);
_psxOnWriteReg(_Rt_);
_psxDeleteReg(_Rt_, 0);
MOV32MtoR(X86ARG1, (uptr)&psxRegs.GPR.r[_Rs_]);
if (_Imm_) ADD32ItoR(X86ARG1, _Imm_);
_callFunctionArg1((uptr)psxMemRead8, X86ARG1|MEM_X86TAG, 0);
if (_Rt_) {
MOVZX32R8toR(EAX, EAX);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rt_], EAX);
}
PSX_DEL_CONST(_Rt_);
}
static void rpsxLH()
{
_psxDeleteReg(_Rs_, 1);
_psxOnWriteReg(_Rt_);
_psxDeleteReg(_Rt_, 0);
MOV32MtoR(X86ARG1, (uptr)&psxRegs.GPR.r[_Rs_]);
if (_Imm_) ADD32ItoR(X86ARG1, _Imm_);
_callFunctionArg1((uptr)psxMemRead16, X86ARG1|MEM_X86TAG, 0);
if (_Rt_) {
MOVSX32R16toR(EAX, EAX);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rt_], EAX);
}
PSX_DEL_CONST(_Rt_);
}
static void rpsxLHU()
{
_psxDeleteReg(_Rs_, 1);
_psxOnWriteReg(_Rt_);
_psxDeleteReg(_Rt_, 0);
MOV32MtoR(X86ARG1, (uptr)&psxRegs.GPR.r[_Rs_]);
if (_Imm_) ADD32ItoR(X86ARG1, _Imm_);
_callFunctionArg1((uptr)psxMemRead16, X86ARG1|MEM_X86TAG, 0);
if (_Rt_) {
MOVZX32R16toR(EAX, EAX);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rt_], EAX);
}
PSX_DEL_CONST(_Rt_);
}
static void rpsxLW()
{
_psxDeleteReg(_Rs_, 1);
_psxOnWriteReg(_Rt_);
_psxDeleteReg(_Rt_, 0);
_psxFlushCall(FLUSH_EVERYTHING);
MOV32MtoR(X86ARG1, (uptr)&psxRegs.GPR.r[_Rs_]);
if (_Imm_) ADD32ItoR(X86ARG1, _Imm_);
#ifndef TLB_DEBUG_MEM
TEST32ItoR(X86ARG1, 0x10000000);
j8Ptr[0] = JZ8(0);
#endif
_callFunctionArg1((uptr)psxMemRead32, X86ARG1|MEM_X86TAG, 0);
if (_Rt_) {
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rt_], EAX);
}
#ifndef TLB_DEBUG_MEM
j8Ptr[1] = JMP8(0);
x86SetJ8(j8Ptr[0]);
// read from psM directly
AND32ItoR(X86ARG1, 0x1fffff);
ADD32ItoR(X86ARG1, (uptr)psxM);
MOV32RmtoR( X86ARG1, X86ARG1 );
MOV32RtoM( (uptr)&psxRegs.GPR.r[_Rt_], X86ARG1);
x86SetJ8(j8Ptr[1]);
#endif
PSX_DEL_CONST(_Rt_);
}
static void rpsxSB()
{
_psxDeleteReg(_Rs_, 1);
_psxDeleteReg(_Rt_, 1);
MOV32MtoR(X86ARG1, (uptr)&psxRegs.GPR.r[_Rs_]);
if (_Imm_) ADD32ItoR(X86ARG1, _Imm_);
_callFunctionArg2((uptr)psxMemWrite8, X86ARG1|MEM_X86TAG, MEM_MEMORYTAG, 0, (uptr)&psxRegs.GPR.r[_Rt_]);
}
static void rpsxSH()
{
_psxDeleteReg(_Rs_, 1);
_psxDeleteReg(_Rt_, 1);
MOV32MtoR(X86ARG1, (uptr)&psxRegs.GPR.r[_Rs_]);
if (_Imm_) ADD32ItoR(X86ARG1, _Imm_);
_callFunctionArg2((uptr)psxMemWrite16, X86ARG1|MEM_X86TAG, MEM_MEMORYTAG, 0, (uptr)&psxRegs.GPR.r[_Rt_]);
}
static void rpsxSW()
{
_psxDeleteReg(_Rs_, 1);
_psxDeleteReg(_Rt_, 1);
MOV32MtoR(X86ARG1, (uptr)&psxRegs.GPR.r[_Rs_]);
if (_Imm_) ADD32ItoR(X86ARG1, _Imm_);
_callFunctionArg2((uptr)psxMemWrite32, X86ARG1|MEM_X86TAG, MEM_MEMORYTAG, 0, (uptr)&psxRegs.GPR.r[_Rt_]);
}
#endif // end load store
//// SLL
void rpsxSLL_const()
{
g_psxConstRegs[_Rd_] = g_psxConstRegs[_Rt_] << _Sa_;
}
// shifttype: 0 - sll, 1 - srl, 2 - sra
void rpsxShiftConst(int info, int rdreg, int rtreg, int imm, int shifttype)
{
imm &= 0x1f;
if (imm) {
if( rdreg == rtreg ) {
switch(shifttype) {
case 0: SHL32ItoM((uptr)&psxRegs.GPR.r[rdreg], imm); break;
case 1: SHR32ItoM((uptr)&psxRegs.GPR.r[rdreg], imm); break;
case 2: SAR32ItoM((uptr)&psxRegs.GPR.r[rdreg], imm); break;
}
}
else {
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[rtreg]);
switch(shifttype) {
case 0: SHL32ItoR(EAX, imm); break;
case 1: SHR32ItoR(EAX, imm); break;
case 2: SAR32ItoR(EAX, imm); break;
}
MOV32RtoM((uptr)&psxRegs.GPR.r[rdreg], EAX);
}
}
else {
if( rdreg != rtreg ) {
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[rtreg]);
MOV32RtoM((uptr)&psxRegs.GPR.r[rdreg], EAX);
}
}
}
void rpsxSLL_(int info) { rpsxShiftConst(info, _Rd_, _Rt_, _Sa_, 0); }
PSXRECOMPILE_CONSTCODE2(SLL);
//// SRL
void rpsxSRL_const()
{
g_psxConstRegs[_Rd_] = g_psxConstRegs[_Rt_] >> _Sa_;
}
void rpsxSRL_(int info) { rpsxShiftConst(info, _Rd_, _Rt_, _Sa_, 1); }
PSXRECOMPILE_CONSTCODE2(SRL);
//// SRA
void rpsxSRA_const()
{
g_psxConstRegs[_Rd_] = *(int*)&g_psxConstRegs[_Rt_] >> _Sa_;
}
void rpsxSRA_(int info) { rpsxShiftConst(info, _Rd_, _Rt_, _Sa_, 2); }
PSXRECOMPILE_CONSTCODE2(SRA);
//// SLLV
void rpsxSLLV_const()
{
g_psxConstRegs[_Rd_] = g_psxConstRegs[_Rt_] << (g_psxConstRegs[_Rs_]&0x1f);
}
void rpsxShiftVconsts(int info, int shifttype)
{
rpsxShiftConst(info, _Rd_, _Rt_, g_psxConstRegs[_Rs_], shifttype);
}
void rpsxShiftVconstt(int info, int shifttype)
{
MOV32ItoR(EAX, g_psxConstRegs[_Rt_]);
MOV32MtoR(ECX, (uptr)&psxRegs.GPR.r[_Rs_]);
switch(shifttype) {
case 0: SHL32CLtoR(EAX); break;
case 1: SHR32CLtoR(EAX); break;
case 2: SAR32CLtoR(EAX); break;
}
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
void rpsxSLLV_consts(int info) { rpsxShiftVconsts(info, 0); }
void rpsxSLLV_constt(int info) { rpsxShiftVconstt(info, 0); }
void rpsxSLLV_(int info)
{
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rt_]);
MOV32MtoR(ECX, (uptr)&psxRegs.GPR.r[_Rs_]);
SHL32CLtoR(EAX);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
PSXRECOMPILE_CONSTCODE0(SLLV);
//// SRLV
void rpsxSRLV_const()
{
g_psxConstRegs[_Rd_] = g_psxConstRegs[_Rt_] >> (g_psxConstRegs[_Rs_]&0x1f);
}
void rpsxSRLV_consts(int info) { rpsxShiftVconsts(info, 1); }
void rpsxSRLV_constt(int info) { rpsxShiftVconstt(info, 1); }
void rpsxSRLV_(int info)
{
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rt_]);
MOV32MtoR(ECX, (uptr)&psxRegs.GPR.r[_Rs_]);
SHR32CLtoR(EAX);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
PSXRECOMPILE_CONSTCODE0(SRLV);
//// SRAV
void rpsxSRAV_const()
{
g_psxConstRegs[_Rd_] = *(int*)&g_psxConstRegs[_Rt_] >> (g_psxConstRegs[_Rs_]&0x1f);
}
void rpsxSRAV_consts(int info) { rpsxShiftVconsts(info, 2); }
void rpsxSRAV_constt(int info) { rpsxShiftVconstt(info, 2); }
void rpsxSRAV_(int info)
{
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rt_]);
MOV32MtoR(ECX, (uptr)&psxRegs.GPR.r[_Rs_]);
SAR32CLtoR(EAX);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
PSXRECOMPILE_CONSTCODE0(SRAV);
extern void rpsxSYSCALL();
extern void rpsxBREAK();
void rpsxMFHI()
{
if (!_Rd_) return;
_psxOnWriteReg(_Rd_);
_psxDeleteReg(_Rd_, 0);
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.n.hi);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
void rpsxMTHI()
{
if( PSX_IS_CONST1(_Rs_) ) {
MOV32ItoM((uptr)&psxRegs.GPR.n.hi, g_psxConstRegs[_Rs_]);
}
else {
_psxDeleteReg(_Rs_, 1);
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rs_]);
MOV32RtoM((uptr)&psxRegs.GPR.n.hi, EAX);
}
}
void rpsxMFLO()
{
if (!_Rd_) return;
_psxOnWriteReg(_Rd_);
_psxDeleteReg(_Rd_, 0);
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.n.lo);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rd_], EAX);
}
void rpsxMTLO()
{
if( PSX_IS_CONST1(_Rs_) ) {
MOV32ItoM((uptr)&psxRegs.GPR.n.hi, g_psxConstRegs[_Rs_]);
}
else {
_psxDeleteReg(_Rs_, 1);
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rs_]);
MOV32RtoM((uptr)&psxRegs.GPR.n.lo, EAX);
}
}
void rpsxJ()
{
// j target
u32 newpc = _Target_ * 4 + (psxpc & 0xf0000000);
psxRecompileNextInstruction(1);
psxSetBranchImm(newpc);
}
void rpsxJAL()
{
u32 newpc = (_Target_ << 2) + ( psxpc & 0xf0000000 );
_psxDeleteReg(31, 0);
PSX_SET_CONST(31);
g_psxConstRegs[31] = psxpc + 4;
psxRecompileNextInstruction(1);
psxSetBranchImm(newpc);
}
void rpsxJR()
{
psxSetBranchReg(_Rs_);
}
void rpsxJALR()
{
// jalr Rs
_allocX86reg(ESI, X86TYPE_PCWRITEBACK, 0, MODE_WRITE);
_psxMoveGPRtoR(ESI, _Rs_);
if ( _Rd_ )
{
_psxDeleteReg(_Rd_, 0);
PSX_SET_CONST(_Rd_);
g_psxConstRegs[_Rd_] = psxpc + 4;
}
psxRecompileNextInstruction(1);
if( x86regs[ESI].inuse ) {
assert( x86regs[ESI].type == X86TYPE_PCWRITEBACK );
MOV32RtoM((uptr)&psxRegs.pc, ESI);
x86regs[ESI].inuse = 0;
}
else {
MOV32MtoR(EAX, (uptr)&g_recWriteback);
MOV32RtoM((uptr)&psxRegs.pc, EAX);
}
psxSetBranchReg(0xffffffff);
}
//// BEQ
static void* s_pbranchjmp;
static u32 s_do32 = 0;
#define JUMPVALID(pjmp) (( x86Ptr - (s8*)pjmp ) <= 0x80)
void rpsxSetBranchEQ(int info, int process)
{
if( process & PROCESS_CONSTS ) {
CMP32ItoM( (uptr)&psxRegs.GPR.r[ _Rt_ ], g_psxConstRegs[_Rs_] );
if( s_do32 ) s_pbranchjmp = JNE32( 0 );
else s_pbranchjmp = JNE8( 0 );
}
else if( process & PROCESS_CONSTT ) {
CMP32ItoM( (uptr)&psxRegs.GPR.r[ _Rs_ ], g_psxConstRegs[_Rt_] );
if( s_do32 ) s_pbranchjmp = JNE32( 0 );
else s_pbranchjmp = JNE8( 0 );
}
else {
MOV32MtoR( EAX, (uptr)&psxRegs.GPR.r[ _Rs_ ] );
CMP32MtoR( EAX, (uptr)&psxRegs.GPR.r[ _Rt_ ] );
if( s_do32 ) s_pbranchjmp = JNE32( 0 );
else s_pbranchjmp = JNE8( 0 );
}
}
void rpsxBEQ_const()
{
u32 branchTo;
if( g_psxConstRegs[_Rs_] == g_psxConstRegs[_Rt_] )
branchTo = ((s32)_Imm_ * 4) + psxpc;
else
branchTo = psxpc+4;
psxRecompileNextInstruction(1);
psxSetBranchImm( branchTo );
}
void rpsxBEQ_process(int info, int process)
{
u32 branchTo = ((s32)_Imm_ * 4) + psxpc;
if ( _Rs_ == _Rt_ )
{
psxRecompileNextInstruction(1);
psxSetBranchImm( branchTo );
}
else
{
_psxFlushAllUnused();
s8* prevx86 = x86Ptr;
s_do32 = 0;
psxSaveBranchState();
rpsxSetBranchEQ(info, process);
psxRecompileNextInstruction(1);
psxSetBranchImm(branchTo);
if( JUMPVALID(s_pbranchjmp) ) {
x86SetJ8A( (u8*)s_pbranchjmp );
}
else {
x86Ptr = prevx86;
s_do32 = 1;
psxpc -= 4;
psxRegs.code = *(u32*)PSXM( psxpc - 4 );
psxLoadBranchState();
rpsxSetBranchEQ(info, process);
psxRecompileNextInstruction(1);
psxSetBranchImm(branchTo);
x86SetJ32A( (u32*)s_pbranchjmp );
}
// recopy the next inst
psxpc -= 4;
psxLoadBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
}
}
void rpsxBEQ_(int info) { rpsxBEQ_process(info, 0); }
void rpsxBEQ_consts(int info) { rpsxBEQ_process(info, PROCESS_CONSTS); }
void rpsxBEQ_constt(int info) { rpsxBEQ_process(info, PROCESS_CONSTT); }
PSXRECOMPILE_CONSTCODE3(BEQ, 0);
//// BNE
void rpsxBNE_const()
{
u32 branchTo;
if( g_psxConstRegs[_Rs_] != g_psxConstRegs[_Rt_] )
branchTo = ((s32)_Imm_ * 4) + psxpc;
else
branchTo = psxpc+4;
psxRecompileNextInstruction(1);
psxSetBranchImm( branchTo );
}
void rpsxBNE_process(int info, int process)
{
u32 branchTo = ((s32)_Imm_ * 4) + psxpc;
if ( _Rs_ == _Rt_ )
{
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
return;
}
_psxFlushAllUnused();
s8* prevx86 = x86Ptr;
s_do32 = 0;
rpsxSetBranchEQ(info, process);
psxSaveBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
if( JUMPVALID(s_pbranchjmp) ) {
x86SetJ8A( (u8*)s_pbranchjmp );
}
else {
x86Ptr = prevx86;
s_do32 = 1;
psxpc -= 4;
psxRegs.code = *(u32*)PSXM( psxpc - 4 );
psxLoadBranchState();
rpsxSetBranchEQ(info, process);
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
x86SetJ32A( (u32*)s_pbranchjmp );
}
// recopy the next inst
psxpc -= 4;
psxLoadBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(branchTo);
}
void rpsxBNE_(int info) { rpsxBNE_process(info, 0); }
void rpsxBNE_consts(int info) { rpsxBNE_process(info, PROCESS_CONSTS); }
void rpsxBNE_constt(int info) { rpsxBNE_process(info, PROCESS_CONSTT); }
PSXRECOMPILE_CONSTCODE3(BNE, 0);
//// BLTZ
void rpsxBLTZ()
{
// Branch if Rs < 0
u32 branchTo = (s32)_Imm_ * 4 + psxpc;
_psxFlushAllUnused();
if( PSX_IS_CONST1(_Rs_) ) {
if( (int)g_psxConstRegs[_Rs_] >= 0 )
branchTo = psxpc+4;
psxRecompileNextInstruction(1);
psxSetBranchImm( branchTo );
return;
}
CMP32ItoM((uptr)&psxRegs.GPR.r[_Rs_], 0);
s8* prevx86 = x86Ptr;
u8* pjmp = JL8(0);
psxSaveBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
if( JUMPVALID(pjmp) ) {
x86SetJ8A( pjmp );
}
else {
x86Ptr = prevx86;
psxpc -= 4;
psxRegs.code = *(u32*)PSXM( psxpc - 4 );
psxLoadBranchState();
u32* pjmp32 = JL32(0);
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
x86SetJ32A( pjmp32 );
}
// recopy the next inst
psxpc -= 4;
psxLoadBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(branchTo);
}
//// BGEZ
void rpsxBGEZ()
{
u32 branchTo = ((s32)_Imm_ * 4) + psxpc;
_psxFlushAllUnused();
if( PSX_IS_CONST1(_Rs_) ) {
if( g_psxConstRegs[_Rs_] < 0 )
branchTo = psxpc+4;
psxRecompileNextInstruction(1);
psxSetBranchImm( branchTo );
return;
}
CMP32ItoM((uptr)&psxRegs.GPR.r[_Rs_], 0);
s8* prevx86 = x86Ptr;
u8* pjmp = JGE8(0);
psxSaveBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
if( JUMPVALID(pjmp) ) {
x86SetJ8A( pjmp );
}
else {
x86Ptr = prevx86;
psxpc -= 4;
psxRegs.code = *(u32*)PSXM( psxpc - 4 );
psxLoadBranchState();
u32* pjmp32 = JGE32(0);
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
x86SetJ32A( pjmp32 );
}
// recopy the next inst
psxpc -= 4;
psxLoadBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(branchTo);
}
//// BLTZAL
void rpsxBLTZAL()
{
// Branch if Rs < 0
u32 branchTo = (s32)_Imm_ * 4 + psxpc;
_psxFlushConstReg(31);
_psxDeleteReg(31, 0);
_psxFlushAllUnused();
if( PSX_IS_CONST1(_Rs_) ) {
if( (int)g_psxConstRegs[_Rs_] >= 0 )
branchTo = psxpc+4;
else {
PSX_SET_CONST(_Rt_);
g_psxConstRegs[31] = psxpc+4;
}
psxRecompileNextInstruction(1);
psxSetBranchImm( branchTo );
return;
}
CMP32ItoM((uptr)&psxRegs.GPR.r[_Rs_], 0);
s8* prevx86 = x86Ptr;
u8* pjmp = JL8(0);
psxSaveBranchState();
MOV32ItoM((uptr)&psxRegs.GPR.r[31], psxpc+4);
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
if( JUMPVALID(pjmp) ) {
x86SetJ8A( pjmp );
}
else {
x86Ptr = prevx86;
psxpc -= 4;
psxRegs.code = *(u32*)PSXM( psxpc - 4 );
psxLoadBranchState();
u32* pjmp32 = JL32(0);
MOV32ItoM((uptr)&psxRegs.GPR.r[31], psxpc+4);
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
x86SetJ32A( pjmp32 );
}
// recopy the next inst
psxpc -= 4;
psxLoadBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(branchTo);
}
//// BGEZAL
void rpsxBGEZAL()
{
u32 branchTo = ((s32)_Imm_ * 4) + psxpc;
_psxFlushConstReg(31);
_psxDeleteReg(31, 0);
_psxFlushAllUnused();
if( PSX_IS_CONST1(_Rs_) ) {
if( g_psxConstRegs[_Rs_] < 0 )
branchTo = psxpc+4;
else MOV32ItoM((uptr)&psxRegs.GPR.r[31], psxpc+4);
psxRecompileNextInstruction(1);
psxSetBranchImm( branchTo );
return;
}
CMP32ItoM((uptr)&psxRegs.GPR.r[_Rs_], 0);
s8* prevx86 = x86Ptr;
u8* pjmp = JGE8(0);
MOV32ItoM((uptr)&psxRegs.GPR.r[31], psxpc+4);
psxSaveBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
if( JUMPVALID(pjmp) ) {
x86SetJ8A( pjmp );
}
else {
x86Ptr = prevx86;
psxpc -= 4;
psxRegs.code = *(u32*)PSXM( psxpc - 4 );
psxLoadBranchState();
u32* pjmp32 = JGE32(0);
MOV32ItoM((uptr)&psxRegs.GPR.r[31], psxpc+4);
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
x86SetJ32A( pjmp32 );
}
// recopy the next inst
psxpc -= 4;
psxLoadBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(branchTo);
}
//// BLEZ
void rpsxBLEZ()
{
// Branch if Rs <= 0
u32 branchTo = (s32)_Imm_ * 4 + psxpc;
_psxFlushAllUnused();
if( PSX_IS_CONST1(_Rs_) ) {
if( (int)g_psxConstRegs[_Rs_] > 0 )
branchTo = psxpc+4;
psxRecompileNextInstruction(1);
psxSetBranchImm( branchTo );
return;
}
_psxDeleteReg(_Rs_, 1);
_clearNeededX86regs();
CMP32ItoM((uptr)&psxRegs.GPR.r[_Rs_], 0);
s8* prevx86 = x86Ptr;
u8* pjmp = JLE8(0);
psxSaveBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
if( JUMPVALID(pjmp) ) {
x86SetJ8A( pjmp );
}
else {
x86Ptr = prevx86;
psxpc -= 4;
psxRegs.code = *(u32*)PSXM( psxpc - 4 );
psxLoadBranchState();
u32* pjmp32 = JLE32(0);
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
x86SetJ32A( pjmp32 );
}
psxpc -= 4;
psxLoadBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(branchTo);
}
//// BGTZ
void rpsxBGTZ()
{
// Branch if Rs > 0
u32 branchTo = (s32)_Imm_ * 4 + psxpc;
_psxFlushAllUnused();
if( PSX_IS_CONST1(_Rs_) ) {
if( (int)g_psxConstRegs[_Rs_] <= 0 )
branchTo = psxpc+4;
psxRecompileNextInstruction(1);
psxSetBranchImm( branchTo );
return;
}
_psxDeleteReg(_Rs_, 1);
_clearNeededX86regs();
CMP32ItoM((uptr)&psxRegs.GPR.r[_Rs_], 0);
s8* prevx86 = x86Ptr;
u8* pjmp = JG8(0);
psxSaveBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
if( JUMPVALID(pjmp) ) {
x86SetJ8A( pjmp );
}
else {
x86Ptr = prevx86;
psxpc -= 4;
psxRegs.code = *(u32*)PSXM( psxpc - 4 );
psxLoadBranchState();
u32* pjmp32 = JG32(0);
psxRecompileNextInstruction(1);
psxSetBranchImm(psxpc);
x86SetJ32A( pjmp32 );
}
psxpc -= 4;
psxLoadBranchState();
psxRecompileNextInstruction(1);
psxSetBranchImm(branchTo);
}
void rpsxMFC0()
{
// Rt = Cop0->Rd
if (!_Rt_) return;
_psxOnWriteReg(_Rt_);
MOV32MtoR(EAX, (uptr)&psxRegs.CP0.r[_Rd_]);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rt_], EAX);
}
void rpsxCFC0()
{
// Rt = Cop0->Rd
if (!_Rt_) return;
_psxOnWriteReg(_Rt_);
MOV32MtoR(EAX, (uptr)&psxRegs.CP0.r[_Rd_]);
MOV32RtoM((uptr)&psxRegs.GPR.r[_Rt_], EAX);
}
void rpsxMTC0()
{
// Cop0->Rd = Rt
if( PSX_IS_CONST1(_Rt_) ) {
MOV32ItoM((uptr)&psxRegs.CP0.r[_Rd_], g_psxConstRegs[_Rt_]);
}
else {
_psxDeleteReg(_Rt_, 1);
MOV32MtoR(EAX, (uptr)&psxRegs.GPR.r[_Rt_]);
MOV32RtoM((uptr)&psxRegs.CP0.r[_Rd_], EAX);
}
}
void rpsxCTC0()
{
// Cop0->Rd = Rt
rpsxMTC0();
}
void rpsxRFE()
{
MOV32MtoR(EAX, (uptr)&psxRegs.CP0.n.Status);
MOV32RtoR(ECX, EAX);
AND32ItoR(EAX, 0xfffffff0);
AND32ItoR(ECX, 0x3c);
SHR32ItoR(ECX, 2);
OR32RtoR (EAX, ECX);
MOV32RtoM((uptr)&psxRegs.CP0.n.Status, EAX);
}
// R3000A tables
extern void (*rpsxBSC[64])();
extern void (*rpsxSPC[64])();
extern void (*rpsxREG[32])();
extern void (*rpsxCP0[32])();
extern void (*rpsxCP2[64])();
extern void (*rpsxCP2BSC[32])();
static void rpsxSPECIAL() { rpsxSPC[_Funct_](); }
static void rpsxREGIMM() { rpsxREG[_Rt_](); }
static void rpsxCOP0() { rpsxCP0[_Rs_](); }
//static void rpsxBASIC() { rpsxCP2BSC[_Rs_](); }
static void rpsxNULL() {
SysPrintf("psxUNK: %8.8x\n", psxRegs.code);
}
void (*rpsxBSC[64])() = {
rpsxSPECIAL, rpsxREGIMM, rpsxJ , rpsxJAL , rpsxBEQ , rpsxBNE , rpsxBLEZ, rpsxBGTZ,
rpsxADDI , rpsxADDIU , rpsxSLTI, rpsxSLTIU, rpsxANDI, rpsxORI , rpsxXORI, rpsxLUI ,
rpsxCOP0 , rpsxNULL , rpsxNULL, rpsxNULL , rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxNULL , rpsxNULL , rpsxNULL, rpsxNULL , rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxLB , rpsxLH , rpsxLWL , rpsxLW , rpsxLBU , rpsxLHU , rpsxLWR , rpsxNULL,
rpsxSB , rpsxSH , rpsxSWL , rpsxSW , rpsxNULL, rpsxNULL, rpsxSWR , rpsxNULL,
rpsxNULL , rpsxNULL , rpsxNULL, rpsxNULL , rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxNULL , rpsxNULL , rpsxNULL, rpsxNULL , rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL
};
void (*rpsxSPC[64])() = {
rpsxSLL , rpsxNULL, rpsxSRL , rpsxSRA , rpsxSLLV , rpsxNULL , rpsxSRLV, rpsxSRAV,
rpsxJR , rpsxJALR, rpsxNULL, rpsxNULL, rpsxSYSCALL, rpsxBREAK, rpsxNULL, rpsxNULL,
rpsxMFHI, rpsxMTHI, rpsxMFLO, rpsxMTLO, rpsxNULL , rpsxNULL , rpsxNULL, rpsxNULL,
rpsxMULT, rpsxMULTU, rpsxDIV, rpsxDIVU, rpsxNULL , rpsxNULL , rpsxNULL, rpsxNULL,
rpsxADD , rpsxADDU, rpsxSUB , rpsxSUBU, rpsxAND , rpsxOR , rpsxXOR , rpsxNOR ,
rpsxNULL, rpsxNULL, rpsxSLT , rpsxSLTU, rpsxNULL , rpsxNULL , rpsxNULL, rpsxNULL,
rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL , rpsxNULL , rpsxNULL, rpsxNULL,
rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL , rpsxNULL , rpsxNULL, rpsxNULL
};
void (*rpsxREG[32])() = {
rpsxBLTZ , rpsxBGEZ , rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxNULL , rpsxNULL , rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxBLTZAL, rpsxBGEZAL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxNULL , rpsxNULL , rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL
};
void (*rpsxCP0[32])() = {
rpsxMFC0, rpsxNULL, rpsxCFC0, rpsxNULL, rpsxMTC0, rpsxNULL, rpsxCTC0, rpsxNULL,
rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxRFE , rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL
};
// coissued insts
void (*rpsxBSC_co[64] )() = {
rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL, rpsxNULL,
};
////////////////////////////////////////////////
// Back-Prob Function Tables - Gathering Info //
////////////////////////////////////////////////
#define rpsxpropSetRead(reg) { \
if( !(pinst->regs[reg] & EEINST_USED) ) \
pinst->regs[reg] |= EEINST_LASTUSE; \
prev->regs[reg] |= EEINST_LIVE0|EEINST_USED; \
pinst->regs[reg] |= EEINST_USED; \
_recFillRegister(pinst, XMMTYPE_GPRREG, reg, 0); \
} \
#define rpsxpropSetWrite(reg) { \
prev->regs[reg] &= ~EEINST_LIVE0; \
if( !(pinst->regs[reg] & EEINST_USED) ) \
pinst->regs[reg] |= EEINST_LASTUSE; \
pinst->regs[reg] |= EEINST_USED; \
prev->regs[reg] |= EEINST_USED; \
_recFillRegister(pinst, XMMTYPE_GPRREG, reg, 1); \
}
void rpsxpropBSC(EEINST* prev, EEINST* pinst);
void rpsxpropSPECIAL(EEINST* prev, EEINST* pinst);
void rpsxpropREGIMM(EEINST* prev, EEINST* pinst);
void rpsxpropCP0(EEINST* prev, EEINST* pinst);
void rpsxpropCP2(EEINST* prev, EEINST* pinst);
//SPECIAL, REGIMM, J , JAL , BEQ , BNE , BLEZ, BGTZ,
//ADDI , ADDIU , SLTI, SLTIU, ANDI, ORI , XORI, LUI ,
//COP0 , NULL , COP2, NULL , NULL, NULL, NULL, NULL,
//NULL , NULL , NULL, NULL , NULL, NULL, NULL, NULL,
//LB , LH , LWL , LW , LBU , LHU , LWR , NULL,
//SB , SH , SWL , SW , NULL, NULL, SWR , NULL,
//NULL , NULL , NULL, NULL , NULL, NULL, NULL, NULL,
//NULL , NULL , NULL, NULL , NULL, NULL, NULL, NULL
void rpsxpropBSC(EEINST* prev, EEINST* pinst)
{
switch(psxRegs.code >> 26) {
case 0: rpsxpropSPECIAL(prev, pinst); break;
case 1: rpsxpropREGIMM(prev, pinst); break;
case 2: // j
break;
case 3: // jal
rpsxpropSetWrite(31);
break;
case 4: // beq
case 5: // bne
rpsxpropSetRead(_Rs_);
rpsxpropSetRead(_Rt_);
break;
case 6: // blez
case 7: // bgtz
rpsxpropSetRead(_Rs_);
break;
case 15: // lui
rpsxpropSetWrite(_Rt_);
break;
case 16: rpsxpropCP0(prev, pinst); break;
case 18: assert(0); break;
// stores
case 40: case 41: case 42: case 43: case 46:
rpsxpropSetRead(_Rt_);
rpsxpropSetRead(_Rs_);
break;
default:
rpsxpropSetWrite(_Rt_);
rpsxpropSetRead(_Rs_);
break;
}
}
//SLL , NULL, SRL , SRA , SLLV , NULL , SRLV, SRAV,
//JR , JALR, NULL, NULL, SYSCALL, BREAK, NULL, NULL,
//MFHI, MTHI, MFLO, MTLO, NULL , NULL , NULL, NULL,
//MULT, MULTU, DIV, DIVU, NULL , NULL , NULL, NULL,
//ADD , ADDU, SUB , SUBU, AND , OR , XOR , NOR ,
//NULL, NULL, SLT , SLTU, NULL , NULL , NULL, NULL,
//NULL, NULL, NULL, NULL, NULL , NULL , NULL, NULL,
//NULL, NULL, NULL, NULL, NULL , NULL , NULL, NULL
void rpsxpropSPECIAL(EEINST* prev, EEINST* pinst)
{
switch(_Funct_) {
case 0: // SLL
case 2: // SRL
case 3: // SRA
rpsxpropSetWrite(_Rd_);
rpsxpropSetRead(_Rt_);
break;
case 8: // JR
rpsxpropSetRead(_Rs_);
break;
case 9: // JALR
rpsxpropSetWrite(_Rd_);
rpsxpropSetRead(_Rs_);
break;
case 12: // syscall
case 13: // break
_recClearInst(prev);
prev->info = 0;
break;
case 15: // sync
break;
case 16: // mfhi
rpsxpropSetWrite(_Rd_);
rpsxpropSetRead(PSX_HI);
break;
case 17: // mthi
rpsxpropSetWrite(PSX_HI);
rpsxpropSetRead(_Rs_);
break;
case 18: // mflo
rpsxpropSetWrite(_Rd_);
rpsxpropSetRead(PSX_LO);
break;
case 19: // mtlo
rpsxpropSetWrite(PSX_LO);
rpsxpropSetRead(_Rs_);
break;
case 24: // mult
case 25: // multu
case 26: // div
case 27: // divu
rpsxpropSetWrite(PSX_LO);
rpsxpropSetWrite(PSX_HI);
rpsxpropSetRead(_Rs_);
rpsxpropSetRead(_Rt_);
break;
case 32: // add
case 33: // addu
case 34: // sub
case 35: // subu
rpsxpropSetWrite(_Rd_);
if( _Rs_ ) rpsxpropSetRead(_Rs_);
if( _Rt_ ) rpsxpropSetRead(_Rt_);
break;
default:
rpsxpropSetWrite(_Rd_);
rpsxpropSetRead(_Rs_);
rpsxpropSetRead(_Rt_);
break;
}
}
//BLTZ , BGEZ , NULL, NULL, NULL, NULL, NULL, NULL,
//NULL , NULL , NULL, NULL, NULL, NULL, NULL, NULL,
//BLTZAL, BGEZAL, NULL, NULL, NULL, NULL, NULL, NULL,
//NULL , NULL , NULL, NULL, NULL, NULL, NULL, NULL
void rpsxpropREGIMM(EEINST* prev, EEINST* pinst)
{
switch(_Rt_) {
case 0: // bltz
case 1: // bgez
rpsxpropSetRead(_Rs_);
break;
case 16: // bltzal
case 17: // bgezal
// do not write 31
rpsxpropSetRead(_Rs_);
break;
default:
assert(0);
break;
}
}
//MFC0, NULL, CFC0, NULL, MTC0, NULL, CTC0, NULL,
//NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
//RFE , NULL, NULL, NULL, NULL, NULL, NULL, NULL,
//NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
void rpsxpropCP0(EEINST* prev, EEINST* pinst)
{
switch(_Rs_) {
case 0: // mfc0
case 2: // cfc0
rpsxpropSetWrite(_Rt_);
break;
case 4: // mtc0
case 6: // ctc0
rpsxpropSetRead(_Rt_);
break;
case 16: // rfe
break;
default:
assert(0);
}
}
#endif // PCSX2_NORECBUILD
| [
"zerofrog@23c756db-88ba-2448-99d7-e6e4c676ec84",
"gigaherz@23c756db-88ba-2448-99d7-e6e4c676ec84"
]
| [
[
[
1,
1
],
[
3,
3
],
[
17,
2053
]
],
[
[
2,
2
],
[
4,
16
]
]
]
|
f9ec6c9da0823c77db2aa2ab1bb378c8343bd88e | bfdfb7c406c318c877b7cbc43bc2dfd925185e50 | /compiler/hyCContext.h | e1d79c2eab9805625e75ab06d78e933b2a465e56 | [
"MIT"
]
| permissive | ysei/Hayat | 74cc1e281ae6772b2a05bbeccfcf430215cb435b | b32ed82a1c6222ef7f4bf0fc9dedfad81280c2c0 | refs/heads/master | 2020-12-11T09:07:35.606061 | 2011-08-01T12:38:39 | 2011-08-01T12:38:39 | null | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 12,296 | h | /* -*- coding: sjis-dos; -*- */
/*
* copyright 2010 FUKUZAWA Tadashi. All rights reserved.
*/
#ifndef m_HYCCONTEXT_H_
#define m_HYCCONTEXT_H_
#include "hyStack.h"
#include "hyArray.h"
#include "hyCSymbolTable.h"
#include "hyCBytecode.h"
#include "hyCPackage.h"
#include "hyCJumpControlTree.h"
#include "hyCSignature.h"
#include "hyC_opcode.h"
#include <stdio.h>
class Test_hyCContext;
namespace Hayat {
namespace Compiler {
class JumpControlTree;
class Context {
friend class ::Test_hyCContext;
public:
static void* operator new(size_t size);
static void operator delete(void* p);
// 全体の初期化
static void initializeAll(void);
// 全体の後始末
static void finalizeAll(void);
// カレントコンテキストを返す
static Context* current(void) { return m_current; }
// パッケージクラスコンテキストを作って最初のコンテキストとする
static void newPackageClass(ClassInfo*);
// コンテキストをスタックに積み、カレントとする
static void push(Context* child);
// スタックからカレントを降ろして1つ前のをカレントとする
static void pop(void);
// カレントの子コンテキストを作ってスタックに積み、新たなカレントとする
static Context* createChild(void);
// カレントのインナークラスコンテキストを作ってスタックに積み、カレントとする
static Context* createInnerClass(SymbolID_t classSym);
// 現パッケージを取得
static Package* getPackage(void) { return m_package; }
// sayCommandStart()に渡すシリアルナンバー
static hys32 sayCommandIndexCount(void) { return m_sayCommandIndex++; }
// sayCommandStart()に渡すシリアルナンバー:カウントアップしない
static hys32 sayCommandIndex(void) { return m_sayCommandIndex; }
// goto の飛び先ラベルが全Context中にあるかどうかチェック
static void jumpLabelCheck(void);
protected:
static Stack<Context*> m_contextStack;
static Context* m_current; // カレントコンテキスト
static TArray<Context*> m_pool; // 全Contextを記憶
static Package* m_package;
static hys32 m_sayCommandIndex;
public:
Context(Context* outerContext = NULL);
~Context();
ClassInfo* classInfo(void) { return m_classInfo; }
Context* outerContext(void) { return m_outerContext; }
// class開始
void newClass(SymbolID_t classSym);
// スーパークラス追加
void addSuper(SymbolID_t superClassSym, Context* searchContext);
// 最終調整
void postCompileProcess(hyu16 defaultValOffs, hyu16 signatureID);
// スコープに対応するClassInfoを検索
ClassInfo* getScopeClassInfo(Scope_t scope, bool ignoreUsing = false);
typedef struct {
hys16 idx; // インデックス
hys16 outerIdx; // 外側contextと共有の場合
bool substFlag; // 代入フラグ
} LocalVar_t;
static const hys16 NO_LOCAL_VAR = (hys16)0x8000; // ローカル変数が存在しないという意味のidx
// ====== 識別子の検索 ======
// 今のスコープと外のスコープにローカル変数があるか
LocalVar_t* getMyLocalVar(const char* p, hyu32 len, LocalVarSymID_t* pSym = NULL);
// 今のスコープと親クラスに識別子があるか
Var_t myIdent(const char* p, hyu32 len);
Var_t myIdent(InputBuffer* inp, Substr_st& ss) {
return myIdent(inp->addr(ss.startPos),ss.len()); }
Var_t searchVar(const char* p, hyu32 len);
Var_t searchVar(InputBuffer* inp, Substr_st& ss) {
return searchVar(inp->addr(ss.startPos),ss.len()); }
// ローカル変数が存在すればそれを返す(外側コンテキストは無視)
LocalVar_t* getLocalVar(LocalVarSymID_t varSym) { return m_localVars.find(varSym); }
// 外側コンテキストの可視ローカル変数を返す
LocalVar_t* getOuterLocalVar(SymbolID_t varSym);
// 可視ローカル変数が無ければ作成
LocalVar_t& getLocalVarCreate(LocalVarSymID_t varSym);
// メソッドが最初に確保すべきローカル変数の数
int numLocalVarAlloc(void) { return m_localVars.size() - m_numParamVar; }
// メソッド仮引数作成
void createParamVar(LocalVarSymID_t varSym);
// シグネチャバイト列をIDに変換
hyu16 getSignatureID(const hyu8* sigBytes, hyu32 len) {
return m_package->getSignatureID(sigBytes, len); }
// 代入の無いローカル変数をチェック
void checkNoSubstLocalVar(void);
// 保持しているバイトコード
Bytecode& bytecode(void) { return m_bytecode; }
// 他パッケージリンク
void require(SymbolID_t sym) { m_package->require(sym); }
template <typename OPCODE> void addCode(void) {
OPCODE::addCodeTo(m_bytecode);
}
template <typename OPCODE, typename OPERAND1> void addCode(OPERAND1 opr1) {
OPCODE::addCodeTo(m_bytecode, opr1);
}
template <typename OPCODE, typename OPERAND1, typename OPERAND2> void addCode(OPERAND1 opr1, OPERAND2 opr2) {
OPCODE::addCodeTo(m_bytecode, opr1, opr2);
}
template <typename OPCODE, typename OPERAND1, typename OPERAND2, typename OPERAND3> void addCode(OPERAND1 opr1, OPERAND2 opr2, OPERAND3 opr3) {
OPCODE::addCodeTo(m_bytecode, opr1, opr2, opr3);
}
void addCodePushInt(hys32 v);
void addCodePushFloat(hyf32 v);
bool removeLastPop(void) { return m_bytecode.removeLastCode(OPL_pop); }
void setClosureContext(void) { m_bClosureContext = true; m_canSeeOuterLocal = true; }
bool isClosureContext(void) { return m_bClosureContext; }
// メソッド追加
void addMethod(SymbolID_t methodSym, Context* methodContext);
// インナークラス登録
void addInnerClass(Context* classContext);
// クロージャ登録
void addClosure(Context* callContext, Context* closureContext);
// 現在のバイトコード登録位置
hyu32 codeAddr(void) { return m_bytecode.getSize(); }
// ラベル登録
void addLabel(SymbolID_t labelSym) {
m_jumpControlInfo->addLabel(labelSym, codeAddr());
}
// jump controlにおけるジャンプコード追加
template <typename OP_JMP> hyu32 addGotoCode(SymbolID_t labelSym = SYMBOL_ID_ERROR) {
hyu32 pos = codeAddr() + 1;
if (labelSym == SYMBOL_ID_ERROR) {
addCode<OP_JMP>(-2);
} else {
hyu32 adr = m_jumpControlInfo->getLocalLabelAddr(labelSym);
if (adr == JumpControlTree::INVALID_ADDR) {
// 未解決ラベル
addCode<OP_JMP>(-3);
m_jumpControlInfo->addResolveAddr(labelSym, pos);
} else {
addCode<OP_JMP>(adr - pos - OPR_RELATIVE::SIZE);
}
}
return pos;
}
// jump control 開始
void jumpControlStart(SymbolID_t catchVar = SYMBOL_ID_ERROR, SymbolID_t finallyValVar = SYMBOL_ID_ERROR);
// jump control 終了
void jumpControlEnd(void);
// jump controlのアドレス解決
void resolveJumpControl(void);
// ジャンプアドレス解決 jumpAddrを省略すると現在位置
void resolveJumpAddr(hyu32 resolveAddr, hyu32 jumpAddr = JumpControlTree::INVALID_ADDR);
// jump命令をjumpControl命令に置き換える
void replaceJumpControl(hyu32 resolveAddr, SymbolID_t label);
// finallyで使用する一時的な変数を用意
LocalVarSymID_t useFinallyValVar(void);
// finallyでの一時変数使用終了
void endUseFinallyValVar(void);
// ジャンプラベルが登録されているか
bool haveLabel(SymbolID_t label);
// resolve後に解決されなかったジャンプラベル
const TArray<SymbolID_t>& getUnresolvedJumpControlLabels(void) { return m_unresolvedJumpControlLabels; }
// ソースコード位置情報をセット
void setSourceInfo(hyu32 parsePos);
// バイトコード情報をArrayに出力
void writeByteCodes(TArray<hyu8>* out);
// バイトコード情報をファイル出力
void fwriteByteCodes(FILE* fp);
// パッケージリンク情報をファイル出力
void fwriteLinks(FILE* fp);
// デバッグ情報をファイル出力
void fwriteDebugInfo(FILE* fp, hyu32 offs);
// FFI宣言からC++ソースを作成
void writeFfi(void);
// FFI呼出し用関数テーブルのC++ソースを出力
void writeFfiTbl(const char* ffiTblFileName);
protected:
// 自分のレベル以下のデバッグ情報をファイル出力
void m_fwriteDebugInfo(FILE* fp, TArray<const char*>& paths, hyu32 offset);
protected:
Context* m_outerContext;
ClassInfo* m_classInfo;
BMap<LocalVarSymID_t, LocalVar_t> m_localVars;
hyu8 m_numParamVar;
hyu8 m_finallyNestLevel;
bool m_canSeeOuterLocal;
bool m_bClosureContext;
Bytecode m_bytecode;
TArray<JumpControlTree*> m_jumpControlTbl;
JumpControlTree* m_jumpControlInfo;
// resolve後にjumpControl命令となったラベル
TArray<SymbolID_t> m_unresolvedJumpControlLabels;
BMap<SymbolID_t, Context*> m_innerClasses;
public:
// SyntaxTree::compile()の結果、スタックに値をpushするコードを追加したか
bool bPushCode;
// bPushCodeがfalseなら、push_nilする
void needLastVal(void) { if (!bPushCode) { addCode<OP_push_nil>(); bPushCode = true; } }
// bPushCodeがtrueなら、popする
void popLastVal(void) { if (bPushCode) { addCode<OP_pop>(); bPushCode = false; } }
// leftValueをコンパイルする時、falseなら値取り出し、trueなら代入
bool bCompileSetVal;
// SyntaxTree::compile()が何かの値を一時的に記憶させるための変数
volatile union {
hys32 tmp_int;
hyu32 tmp_hyu32;
hyf32 tmp_float;
SymbolID_t tmp_symbol;
void* tmp_ptr;
ArgD_t tmp_argD;
FfiSigDecl_t tmp_ffiSigDecl;
Signature* tmp_signature;
};
};
}
}
#endif /* m_HYCCONTEXT_H_ */
| [
"[email protected]"
]
| [
[
[
1,
271
]
]
]
|
28b88e9b9287f5056c28585f6e9c102de322c953 | 942c07b43867ce218375a2a150d389f6ef11784a | /Window.h | 62969c63f1d6ff235e8448d8a49492846ef903f3 | []
| no_license | NIA/D3DBumpMapping | b8afa25ce367d9cad9ef207490171accec52e25b | cbd3a635ee40e45c2db870a5e3cd88ff72fb48f8 | refs/heads/master | 2016-09-05T13:56:19.504141 | 2009-12-27T20:17:57 | 2009-12-27T20:17:57 | 411,850 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 451 | h | #pragma once
#include <windows.h>
#include "main.h"
class Window
{
private:
HWND hwnd;
WNDCLASSEX window_class;
void unregister_class();
public:
Window(int width, int height);
void show() const;
void update() const;
static LRESULT WINAPI MsgProc( HWND, UINT, WPARAM, LPARAM );
inline operator HWND() { return this->hwnd; }
inline operator HWND() const { return this->hwnd; }
~Window();
}; | [
"[email protected]"
]
| [
[
[
1,
21
]
]
]
|
eeee10244bcd228dc83cdfab62a2447fb7462446 | b7c505dcef43c0675fd89d428e45f3c2850b124f | /Src/SimulatorQt/Util/qt/Win32/include/Qt/q3hbox.h | dd00641b200c135afc1e7a0a63fa6728899add16 | [
"BSD-2-Clause"
]
| permissive | pranet/bhuman2009fork | 14e473bd6e5d30af9f1745311d689723bfc5cfdb | 82c1bd4485ae24043aa720a3aa7cb3e605b1a329 | refs/heads/master | 2021-01-15T17:55:37.058289 | 2010-02-28T13:52:56 | 2010-02-28T13:52:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,647 | h | /****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information ([email protected])
**
** This file is part of the Qt3Support module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at [email protected].
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef Q3HBOX_H
#define Q3HBOX_H
#include <Qt3Support/q3frame.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Qt3SupportLight)
class QBoxLayout;
class Q_COMPAT_EXPORT Q3HBox : public Q3Frame
{
Q_OBJECT
public:
Q3HBox(QWidget* parent=0, const char* name=0, Qt::WindowFlags f=0);
void setSpacing(int);
bool setStretchFactor(QWidget*, int stretch);
QSize sizeHint() const;
protected:
Q3HBox(bool horizontal, QWidget* parent, const char* name, Qt::WindowFlags f = 0);
void frameChanged();
private:
Q_DISABLE_COPY(Q3HBox)
};
QT_END_NAMESPACE
QT_END_HEADER
#endif // Q3HBOX_H
| [
"alon@rogue.(none)"
]
| [
[
[
1,
77
]
]
]
|
96876f69260f8371a1c2a819d7961a284b85cd73 | b23a27888195014aa5bc123d7910515e9a75959c | /Main/Srcs/opcspot/MyClassFactory.cpp | 633bc4790da2a3cd3a16ec55ac46417528cf7141 | []
| no_license | fostrock/connectspot | c54bb5484538e8dd7c96b76d3096dad011279774 | 1197a196d9762942c0d61e2438c4a3bca513c4c8 | refs/heads/master | 2021-01-10T11:39:56.096336 | 2010-08-17T05:46:51 | 2010-08-17T05:46:51 | 50,015,788 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,342 | cpp | //------------------------------------------------------------------------------------------
// File: <MyClassFactory.cpp>
// Purpose: implement <Self-defined class factory to create the opc server object.>
//
// @author <Yun Hua>
// @version 1.0 2010/01/05
//
// Copyright (C) 2010, Yun Hua
//-----------------------------------------------------------------------------------------//
#include "StdAfx.h"
#include "MyClassFactory.h"
#include "lightopc.h"
#include "DataService.h"
#include "opcda.h"
#include "ULog.h"
#include <boost/thread/thread.hpp>
static const loVendorInfo vendor = {
1 /*Major */ , 0 /*Minor */ , 1 /*Build */ , 0 /*Reserv */ ,
"ZongShi OPC DA Server"
};
static void a_server_finished(void *arg, loService *b, loClient *c)
{
DataService::UninitService();
_pAtlModule->m_nLockCnt = 1; // Decrease the reference count by force.
_pAtlModule->Unlock();
}
static void LicenseTimeout()
{
Sleep(96 * 3600 * 1000);
DataService::UninitService();
}
MyClassFactory::MyClassFactory(void)
{
}
MyClassFactory::~MyClassFactory(void)
{
}
HRESULT MyClassFactory::CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, void** ppvObj)
{
ATLASSERT(ppvObj);
if (NULL == ppvObj)
{
return E_INVALIDARG;
}
*ppvObj = NULL;
HRESULT hr = S_OK;
IUnknown *server = NULL;
IUnknown *inner = NULL;
if (NULL == DataService::Instance())
{
return E_POINTER;
}
if (loClientCreate_agg(DataService::Instance().get(), (loClient**)&server,
pUnkOuter, &inner,
0, &vendor, a_server_finished, NULL/*cuserid*/))
{
// server remove
UL_ERROR((Log::Instance().get(), 0, "myClassFactory::loClientCreate_agg() failed"));
hr = E_OUTOFMEMORY;
}
else if (pUnkOuter)
{
*ppvObj = (void*)inner; // aggregation requested
}
else // no aggregation
{
hr = server->QueryInterface(riid, ppvObj); // Then 2 (if success)
server->Release(); // Then 1 (on behalf of client) or 0 (if QI failed)
}
if (SUCCEEDED(hr))
{
loSetState(DataService::Instance().get(), (loClient*)server,
loOP_OPERATE, (int)OPC_STATUS_RUNNING, "Finished by client");
UL_INFO((Log::Instance().get(), 0, "OPC service is started."));
}
#ifdef __EVAL__
boost::shared_ptr<boost::thread> licThread(new boost::thread(LicenseTimeout));
#endif
return hr;
}
| [
"[email protected]"
]
| [
[
[
1,
93
]
]
]
|
7106b3755bcfbc80b8bb4918f1d691bb60ff22f9 | b2155efef00dbb04ae7a23e749955f5ec47afb5a | /demo/demo_water/Water.h | 35bce1fa7e96a6c162ee8949a10c282bd82bf46a | []
| no_license | zjhlogo/originengine | 00c0bd3c38a634b4c96394e3f8eece86f2fe8351 | a35a83ed3f49f6aeeab5c3651ce12b5c5a43058f | refs/heads/master | 2021-01-20T13:48:48.015940 | 2011-04-21T04:10:54 | 2011-04-21T04:10:54 | 32,371,356 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,450 | h | /*!
* \file Water.h
* \date 10-6-2010 22:58:29
*
*
* \author zjhlogo ([email protected])
*/
#ifndef __WATER_H__
#define __WATER_H__
#include <OECore/IOERenderableObject.h>
#include <OECore/IOEShader.h>
class CWater : public IOERenderableObject
{
public:
enum CONST_DEFINE
{
NUM_X = 80,
NUM_Z = 80,
};
typedef struct VERTEX_tag
{
float x, y, z;
float u, v;
} VERTEX;
public:
RTTI_DEF(CWater, IOERenderableObject);
CWater();
virtual ~CWater();
virtual void Update(float fDetailTime);
virtual void Render(float fDetailTime);
virtual IOERenderData* GetRenderData();
void SetTime(float fTime) {m_fTime = fTime;};
void SetVecFreq(const CVector4& vecFreq) {m_vVecFreq = vecFreq;};
void SetVecSpeed(const CVector4& vecSpeed) {m_vVecSpeed = vecSpeed;};
void SetVecDirX(const CVector4& vecDirX) {m_vVecDirX = vecDirX;};
void SetVecDirY(const CVector4& vecDirY) {m_vVecDirY = vecDirY;};
void SetVecHeight(const CVector4& vecHeight) {m_vVecHeight = vecHeight;};
void SetEyePos(const CVector3& vEyePos) {m_vEyePos = vEyePos;};
private:
bool Init();
void Destroy();
private:
VERTEX* m_pVerts;
ushort* m_pIndis;
uint m_nVerts;
uint m_nIndis;
IOEShader* m_pShader;
float m_fTime;
CVector4 m_vVecFreq;
CVector4 m_vVecSpeed;
CVector4 m_vVecDirX;
CVector4 m_vVecDirY;
CVector4 m_vVecHeight;
CVector3 m_vEyePos;
};
#endif // __WATER_H__
| [
"zjhlogo@fdcc8808-487c-11de-a4f5-9d9bc3506571"
]
| [
[
[
1,
70
]
]
]
|
97d6d1d96d6e3b47ff01674734b348041fd8a8c5 | f25e9e8fd224f81cefd6d900f6ce64ce77abb0ae | /Exercises/Old Solutions/OpenGL4/OpenGL4/SceneNode.h | f645cbd4898d6396d5fb9c86dcacf67ca1fe8847 | []
| no_license | giacomof/gameengines2010itu | 8407be66d1aff07866d3574a03804f2f5bcdfab1 | bc664529a429394fe5743d5a76a3d3bf5395546b | refs/heads/master | 2016-09-06T05:02:13.209432 | 2010-12-12T22:18:19 | 2010-12-12T22:18:19 | 35,165,366 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,714 | h | #pragma once
#include <SDL_mutex.h>
#include <string>
#include <list>
#include "linearAlgebraDLL.h" // Header File for our math library
#include "transformation.h"
#include "sceneObject.h"
#include "assetManager.h"
using namespace linearAlgebraDLL;
using namespace std;
class SceneNode
{
public:
SDL_mutex *mutex_node; // Mutex for the Node
// default constructor
SceneNode() { mutex_node = SDL_CreateMutex(); };
// actual constructor
SceneNode( SceneNode * parentNode, string str, SceneObject * g,
Vector v,
Vector p_axis, float p_angle);
// destructor
virtual ~SceneNode() { destroy(); }
// delete object
void release() { /*SDL_DestroyMutex ( mutex_node );*/ }
void update(float dt);
void destroy(void);
// add a child
void addChild( SceneNode * pNode );
// detach a child
//void detachChild( SceneNode & cNode );
// set parent node
void setParent ( SceneNode * pNode );
// get parent node
SceneNode* getParent(void);
// set the node name
void setName(string name);
// get the node name
string getName(void);
bool isVisible(void);
void setVisible(bool b);
void addSceneObject(SceneObject * g);
SceneObject* getSceneObject();
void rotateAboutAxis(Vector p_Axis, float p_Degree);
void translate(Vector translateVector);
void scale(float p_sX, float p_sY, float p_sZ);
void shear(float p_sxy, float p_sxz, float p_syx, float p_syz, float p_szx, float p_szy);
void applyTransformation(void);
void SceneNode::removeTransformation(void);
void drawGeometry(void);
static unsigned int getNodeCount(void);
protected:
bool visible; // The node should be drawn or not
int id; // Unique id
string nodeName; // Name
SceneNode * parentNode; // Parent Node
list<SceneNode*> childList; // List of child Nodes
Transformation nodeTransformation; // Transformation of the Node
SceneObject * geometry; // Mesh to render
};
class Root : public SceneNode
{
public: // Singleton
static Root _instance;
static SDL_mutex * rootMutex;
Root(void) { &getInstance(); }
//~Root(void);
Root(const Root &getInstance());
Root & operator=(Root &getInstance());
static Root &getInstance();
// set parent node
static void setParent( SceneNode * pNode );
// get parent node
static SceneNode * getParent(void);
// Update all the children
static void update(float dt);
// Draw the geometry of all the children
static void drawGeometry(void);
static list<SceneNode*> childOfRootList;
static unsigned int id;
static string nodeName;
};
| [
"[email protected]@1a5f623d-5e27-cfcb-749e-01bf3eb0ad9d",
"[email protected]@1a5f623d-5e27-cfcb-749e-01bf3eb0ad9d",
"[email protected]@1a5f623d-5e27-cfcb-749e-01bf3eb0ad9d"
]
| [
[
[
1,
2
],
[
8,
9
],
[
18,
20
],
[
24,
24
],
[
30,
30
],
[
32,
32
],
[
52,
54
],
[
61,
63
],
[
65,
66
],
[
74,
74
],
[
80,
86
],
[
88,
92
],
[
94,
94
],
[
96,
96
],
[
99,
99
],
[
101,
106
]
],
[
[
3,
3
],
[
22,
22
]
],
[
[
4,
7
],
[
10,
17
],
[
21,
21
],
[
23,
23
],
[
25,
29
],
[
31,
31
],
[
33,
51
],
[
55,
60
],
[
64,
64
],
[
67,
73
],
[
75,
79
],
[
87,
87
],
[
93,
93
],
[
95,
95
],
[
97,
98
],
[
100,
100
],
[
107,
109
]
]
]
|
f673ac94bca4380688291a605c815fc89cdde136 | 5236606f2e6fb870fa7c41492327f3f8b0fa38dc | /svoip/src/stdafx.cpp | 9decc0e56a9062fb9d1e8235c5a58019c1dfacef | []
| no_license | jcloudpld/srpc | aa8ecf4ffc5391b7183b19d217f49fb2b1a67c88 | f2483c8177d03834552053e8ecbe788e15b92ac0 | refs/heads/master | 2021-01-10T08:54:57.140800 | 2010-02-08T07:03:00 | 2010-02-08T07:03:00 | 44,454,693 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 204 | cpp | // stdafx.cpp : source file that includes just the standard includes
// libsvoip.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
| [
"kcando@6d7ccee0-1a3b-0410-bfa1-83648d9ec9a4"
]
| [
[
[
1,
5
]
]
]
|
25586c7d186869ad1de87a402c6fa200fdfb3a18 | b3b0c727bbafdb33619dedb0b61b6419692e03d3 | /Source/DCOMPrototype/DcomConsole/DcomConsole.cpp | ba23bddcf7aa6bead2865b62643645e3ef124837 | []
| no_license | testzzzz/hwccnet | 5b8fb8be799a42ef84d261e74ee6f91ecba96b1d | 4dbb1d1a5d8b4143e8c7e2f1537908cb9bb98113 | refs/heads/master | 2021-01-10T02:59:32.527961 | 2009-11-04T03:39:39 | 2009-11-04T03:39:39 | 45,688,112 | 0 | 1 | null | null | null | null | GB18030 | C++ | false | false | 2,040 | cpp | //////////////////////////////////////////////////////////
/// @file DcomConsole.cpp
/// @brief 一个简单的Dcom示例程序客户端部分
/// @version 1.0
/// @author 甘先志
/// @date 2009-09-02
/// <修改日期> <修改者> <修改描述>\n
/// 2009-09-02 甘先志 创建
////////////////////////////////////////////////////////////
#include "stdafx.h"
void UseDcomSvr()
{
HRESULT hr;
COSERVERINFO serverinfo;
MULTI_QI Result;
ZeroMemory(&serverinfo,sizeof(serverinfo));
ZeroMemory(&Result,sizeof(Result));
hr = CoInitializeSecurity(
NULL,
-1,
NULL,
NULL,
RPC_C_AUTHN_LEVEL_DEFAULT,
RPC_C_IMP_LEVEL_IDENTIFY,
NULL,
EOAC_NONE,
NULL
);
if (FAILED(hr))
{
cout << "init right fail!" <<endl;
return;
}
serverinfo.dwReserved1 = 0;
serverinfo.dwReserved2 = 0;
serverinfo.pAuthInfo = NULL;
serverinfo.pwszName = L"127.0.0.1";
Result.pIID = &IID_IMyObject;
Result.pItf = NULL;
hr = CoCreateInstanceEx(
CLSID_MyObject,
NULL,
CLSCTX_REMOTE_SERVER,
&serverinfo,
1,
&Result
);
if (FAILED(hr))
{
cout << "cannot create object1 :" << GetLastError() << endl;
return;
}
if (FAILED(Result.hr))
{
cout << "cannot create object2 :" << GetLastError() <<endl;
return;
}
IMyObject *pt = NULL;
long data = 0;
Result.pItf->QueryInterface(&pt);
Result.pItf->Release();
pt->GetData(&data);
cout << data << endl;
pt->Release();
}
int main(int argc, char* argv[])
{
HRESULT hr;
hr = CoInitialize(NULL);
if (FAILED(hr))
{
cout << "error " <<endl;
return 0;
}
UseDcomSvr();
CoUninitialize();
system("pause");
return 0;
}
| [
"[email protected]"
]
| [
[
[
1,
85
]
]
]
|
06385b1a3a0b99a5dce84c40d7bdc50db16cf740 | cf58ec40b7ea828aba01331ee3ab4c7f2195b6ca | /Nestopia/core/board/NstBoardIremH3001.cpp | 2e07c88ff6f48ffc2e11478d25f24aa67642a374 | []
| no_license | nicoya/OpenEmu | e2fd86254d45d7aa3d7ef6a757192e2f7df0da1e | dd5091414baaaddbb10b9d50000b43ee336ab52b | refs/heads/master | 2021-01-16T19:51:53.556272 | 2011-08-06T18:52:40 | 2011-08-06T18:52:40 | 2,131,312 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,205 | cpp | ////////////////////////////////////////////////////////////////////////////////////////
//
// Nestopia - NES/Famicom emulator written in C++
//
// Copyright (C) 2003-2008 Martin Freij
//
// This file is part of Nestopia.
//
// Nestopia is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Nestopia 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 Nestopia; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
////////////////////////////////////////////////////////////////////////////////////////
#include "NstBoard.hpp"
#include "../NstClock.hpp"
#include "NstBoardIremH3001.hpp"
namespace Nes
{
namespace Core
{
namespace Boards
{
namespace Irem
{
#ifdef NST_MSVC_OPTIMIZE
#pragma optimize("s", on)
#endif
H3001::H3001(const Context& c)
: Board(c), irq(*c.cpu) {}
void H3001::Irq::Reset(const bool hard)
{
if (hard)
{
enabled = false;
count = 0;
latch = 0;
}
}
void H3001::SubReset(const bool hard)
{
irq.Reset( hard, true );
Map( 0x9001U, &H3001::Poke_9001 );
Map( 0x9003U, &H3001::Poke_9003 );
Map( 0x9004U, &H3001::Poke_9004 );
Map( 0x9005U, &H3001::Poke_9005 );
Map( 0x9006U, &H3001::Poke_9006 );
Map( 0x8000U, PRG_SWAP_8K_0 );
Map( 0xA000U, PRG_SWAP_8K_1 );
Map( 0xC000U, PRG_SWAP_8K_2 );
Map( 0xB000U, CHR_SWAP_1K_0 );
Map( 0xB001U, CHR_SWAP_1K_1 );
Map( 0xB002U, CHR_SWAP_1K_2 );
Map( 0xB003U, CHR_SWAP_1K_3 );
Map( 0xB004U, CHR_SWAP_1K_4 );
Map( 0xB005U, CHR_SWAP_1K_5 );
Map( 0xB006U, CHR_SWAP_1K_6 );
Map( 0xB007U, CHR_SWAP_1K_7 );
}
void H3001::SubLoad(State::Loader& state,const dword baseChunk)
{
NST_VERIFY( baseChunk == (AsciiId<'I','H','3'>::V) );
if (baseChunk == AsciiId<'I','H','3'>::V)
{
while (const dword chunk = state.Begin())
{
if (chunk == AsciiId<'I','R','Q'>::V)
{
State::Loader::Data<5> data( state );
irq.unit.enabled = data[0] & 0x1;
irq.unit.latch = data[1] | data[2] << 8;
irq.unit.count = data[3] | data[4] << 8;
}
state.End();
}
}
}
void H3001::SubSave(State::Saver& state) const
{
const byte data[5] =
{
irq.unit.enabled ? 0x1 : 0x0,
irq.unit.latch & 0xFF,
irq.unit.latch >> 8,
irq.unit.count & 0xFF,
irq.unit.count >> 8
};
state.Begin( AsciiId<'I','H','3'>::V ).Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End().End();
}
#ifdef NST_MSVC_OPTIMIZE
#pragma optimize("", on)
#endif
NES_POKE_D(H3001,9001)
{
ppu.SetMirroring( (data & 0x80) ? Ppu::NMT_H : Ppu::NMT_V );
}
NES_POKE_D(H3001,9003)
{
irq.Update();
irq.unit.enabled = data & 0x80;
irq.ClearIRQ();
}
NES_POKE(H3001,9004)
{
irq.Update();
irq.unit.count = irq.unit.latch;
irq.ClearIRQ();
}
NES_POKE_D(H3001,9005)
{
irq.Update();
irq.unit.latch = (irq.unit.latch & 0x00FF) | data << 8;
}
NES_POKE_D(H3001,9006)
{
irq.Update();
irq.unit.latch = (irq.unit.latch & 0xFF00) | data << 0;
}
bool H3001::Irq::Clock()
{
if (enabled && count && !--count)
{
enabled = false;
return true;
}
return false;
}
void H3001::Sync(Event event,Input::Controllers* controllers)
{
if (event == EVENT_END_FRAME)
irq.VSync();
Board::Sync( event, controllers );
}
}
}
}
}
| [
"[email protected]"
]
| [
[
[
1,
169
]
]
]
|
9c748fbb62d3aeae56a72f92da180b89fc9aee5e | e02fa80eef98834bf8a042a09d7cb7fe6bf768ba | /MyGUIEngine/src/MyGUI_Sheet.cpp | 0c64ff8e1e83a205299fd8c29538fd376e0081d6 | []
| no_license | MyGUI/mygui-historical | fcd3edede9f6cb694c544b402149abb68c538673 | 4886073fd4813de80c22eded0b2033a5ba7f425f | refs/heads/master | 2021-01-23T16:40:19.477150 | 2008-03-06T22:19:12 | 2008-03-06T22:19:12 | 22,805,225 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,012 | cpp | /*!
@file
@author Albert Semenov
@date 01/2008
@module
*/
#include "MyGUI_Sheet.h"
#include "MyGUI_Tab.h"
namespace MyGUI
{
Sheet::Sheet(const IntCoord& _coord, char _align, const WidgetSkinInfoPtr _info, CroppedRectanglePtr _parent, const Ogre::String & _name) :
Widget(_coord, _align, _info, _parent, _name),
mOwner(null)
{
}
void Sheet::setPosition(const IntPoint& _pos) {Widget::setPosition(_pos);}
void Sheet::setPosition(const IntCoord& _coord) {Widget::setPosition(_coord);}
void Sheet::setSize(const IntSize& _size) {Widget::setSize(_size);}
void Sheet::show() {Widget::show();}
void Sheet::hide() {Widget::hide();}
void Sheet::setCaption(const Ogre::DisplayString & _caption)
{
MYGUI_ASSERT(null != mOwner, "Sheet must create only in Tab");
mOwner->setSheetName(this, _caption);
}
const Ogre::DisplayString & Sheet::getCaption()
{
MYGUI_ASSERT(null != mOwner, "Sheet must create only in Tab");
return mOwner->getSheetName(this);
}
const Ogre::DisplayString & Sheet::getSheetName()
{
MYGUI_ASSERT(null != mOwner, "Sheet must create only in Tab");
return mOwner->getSheetName(this);
}
void Sheet::setSheetName(const Ogre::DisplayString & _name, int _width)
{
MYGUI_ASSERT(null != mOwner, "Sheet must create only in Tab");
mOwner->setSheetName(this, _name, _width);
}
int Sheet::getSheetButtonWidth()
{
MYGUI_ASSERT(null != mOwner, "Sheet must create only in Tab");
return mOwner->getSheetButtonWidth(this);
}
void Sheet::setSheetButtonWidth(int _width)
{
MYGUI_ASSERT(null != mOwner, "Sheet must create only in Tab");
mOwner->setSheetButtonWidth(this, _width);
}
void Sheet::selectSheet(bool _smooth)
{
MYGUI_ASSERT(null != mOwner, "Sheet must create only in Tab");
mOwner->selectSheet(this, _smooth);
}
void Sheet::removeSheet()
{
MYGUI_ASSERT(null != mOwner, "Sheet must create only in Tab");
mOwner->removeSheet(this);
}
} // namespace MyGUI
| [
"[email protected]",
"[email protected]"
]
| [
[
[
1,
7
],
[
9,
74
]
],
[
[
8,
8
]
]
]
|
d1c467795edf3716868f7d96ddd1ffef07c4c948 | 69aab86a56c78cdfb51ab19b8f6a71274fb69fba | /Code/src/Engine/Material.cpp | c71d6348fe916362e0f3f4c194f0c23c59f9b72c | [
"BSD-3-Clause"
]
| permissive | zc5872061/wonderland | 89882b6062b4a2d467553fc9d6da790f4df59a18 | b6e0153eaa65a53abdee2b97e1289a3252b966f1 | refs/heads/master | 2021-01-25T10:44:13.871783 | 2011-08-11T20:12:36 | 2011-08-11T20:12:36 | 38,088,714 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,668 | cpp | /*
* Material.cpp
*
* Created on: 2011-02-13
* Author: Artur
*/
#include "Engine/Material.h"
#include "pi.h"
#include "Game.h"
#include <algorithm>
std::vector<std::string> Material::s_warningVariables;
Material::Material(Program* program, const std::string& name) :
m_program(program),
m_name(name)
{
memset(m_locations, GL_INVALID_LOCATION, sizeof(m_locations));
}
void Material::setAttribute(const LocationInfo& location, const float* data, int stride)
{
// no assert here to make at least some optimizations ;P
glVertexAttribPointer(location.location, stride, GL_FLOAT, GL_FALSE, 0 * stride * sizeof(GLfloat), data);
glEnableVertexAttribArray(location.location);
}
void Material::setUniform(const LocationInfo& location, const Matrix& matrix)
{
glUniformMatrix4fv(location.location, 1, false, reinterpret_cast<const GLfloat*>(&(matrix.m)));
}
void Material::setUniform(const LocationInfo& location, float value)
{
glUniform1f(location.location, value);
}
void Material::setUniform(const LocationInfo& location, const std::string& textureName)
{
glActiveTexture(GL_TEXTURE0);
glUniform1i(location.location, 0);
glBindTexture(GL_TEXTURE_2D, Game::getInstance().getResourceManager().getBitmapId(textureName)); // TODO: fix the problem with extensions
}
void Material::setUniform(const LocationInfo& location, const Vector& vector)
{
switch(location.size)
{
case 3:
glUniform3f(location.location, vector.x, vector.y, vector.z);
break;
case 4:
glUniform4f(location.location, vector.x, vector.y, vector.z, 1);
break;
default:
Log("Wrong size in location %d - %d", location.location, static_cast<int>(location.size));
assert(0);
}
}
void Material::disableAttribute(MaterialVariables id)
{
assert(id == MV_POSITION || id == MV_NORMAL || id == MV_UV);
if(m_locations[id].location == GL_INVALID_LOCATION) return;
glDisableVertexAttribArray(m_locations[id].location);
}
bool Material::addVariable(const std::string& var, size_t size)
{
GLint location = m_program->getLocation(var);
if(location == GL_INVALID_LOCATION)
{
Log("Could not map '%s' in material '%s' - .mat file issue or shader optimizer issue", var.c_str(), m_name.c_str());
return false;
}
Log("Location %d is %s", location, var.c_str());
m_variables[var].location = location;
m_variables[var].size = size;
return true;
}
bool Material::addVariable(const std::string& var, MaterialVariables id, size_t size)
{
assert(id >= MV_POSITION && id < MV_ENUMERATION_SIZE);
GLint location = m_program->getLocation(var);
if(location == GL_INVALID_LOCATION) return false;
Log("Location %d is %s", location, var.c_str());
m_locations[id].location = location;
m_locations[id].size = size;
return true;
}
void Material::notInMap(const std::string& var)
{
if(std::find(s_warningVariables.begin(), s_warningVariables.end(), var) != s_warningVariables.end())
return;
Log("WARNING: Material(%s)::setValue(%s) not in available names list (not put into material file?)", m_name.c_str(), var.c_str());
s_warningVariables.push_back(var);
}
void Material::invalidLocation(const std::string& var)
{
if(std::find(s_warningVariables.begin(), s_warningVariables.end(), var) != s_warningVariables.end())
return;
Log("WARNING: Material(%s)::setValue(%s) - underlaying location == -1 - is the mapping correct?", m_name.c_str(), var.c_str());
s_warningVariables.push_back(var);
}
| [
"[email protected]"
]
| [
[
[
1,
110
]
]
]
|
80c603f1e453290377b5f8c95e5f8801e5048d8d | 116e286b7d451d30fd5d9a3ce9b3013b8d2c1a0c | /vc60/robolangView.h | 0c9f71d23f6b06bcf51ff63d5553634e16d04634 | []
| no_license | savfod/robolang | 649f2db0f773e3ad5be58c433920dff7aadfafd0 | f97446db5405d3e17b29947fc5b61ab05ef1fa24 | refs/heads/master | 2021-01-10T04:07:06.895016 | 2009-11-17T19:54:23 | 2009-11-17T19:54:23 | 48,452,157 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,335 | h | // robolangView.h : interface of the CRobolangView class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_ROBOLANGVIEW_H__1DFBC0A7_4636_4379_BFC3_5B65A5B53E3A__INCLUDED_)
#define AFX_ROBOLANGVIEW_H__1DFBC0A7_4636_4379_BFC3_5B65A5B53E3A__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/*#########################################################################*/
/*#########################################################################*/
class CRobolangView : public CView
{
protected: // create from serialization only
CRobolangView();
DECLARE_DYNCREATE(CRobolangView)
// Attributes
public:
CRobolangDoc* GetDocument();
// Operations
public:
void createViews( CCreateContext* pContext );
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRobolangView)
public:
virtual void OnDraw(CDC* pDC); // overridden to draw this view
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
protected:
virtual void OnInitialUpdate(); // called first time after construct
virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CRobolangView();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
public:
CRobolangSplitter splitter;
// Generated message map functions
protected:
//{{AFX_MSG(CRobolangView)
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnSize(UINT nType, int cx, int cy);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#ifndef _DEBUG // debug version in robolangView.cpp
inline CRobolangDoc* CRobolangView::GetDocument()
{ return (CRobolangDoc*)m_pDocument; }
#endif
/*#########################################################################*/
/*#########################################################################*/
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_ROBOLANGVIEW_H__1DFBC0A7_4636_4379_BFC3_5B65A5B53E3A__INCLUDED_)
| [
"SAVsmail@11fe8b10-5191-11de-bc8f-bda5044519d4"
]
| [
[
[
1,
75
]
]
]
|
3768fd1d5b66836730566c575b89f4af596bdca3 | 27d5670a7739a866c3ad97a71c0fc9334f6875f2 | /CPP/Shared/symbian-r7/Conditional.cpp | 97b01c5a0789cb1fe5b13b9c7735fbdd74c053a6 | [
"BSD-3-Clause"
]
| permissive | ravustaja/Wayfinder-S60-Navigator | ef506c418b8c2e6498ece6dcae67e583fb8a4a95 | 14d1b729b2cea52f726874687e78f17492949585 | refs/heads/master | 2021-01-16T20:53:37.630909 | 2010-06-28T09:51:10 | 2010-06-28T09:51:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,583 | cpp | /*
Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "../symbian-r6/Conditional.cpp"
| [
"[email protected]"
]
| [
[
[
1,
13
]
]
]
|
452f015f23be8e8f36b39af8dc0de4c41e12a402 | 0fadcdb36693fb270233d2da744daf9759ab0571 | /build/source/NxOgreKinematicActor.cpp | bdcfd2d3422f660f15fd04525ec98aa6ad6e2f61 | []
| no_license | ly515106325/nxogre | 5cdb3fdd82398377e645d9e65a57a23e620f4a61 | 80bfd8f1220c058d7b2ab2817c4000d4014f5abd | refs/heads/master | 2021-01-15T23:53:28.268769 | 2010-01-10T18:13:01 | 2010-01-10T18:13:01 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 6,203 | cpp | /** File: NxOgreKinematicActor.cpp
Created on: 20-Nov-08
Author: Robin Southern "betajaen"
© Copyright, 2008-2009 by Robin Southern, http://www.nxogre.org
This file is part of NxOgre.
NxOgre is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
NxOgre 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with NxOgre. If not, see <http://www.gnu.org/licenses/>.
*/
#include "NxOgreStable.h"
#include "NxOgreKinematicActor.h"
#include "NxOgreScene.h"
#include "NxOgreShape.h"
#include "NxOgreRigidBodyFunctions.h"
#include "NxOgreRigidBodyPrototype.h"
namespace NxOgre
{
KinematicActor::KinematicActor(Scene* scene)
: RigidBody(),
mScene(scene)
{
}
KinematicActor::KinematicActor(RigidBodyPrototype* prototype, Scene* scene)
: RigidBody(),
mScene(scene)
{
create(prototype, scene, &mShapes);
}
KinematicActor::~KinematicActor(void)
{
destroy();
}
unsigned int KinematicActor::getClassType() const
{
return Classes::_KinematicActor;
}
void KinematicActor::setGroup(GroupIdentifier actorGroup)
{
::NxOgre::Functions::RigidBodyFunctions::setGroup(actorGroup, mActor);
}
GroupIdentifier KinematicActor::getGroup(void) const
{
return ::NxOgre::Functions::RigidBodyFunctions::getGroup(mActor);
}
void KinematicActor::setDominanceGroup(GroupIdentifier dominanceGroup)
{
::NxOgre::Functions::RigidBodyFunctions::setGroup(dominanceGroup, mActor);
}
GroupIdentifier KinematicActor::getDominanceGroup(void) const
{
return ::NxOgre::Functions::RigidBodyFunctions::getDominanceGroup(mActor);
}
void KinematicActor::resetPairFiltering(void)
{
::NxOgre::Functions::RigidBodyFunctions::resetPairFiltering(mActor);
}
bool KinematicActor::isDynamic(void) const
{
return ::NxOgre::Functions::RigidBodyFunctions::isDynamic(mActor);
}
Real KinematicActor::computeKineticEnergy(void) const
{
return ::NxOgre::Functions::RigidBodyFunctions::computeKineticEnergy(mActor);
}
void KinematicActor::setSolverIterationCount(unsigned int iterCount)
{
::NxOgre::Functions::RigidBodyFunctions::setSolverIterationCount(iterCount, mActor);
}
unsigned int KinematicActor::getSolverIterationCount(void) const
{
return ::NxOgre::Functions::RigidBodyFunctions::getSolverIterationCount(mActor);
}
Real KinematicActor::getContactReportThreshold(void) const
{
return ::NxOgre::Functions::RigidBodyFunctions::getContactReportThreshold(mActor);
}
void KinematicActor::setContactReportThreshold(Real threshold)
{
::NxOgre::Functions::RigidBodyFunctions::setContactReportThreshold(threshold, mActor);
}
unsigned int KinematicActor::getContactReportFlags(void) const
{
return ::NxOgre::Functions::RigidBodyFunctions::getContactReportFlags(mActor);
}
void KinematicActor::setContactReportFlags(unsigned int flags)
{
::NxOgre::Functions::RigidBodyFunctions::setContactReportFlags(flags, mActor);
}
unsigned short KinematicActor::getForceFieldMaterial(void) const
{
return ::NxOgre::Functions::RigidBodyFunctions::getForceFieldMaterial(mActor);
}
void KinematicActor::setForceFieldMaterial(unsigned short ffm)
{
::NxOgre::Functions::RigidBodyFunctions::setForceFieldMaterial(ffm, mActor);
}
void KinematicActor::setGlobalPose(const Matrix44& matrix)
{
::NxOgre::Functions::RigidBodyFunctions::setGlobalPose(matrix, mActor);
}
void KinematicActor::setGlobalPosition (const Vec3& r3)
{
::NxOgre::Functions::RigidBodyFunctions::setGlobalPosition(r3, mActor);
}
void KinematicActor::setGlobalOrientation(const Matrix33& r33)
{
::NxOgre::Functions::RigidBodyFunctions::setGlobalOrientation(r33, mActor);
}
void KinematicActor::setGlobalOrientationQuat(const Quat& quat)
{
::NxOgre::Functions::RigidBodyFunctions::setGlobalOrientationQuat(quat, mActor);
}
Matrix44 KinematicActor::getGlobalPose(void) const
{
return ::NxOgre::Functions::RigidBodyFunctions::getGlobalPose(mActor);
}
Vec3 KinematicActor::getGlobalPosition(void) const
{
return ::NxOgre::Functions::RigidBodyFunctions::getGlobalPosition(mActor);
}
Matrix33 KinematicActor::getGlobalOrientation(void) const
{
return ::NxOgre::Functions::RigidBodyFunctions::getGlobalOrientation(mActor);
}
Quat KinematicActor::getGlobalOrientationQuat(void) const
{
return ::NxOgre::Functions::RigidBodyFunctions::getGlobalOrientationQuat(mActor);
}
void KinematicActor::createShape(Shape*)
{
//< \argh
}
void KinematicActor::releaseShape(Shape*)
{
//< \argh
}
unsigned int KinematicActor::getNbShapes(void) const
{
return ::NxOgre::Functions::RigidBodyFunctions::getNbShapes(mActor);
}
void KinematicActor::moveGlobalPose(const Matrix44& m44)
{
::NxOgre::Functions::RigidBodyFunctions::moveGlobalPose(m44, mActor);
}
void KinematicActor::moveGlobalPosition(const Vec3& r3)
{
::NxOgre::Functions::RigidBodyFunctions::moveGlobalPosition(r3, mActor);
}
void KinematicActor::moveGlobalOrientation (const Matrix33& r33)
{
::NxOgre::Functions::RigidBodyFunctions::moveGlobalOrientation(r33, mActor);
}
void KinematicActor::moveGlobalOrientationQuat (const Quat& q)
{
::NxOgre::Functions::RigidBodyFunctions::moveGlobalOrientationQuat(q, mActor);
}
} // namespace NxOgre
| [
"robin@.(none)",
"[email protected]"
]
| [
[
[
1,
3
],
[
5,
35
],
[
37,
41
],
[
43,
43
],
[
45,
51
],
[
53,
68
],
[
70,
73
],
[
75,
78
],
[
80,
83
],
[
85,
88
],
[
90,
93
],
[
95,
98
],
[
100,
103
],
[
105,
108
],
[
110,
113
],
[
115,
118
],
[
120,
123
],
[
125,
128
],
[
130,
133
],
[
135,
138
],
[
140,
143
],
[
145,
148
],
[
150,
153
],
[
155,
158
],
[
160,
163
],
[
165,
168
],
[
170,
173
],
[
175,
178
],
[
180,
194
],
[
196,
199
],
[
201,
204
],
[
206,
209
],
[
211,
212
],
[
214,
214
],
[
216,
219
],
[
221,
222
]
],
[
[
4,
4
],
[
36,
36
],
[
42,
42
],
[
44,
44
],
[
52,
52
],
[
69,
69
],
[
74,
74
],
[
79,
79
],
[
84,
84
],
[
89,
89
],
[
94,
94
],
[
99,
99
],
[
104,
104
],
[
109,
109
],
[
114,
114
],
[
119,
119
],
[
124,
124
],
[
129,
129
],
[
134,
134
],
[
139,
139
],
[
144,
144
],
[
149,
149
],
[
154,
154
],
[
159,
159
],
[
164,
164
],
[
169,
169
],
[
174,
174
],
[
179,
179
],
[
195,
195
],
[
200,
200
],
[
205,
205
],
[
210,
210
],
[
213,
213
],
[
215,
215
],
[
220,
220
]
]
]
|
9f5fe7c7771f378f052be6d3d982e1ba10f28f56 | 6fbf3695707248bfb00e3f8c4a0f9adf5d8a3d4c | /java/jniutil/include/jvm/global.hpp | 52eddbde9ae92ea7c05ba9854570b63ece76bb0b | []
| no_license | ochafik/cppjvm | c554a2f224178bc3280f03919aff9287bd912024 | e1feb48eee3396d3a5ecb539de467c0a8643cba0 | refs/heads/master | 2020-12-25T16:02:38.582622 | 2011-11-17T00:11:35 | 2011-11-17T00:11:35 | 2,790,123 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,843 | hpp | #ifndef JVM_GLOBAL_INCLUDED
#define JVM_GLOBAL_INCLUDED
#include <jvm/virtual_machine.hpp>
namespace jvm
{
/* Whenever local references to objects are exposed through JNI, they
are added to a list associated with the top-most JVM stack frame.
When execution exists that stack frame, all local references on the
list are deleted, meaning that the objects they referred to can now
be garbage collected (though not necessarily immediately).
If you need an object to stay alive regardless, you should store
it in a reference wrapped with global<T>, e.g.
jvm::global<InputStream>
Use the local_frame class to create your own JVM stack frames.
For example:
jvm::global<InputStream> i;
{
jvm::local_frame lf;
i = (obtain input stream somehow)
}
// i can still be used safely here
Global references work somewhat like ref-counted smart pointers.
*/
template <class T>
class global : public T
{
public:
global() { }
global(const global<T> &o)
{ put_impl(o); }
explicit global(const T &o)
{ put_impl(o); }
// Destructor deletes the reference
~global()
{ T::delete_global(); }
global<T> &operator=(jobject o)
{
put_impl(o);
return *this;
}
operator jobject() const
{ return get_impl(); }
global<T> &operator=(const T &o)
{
put_impl(o);
return *this;
}
global<T> &operator=(const global<T> &o)
{
put_impl(o);
return *this;
}
jobject get_impl() const
{ return global_vm().env()->NewLocalRef(T::get_impl()); }
// however a reference is stored, it goes via this,
// ensuring it gets traded for a unique global reference
void put_impl(jobject o)
{
T::delete_global();
T::put_impl(o);
T::make_global();
}
};
}
#endif
| [
"danielearwicker@ubuntu.(none)"
]
| [
[
[
1,
86
]
]
]
|
184effc5ad878225ea06be4cc227dd17bd1981b7 | f76e8eb54d95cedcc6c4e35d753a4690b8ead68e | /OnePlayer/stdafx.cpp | 2ec5d5abd4dff4242c85f86ae39a5037418cdd4c | []
| no_license | Henry-T/one-player | 42701d290359adf3ff3545efa0b8514a3929f704 | a0b549d3a87290ad4eae07cf6e1fc0a29cade511 | refs/heads/master | 2021-01-10T17:50:03.155313 | 2011-04-20T09:59:46 | 2011-04-20T09:59:46 | 50,159,785 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 170 | cpp | // stdafx.cpp : 只包括标准包含文件的源文件
// OnePlayer.pch 将作为预编译头
// stdafx.obj 将包含预编译类型信息
#include "stdafx.h"
| [
"[email protected]"
]
| [
[
[
1,
7
]
]
]
|
78243fc00a6416dd9fe39ac7c0312e73970fc41a | 5da9d428805218901d7c039049d7e13a1a2b1c4c | /Vivian/libFade/preLoad.h | c4a7953e22339482489c2e9a577679429402814e | []
| no_license | SakuraSinojun/vivianmage | 840be972f14e17bb76241ba833318c13cf2b00a4 | 7a82ee5c5f37d98b86e8d917d9bb20c96a2d6c7f | refs/heads/master | 2021-01-22T20:44:33.191391 | 2010-12-11T15:26:15 | 2010-12-11T15:26:15 | 32,322,907 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 155 | h |
#pragma once
#include "..\stdafx.h"
namespace pl
{
HDC Load(LPCSTR filename,BITMAP * bitmap=NULL);
void UnLoad(LPCSTR filename);
};
| [
"SakuraSinojun@c9cc3ed0-94a9-11de-b6d4-8762f465f3f9"
]
| [
[
[
1,
14
]
]
]
|
66709865eaae038c92f1250cc4095cd145ae6b24 | d504537dae74273428d3aacd03b89357215f3d11 | /src/Renderer/Dx9/vmr9/Allocator.cpp | 86ad20f26466a0a166b0e3f66ba6b1f3f702bea2 | []
| no_license | h0MER247/e6 | 1026bf9aabd5c11b84e358222d103aee829f62d7 | f92546fd1fc53ba783d84e9edf5660fe19b739cc | refs/heads/master | 2020-12-23T05:42:42.373786 | 2011-02-18T16:16:24 | 2011-02-18T16:16:24 | 237,055,477 | 1 | 0 | null | 2020-01-29T18:39:15 | 2020-01-29T18:39:14 | null | UTF-8 | C++ | false | false | 10,489 | cpp | //------------------------------------------------------------------------------
// File: Allocator.cpp
//
// Desc: DirectShow sample code - implementation of the CAllocator class
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
#include "util.h"
#include "Allocator.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CAllocator::CAllocator(HRESULT& hr, HWND wnd, IDirect3D9* d3d, IDirect3DDevice9* d3dd)
: m_refCount(1)
, m_D3D(d3d)
, m_D3DDev(d3dd)
, m_window( wnd )
{
CAutoLock Lock(&m_ObjectLock);
hr = E_FAIL;
if( IsWindow( wnd ) == FALSE )
{
hr = E_INVALIDARG;
return;
}
if( m_D3D == NULL )
{
ASSERT( d3dd == NULL );
m_D3D.Attach( Direct3DCreate9(D3D_SDK_VERSION) );
if (m_D3D == NULL) {
hr = E_FAIL;
return;
}
}
if( m_D3DDev == NULL )
{
hr = CreateDevice();
}
}
CAllocator::~CAllocator()
{
DeleteSurfaces();
}
HRESULT CAllocator::CreateDevice()
{
HRESULT hr;
m_D3DDev = NULL;
D3DDISPLAYMODE dm;
hr = m_D3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &dm);
D3DPRESENT_PARAMETERS pp;
ZeroMemory(&pp, sizeof(pp));
pp.Windowed = TRUE;
pp.hDeviceWindow = m_window;
pp.SwapEffect = D3DSWAPEFFECT_COPY;
pp.BackBufferFormat = dm.Format;
FAIL_RET( m_D3D->CreateDevice( D3DADAPTER_DEFAULT,
D3DDEVTYPE_HAL,
m_window,
D3DCREATE_SOFTWARE_VERTEXPROCESSING |
D3DCREATE_MULTITHREADED,
&pp,
&m_D3DDev.p) );
m_renderTarget = NULL;
return m_D3DDev->GetRenderTarget( 0, & m_renderTarget.p );
}
void CAllocator::DeleteSurfaces()
{
CAutoLock Lock(&m_ObjectLock);
// clear out the private texture
m_privateTexture = NULL;
for( size_t i = 0; i < m_surfaces.size(); ++i )
{
m_surfaces[i] = NULL;
}
}
//IVMRSurfaceAllocator9
HRESULT CAllocator::InitializeDevice(
/* [in] */ DWORD_PTR dwUserID,
/* [in] */ VMR9AllocationInfo *lpAllocInfo,
/* [out][in] */ DWORD *lpNumBuffers)
{
D3DCAPS9 d3dcaps;
DWORD dwWidth = 1;
DWORD dwHeight = 1;
float fTU = 1.f;
float fTV = 1.f;
if( lpNumBuffers == NULL )
{
return E_POINTER;
}
if( m_lpIVMRSurfAllocNotify == NULL )
{
return E_FAIL;
}
HRESULT hr = S_OK;
m_D3DDev->GetDeviceCaps( &d3dcaps );
if( d3dcaps.TextureCaps & D3DPTEXTURECAPS_POW2 )
{
while( dwWidth < lpAllocInfo->dwWidth )
dwWidth = dwWidth << 1;
while( dwHeight < lpAllocInfo->dwHeight )
dwHeight = dwHeight << 1;
fTU = (float)(lpAllocInfo->dwWidth) / (float)(dwWidth);
fTV = (float)(lpAllocInfo->dwHeight) / (float)(dwHeight);
m_scene.SetSrcRect( fTU, fTV );
lpAllocInfo->dwWidth = dwWidth;
lpAllocInfo->dwHeight = dwHeight;
}
// NOTE:
// we need to make sure that we create textures because
// surfaces can not be textured onto a primitive.
lpAllocInfo->dwFlags |= VMR9AllocFlag_TextureSurface;
DeleteSurfaces();
m_surfaces.resize(*lpNumBuffers);
hr = m_lpIVMRSurfAllocNotify->AllocateSurfaceHelper(lpAllocInfo, lpNumBuffers, & m_surfaces.at(0) );
// If we couldn't create a texture surface and
// the format is not an alpha format,
// then we probably cannot create a texture.
// So what we need to do is create a private texture
// and copy the decoded images onto it.
if(FAILED(hr) && !(lpAllocInfo->dwFlags & VMR9AllocFlag_3DRenderTarget))
{
DeleteSurfaces();
// is surface YUV ?
if (lpAllocInfo->Format > '0000')
{
D3DDISPLAYMODE dm;
FAIL_RET( m_D3DDev->GetDisplayMode(NULL, & dm ) );
// create the private texture
FAIL_RET( m_D3DDev->CreateTexture(lpAllocInfo->dwWidth, lpAllocInfo->dwHeight,
1,
D3DUSAGE_RENDERTARGET,
dm.Format,
D3DPOOL_DEFAULT /* default pool - usually video memory */,
& m_privateTexture.p, NULL ) );
}
lpAllocInfo->dwFlags &= ~VMR9AllocFlag_TextureSurface;
lpAllocInfo->dwFlags |= VMR9AllocFlag_OffscreenSurface;
FAIL_RET( m_lpIVMRSurfAllocNotify->AllocateSurfaceHelper(lpAllocInfo, lpNumBuffers, & m_surfaces.at(0) ) );
}
return m_scene.Init(m_D3DDev);
}
HRESULT CAllocator::TerminateDevice(
/* [in] */ DWORD_PTR dwID)
{
DeleteSurfaces();
return S_OK;
}
HRESULT CAllocator::GetSurface(
/* [in] */ DWORD_PTR dwUserID,
/* [in] */ DWORD SurfaceIndex,
/* [in] */ DWORD SurfaceFlags,
/* [out] */ IDirect3DSurface9 **lplpSurface)
{
if( lplpSurface == NULL )
{
return E_POINTER;
}
if (SurfaceIndex >= m_surfaces.size() )
{
return E_FAIL;
}
CAutoLock Lock(&m_ObjectLock);
return m_surfaces[SurfaceIndex].CopyTo(lplpSurface) ;
}
HRESULT CAllocator::AdviseNotify(
/* [in] */ IVMRSurfaceAllocatorNotify9 *lpIVMRSurfAllocNotify)
{
CAutoLock Lock(&m_ObjectLock);
HRESULT hr;
m_lpIVMRSurfAllocNotify = lpIVMRSurfAllocNotify;
HMONITOR hMonitor = m_D3D->GetAdapterMonitor( D3DADAPTER_DEFAULT );
FAIL_RET( m_lpIVMRSurfAllocNotify->SetD3DDevice( m_D3DDev, hMonitor ) );
return hr;
}
HRESULT CAllocator::StartPresenting(
/* [in] */ DWORD_PTR dwUserID)
{
CAutoLock Lock(&m_ObjectLock);
ASSERT( m_D3DDev );
if( m_D3DDev == NULL )
{
return E_FAIL;
}
return S_OK;
}
HRESULT CAllocator::StopPresenting(
/* [in] */ DWORD_PTR dwUserID)
{
return S_OK;
}
HRESULT CAllocator::PresentImage(
/* [in] */ DWORD_PTR dwUserID,
/* [in] */ VMR9PresentationInfo *lpPresInfo)
{
HRESULT hr;
CAutoLock Lock(&m_ObjectLock);
// if we are in the middle of the display change
if( NeedToHandleDisplayChange() )
{
// NOTE: this piece of code is left as a user exercise.
// The D3DDevice here needs to be switched
// to the device that is using another adapter
}
hr = PresentHelper( lpPresInfo );
// IMPORTANT: device can be lost when user changes the resolution
// or when (s)he presses Ctrl + Alt + Delete.
// We need to restore our video memory after that
if( hr == D3DERR_DEVICELOST)
{
if (m_D3DDev->TestCooperativeLevel() == D3DERR_DEVICENOTRESET)
{
DeleteSurfaces();
FAIL_RET( CreateDevice() );
HMONITOR hMonitor = m_D3D->GetAdapterMonitor( D3DADAPTER_DEFAULT );
FAIL_RET( m_lpIVMRSurfAllocNotify->ChangeD3DDevice( m_D3DDev, hMonitor ) );
}
hr = S_OK;
}
return hr;
}
HRESULT CAllocator::PresentHelper(VMR9PresentationInfo *lpPresInfo)
{
// parameter validation
if( lpPresInfo == NULL )
{
return E_POINTER;
}
else if( lpPresInfo->lpSurf == NULL )
{
return E_POINTER;
}
CAutoLock Lock(&m_ObjectLock);
HRESULT hr;
m_D3DDev->SetRenderTarget( 0, m_renderTarget );
// if we created a private texture
// blt the decoded image onto the texture.
if( m_privateTexture != NULL )
{
CComPtr<IDirect3DSurface9> surface;
FAIL_RET( m_privateTexture->GetSurfaceLevel( 0 , & surface.p ) );
// copy the full surface onto the texture's surface
FAIL_RET( m_D3DDev->StretchRect( lpPresInfo->lpSurf, NULL,
surface, NULL,
D3DTEXF_NONE ) );
FAIL_RET( m_scene.DrawScene(m_D3DDev, m_privateTexture ) );
}
else // this is the case where we have got the textures allocated by VMR
// all we need to do is to get them from the surface
{
CComPtr<IDirect3DTexture9> texture;
FAIL_RET( lpPresInfo->lpSurf->GetContainer( IID_IDirect3DTexture9, (LPVOID*) & texture.p ) );
FAIL_RET( m_scene.DrawScene(m_D3DDev, texture ) );
}
FAIL_RET( m_D3DDev->Present( NULL, NULL, NULL, NULL ) );
return hr;
}
bool CAllocator::NeedToHandleDisplayChange()
{
if( ! m_lpIVMRSurfAllocNotify )
{
return false;
}
D3DDEVICE_CREATION_PARAMETERS Parameters;
if( FAILED( m_D3DDev->GetCreationParameters(&Parameters) ) )
{
ASSERT( false );
return false;
}
HMONITOR currentMonitor = m_D3D->GetAdapterMonitor( Parameters.AdapterOrdinal );
HMONITOR hMonitor = m_D3D->GetAdapterMonitor( D3DADAPTER_DEFAULT );
return hMonitor != currentMonitor;
}
// IUnknown
HRESULT CAllocator::QueryInterface(
REFIID riid,
void** ppvObject)
{
HRESULT hr = E_NOINTERFACE;
if( ppvObject == NULL ) {
hr = E_POINTER;
}
else if( riid == IID_IVMRSurfaceAllocator9 ) {
*ppvObject = static_cast<IVMRSurfaceAllocator9*>( this );
AddRef();
hr = S_OK;
}
else if( riid == IID_IVMRImagePresenter9 ) {
*ppvObject = static_cast<IVMRImagePresenter9*>( this );
AddRef();
hr = S_OK;
}
else if( riid == IID_IUnknown ) {
*ppvObject =
static_cast<IUnknown*>(
static_cast<IVMRSurfaceAllocator9*>( this ) );
AddRef();
hr = S_OK;
}
return hr;
}
ULONG CAllocator::AddRef()
{
return InterlockedIncrement(& m_refCount);
}
ULONG CAllocator::Release()
{
ULONG ret = InterlockedDecrement(& m_refCount);
if( ret == 0 )
{
delete this;
}
return ret;
} | [
"[email protected]"
]
| [
[
[
1,
390
]
]
]
|
6852fae47b747e2686da74e7ab90cb9ebda49860 | d6a28d9d845a20463704afe8ebe644a241dc1a46 | /source/Irrlicht/CMountPointReader.cpp | 0432dae3874b4c49a8a47170f8ce3d655c9376e5 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-other-permissive",
"Zlib"
]
| permissive | marky0720/irrlicht-android | 6932058563bf4150cd7090d1dc09466132df5448 | 86512d871eeb55dfaae2d2bf327299348cc5202c | refs/heads/master | 2021-04-30T08:19:25.297407 | 2010-10-08T08:27:33 | 2010-10-08T08:27:33 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,280 | cpp | // Copyright (C) 2002-2009 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#include "CMountPointReader.h"
#ifdef __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_
#include "CReadFile.h"
#include "os.h"
namespace irr
{
namespace io
{
//! Constructor
CArchiveLoaderMount::CArchiveLoaderMount( io::IFileSystem* fs)
: FileSystem(fs)
{
#ifdef _DEBUG
setDebugName("CArchiveLoaderMount");
#endif
}
//! returns true if the file maybe is able to be loaded by this class
bool CArchiveLoaderMount::isALoadableFileFormat(const io::path& filename) const
{
io::path fname(filename);
deletePathFromFilename(fname);
if (!fname.size())
return true;
IFileList* list = FileSystem->createFileList();
if (list)
{
// check if name is found as directory
if (list->findFile(filename, true))
return true;
}
return false;
}
//! Check to see if the loader can create archives of this type.
bool CArchiveLoaderMount::isALoadableFileFormat(E_FILE_ARCHIVE_TYPE fileType) const
{
return fileType == EFAT_FOLDER;
}
//! Check if the file might be loaded by this class
bool CArchiveLoaderMount::isALoadableFileFormat(io::IReadFile* file) const
{
return false;
}
//! Creates an archive from the filename
IFileArchive* CArchiveLoaderMount::createArchive(const io::path& filename, bool ignoreCase, bool ignorePaths) const
{
IFileArchive *archive = 0;
EFileSystemType current = FileSystem->setFileListSystem(FILESYSTEM_NATIVE);
const io::path save = FileSystem->getWorkingDirectory();
io::path fullPath = FileSystem->getAbsolutePath(filename);
FileSystem->flattenFilename(fullPath);
if (FileSystem->changeWorkingDirectoryTo(fullPath))
{
archive = new CMountPointReader(FileSystem, fullPath, ignoreCase, ignorePaths);
}
FileSystem->changeWorkingDirectoryTo(save);
FileSystem->setFileListSystem(current);
return archive;
}
//! creates/loads an archive from the file.
//! \return Pointer to the created archive. Returns 0 if loading failed.
IFileArchive* CArchiveLoaderMount::createArchive(io::IReadFile* file, bool ignoreCase, bool ignorePaths) const
{
return 0;
}
//! compatible Folder Architecture
CMountPointReader::CMountPointReader(IFileSystem * parent, const io::path& basename, bool ignoreCase, bool ignorePaths)
: CFileList(basename, ignoreCase, ignorePaths), Parent(parent)
{
//! ensure CFileList path ends in a slash
if (Path.lastChar() != '/' )
Path.append('/');
const io::path work = Parent->getWorkingDirectory();
Parent->changeWorkingDirectoryTo(basename);
buildDirectory();
Parent->changeWorkingDirectoryTo(work);
sort();
}
//! returns the list of files
const IFileList* CMountPointReader::getFileList() const
{
return this;
}
void CMountPointReader::buildDirectory()
{
IFileList * list = Parent->createFileList();
if (!list)
return;
const u32 size = list->getFileCount();
for (u32 i=0; i < size; ++i)
{
io::path full = list->getFullFileName(i);
full = full.subString(Path.size(), full.size() - Path.size());
if (!list->isDirectory(i))
{
addItem(full, list->getFileOffset(i), list->getFileSize(i), false, RealFileNames.size());
RealFileNames.push_back(list->getFullFileName(i));
}
else
{
const io::path rel = list->getFileName(i);
io::path pwd = Parent->getWorkingDirectory();
if (pwd.lastChar() != '/')
pwd.append('/');
pwd.append(rel);
if ( rel != "." && rel != ".." )
{
addItem(full, 0, 0, true, 0);
Parent->changeWorkingDirectoryTo(pwd);
buildDirectory();
Parent->changeWorkingDirectoryTo("..");
}
}
}
list->drop();
}
//! opens a file by index
IReadFile* CMountPointReader::createAndOpenFile(u32 index)
{
if (index >= Files.size())
return 0;
return createReadFile(RealFileNames[Files[index].ID]);
}
//! opens a file by file name
IReadFile* CMountPointReader::createAndOpenFile(const io::path& filename)
{
s32 index = findFile(filename, false);
if (index != -1)
return createAndOpenFile(index);
else
return 0;
}
} // io
} // irr
#endif // __IRR_COMPILE_WITH_MOUNT_ARCHIVE_LOADER_
| [
"bitplane@dfc29bdd-3216-0410-991c-e03cc46cb475",
"hybrid@dfc29bdd-3216-0410-991c-e03cc46cb475",
"engineer_apple@dfc29bdd-3216-0410-991c-e03cc46cb475"
]
| [
[
[
1,
27
],
[
29,
29
],
[
31,
33
],
[
37,
37
],
[
41,
41
],
[
43,
57
],
[
59,
63
],
[
66,
67
],
[
69,
85
],
[
88,
90
],
[
93,
93
],
[
95,
112
],
[
115,
118
],
[
120,
123
],
[
125,
128
],
[
132,
136
],
[
138,
138
],
[
140,
157
],
[
159,
171
]
],
[
[
28,
28
],
[
30,
30
],
[
34,
36
],
[
38,
40
],
[
42,
42
],
[
58,
58
],
[
64,
65
],
[
68,
68
],
[
86,
87
],
[
91,
92
],
[
94,
94
],
[
113,
114
],
[
119,
119
],
[
129,
131
],
[
139,
139
],
[
158,
158
]
],
[
[
124,
124
],
[
137,
137
]
]
]
|
6cbd692205b59080045545929bd6f3dcdff2337f | b8ac0bb1d1731d074b7a3cbebccc283529b750d4 | /Code/controllers/RecollectionBenchmark/robotapi/webts/WebotsRobot.h | 9696856bde9bfd5c139d515198b995d45059918e | []
| no_license | dh-04/tpf-robotica | 5efbac38d59fda0271ac4639ea7b3b4129c28d82 | 10a7f4113d5a38dc0568996edebba91f672786e9 | refs/heads/master | 2022-12-10T18:19:22.428435 | 2010-11-05T02:42:29 | 2010-11-05T02:42:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,619 | h | #ifndef robotapi_webts_WebotsRobot_h
#define robotapi_webts_WebotsRobot_h
#include <robotapi/IRobot.h>
#include <webots/DifferentialWheels.hpp>
#include <WorldInfo.h>
#include <list>
#include <utils/ArenaGrid.h>
#include <utils/ArenaGridSlot.h>
#include <utils/MyPoint.h>
namespace robotapi {
namespace webts {
class WebotsRobot : virtual public robotapi::IRobot {
public:
WebotsRobot(WorldInfo * wi, webots::DifferentialWheels & dw );
std::string getName();
double getTime();
int getMode();
void setGC(IGarbageCleaner * gc);
bool getSynchronization();
double getBasicTimeStep();
ICamera & getCamera(std::string name);
IDistanceSensor & getDistanceSensor(std::string name);
IServo & getServo(std::string name);
IDevice & getDevice(std::string name);
IDifferentialWheels & getDifferentialWheels(std::string name);
IBattery & getBattery(std::string name);
ITrashBin & getTrashBin(std::string name);
void step(int ms);
void saveChanges(std::list<utils::ArenaGridSlot *> ags);
std::list<utils::ArenaGridSlot *> getSlotsSeen(utils::MyPoint * position, double angle, utils::ArenaGridSlot * currentSlot);
void shutdown();
// destructor for interface
~WebotsRobot() { }
private:
IGarbageCleaner * gc;
WorldInfo * wi;
IDifferentialWheels * df;
IBattery * robotBattery;
IBattery * pcBattery;
ITrashBin * tb;
utils::ArenaGrid * ag;
};
} /* End of namespace robotapi::webts */
} /* End of namespace robotapi */
#endif // robotapi_webts_WebotsRobot_h
| [
"guicamest@d69ea68a-f96b-11de-8cdf-e97ad7d0f28a",
"nachogoni@d69ea68a-f96b-11de-8cdf-e97ad7d0f28a"
]
| [
[
[
1,
26
],
[
28,
51
],
[
53,
56
],
[
58,
69
]
],
[
[
27,
27
],
[
52,
52
],
[
57,
57
]
]
]
|
0f1fc69518696b57a804f26ac88f274535b1010d | 135522f4ca53fda5a5f5eac5b79a3f5f8f2c089f | /EasyWar/Sprite.h | dcb2d24395727ebf7c72ea2ec9b4042ae83619fd | []
| no_license | weimingtom/easywar | b0a006a59cc059131ba30c6aa8fd238643a201de | 5279851c0c23af51b2273b2076d05f44a50bc2c7 | refs/heads/master | 2021-01-09T21:58:26.257817 | 2009-12-13T02:52:06 | 2009-12-13T02:52:06 | 44,422,879 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 746 | h | #pragma once
#include "BasicUtility.h"
class SpriteGroup;
//Sprite类,用于表示2D图块
class Sprite
{
friend class SpriteGroup;
public:
Sprite();
Sprite( const char* filename );
~Sprite();
void Load( const char* filename ); //加载图片
void Kill(); //删除Sprite
void SetAlpha( int alpha ); //设置半透明
void SetAngleZoom( double angle, double zoom );
//旋转缩放
void Clip( int x, int y, int wid, int hei );
//剪切(以得到原图的局部)
void Clip( Rect& region ); //剪切
void Clip( float u1, float v1, float u2, float v2 );
//剪切(按照UV坐标来)
protected:
SDL_Surface* m_spr; //存储本图块的surface
};
| [
"xujia1985@d64887d6-d1e9-11de-a205-5990a31c5447"
]
| [
[
[
1,
29
]
]
]
|
3abe8cee98a8e1bdc074e91eeb973df56e51adfb | 580738f96494d426d6e5973c5b3493026caf8b6a | /Include/Vcl/qrprnsu.hpp | ad4835852047394722a473c0d6e5e585cfee399b | []
| no_license | bravesoftdz/cbuilder-vcl | 6b460b4d535d17c309560352479b437d99383d4b | 7b91ef1602681e094a6a7769ebb65ffd6f291c59 | refs/heads/master | 2021-01-10T14:21:03.726693 | 2010-01-11T11:23:45 | 2010-01-11T11:23:45 | 48,485,606 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 5,832 | hpp | // Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved
// (DO NOT EDIT: machine generated header) 'QRPrnSu.pas' rev: 6.00
#ifndef QRPrnSuHPP
#define QRPrnSuHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Printers.hpp> // Pascal unit
#include <Dialogs.hpp> // Pascal unit
#include <StdCtrls.hpp> // Pascal unit
#include <Forms.hpp> // Pascal unit
#include <Controls.hpp> // Pascal unit
#include <Graphics.hpp> // Pascal unit
#include <Classes.hpp> // Pascal unit
#include <CommDlg.hpp> // Pascal unit
#include <SysUtils.hpp> // Pascal unit
#include <Messages.hpp> // Pascal unit
#include <Windows.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Qrprnsu
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS TQRCommonDialog;
class PASCALIMPLEMENTATION TQRCommonDialog : public Classes::TComponent
{
typedef Classes::TComponent inherited;
private:
bool FCtl3D;
void *FDefWndProc;
Classes::THelpContext FHelpContext;
HWND FHandle;
void *FObjectInstance;
char *FTemplate;
Classes::TNotifyEvent FOnClose;
Classes::TNotifyEvent FOnShow;
MESSAGE void __fastcall WMDestroy(Messages::TWMNoParams &Message);
MESSAGE void __fastcall WMInitDialog(Messages::TWMInitDialog &Message);
MESSAGE void __fastcall WMNCDestroy(Messages::TWMNoParams &Message);
protected:
virtual void __fastcall DefaultHandler(void *Message);
virtual void __fastcall WndProc(Messages::TMessage &Message);
virtual bool __fastcall MessageHook(Messages::TMessage &Msg);
virtual BOOL __fastcall TaskModalDialog(void * DialogFunc, void *DialogData);
DYNAMIC void __fastcall DoClose(void);
DYNAMIC void __fastcall DoShow(void);
virtual bool __fastcall Execute(void) = 0 ;
__property char * Template = {read=FTemplate, write=FTemplate};
public:
__fastcall virtual TQRCommonDialog(Classes::TComponent* AOwner);
__fastcall virtual ~TQRCommonDialog(void);
__property HWND Handle = {read=FHandle, nodefault};
__published:
__property bool Ctl3D = {read=FCtl3D, write=FCtl3D, default=1};
__property Classes::THelpContext HelpContext = {read=FHelpContext, write=FHelpContext, default=0};
__property Classes::TNotifyEvent OnClose = {read=FOnClose, write=FOnClose};
__property Classes::TNotifyEvent OnShow = {read=FOnShow, write=FOnShow};
};
class DELPHICLASS TQRBasePrintDialog;
class PASCALIMPLEMENTATION TQRBasePrintDialog : public TQRCommonDialog
{
typedef TQRCommonDialog inherited;
private:
Printers::TPrinter* FPrinter;
protected:
char Device[80];
char Driver[80];
char Port[80];
unsigned __fastcall CopyData(unsigned Handle);
void __fastcall SetPrinter(unsigned DeviceMode, unsigned DeviceNames);
void __fastcall GetPrinter(unsigned &DeviceMode, unsigned &DeviceNames);
public:
__fastcall virtual TQRBasePrintDialog(Classes::TComponent* AOwner);
__property Printers::TPrinter* Printer = {read=FPrinter, write=FPrinter};
public:
#pragma option push -w-inl
/* TQRCommonDialog.Destroy */ inline __fastcall virtual ~TQRBasePrintDialog(void) { }
#pragma option pop
};
class DELPHICLASS TQRPrinterSetupDialog;
class PASCALIMPLEMENTATION TQRPrinterSetupDialog : public TQRBasePrintDialog
{
typedef TQRBasePrintDialog inherited;
public:
virtual bool __fastcall Execute(void);
public:
#pragma option push -w-inl
/* TQRBasePrintDialog.Create */ inline __fastcall virtual TQRPrinterSetupDialog(Classes::TComponent* AOwner) : TQRBasePrintDialog(AOwner) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TQRCommonDialog.Destroy */ inline __fastcall virtual ~TQRPrinterSetupDialog(void) { }
#pragma option pop
};
class DELPHICLASS TQRPrintDialog;
class PASCALIMPLEMENTATION TQRPrintDialog : public TQRBasePrintDialog
{
typedef TQRBasePrintDialog inherited;
private:
int FFromPage;
int FToPage;
bool FCollate;
Dialogs::TPrintDialogOptions FOptions;
bool FPrintToFile;
Dialogs::TPrintRange FPrintRange;
int FMinPage;
int FMaxPage;
int FCopies;
void __fastcall SetNumCopies(int Value);
public:
virtual bool __fastcall Execute(void);
__published:
__property bool Collate = {read=FCollate, write=FCollate, default=0};
__property int Copies = {read=FCopies, write=SetNumCopies, default=0};
__property int FromPage = {read=FFromPage, write=FFromPage, default=0};
__property int MinPage = {read=FMinPage, write=FMinPage, default=0};
__property int MaxPage = {read=FMaxPage, write=FMaxPage, default=0};
__property Dialogs::TPrintDialogOptions Options = {read=FOptions, write=FOptions, default=0};
__property bool PrintToFile = {read=FPrintToFile, write=FPrintToFile, default=0};
__property Dialogs::TPrintRange PrintRange = {read=FPrintRange, write=FPrintRange, default=0};
__property int ToPage = {read=FToPage, write=FToPage, default=0};
public:
#pragma option push -w-inl
/* TQRBasePrintDialog.Create */ inline __fastcall virtual TQRPrintDialog(Classes::TComponent* AOwner) : TQRBasePrintDialog(AOwner) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TQRCommonDialog.Destroy */ inline __fastcall virtual ~TQRPrintDialog(void) { }
#pragma option pop
};
//-- var, const, procedure ---------------------------------------------------
static const Shortint MaxCustomColors = 0x10;
} /* namespace Qrprnsu */
using namespace Qrprnsu;
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // QRPrnSu
| [
"bitscode@7bd08ab0-fa70-11de-930f-d36749347e7b"
]
| [
[
[
1,
173
]
]
]
|
182e653e0c1cfe50a18a366bdedd74309aa59263 | 3b70a7b1d647a401c69c10b39ca75e38ee8741cb | /ofxArgosUI/src/Controls/ofxArgosUI_Panel.h | b809621b40bdb6b43da2f004097f0223f2fd89c3 | []
| no_license | nuigroup/argos-interface-builder | dc4e2daea0e318052165432f09a08b2c2285e516 | dc231f73a04b7bad23fb03c8f4eca4dcfc3d8fd8 | refs/heads/master | 2020-05-19T09:20:38.019073 | 2010-05-30T05:41:34 | 2010-05-30T05:41:34 | 8,322,636 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,595 | h | /***********************************************************************
Copyright (c) 2009, 2010 Dimitri Diakopoulos, http://www.dimitridiakopoulos.com/
Portions Copyright (c) 2008, 2009 Memo Aktens, http://www.memo.tv/
-> Based on ofxSimpleGuiToo
Portions Copyright (c) 2008 Todd Vanderlin, http://toddvanderlin.com/
-> Inspired by ofxSimpleGui API
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NOEVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*************************************************************************/
#pragma once
#include "ofxArgosUI_Includes.h"
class ofxArgosUI_Panel : public ofxArgosUI_Control {
public:
bool hidden;
bool isprotected;
int oWidth;
int oHeight;
int cornerRadius;
ofxArgosUI_Panel(string name, int x, int y, int width, int height) : ofxArgosUI_Control(name) {
disableAllEvents();
disableAllInput(); // Adds the FocusActive listener we can hack to clear the editor
oHeight = height;
controlType = "Panel";
setup(x, y, width, height);
cornerRadius = 12;
isprotected = false;
hidden = false;
}
void setup(int _x, int _y, int _width, int _height) {
setPos(_x, _y);
setSize(_width, _height);
}
void loadFromXML(ofxXmlSettings &XML){}
void saveToXML(ofxXmlSettings &XML){}
void toggleDraw(){
enabled = !enabled;
}
void focusActive(){}
void showPanel(){
printf("ofxArgosUI_Panel::showPanel\n");
// Show the controls
hidden = false;
// Enable the controls
for(int i = 0; i < panel_children.size(); i++) {
panel_children[i]->enabled = true;
}
}
void hidePanel(){
printf("ofxArgosUI_Panel::hidePanel\n");
// Save height
oHeight = height;
// Hide the controls
hidden = true;
// Disable the controls
for(int i = 0; i < panel_children.size(); i++) {
panel_children[i]->enabled = false;
}
}
void lockPanel(){
this->canfocus = false;
}
void resetPanel(string nN, int nW, int nH){
setName(nN);
setSize(nW,nH);
for(int i = 0; i < panel_children.size(); i++) {
panel_children[i]->killMe();
}
panel_children.clear();
}
int numControls(){
return panel_children.size();
}
ofxArgosUI_Control *addControl(ofxArgosUI_Control *control) {
// Rather than glTranslate the controls every draw,
// this adds them them relative to the panel's (0,0);
control->setPos(x + control->x, y + control->y);
panel_children.push_back(control);
return control;
}
void setCornerRadius(int radius){
cornerRadius = radius;
}
ofxArgosUI_Button *addButton(string name, int x, int y, int width, int height, bool *value) {
return (ofxArgosUI_Button *)addControl(new ofxArgosUI_Button(name, x, y, width, height, value));
}
ofxArgosUI_FPSCounter *addFPSCounter(int x, int y, int width, int height) {
return (ofxArgosUI_FPSCounter *)addControl(new ofxArgosUI_FPSCounter(x, y, width, height));
}
ofxArgosUI_SliderInt *addSlider(string name, int x, int y, int width, int height, int *value, int min, int max) {
return (ofxArgosUI_SliderInt *)addControl(new ofxArgosUI_SliderInt(name, x, y, width, height, value, min, max, 0));
}
ofxArgosUI_SliderFloat *addSlider(string name, int x, int y, int width, int height, float *value, float min, float max, float smoothing) {
return (ofxArgosUI_SliderFloat *)addControl(new ofxArgosUI_SliderFloat(name, x, y, width, height, value, min, max, smoothing));
}
ofxArgosUI_XYPad *addXYPad(string name, int x, int y, int width, int height, ofPoint* value, float xmin, float xmax, float ymin, float ymax) {
return (ofxArgosUI_XYPad *)addControl(new ofxArgosUI_XYPad(name, x, y, width, height, value, xmin, xmax, ymin, ymax));
}
ofxArgosUI_TextField *addTextField(string name, int x, int y, int width, int height, string *value){
return (ofxArgosUI_TextField *)addControl(new ofxArgosUI_TextField(name, x, y, width, height, value));
}
ofxArgosUI_Title *addTitle(string name, bool *value) {
return (ofxArgosUI_Title *)addControl(new ofxArgosUI_Title(name, value));
}
ofxArgosUI_Toggle *addToggle(string name, int x, int y, int width, int height, bool *value) {
return (ofxArgosUI_Toggle *)addControl(new ofxArgosUI_Toggle(name, x, y, width, height, value));
}
ofxArgosUI_Knob *addKnob(string name, int x, int y, int radius, float *value, float min, float max, float smoothing){
return (ofxArgosUI_Knob *)addControl(new ofxArgosUI_Knob(name, x, y, radius, value, min, max, smoothing));
}
ofxArgosUI_Icon *addIcon(int x, int y, int width, int height) {
return (ofxArgosUI_Icon *)addControl(new ofxArgosUI_Icon(x, y, width, height));
}
void update() {
if(!enabled) return;
enabled = false;
}
void draw(float x, float y) {
if(!enabled) return;
setPos(x, y);
ofEnableAlphaBlending();
ofSetColor(0x363636);
rRectangle(x, y, width, height, cornerRadius);
ofSetColor(0xf0f0f0);
argosText::font.drawString(name, x + 5, y - 3);
for(int i = 0; i < panel_children.size(); i++) {
panel_children[i]->draw(panel_children[i]->x, panel_children[i]->y);
}
ofDisableAlphaBlending();
}
protected:
vector <ofxArgosUI_Control*> panel_children;
}; | [
"eliftherious@85a45124-5891-11de-8d7d-01d876f1962d"
]
| [
[
[
1,
218
]
]
]
|
bd6682d35e9ba6dbd1099e5752bd0a9b44c19e72 | 15fc90dea35740998f511319027d9971bae9251c | /SwBookmarksMerge/BookmarkWriter.h | c7526208005575b5ab8f6136b77483763a265660 | []
| no_license | ECToo/switch-soft | c35020249be233cf1e35dc18b5c097894d5efdb4 | 5edf2cc907259fb0a0905fc2c321f46e234e6263 | refs/heads/master | 2020-04-02T10:15:53.067883 | 2009-05-29T15:13:23 | 2009-05-29T15:13:23 | 32,216,312 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 368 | h | #pragma once
class BookmarkWriter
{
wstring Name;
ofstream File;
BookmarkItem* RootItem;
string Indent;
int BookmarkCount;
int GroupCount;
public:
BookmarkWriter(wstring Name, BookmarkItem* RootItem);
~BookmarkWriter(void);
public:
void WriteFile();
void WriteItem(BookmarkItem* item);
void WriteAttributes( BookmarkItem* item );
};
| [
"roman.dzieciol@e6f6c67e-47ec-11de-80ae-c1ff141340a0"
]
| [
[
[
1,
20
]
]
]
|
105837e09fb6af09e3ea59f0e79a8e862a779a6d | d1dc408f6b65c4e5209041b62cd32fb5083fe140 | /src/gameobjects/structures/cWindTrap.h | fb179a2abd5ffe466c89484813a109941c45012e | []
| no_license | dmitrygerasimuk/dune2themaker-fossfriendly | 7b4bed2dfb2b42590e4b72bd34bb0f37f6c81e37 | 89a6920b216f3964241eeab7cf1a631e1e63f110 | refs/heads/master | 2020-03-12T03:23:40.821001 | 2011-02-19T12:01:30 | 2011-02-19T12:01:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 589 | h | // Structure class
class cWindTrap : public cAbstractStructure
{
private:
int iFade; // Fading progress (windtraps)
bool bFadeDir; // Fading direction (TRUE -> up, FALSE -> down)
// TIMER
int TIMER_fade;
// windtrap specific animation:
void think_fade();
public:
cWindTrap();
~cWindTrap();
// overloaded functions
void think();
void think_animation();
void think_guard();
void draw(int iStage);
int getType();
int getPowerOut();
int getMaxPowerOut();
int getFade() { return iFade; }
};
| [
"stefanhen83@52bf4e17-6a1c-0410-83a1-9b5866916151"
]
| [
[
[
1,
32
]
]
]
|
91f50cd8a4579796b9131d9d749c6d94134d66fa | dbe1ad8c1ae77e80c1f0d613c70334bf911d2f5f | /apps/shaderResearch/metaball_marchingcube/ofxShader/ofxOpenCv/libs/opencv/include/cvmat.hpp | 0b60baf6c23223f441c8c36c24e8f429247ad336 | []
| no_license | levky/OF | b239f2337ecdadc2ef72058f7cc6e206167e78f2 | 49acda22ecb8ff2e4e2cf198d7f494c562ab2e89 | refs/heads/master | 2020-05-15T18:28:12.238925 | 2011-09-15T10:15:57 | 2011-09-15T10:16:01 | 1,170,485 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 72,904 | hpp | /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef _CVMAT_HPP_
#define _CVMAT_HPP_
#if 0 && (defined __cplusplus && (_MSC_VER>=1200 || defined __BORLANDC__ || defined __GNUC__))
#if _MSC_VER >= 1200
#pragma warning( disable: 4710 ) /* suppress "function ... is not inlined" */
#endif
#include <string.h>
#include <stdio.h>
#undef min
#undef max
/****************************************************************************************\
* C++ - like operations on CvScalar *
\****************************************************************************************/
inline CvScalar& operator += ( CvScalar& a, const CvScalar& b )
{
double t0 = a.val[0] + b.val[0];
double t1 = a.val[1] + b.val[1];
a.val[0] = t0;
a.val[1] = t1;
t0 = a.val[2] + b.val[2];
t1 = a.val[3] + b.val[3];
a.val[2] = t0;
a.val[3] = t1;
return a;
}
inline CvScalar& operator -= ( CvScalar& a, const CvScalar& b )
{
double t0 = a.val[0] - b.val[0];
double t1 = a.val[1] - b.val[1];
a.val[0] = t0;
a.val[1] = t1;
t0 = a.val[2] - b.val[2];
t1 = a.val[3] - b.val[3];
a.val[2] = t0;
a.val[3] = t1;
return a;
}
inline CvScalar& operator *= ( CvScalar& a, double b )
{
double t0 = a.val[0] * b;
double t1 = a.val[1] * b;
a.val[0] = t0;
a.val[1] = t1;
t0 = a.val[2] * b;
t1 = a.val[3] * b;
a.val[2] = t0;
a.val[3] = t1;
return a;
}
inline CvScalar& operator /= ( CvScalar& a, double b )
{
double inv_b = 1./b;
double t0 = a.val[0] * inv_b;
double t1 = a.val[1] * inv_b;
a.val[0] = t0;
a.val[1] = t1;
t0 = a.val[2] * inv_b;
t1 = a.val[3] * inv_b;
a.val[2] = t0;
a.val[3] = t1;
return a;
}
inline CvScalar& operator *= ( CvScalar& a, const CvScalar& b )
{
double t0 = a.val[0]*b.val[0] - a.val[1]*b.val[1] -
a.val[2]*b.val[2] - a.val[3]*b.val[3];
double t1 = a.val[0]*b.val[1] + a.val[1]*b.val[0] +
a.val[2]*b.val[3] - a.val[3]*b.val[2];
double t2 = a.val[0]*b.val[2] - a.val[1]*b.val[3] +
a.val[2]*b.val[0] + a.val[3]*b.val[1];
double t3 = a.val[0]*b.val[3] + a.val[1]*b.val[2] -
a.val[2]*b.val[1] + a.val[3]*b.val[0];
a.val[0] = t0;
a.val[1] = t1;
a.val[2] = t2;
a.val[3] = t3;
return a;
}
inline CvScalar& operator /= ( CvScalar& a, const CvScalar& b )
{
double inv_d = -1./(b.val[0]*b.val[0] + b.val[1]*b.val[1] +
b.val[2]*b.val[2] + b.val[3]*b.val[3]);
return a *= cvScalar( b.val[0] * -inv_d, b.val[1] * inv_d,
b.val[2] * inv_d, b.val[3] * inv_d );
}
inline CvScalar& operator += ( CvScalar& a, double b )
{
a.val[0] += b;
return a;
}
inline CvScalar& operator -= ( CvScalar& a, double b )
{
a.val[0] -= b;
return a;
}
inline CvScalar operator + ( const CvScalar& a, const CvScalar& b )
{
return cvScalar( a.val[0] + b.val[0], a.val[1] + b.val[1],
a.val[2] + b.val[2], a.val[3] + b.val[3] );
}
inline CvScalar operator - ( const CvScalar& a, const CvScalar& b )
{
return cvScalar( a.val[0] - b.val[0], a.val[1] - b.val[1],
a.val[2] - b.val[2], a.val[3] - b.val[3] );
}
inline CvScalar operator + ( const CvScalar& a, double b )
{
return cvScalar( a.val[0] + b, a.val[1], a.val[2], a.val[3] );
}
inline CvScalar operator - ( const CvScalar& a, double b )
{
return cvScalar( a.val[0] - b, a.val[1], a.val[2], a.val[3] );
}
inline CvScalar operator + ( double a, const CvScalar& b )
{
return cvScalar( a + b.val[0], b.val[1], b.val[2], b.val[3] );
}
inline CvScalar operator - ( double a, const CvScalar& b )
{
return cvScalar( a - b.val[0], -b.val[1], -b.val[2], -b.val[3] );
}
inline CvScalar operator - ( const CvScalar& b )
{
return cvScalar( -b.val[0], -b.val[1], -b.val[2], -b.val[3] );
}
inline CvScalar operator * ( const CvScalar& a, const CvScalar& b )
{
CvScalar c = a;
return (c *= b);
}
inline CvScalar operator * ( const CvScalar& a, double b )
{
return cvScalar( a.val[0]*b, a.val[1]*b, a.val[2]*b, a.val[3]*b );
}
inline CvScalar operator * ( double a, const CvScalar& b )
{
return cvScalar( b.val[0]*a, b.val[1]*a, b.val[2]*a, b.val[3]*a );
}
inline CvScalar operator / ( const CvScalar& a, const CvScalar& b )
{
CvScalar c = a;
return (c /= b);
}
inline CvScalar operator / ( const CvScalar& a, double b )
{
double inv_b = 1./b;
return cvScalar( a.val[0]*inv_b, a.val[1]*inv_b,
a.val[2]*inv_b, a.val[3]*inv_b );
}
inline CvScalar operator / ( double a, const CvScalar& b )
{
double inv_d = -a/(b.val[0]*b.val[0] + b.val[1]*b.val[1] +
b.val[2]*b.val[2] + b.val[3]*b.val[3]);
return cvScalar( b.val[0] * -inv_d, b.val[1] * inv_d,
b.val[2] * inv_d, b.val[3] * inv_d );
}
inline CvScalar& operator &= ( CvScalar& a, const CvScalar& b )
{
int t0 = cvRound(a.val[0]) & cvRound(b.val[0]);
int t1 = cvRound(a.val[1]) & cvRound(b.val[1]);
a.val[0] = t0;
a.val[1] = t1;
t0 = cvRound(a.val[2]) & cvRound(b.val[2]);
t1 = cvRound(a.val[3]) & cvRound(b.val[3]);
a.val[2] = t0;
a.val[3] = t1;
return a;
}
inline CvScalar& operator |= ( CvScalar& a, const CvScalar& b )
{
int t0 = cvRound(a.val[0]) | cvRound(b.val[0]);
int t1 = cvRound(a.val[1]) | cvRound(b.val[1]);
a.val[0] = t0;
a.val[1] = t1;
t0 = cvRound(a.val[2]) | cvRound(b.val[2]);
t1 = cvRound(a.val[3]) | cvRound(b.val[3]);
a.val[2] = t0;
a.val[3] = t1;
return a;
}
inline CvScalar& operator ^= ( CvScalar& a, const CvScalar& b )
{
int t0 = cvRound(a.val[0]) ^ cvRound(b.val[0]);
int t1 = cvRound(a.val[1]) ^ cvRound(b.val[1]);
a.val[0] = t0;
a.val[1] = t1;
t0 = cvRound(a.val[2]) ^ cvRound(b.val[2]);
t1 = cvRound(a.val[3]) ^ cvRound(b.val[3]);
a.val[2] = t0;
a.val[3] = t1;
return a;
}
inline CvScalar operator & ( const CvScalar& a, const CvScalar& b )
{
CvScalar c = a;
return (c &= b);
}
inline CvScalar operator | ( const CvScalar& a, const CvScalar& b )
{
CvScalar c = a;
return (c |= b);
}
inline CvScalar operator ^ ( const CvScalar& a, const CvScalar& b )
{
CvScalar c = a;
return (c ^= b);
}
inline CvScalar operator ~ ( const CvScalar& a )
{
return cvScalar( ~cvRound(a.val[0]), ~cvRound(a.val[1]),
~cvRound(a.val[2]), ~cvRound(a.val[3]));
}
/****************************************************************************************\
* C++ Matrix Class *
\****************************************************************************************/
struct _CvMATConstElem_;
struct _CvMATElem_;
struct _CvMATElemCn_;
struct _CvMAT_T_;
struct _CvMAT_MUL_;
struct _CvMAT_INV_;
struct _CvMAT_SCALE_;
struct _CvMAT_SCALE_SHIFT_;
struct _CvMAT_ADD_;
struct _CvMAT_ADD_EX_;
struct _CvMAT_MUL_ADD_;
struct _CvMAT_LOGIC_;
struct _CvMAT_UN_LOGIC_;
struct _CvMAT_NOT_;
struct _CvMAT_CVT_;
struct _CvMAT_COPY_;
struct _CvMAT_DOT_OP_;
struct _CvMAT_SOLVE_;
struct _CvMAT_CMP_;
class CV_EXPORTS CvMAT : public CvMat
{
protected:
public:
/* helper methods for retrieving/setting matrix elements */
static double get( const uchar* ptr, int type, int coi = 0 );
static void set( uchar* ptr, int type, int coi, double d );
static void set( uchar* ptr, int type, int coi, int i );
static void set( uchar* ptr, int type, double d );
static void set( uchar* ptr, int type, int i );
/******************* constructors ********************/
/* empty */
explicit CvMAT();
/* creation */
explicit CvMAT( int rows, int cols, int type, void* data, int step = CV_AUTOSTEP );
explicit CvMAT( int rows, int type, void* data, int step = CV_AUTOSTEP );
explicit CvMAT( int rows, int cols, int type );
explicit CvMAT( int rows, int type );
/* extracting part of an existing matrix */
explicit CvMAT( const CvMat& mat, CvRect rect ); /* submatrix */
explicit CvMAT( const CvMat& mat, int k, int i ); /* submatrix:
k == 0 - i-th row
k > 0 - i-th column
k < 0 - i-th diagonal */
/* copying */
CvMAT( const CvMat& mat );
CvMAT( const CvMAT& mat );
CvMAT( const IplImage& img );
/* CvMAT b = op(a1,a2,...) */
explicit CvMAT( const _CvMAT_T_& mat_t );
explicit CvMAT( const _CvMAT_INV_& inv_mat );
explicit CvMAT( const _CvMAT_ADD_& mat_add );
explicit CvMAT( const _CvMAT_ADD_EX_& mat_add );
explicit CvMAT( const _CvMAT_SCALE_& scale_mat );
explicit CvMAT( const _CvMAT_SCALE_SHIFT_& scale_shift_mat );
explicit CvMAT( const _CvMAT_MUL_& mmul );
explicit CvMAT( const _CvMAT_MUL_ADD_& mmuladd );
explicit CvMAT( const _CvMAT_LOGIC_& mat_logic );
explicit CvMAT( const _CvMAT_UN_LOGIC_& mat_logic );
explicit CvMAT( const _CvMAT_NOT_& not_mat );
explicit CvMAT( const _CvMAT_COPY_& mat_copy );
explicit CvMAT( const _CvMAT_CVT_& mat_copy );
explicit CvMAT( const _CvMAT_DOT_OP_& dot_mul );
explicit CvMAT( const _CvMAT_SOLVE_& solve_mat );
explicit CvMAT( const _CvMAT_CMP_& cmp_mat );
/* desctructor */
~CvMAT();
/* copying and filling with a constant */
CvMAT& operator = ( const CvMAT& mat );
CvMAT& operator = ( const CvMat& mat );
CvMAT& operator = ( const IplImage& img );
CvMAT& operator = ( double fillval );
CvMAT& operator = ( const CvScalar& fillval );
/* b = op(a1, a2,...) */
CvMAT& operator = ( const _CvMAT_T_& mat_t );
CvMAT& operator = ( const _CvMAT_INV_& inv_mat );
CvMAT& operator = ( const _CvMAT_ADD_& mat_add );
CvMAT& operator = ( const _CvMAT_ADD_EX_& mat_add );
CvMAT& operator = ( const _CvMAT_SCALE_& scale_mat );
CvMAT& operator = ( const _CvMAT_SCALE_SHIFT_& scale_shift_mat );
CvMAT& operator = ( const _CvMAT_MUL_& mmul );
CvMAT& operator = ( const _CvMAT_MUL_ADD_& mmuladd );
CvMAT& operator = ( const _CvMAT_LOGIC_& mat_logic );
CvMAT& operator = ( const _CvMAT_UN_LOGIC_& mat_logic );
CvMAT& operator = ( const _CvMAT_NOT_& not_mat );
CvMAT& operator = ( const _CvMAT_DOT_OP_& dot_mul );
CvMAT& operator = ( const _CvMAT_SOLVE_& solve_mat );
CvMAT& operator = ( const _CvMAT_CMP_& cmp_mat );
CvMAT& operator = ( const _CvMAT_CVT_& mat_cvt );
/* copy matrix data, not only matrix header */
CvMAT& operator = ( const _CvMAT_COPY_& mat_copy );
/* augmented assignments */
CvMAT& operator += ( const CvMat& mat );
CvMAT& operator += ( double val );
CvMAT& operator += ( const CvScalar& val );
CvMAT& operator += ( const _CvMAT_SCALE_& scale_mat );
CvMAT& operator += ( const _CvMAT_SCALE_SHIFT_& scale_mat );
CvMAT& operator += ( const _CvMAT_MUL_& mmul );
CvMAT& operator -= ( const CvMat& mat );
CvMAT& operator -= ( double val );
CvMAT& operator -= ( const CvScalar& val );
CvMAT& operator -= ( const _CvMAT_SCALE_& scale_mat );
CvMAT& operator -= ( const _CvMAT_SCALE_SHIFT_& scale_mat );
CvMAT& operator -= ( const _CvMAT_MUL_& mmul );
CvMAT& operator *= ( const CvMat& mat );
CvMAT& operator *= ( double val );
CvMAT& operator *= ( const CvScalar& val );
CvMAT& operator *= ( const _CvMAT_SCALE_& scale_mat );
CvMAT& operator *= ( const _CvMAT_SCALE_SHIFT_& scale_mat );
CvMAT& operator &= ( const CvMat& mat );
CvMAT& operator &= ( double val );
CvMAT& operator &= ( const CvScalar& val );
CvMAT& operator |= ( const CvMat& mat );
CvMAT& operator |= ( double val );
CvMAT& operator |= ( const CvScalar& val );
CvMAT& operator ^= ( const CvMat& mat );
CvMAT& operator ^= ( double val );
CvMAT& operator ^= ( const CvScalar& val );
/* various scalar charactertics */
double norm( int norm_type = CV_L2 ) const;
double norm( CvMat& mat, int norm_type = CV_L2 ) const;
CvScalar sum() const;
double det() const;
double trace() const;
_CvMAT_T_ t() const; /* transposition */
_CvMAT_INV_ inv(int method = 0) const;
/* inversion using one of the following methods:
method = 0 - Gaussian elimination,
method = 1 - SVD */
_CvMAT_DOT_OP_ mul( const CvMAT& mat ) const;
_CvMAT_DOT_OP_ mul( const _CvMAT_SCALE_& mat ) const;
_CvMAT_DOT_OP_ div( const CvMAT& mat ) const;
_CvMAT_DOT_OP_ div( const _CvMAT_SCALE_& mat ) const;
_CvMAT_DOT_OP_ min( const CvMAT& mat ) const;
_CvMAT_DOT_OP_ max( const CvMAT& mat ) const;
_CvMAT_DOT_OP_ min( double value ) const;
_CvMAT_DOT_OP_ max( double value ) const;
double min( CvPoint* minloc = 0 ) const;
double max( CvPoint* maxloc = 0 ) const;
_CvMAT_DOT_OP_ abs() const;
/* accessing matrix elements */
_CvMATElem_ operator ()( int row );
_CvMATConstElem_ operator ()( int row ) const;
_CvMATElem_ operator ()( int row, int col );
_CvMATConstElem_ operator ()( int row, int col ) const;
_CvMATElem_ operator ()( CvPoint loc );
_CvMATConstElem_ operator ()( CvPoint loc ) const;
_CvMATElemCn_ operator()( int row, int col, int coi );
double operator()( int row, int col, int coi ) const;
_CvMATElemCn_ operator()( CvPoint pt, int coi );
double operator()( CvPoint pt, int coi ) const;
void* ptr( int row );
const void* ptr( int row ) const;
void* ptr( int row, int col );
const void* ptr( int row, int col ) const;
void* ptr( CvPoint pt );
const void* ptr( CvPoint pt ) const;
/* accessing matrix parts */
CvMAT row( int row ) const;
CvMAT rowrange( int row1, int row2 ) const;
CvMAT col( int col ) const;
CvMAT colrange( int col1, int col2 ) const;
CvMAT rect( CvRect rect ) const;
CvMAT diag( int diag = 0 ) const;
_CvMAT_COPY_ clone() const;
/* convert matrix */
_CvMAT_CVT_ cvt( int newdepth = -1, double scale = 1,
double shift = 0 ) const;
/* matrix transformation */
void reshape( int newcn, int newrows = 0 );
void flipX();
void flipY();
void flipXY();
/* matrix I/O: use dynamically linked runtime libraries */
void write( const char* name = 0, FILE* f = 0, const char* fmt = 0 );
void read( char** name = 0, FILE* f = 0 );
/* decrease matrix data reference counter and clear data pointer */
void release();
protected:
void create( int rows, int cols, int type );
};
/* !!! Internal Use Only !!! */
/* proxies for matrix elements */
/* const_A(i,j) */
struct CV_EXPORTS _CvMATConstElem_
{
explicit _CvMATConstElem_( const uchar* ptr, int type );
operator CvScalar () const;
double operator ()( int coi = 0 ) const;
uchar* ptr;
int type;
};
/* A(i,j,cn) or A(i,j)(cn) */
struct CV_EXPORTS _CvMATElemCn_
{
explicit _CvMATElemCn_( uchar* ptr, int type, int coi );
operator double() const;
_CvMATElemCn_& operator = ( const _CvMATConstElem_& elem );
_CvMATElemCn_& operator = ( const _CvMATElemCn_& elem );
_CvMATElemCn_& operator = ( const CvScalar& scalar );
_CvMATElemCn_& operator = ( double d );
_CvMATElemCn_& operator = ( float f );
_CvMATElemCn_& operator = ( int i );
uchar* ptr;
int type;
};
/* A(i,j) */
struct CV_EXPORTS _CvMATElem_ : public _CvMATConstElem_
{
explicit _CvMATElem_( uchar* ptr, int type );
_CvMATElemCn_ operator ()( int coi = 0 );
_CvMATElem_& operator = ( const _CvMATConstElem_& elem );
_CvMATElem_& operator = ( const _CvMATElem_& elem );
_CvMATElem_& operator = ( const _CvMATElemCn_& elem );
_CvMATElem_& operator = ( const CvScalar& val );
_CvMATElem_& operator = ( double d );
_CvMATElem_& operator = ( float f );
_CvMATElem_& operator = ( int i );
};
struct CV_EXPORTS _CvMAT_BASE_OP_
{
_CvMAT_BASE_OP_() {};
virtual operator CvMAT() const = 0;
_CvMAT_DOT_OP_ mul( const CvMAT& a ) const;
_CvMAT_DOT_OP_ mul( const _CvMAT_SCALE_& a ) const;
_CvMAT_DOT_OP_ div( const CvMAT& a ) const;
_CvMAT_DOT_OP_ div( const _CvMAT_SCALE_& a ) const;
_CvMAT_DOT_OP_ max( const CvMAT& a ) const;
_CvMAT_DOT_OP_ min( const CvMAT& a ) const;
_CvMAT_DOT_OP_ max( double value ) const;
_CvMAT_DOT_OP_ min( double value ) const;
double max( CvPoint* maxloc = 0 ) const;
double min( CvPoint* minloc = 0 ) const;
_CvMAT_DOT_OP_ abs() const;
_CvMAT_INV_ inv( int method = 0 ) const;
_CvMAT_T_ t() const;
CvMAT row( int row ) const;
CvMAT rowrange( int row1, int row2 ) const;
CvMAT col( int col ) const;
CvMAT colrange( int col1, int col2 ) const;
CvMAT rect( CvRect rect ) const;
CvMAT diag( int diag = 0 ) const;
_CvMAT_CVT_ cvt( int newdepth = -1, double scale = 1, double shift = 0 ) const;
double norm( int norm_type = CV_L2 ) const;
double det() const;
double trace() const;
CvScalar sum() const;
};
/* (A^t)*alpha */
struct CV_EXPORTS _CvMAT_T_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_T_( const CvMAT* a );
explicit _CvMAT_T_( const CvMAT* a, double alpha );
double det() const;
double norm( int normType = CV_L2 ) const;
operator CvMAT() const;
CvMAT a;
double alpha;
};
/* inv(A) */
struct CV_EXPORTS _CvMAT_INV_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_INV_( const CvMAT* mat, int method );
operator CvMAT() const;
CvMAT a;
int method;
};
/* (A^ta)*(B^tb)*alpha */
struct CV_EXPORTS _CvMAT_MUL_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_MUL_( const CvMAT* a, const CvMAT* b, int t_ab );
explicit _CvMAT_MUL_( const CvMAT* a, const CvMAT* b,
double alpha, int t_abc );
operator CvMAT() const;
double alpha;
CvMAT* a;
CvMAT* b;
int t_ab; /* (t_ab & 1) = ta, (t_ab & 2) = tb */
};
/* (A^ta)*(B^tb)*alpha + (C^tc)*beta */
struct CV_EXPORTS _CvMAT_MUL_ADD_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_MUL_ADD_( const CvMAT* a, const CvMAT* b,
const CvMAT* c, int t_abc );
explicit _CvMAT_MUL_ADD_( const CvMAT* a, const CvMAT* b, double alpha,
const CvMAT* c, double beta, int t_abc );
operator CvMAT() const;
double alpha, beta;
CvMAT* a;
CvMAT* b;
CvMAT* c;
int t_abc; /* (t_abc & 1) = ta, (t_abc & 2) = tb, (t_abc & 4) = tc */
};
/* A + B*beta */
struct CV_EXPORTS _CvMAT_ADD_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_ADD_( const CvMAT* a, const CvMAT* b, double beta = 1 );
operator CvMAT() const;
double norm( int norm_type = CV_L2 ) const;
_CvMAT_DOT_OP_ abs() const;
double beta;
CvMAT* a;
CvMAT* b;
};
/* A*alpha + B*beta + gamma */
struct CV_EXPORTS _CvMAT_ADD_EX_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_ADD_EX_( const CvMAT* a, double alpha,
const CvMAT* b, double beta, double gamma = 0 );
operator CvMAT() const;
double alpha, beta, gamma;
CvMAT* a;
CvMAT* b;
};
/* A*alpha */
struct CV_EXPORTS _CvMAT_SCALE_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_SCALE_( const CvMAT* a, double alpha );
operator CvMAT() const;
_CvMAT_DOT_OP_ mul( const CvMAT& a ) const;
_CvMAT_DOT_OP_ mul( const _CvMAT_SCALE_& a ) const;
_CvMAT_DOT_OP_ div( const CvMAT& a ) const;
_CvMAT_DOT_OP_ div( const _CvMAT_SCALE_& a ) const;
double alpha;
CvMAT* a;
};
/* A*alpha + beta */
struct CV_EXPORTS _CvMAT_SCALE_SHIFT_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_SCALE_SHIFT_( const CvMAT* a, double alpha, double beta );
operator CvMAT() const;
_CvMAT_DOT_OP_ abs() const;
double alpha, beta;
CvMAT* a;
};
/* (A & B), (A | B) or (A ^ B) */
struct CV_EXPORTS _CvMAT_LOGIC_ : public _CvMAT_BASE_OP_
{
enum Op { AND = 0, OR = 1, XOR = 2 };
explicit _CvMAT_LOGIC_( const CvMAT* a, const CvMAT* b, Op op, int flags = 0 );
operator CvMAT() const;
CvMAT* a;
CvMAT* b;
Op op;
int flags;
};
/* (A & scalar), (A | scalar) or (A ^ scalar) */
struct CV_EXPORTS _CvMAT_UN_LOGIC_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_UN_LOGIC_( const CvMAT* a, double alpha,
_CvMAT_LOGIC_::Op op, int flags = 0 );
operator CvMAT() const;
CvMAT* a;
double alpha;
_CvMAT_LOGIC_::Op op;
int flags;
};
/* ~A */
struct CV_EXPORTS _CvMAT_NOT_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_NOT_( const CvMAT* a );
operator CvMAT() const;
CvMAT* a;
};
/* conversion of data type */
struct CV_EXPORTS _CvMAT_CVT_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_CVT_( const CvMAT* a, int newdepth = -1,
double scale = 1, double shift = 0 );
operator CvMAT() const;
CvMAT a;
int newdepth;
double scale, shift;
};
/* conversion of data type */
struct CV_EXPORTS _CvMAT_COPY_
{
explicit _CvMAT_COPY_( const CvMAT* a );
operator CvMAT() const;
CvMAT* a;
};
/* a.op(b), where op = mul, div, min, max ... */
struct CV_EXPORTS _CvMAT_DOT_OP_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_DOT_OP_( const CvMAT* a, const CvMAT* b,
int op, double alpha = 1 );
operator CvMAT() const;
CvMAT a; /* keep the left operand copy */
CvMAT* b;
double alpha;
int op;
};
/* A.inv()*B or A.pinv()*B */
struct CV_EXPORTS _CvMAT_SOLVE_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_SOLVE_( const CvMAT* a, const CvMAT* b, int method );
operator CvMAT() const;
CvMAT* a;
CvMAT* b;
int method;
};
/* A <=> B */
struct CV_EXPORTS _CvMAT_CMP_ : public _CvMAT_BASE_OP_
{
explicit _CvMAT_CMP_( const CvMAT* a, const CvMAT* b, int cmp_op );
explicit _CvMAT_CMP_( const CvMAT* a, double alpha, int cmp_op );
operator CvMAT() const;
CvMAT* a;
CvMAT* b;
double alpha;
int cmp_op;
};
/************************* _CvMATConstElem_ inline methods ******************************/
inline _CvMATConstElem_::_CvMATConstElem_(const uchar* p, int t) : ptr((uchar*)p), type(t)
{}
inline _CvMATConstElem_::operator CvScalar() const
{
CvScalar scalar;
cvRawDataToScalar( ptr, type, &scalar );
return scalar;
}
inline double _CvMATConstElem_::operator ()( int coi ) const
{ return CvMAT::get( ptr, type, coi ); }
inline _CvMATElemCn_::_CvMATElemCn_( uchar* p, int t, int coi ) :
ptr(p), type(CV_MAT_DEPTH(t))
{
if( coi )
{
assert( (unsigned)coi < (unsigned)CV_MAT_CN(t) );
ptr += coi * CV_ELEM_SIZE(type);
}
}
inline _CvMATElemCn_::operator double() const
{ return CvMAT::get( ptr, type ); }
inline _CvMATElemCn_& _CvMATElemCn_::operator = ( const _CvMATConstElem_& elem )
{
if( type == elem.type )
memcpy( ptr, elem.ptr, CV_ELEM_SIZE(type) );
else
{
assert( CV_MAT_CN(elem.type) == 1 );
CvMAT::set( ptr, type, 0, elem(0));
}
return *this;
}
inline _CvMATElemCn_& _CvMATElemCn_::operator = ( const _CvMATElemCn_& elem )
{
if( type == elem.type )
memcpy( ptr, elem.ptr, CV_ELEM_SIZE(type) );
else
CvMAT::set( ptr, type, 0, (double)elem );
return *this;
}
inline _CvMATElemCn_& _CvMATElemCn_::operator = ( const CvScalar& scalar )
{
CvMAT::set( ptr, type, 0, scalar.val[0] );
return *this;
}
inline _CvMATElemCn_& _CvMATElemCn_::operator = ( double d )
{
CvMAT::set( ptr, type, 0, d );
return *this;
}
inline _CvMATElemCn_& _CvMATElemCn_::operator = ( float f )
{
CvMAT::set( ptr, type, 0, (double)f );
return *this;
}
inline _CvMATElemCn_& _CvMATElemCn_::operator = ( int i )
{
CvMAT::set( ptr, type, 0, i );
return *this;
}
inline _CvMATElem_::_CvMATElem_( uchar* p, int t ) : _CvMATConstElem_( (const uchar*)p, t )
{}
inline _CvMATElemCn_ _CvMATElem_::operator ()( int coi )
{ return _CvMATElemCn_( ptr, type, coi ); }
inline _CvMATElem_& _CvMATElem_::operator = ( const _CvMATConstElem_& elem )
{
if( type == elem.type )
memcpy( ptr, elem.ptr, CV_ELEM_SIZE(type) );
else
{
assert( CV_MAT_CN( type ^ elem.type ) == 0 );
CvScalar sc = (CvScalar)elem;
cvScalarToRawData( &sc, ptr, type, 0 );
}
return *this;
}
inline _CvMATElem_& _CvMATElem_::operator = ( const _CvMATElem_& elem )
{
*this = (const _CvMATConstElem_&)elem;
return *this;
}
inline _CvMATElem_& _CvMATElem_::operator = ( const _CvMATElemCn_& elem )
{
if( type == elem.type )
memcpy( ptr, elem.ptr, CV_ELEM_SIZE(type) );
else
CvMAT::set( ptr, type, (double)elem );
return *this;
}
inline _CvMATElem_& _CvMATElem_::operator = ( const CvScalar& scalar )
{
cvScalarToRawData( &scalar, ptr, type, 0 );
return *this;
}
inline _CvMATElem_& _CvMATElem_::operator = ( double d )
{
CvMAT::set( ptr, type, d );
return *this;
}
inline _CvMATElem_& _CvMATElem_::operator = ( float f )
{
CvMAT::set( ptr, type, (double)f );
return *this;
}
inline _CvMATElem_& _CvMATElem_::operator = ( int i )
{
CvMAT::set( ptr, type, i );
return *this;
}
/********************************** CvMAT inline methods ********************************/
inline CvMAT::CvMAT()
{
memset( this, 0, sizeof(*this));
}
inline CvMAT::CvMAT( int rows, int cols, int type, void* data, int step )
{
cvInitMatHeader( this, rows, cols, type, data, step );
}
inline CvMAT::CvMAT( int rows, int type, void* data, int step )
{
cvInitMatHeader( this, rows, 1, type, data, step );
}
inline void CvMAT::create( int rows, int cols, int type )
{
int step = cols*CV_ELEM_SIZE(type), total_size = step*rows;
this->rows = rows;
this->cols = cols;
this->step = rows == 1 ? 0 : step;
this->type = CV_MAT_MAGIC_VAL | (type & CV_MAT_TYPE_MASK) | CV_MAT_CONT_FLAG;
refcount = (int*)cvAlloc((size_t)total_size + 8);
data.ptr = (uchar*)(((size_t)(refcount + 1) + 7) & -8);
*refcount = 1;
}
inline CvMAT::CvMAT( int rows, int cols, int type )
{
create( rows, cols, type );
}
inline CvMAT::CvMAT( int rows, int type )
{
create( rows, 1, type );
}
inline CvMAT::CvMAT( const CvMat& mat )
{
memcpy( this, &mat, sizeof(mat));
if( refcount )
(*refcount)++;
}
inline CvMAT::CvMAT( const CvMAT& mat )
{
memcpy( this, &mat, sizeof(mat));
if( refcount )
(*refcount)++;
}
inline CvMAT::CvMAT( const IplImage& img )
{
cvGetMat( &img, this );
}
inline void CvMAT::release()
{
data.ptr = NULL;
if( refcount != NULL && --*refcount == 0 )
cvFree( (void**)&refcount );
refcount = 0;
}
inline CvMAT::~CvMAT()
{
release();
}
inline CvMAT& CvMAT::operator = ( const CvMAT& mat )
{
if( this != &mat )
{
release();
memcpy( this, &mat, sizeof(mat));
if( refcount )
(*refcount)++;
}
return *this;
}
inline CvMAT& CvMAT::operator = ( const CvMat& mat )
{
*this = (const CvMAT&)mat;
return *this;
}
inline CvMAT& CvMAT::operator = ( const IplImage& img )
{
release();
cvGetMat( &img, this );
return *this;
}
inline CvMAT& CvMAT::operator = ( double fillval )
{
cvFillImage( this, fillval );
return *this;
}
inline CvMAT& CvMAT::operator = ( const CvScalar& fillval )
{
cvSet( this, fillval );
return *this;
}
inline CvMAT& CvMAT::operator += ( const CvMat& mat )
{
cvAdd( this, &mat, this );
return *this;
}
inline CvMAT& CvMAT::operator += ( double val )
{
cvAddS( this, cvScalar(val), this );
return *this;
}
inline CvMAT& CvMAT::operator += ( const CvScalar& val )
{
cvAddS( this, val, this );
return *this;
}
inline CvMAT& CvMAT::operator -= ( const CvMat& mat )
{
cvSub( this, &mat, this );
return *this;
}
inline CvMAT& CvMAT::operator -= ( double val )
{
cvSubS( this, cvScalar(val), this );
return *this;
}
inline CvMAT& CvMAT::operator -= ( const CvScalar& val )
{
cvSubS( this, val, this );
return *this;
}
inline CvMAT& CvMAT::operator *= ( const CvMat& mat )
{
cvMul( this, &mat, this );
return *this;
}
inline CvMAT& CvMAT::operator *= ( double val )
{
cvScale( this, this, val, 0 );
return *this;
}
inline CvMAT& CvMAT::operator *= ( const CvScalar& val )
{
cvScaleAdd( this, val, 0, this );
return *this;
}
inline CvMAT& CvMAT::operator &= ( const CvMat& mat )
{
cvAnd( this, &mat, this );
return *this;
}
inline CvMAT& CvMAT::operator &= ( double val )
{
cvAndS( this, cvScalarAll(val), this );
return *this;
}
inline CvMAT& CvMAT::operator &= ( const CvScalar& val )
{
cvAndS( this, val, this );
return *this;
}
inline CvMAT& CvMAT::operator |= ( const CvMat& mat )
{
cvOr( this, &mat, this );
return *this;
}
inline CvMAT& CvMAT::operator |= ( double val )
{
cvOrS( this, cvScalarAll(val), this );
return *this;
}
inline CvMAT& CvMAT::operator |= ( const CvScalar& val )
{
cvOrS( this, val, this );
return *this;
}
inline CvMAT& CvMAT::operator ^= ( const CvMat& mat )
{
cvXor( this, &mat, this );
return *this;
}
inline CvMAT& CvMAT::operator ^= ( double val )
{
cvXorS( this, cvScalarAll(val), this );
return *this;
}
inline CvMAT& CvMAT::operator ^= ( const CvScalar& val )
{
cvXorS( this, val, this );
return *this;
}
inline double CvMAT::norm( int normType ) const
{ return cvNorm( this, 0, normType ); }
inline double CvMAT::min( CvPoint* minloc ) const
{
double t;
cvMinMaxLoc( this, &t, 0, minloc, 0, 0 );
return t;
}
inline double CvMAT::max( CvPoint* maxloc ) const
{
double t;
cvMinMaxLoc( this, 0, &t, 0, maxloc, 0 );
return t;
}
inline double CvMAT::norm( CvMat& mat, int normType ) const
{ return cvNorm( this, &mat, normType ); }
inline CvScalar CvMAT::sum() const
{ return cvSum( this ); }
inline double CvMAT::det() const
{ return cvDet( this ); }
inline void CvMAT::reshape( int newcn, int newrows )
{ cvReshape( this, this, newcn, newrows ); }
inline void CvMAT::flipX()
{ cvFlip( this, this, 1 ); }
inline void CvMAT::flipY()
{ cvFlip( this, this, 0 ); }
inline void CvMAT::flipXY()
{ cvFlip( this, this, -1 ); }
inline _CvMATElem_ CvMAT::operator ()( int row )
{ return _CvMATElem_( CV_MAT_ELEM_PTR( *this, row, 0 ), type ); }
inline _CvMATConstElem_ CvMAT::operator ()( int row ) const
{ return _CvMATConstElem_( CV_MAT_ELEM_PTR( *this, row, 0 ), type ); }
inline _CvMATElem_ CvMAT::operator ()( int row, int col )
{ return _CvMATElem_( CV_MAT_ELEM_PTR( *this, row, col ), type ); }
inline _CvMATConstElem_ CvMAT::operator ()( int row, int col ) const
{ return _CvMATConstElem_( CV_MAT_ELEM_PTR( *this, row, col ), type ); }
inline _CvMATElemCn_ CvMAT::operator()( int row, int col, int coi )
{ return _CvMATElemCn_( CV_MAT_ELEM_PTR( *this, row, col ), type, coi ); }
inline _CvMATElemCn_ CvMAT::operator()( CvPoint pt, int coi )
{ return _CvMATElemCn_( CV_MAT_ELEM_PTR( *this, pt.y, pt.x ), type, coi ); }
inline double CvMAT::operator()( int row, int col, int coi ) const
{ return get( CV_MAT_ELEM_PTR( *this, row, col ), type, coi ); }
inline _CvMATElem_ CvMAT::operator ()( CvPoint pt )
{ return _CvMATElem_( CV_MAT_ELEM_PTR( *this, pt.y, pt.x ), type ); }
inline _CvMATConstElem_ CvMAT::operator ()( CvPoint pt ) const
{ return _CvMATConstElem_( CV_MAT_ELEM_PTR( *this, pt.y, pt.x ), type ); }
inline double CvMAT::operator()( CvPoint pt, int coi ) const
{ return get( CV_MAT_ELEM_PTR( *this, pt.y, pt.x ), type, coi ); }
inline void* CvMAT::ptr( int row )
{ return CV_MAT_ELEM_PTR( *this, row, 0 ); }
inline const void* CvMAT::ptr( int row ) const
{ return (const void*)CV_MAT_ELEM_PTR( *this, row, 0 ); }
inline void* CvMAT::ptr( int row, int col )
{ return CV_MAT_ELEM_PTR( *this, row, col ); }
inline const void* CvMAT::ptr( int row, int col ) const
{ return (const void*)CV_MAT_ELEM_PTR( *this, row, col ); }
inline void* CvMAT::ptr( CvPoint pt )
{ return CV_MAT_ELEM_PTR( *this, pt.y, pt.x ); }
inline const void* CvMAT::ptr( CvPoint pt ) const
{ return (const void*)CV_MAT_ELEM_PTR( *this, pt.y, pt.x ); }
inline _CvMAT_INV_ CvMAT::inv( int method ) const
{ return _CvMAT_INV_( this, method ); }
inline _CvMAT_T_ CvMAT::t() const
{ return _CvMAT_T_( this ); }
inline _CvMAT_COPY_ CvMAT::clone() const
{ return _CvMAT_COPY_( this ); }
inline _CvMAT_CVT_ CvMAT::cvt( int newdepth, double scale, double shift ) const
{ return _CvMAT_CVT_( this, newdepth, scale, shift ); }
inline CvMAT::CvMAT( const CvMat& mat, CvRect rect )
{
type = 0;
cvGetSubArr( &mat, this, rect );
cvIncRefData( this );
}
/* submatrix:
k == 0 - i-th row
k > 0 - i-th column
k < 0 - i-th diagonal */
inline CvMAT::CvMAT( const CvMat& mat, int k, int i )
{
type = 0;
if( k == 0 )
cvGetRow( &mat, this, i );
else if( k > 0 )
cvGetCol( &mat, this, i );
else
cvGetDiag( &mat, this, i );
cvIncRefData( this );
}
inline CvMAT CvMAT::row( int r ) const
{ return CvMAT( *this, 0, r ); }
inline CvMAT CvMAT::col( int c ) const
{ return CvMAT( *this, 1, c ); }
inline CvMAT CvMAT::diag( int d ) const
{ return CvMAT( *this, -1, d ); }
inline CvMAT CvMAT::rect( CvRect rect ) const
{ return CvMAT( *this, rect ); }
inline CvMAT CvMAT::rowrange( int row1, int row2 ) const
{
assert( 0 <= row1 && row1 < row2 && row2 <= height );
return CvMAT( *this, cvRect( 0, row1, width, row2 - row1 ));
}
inline CvMAT CvMAT::colrange( int col1, int col2 ) const
{
assert( 0 <= col1 && col1 < col2 && col2 <= width );
return CvMAT( *this, cvRect( col1, 0, col2 - col1, height ));
}
inline _CvMAT_DOT_OP_ CvMAT::mul( const CvMAT& mat ) const
{ return _CvMAT_DOT_OP_( this, &mat, '*' ); }
inline _CvMAT_DOT_OP_ CvMAT::mul( const _CvMAT_SCALE_& mat ) const
{ return _CvMAT_DOT_OP_( this, mat.a, '*', mat.alpha ); }
inline _CvMAT_DOT_OP_ CvMAT::div( const CvMAT& mat ) const
{ return _CvMAT_DOT_OP_( this, &mat, '/' ); }
inline _CvMAT_DOT_OP_ CvMAT::div( const _CvMAT_SCALE_& mat ) const
{ return _CvMAT_DOT_OP_( this, mat.a, '/', 1./mat.alpha ); }
inline _CvMAT_DOT_OP_ CvMAT::min( const CvMAT& mat ) const
{ return _CvMAT_DOT_OP_( this, &mat, 'm' ); }
inline _CvMAT_DOT_OP_ CvMAT::max( const CvMAT& mat ) const
{ return _CvMAT_DOT_OP_( this, &mat, 'M' ); }
inline _CvMAT_DOT_OP_ CvMAT::min( double value ) const
{ return _CvMAT_DOT_OP_( this, 0, 'm', value ); }
inline _CvMAT_DOT_OP_ CvMAT::max( double value ) const
{ return _CvMAT_DOT_OP_( this, 0, 'M', value ); }
inline _CvMAT_DOT_OP_ CvMAT::abs() const
{ return _CvMAT_DOT_OP_( this, 0, 'a', 0 ); }
/****************************************************************************************\
* binary operations (+,-,*) *
\****************************************************************************************/
/*
* PART I. Scaling, shifting, addition/subtraction operations
*/
/* (mat2^t) = (mat1^t) * scalar */
inline _CvMAT_T_ operator * ( const _CvMAT_T_& a, double alpha )
{ return _CvMAT_T_( &a.a, a.alpha*alpha ); }
/* (mat2^t) = scalar * (mat1^t) */
inline _CvMAT_T_ operator * ( double alpha, const _CvMAT_T_& a )
{ return _CvMAT_T_( &a.a, a.alpha*alpha ); }
/* -(mat^t) */
inline _CvMAT_T_ operator - ( const _CvMAT_T_& a )
{ return _CvMAT_T_( &a.a, -a.alpha ); }
/* mat_scaled = mat * scalar */
inline _CvMAT_SCALE_ operator * ( const CvMAT& a, double alpha )
{ return _CvMAT_SCALE_( &a, alpha ); }
/* mat_scaled = scalar * mat */
inline _CvMAT_SCALE_ operator * ( double alpha, const CvMAT& a )
{ return _CvMAT_SCALE_( &a, alpha ); }
/* mat_scaled2 = mat_scaled1 * scalar */
inline _CvMAT_SCALE_ operator * ( const _CvMAT_SCALE_& a, double alpha )
{ return _CvMAT_SCALE_( a.a, a.alpha*alpha ); }
/* mat_scaled2 = scalar * mat_scaled1 */
inline _CvMAT_SCALE_ operator * ( double alpha, const _CvMAT_SCALE_& a )
{ return _CvMAT_SCALE_( a.a, a.alpha*alpha ); }
/* -mat_scaled */
inline _CvMAT_SCALE_ operator - ( const _CvMAT_SCALE_& a )
{ return _CvMAT_SCALE_( a.a, -a.alpha ); }
/* mat_scaled_shifted = mat + scalar */
inline _CvMAT_SCALE_SHIFT_ operator + ( const CvMAT& a, double beta )
{ return _CvMAT_SCALE_SHIFT_( &a, 1, beta ); }
/* mat_scaled_shifted = scalar + mat */
inline _CvMAT_SCALE_SHIFT_ operator + ( double beta, const CvMAT& a )
{ return _CvMAT_SCALE_SHIFT_( &a, 1, beta ); }
/* mat_scaled_shifted = mat - scalar */
inline _CvMAT_SCALE_SHIFT_ operator - ( const CvMAT& a, double beta )
{ return _CvMAT_SCALE_SHIFT_( &a, 1, -beta ); }
/* mat_scaled_shifted = scalar - mat */
inline _CvMAT_SCALE_SHIFT_ operator - ( double beta, const CvMAT& a )
{ return _CvMAT_SCALE_SHIFT_( &a, -1, beta ); }
/* mat_scaled_shifted = mat_scaled + scalar */
inline _CvMAT_SCALE_SHIFT_ operator + ( const _CvMAT_SCALE_& a, double beta )
{ return _CvMAT_SCALE_SHIFT_( a.a, a.alpha, beta ); }
/* mat_scaled_shifted = scalar + mat_scaled */
inline _CvMAT_SCALE_SHIFT_ operator + ( double beta, const _CvMAT_SCALE_& a )
{ return _CvMAT_SCALE_SHIFT_( a.a, a.alpha, beta ); }
/* mat_scaled_shifted = mat_scaled - scalar */
inline _CvMAT_SCALE_SHIFT_ operator - ( const _CvMAT_SCALE_& a, double beta )
{ return _CvMAT_SCALE_SHIFT_( a.a, a.alpha, -beta ); }
/* mat_scaled_shifted = scalar - mat_scaled */
inline _CvMAT_SCALE_SHIFT_ operator - ( double beta, const _CvMAT_SCALE_& a )
{ return _CvMAT_SCALE_SHIFT_( a.a, -a.alpha, beta ); }
/* mat_scaled_shifted2 = mat_scaled_shifted1 + scalar */
inline _CvMAT_SCALE_SHIFT_ operator + ( const _CvMAT_SCALE_SHIFT_& a, double beta )
{ return _CvMAT_SCALE_SHIFT_( a.a, a.alpha, a.beta + beta ); }
/* mat_scaled_shifted2 = scalar + mat_scaled_shifted1 */
inline _CvMAT_SCALE_SHIFT_ operator + ( double beta, const _CvMAT_SCALE_SHIFT_& a )
{ return _CvMAT_SCALE_SHIFT_( a.a, a.alpha, a.beta + beta ); }
/* mat_scaled_shifted2 = mat_scaled_shifted1 - scalar */
inline _CvMAT_SCALE_SHIFT_ operator - ( const _CvMAT_SCALE_SHIFT_& a, double beta )
{ return _CvMAT_SCALE_SHIFT_( a.a, a.alpha, a.beta - beta ); }
/* mat_scaled_shifted2 = scalar - mat_scaled_shifted1 */
inline _CvMAT_SCALE_SHIFT_ operator - ( double beta, const _CvMAT_SCALE_SHIFT_& a )
{ return _CvMAT_SCALE_SHIFT_( a.a, -a.alpha, beta - a.beta ); }
/* mat_scaled_shifted2 = mat_scaled_shifted1 * scalar */
inline _CvMAT_SCALE_SHIFT_ operator * ( const _CvMAT_SCALE_SHIFT_& a, double alpha )
{ return _CvMAT_SCALE_SHIFT_( a.a, a.alpha*alpha, a.beta*alpha ); }
/* mat_scaled_shifted2 = scalar * mat_scaled_shifted1 */
inline _CvMAT_SCALE_SHIFT_ operator * ( double alpha, const _CvMAT_SCALE_SHIFT_& a )
{ return _CvMAT_SCALE_SHIFT_( a.a, a.alpha*alpha, a.beta*alpha ); }
/* -mat_scaled_shifted */
inline _CvMAT_SCALE_SHIFT_ operator - ( const _CvMAT_SCALE_SHIFT_& a )
{ return _CvMAT_SCALE_SHIFT_( a.a, -a.alpha, -a.beta ); }
/* -mat1 */
inline _CvMAT_SCALE_ operator - ( const CvMAT& a )
{ return _CvMAT_SCALE_( &a, -1 ); }
/* mat_add = mat1 + mat2 */
inline _CvMAT_ADD_ operator + ( const CvMAT& a, const CvMAT& b )
{ return _CvMAT_ADD_( &a, &b ); }
/* mat_add = mat1 - mat2 */
inline _CvMAT_ADD_ operator - ( const CvMAT& a, const CvMAT& b )
{ return _CvMAT_ADD_( &a, &b, -1 ); }
/* mat_add = mat_scaled1 + mat2 */
inline _CvMAT_ADD_ operator + ( const _CvMAT_SCALE_& a, const CvMAT& b )
{ return _CvMAT_ADD_( &b, a.a, a.alpha ); }
/* mat_add = mat1 + mat_scaled2 */
inline _CvMAT_ADD_ operator + ( const CvMAT& b, const _CvMAT_SCALE_& a )
{ return _CvMAT_ADD_( &b, a.a, a.alpha ); }
/* -mat_add */
inline _CvMAT_ADD_EX_ operator - ( const _CvMAT_ADD_& a )
{ return _CvMAT_ADD_EX_( a.a, -1, a.b, -a.beta ); }
/* mat_add = mat_scaled1 - mat2 */
inline _CvMAT_ADD_EX_ operator - ( const _CvMAT_SCALE_& a, const CvMAT& b )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, &b, -1 ); }
/* mat_add = mat1 - mat_scaled2 */
inline _CvMAT_ADD_ operator - ( const CvMAT& b, const _CvMAT_SCALE_& a )
{ return _CvMAT_ADD_( &b, a.a, -a.alpha ); }
/* mat_add = mat_scaled_shifted1 + mat2 */
inline _CvMAT_ADD_EX_ operator + ( const _CvMAT_SCALE_SHIFT_& a, const CvMAT& b )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, &b, 1, a.beta ); }
/* mat_add = mat1 + mat_scaled_shifted2 */
inline _CvMAT_ADD_EX_ operator + ( const CvMAT& b, const _CvMAT_SCALE_SHIFT_& a )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, &b, 1, a.beta ); }
/* mat_add = mat_scaled_shifted1 - mat2 */
inline _CvMAT_ADD_EX_ operator - ( const _CvMAT_SCALE_SHIFT_& a, const CvMAT& b )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, &b, -1, a.beta ); }
/* mat_add = mat1 - mat_scaled_shifted2 */
inline _CvMAT_ADD_EX_ operator - ( const CvMAT& b, const _CvMAT_SCALE_SHIFT_& a )
{ return _CvMAT_ADD_EX_( a.a, -a.alpha, &b, 1, -a.beta ); }
/* mat_add = mat_scaled_shifted1 + mat_scaled2 */
inline _CvMAT_ADD_EX_ operator + ( const _CvMAT_SCALE_SHIFT_& a, const _CvMAT_SCALE_& b )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, b.a, b.alpha, a.beta ); }
/* mat_add = mat_scaled1 + mat_scaled_shifted2 */
inline _CvMAT_ADD_EX_ operator + ( const _CvMAT_SCALE_& b, const _CvMAT_SCALE_SHIFT_& a )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, b.a, b.alpha, a.beta ); }
/* mat_add = mat_scaled_shifted1 - mat_scaled2 */
inline _CvMAT_ADD_EX_ operator - ( const _CvMAT_SCALE_SHIFT_& a, const _CvMAT_SCALE_& b )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, b.a, -b.alpha, a.beta ); }
/* mat_add = mat_scaled1 - mat_scaled_shifted2 */
inline _CvMAT_ADD_EX_ operator - ( const _CvMAT_SCALE_& b, const _CvMAT_SCALE_SHIFT_& a )
{ return _CvMAT_ADD_EX_( a.a, -a.alpha, b.a, b.alpha, -a.beta ); }
/* mat_add = mat_scaled1 + mat_scaled2 */
inline _CvMAT_ADD_EX_ operator + ( const _CvMAT_SCALE_& a, const _CvMAT_SCALE_& b )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, b.a, b.alpha ); }
/* mat_add = mat_scaled1 - mat_scaled2 */
inline _CvMAT_ADD_EX_ operator - ( const _CvMAT_SCALE_& a, const _CvMAT_SCALE_& b )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, b.a, -b.alpha ); }
/* mat_add = mat_scaled_shifted1 + mat_scaled_shifted2 */
inline _CvMAT_ADD_EX_ operator + ( const _CvMAT_SCALE_SHIFT_& a,
const _CvMAT_SCALE_SHIFT_& b )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, b.a, b.alpha, a.beta + b.beta ); }
/* mat_add = mat_scaled_shifted1 - mat_scaled_shifted2 */
inline _CvMAT_ADD_EX_ operator - ( const _CvMAT_SCALE_SHIFT_& a,
const _CvMAT_SCALE_SHIFT_& b )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, b.a, -b.alpha, a.beta - b.beta ); }
/* mat_add2 = mat_add1 + scalar */
inline _CvMAT_ADD_EX_ operator + ( const _CvMAT_ADD_EX_& a, double gamma )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, a.b, a.beta, a.gamma + gamma ); }
/* mat_add2 = scalar + mat_add1 */
inline _CvMAT_ADD_EX_ operator + ( double gamma, const _CvMAT_ADD_EX_& a )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, a.b, a.beta, a.gamma + gamma ); }
/* mat_add2 = mat_add1 - scalar */
inline _CvMAT_ADD_EX_ operator - ( const _CvMAT_ADD_EX_& a, double gamma )
{ return _CvMAT_ADD_EX_( a.a, a.alpha, a.b, a.beta, a.gamma - gamma ); }
/* mat_add2 = scalar - mat_add1 */
inline _CvMAT_ADD_EX_ operator - ( double gamma, const _CvMAT_ADD_EX_& a )
{ return _CvMAT_ADD_EX_( a.a, -a.alpha, a.b, -a.beta, gamma - a.gamma ); }
/* mat_add2 = mat_add1 * scalar */
inline _CvMAT_ADD_EX_ operator * ( const _CvMAT_ADD_EX_& a, double alpha )
{ return _CvMAT_ADD_EX_( a.a, a.alpha*alpha, a.b, a.beta*alpha, a.gamma*alpha ); }
/* mat_add2 = scalar * mat_add1 */
inline _CvMAT_ADD_EX_ operator * ( double alpha, const _CvMAT_ADD_EX_& a )
{ return _CvMAT_ADD_EX_( a.a, a.alpha*alpha, a.b, a.beta*alpha, a.gamma*alpha ); }
/* mat_add2 = mat_add1 + scalar */
inline _CvMAT_ADD_EX_ operator + ( const _CvMAT_ADD_& a, double gamma )
{ return _CvMAT_ADD_EX_( a.a, 1, a.b, a.beta, gamma ); }
/* mat_add2 = scalar + mat_add1 */
inline _CvMAT_ADD_EX_ operator + ( double gamma, const _CvMAT_ADD_& a )
{ return _CvMAT_ADD_EX_( a.a, 1, a.b, a.beta, gamma ); }
/* mat_add2 = mat_add1 - scalar */
inline _CvMAT_ADD_EX_ operator - ( const _CvMAT_ADD_& a, double gamma )
{ return _CvMAT_ADD_EX_( a.a, 1, a.b, a.beta, -gamma ); }
/* mat_add2 = scalar - mat_add1 */
inline _CvMAT_ADD_EX_ operator - ( double gamma, const _CvMAT_ADD_& a )
{ return _CvMAT_ADD_EX_( a.a, -1, a.b, -a.beta, gamma ); }
/* mat_add2 = mat_add1 * scalar */
inline _CvMAT_ADD_EX_ operator * ( const _CvMAT_ADD_& a, double alpha )
{ return _CvMAT_ADD_EX_( a.a, alpha, a.b, a.beta*alpha, 0 ); }
/* mat_add2 = scalar * mat_add1 */
inline _CvMAT_ADD_EX_ operator * ( double alpha, const _CvMAT_ADD_& a )
{ return _CvMAT_ADD_EX_( a.a, alpha, a.b, a.beta*alpha, 0 ); }
/* -mat_add_ex */
inline _CvMAT_ADD_EX_ operator - ( const _CvMAT_ADD_EX_& a )
{ return _CvMAT_ADD_EX_( a.a, -a.alpha, a.b, -a.beta, -a.gamma ); }
/*
* PART II. Matrix multiplication.
*/
/* mmul = mat1 * mat2 */
inline _CvMAT_MUL_ operator * ( const CvMAT& a, const CvMAT& b )
{ return _CvMAT_MUL_( &a, &b, 0 ); }
/* mmul = (mat1^t) * mat2 */
inline _CvMAT_MUL_ operator * ( const _CvMAT_T_& a, const CvMAT& b )
{ return _CvMAT_MUL_( &a.a, &b, a.alpha, 1 ); }
/* mmul = mat1 * (mat2^t) */
inline _CvMAT_MUL_ operator * ( const CvMAT& b, const _CvMAT_T_& a )
{ return _CvMAT_MUL_( &b, &a.a, a.alpha, 2 ); }
/* mmul = (mat1^t) * (mat2^t) */
inline _CvMAT_MUL_ operator * ( const _CvMAT_T_& a, const _CvMAT_T_& b )
{ return _CvMAT_MUL_( &a.a, &b.a, a.alpha*b.alpha, 3 ); }
/* mmul = mat_scaled1 * mat2 */
inline _CvMAT_MUL_ operator * ( const _CvMAT_SCALE_& a, const CvMAT& b )
{ return _CvMAT_MUL_( a.a, &b, a.alpha, 0 ); }
/* mmul = mat1 * mat_scaled2 */
inline _CvMAT_MUL_ operator * ( const CvMAT& b, const _CvMAT_SCALE_& a )
{ return _CvMAT_MUL_( &b, a.a, a.alpha, 0 ); }
/* mmul = (mat1^t) * mat_scaled1 */
inline _CvMAT_MUL_ operator * ( const _CvMAT_T_& a, const _CvMAT_SCALE_& b )
{ return _CvMAT_MUL_( &a.a, b.a, a.alpha*b.alpha, 1 ); }
/* mmul = mat_scaled1 * (mat2^t) */
inline _CvMAT_MUL_ operator * ( const _CvMAT_SCALE_& b, const _CvMAT_T_& a )
{ return _CvMAT_MUL_( b.a, &a.a, a.alpha*b.alpha, 2 ); }
/* mmul = mat_scaled1 * mat_scaled2 */
inline _CvMAT_MUL_ operator * ( const _CvMAT_SCALE_& a, const _CvMAT_SCALE_& b )
{ return _CvMAT_MUL_( a.a, b.a, a.alpha*b.alpha, 0 ); }
/* mmul2 = mmul1 * scalar */
inline _CvMAT_MUL_ operator * ( const _CvMAT_MUL_& a, double alpha )
{ return _CvMAT_MUL_( a.a, a.b, a.alpha*alpha, a.t_ab ); }
/* mmul2 = scalar * mmul1 */
inline _CvMAT_MUL_ operator * ( double alpha, const _CvMAT_MUL_& a )
{ return _CvMAT_MUL_( a.a, a.b, a.alpha*alpha, a.t_ab ); }
/* -mmul */
inline _CvMAT_MUL_ operator - ( const _CvMAT_MUL_& a )
{ return _CvMAT_MUL_( a.a, a.b, -a.alpha, a.t_ab ); }
/* mmuladd = mmul + mat */
inline _CvMAT_MUL_ADD_ operator + ( const _CvMAT_MUL_& a, const CvMAT& b )
{ return _CvMAT_MUL_ADD_( a.a, a.b, a.alpha, &b, 1, a.t_ab ); }
/* !!! Comment this off because of ambigous conversion error !!!
mmuladd = mat + mmul */
/* inline _CvMAT_MUL_ADD_ operator + ( const CvMAT& b, const _CvMAT_MUL_& a )
{ return _CvMAT_MUL_ADD_( a.a, a.b, a.alpha, &b, 1, a.t_ab ); }*/
/* mmuladd = mmul - mat */
inline _CvMAT_MUL_ADD_ operator - ( const _CvMAT_MUL_& a, const CvMAT& b )
{ return _CvMAT_MUL_ADD_( a.a, a.b, a.alpha, &b, -1, a.t_ab ); }
/* !!! Comment this off because of ambigous conversion error !!!
mmuladd = mat - mmul */
/*inline _CvMAT_MUL_ADD_ operator - ( const CvMAT& b, const _CvMAT_MUL_& a )
{ return _CvMAT_MUL_ADD_( a.a, a.b, -a.alpha, &b, 1, a.t_ab ); }*/
/* mmuladd = mmul + mat_scaled */
inline _CvMAT_MUL_ADD_ operator + ( const _CvMAT_MUL_& a, const _CvMAT_SCALE_& b )
{ return _CvMAT_MUL_ADD_( a.a, a.b, a.alpha, b.a, b.alpha, a.t_ab ); }
/* mmuladd = mat_scaled + mmul */
inline _CvMAT_MUL_ADD_ operator + ( const _CvMAT_SCALE_& b, const _CvMAT_MUL_& a )
{ return _CvMAT_MUL_ADD_( a.a, a.b, a.alpha, b.a, b.alpha, a.t_ab ); }
/* mmuladd = mmul - mat_scaled */
inline _CvMAT_MUL_ADD_ operator - ( const _CvMAT_MUL_& a, const _CvMAT_SCALE_& b )
{ return _CvMAT_MUL_ADD_( a.a, a.b, a.alpha, b.a, -b.alpha, a.t_ab ); }
/* mmuladd = mat_scaled - mmul */
inline _CvMAT_MUL_ADD_ operator - ( const _CvMAT_SCALE_& b, const _CvMAT_MUL_& a )
{ return _CvMAT_MUL_ADD_( a.a, a.b, -a.alpha, b.a, b.alpha, a.t_ab ); }
/* mmuladd = mmul + (mat^t) */
inline _CvMAT_MUL_ADD_ operator + ( const _CvMAT_MUL_& a, const _CvMAT_T_& b )
{ return _CvMAT_MUL_ADD_( a.a, a.b, a.alpha, &b.a, b.alpha, a.t_ab + 4 ); }
/* mmuladd = (mat^t) + mmul */
inline _CvMAT_MUL_ADD_ operator + ( const _CvMAT_T_& b, const _CvMAT_MUL_& a )
{ return _CvMAT_MUL_ADD_( a.a, a.b, a.alpha, &b.a, b.alpha, a.t_ab + 4 ); }
/* mmuladd = mmul - (mat^t) */
inline _CvMAT_MUL_ADD_ operator - ( const _CvMAT_MUL_& a, const _CvMAT_T_& b )
{ return _CvMAT_MUL_ADD_( a.a, a.b, a.alpha, &b.a, -b.alpha, a.t_ab + 4 ); }
/* mmuladd = (mat^t) - mmul */
inline _CvMAT_MUL_ADD_ operator - ( const _CvMAT_T_& b, const _CvMAT_MUL_& a )
{ return _CvMAT_MUL_ADD_( a.a, a.b, -a.alpha, &b.a, b.alpha, a.t_ab + 4 ); }
/* mmuladd = mat_scaled_shifted * mat */
inline _CvMAT_MUL_ADD_ operator * ( const _CvMAT_SCALE_SHIFT_& a, const CvMAT& b )
{ return _CvMAT_MUL_ADD_( a.a, &b, a.alpha, &b, a.beta, 0 ); }
/* mmuladd = mat * mat_scaled_shifted */
inline _CvMAT_MUL_ADD_ operator * ( const CvMAT& b, const _CvMAT_SCALE_SHIFT_& a )
{ return _CvMAT_MUL_ADD_( &b, a.a, a.alpha, &b, a.beta, 0 ); }
/* mmuladd = mat_scaled_shifted * mat_scaled */
inline _CvMAT_MUL_ADD_ operator * ( const _CvMAT_SCALE_SHIFT_& a, const _CvMAT_SCALE_& b )
{ return _CvMAT_MUL_ADD_( a.a, b.a, a.alpha*b.alpha, b.a, a.beta*b.alpha, 0 ); }
/* mmuladd = mat_scaled * mat_scaled_shifted */
inline _CvMAT_MUL_ADD_ operator * ( const _CvMAT_SCALE_& b, const _CvMAT_SCALE_SHIFT_& a )
{ return _CvMAT_MUL_ADD_( b.a, a.a, a.alpha*b.alpha, b.a, a.beta*b.alpha, 0 ); }
/* mmuladd = mat_scaled_shifted * (mat^t) */
inline _CvMAT_MUL_ADD_ operator * ( const _CvMAT_SCALE_SHIFT_& a, const _CvMAT_T_& b )
{ return _CvMAT_MUL_ADD_( a.a, &b.a, a.alpha*b.alpha, &b.a, a.beta*b.alpha, 6 ); }
/* mmuladd = (mat^t) * mat_scaled_shifted */
inline _CvMAT_MUL_ADD_ operator * ( const _CvMAT_T_& b, const _CvMAT_SCALE_SHIFT_& a )
{ return _CvMAT_MUL_ADD_( &b.a, a.a, a.alpha*b.alpha, &b.a, a.beta*b.alpha, 5 ); }
/* mmuladd2 = mmuladd1 * scalar */
inline _CvMAT_MUL_ADD_ operator * ( const _CvMAT_MUL_ADD_& a, double alpha )
{ return _CvMAT_MUL_ADD_( a.a, a.b, a.alpha*alpha, a.c, a.beta*alpha, a.t_abc ); }
/* mmuladd2 = scalar * mmuladd1 */
inline _CvMAT_MUL_ADD_ operator * ( double alpha, const _CvMAT_MUL_ADD_& a )
{ return _CvMAT_MUL_ADD_( a.a, a.b, a.alpha*alpha, a.c, a.beta*alpha, a.t_abc ); }
/* -mmuladd */
inline _CvMAT_MUL_ADD_ operator - ( const _CvMAT_MUL_ADD_& a )
{ return _CvMAT_MUL_ADD_( a.a, a.b, -a.alpha, a.c, -a.beta, a.t_abc ); }
/* inv(a)*b, i.e. solve a*x = b */
inline _CvMAT_SOLVE_ operator * ( const _CvMAT_INV_& a, const CvMAT& b )
{ return _CvMAT_SOLVE_( &a.a, &b, a.method ); }
/*
* PART III. Logical operations
*/
inline _CvMAT_NOT_ operator ~ ( const CvMAT& a )
{ return _CvMAT_NOT_(&a); }
inline _CvMAT_LOGIC_ operator & ( const CvMAT& a, const CvMAT& b )
{ return _CvMAT_LOGIC_( &a, &b, _CvMAT_LOGIC_::AND, 0 ); }
inline _CvMAT_LOGIC_ operator & ( const _CvMAT_NOT_& a, const CvMAT& b )
{ return _CvMAT_LOGIC_( a.a, &b, _CvMAT_LOGIC_::AND, 1 ); }
inline _CvMAT_LOGIC_ operator & ( const CvMAT& a, const _CvMAT_NOT_& b )
{ return _CvMAT_LOGIC_( &a, b.a, _CvMAT_LOGIC_::AND, 2 ); }
inline _CvMAT_LOGIC_ operator & ( const _CvMAT_NOT_& a, const _CvMAT_NOT_& b )
{ return _CvMAT_LOGIC_( a.a, b.a, _CvMAT_LOGIC_::AND, 3 ); }
inline _CvMAT_LOGIC_ operator | ( const CvMAT& a, const CvMAT& b )
{ return _CvMAT_LOGIC_( &a, &b, _CvMAT_LOGIC_::OR, 0 ); }
inline _CvMAT_LOGIC_ operator | ( const _CvMAT_NOT_& a, const CvMAT& b )
{ return _CvMAT_LOGIC_( a.a, &b, _CvMAT_LOGIC_::OR, 1 ); }
inline _CvMAT_LOGIC_ operator | ( const CvMAT& a, const _CvMAT_NOT_& b )
{ return _CvMAT_LOGIC_( &a, b.a, _CvMAT_LOGIC_::OR, 2 ); }
inline _CvMAT_LOGIC_ operator | ( const _CvMAT_NOT_& a, const _CvMAT_NOT_& b )
{ return _CvMAT_LOGIC_( a.a, b.a, _CvMAT_LOGIC_::OR, 3 ); }
inline _CvMAT_LOGIC_ operator ^ ( const CvMAT& a, const CvMAT& b )
{ return _CvMAT_LOGIC_( &a, &b, _CvMAT_LOGIC_::XOR, 0 ); }
inline _CvMAT_LOGIC_ operator ^ ( const _CvMAT_NOT_& a, const CvMAT& b )
{ return _CvMAT_LOGIC_( a.a, &b, _CvMAT_LOGIC_::XOR, 1 ); }
inline _CvMAT_LOGIC_ operator ^ ( const CvMAT& a, const _CvMAT_NOT_& b )
{ return _CvMAT_LOGIC_( &a, b.a, _CvMAT_LOGIC_::XOR, 2 ); }
inline _CvMAT_LOGIC_ operator ^ ( const _CvMAT_NOT_& a, const _CvMAT_NOT_& b )
{ return _CvMAT_LOGIC_( a.a, b.a, _CvMAT_LOGIC_::XOR, 3 ); }
inline _CvMAT_UN_LOGIC_ operator & ( const CvMAT& a, double alpha )
{ return _CvMAT_UN_LOGIC_( &a, alpha, _CvMAT_LOGIC_::AND, 0 ); }
inline _CvMAT_UN_LOGIC_ operator & ( double alpha, const CvMAT& a )
{ return _CvMAT_UN_LOGIC_( &a, alpha, _CvMAT_LOGIC_::AND, 0 ); }
inline _CvMAT_UN_LOGIC_ operator & ( const _CvMAT_NOT_& a, double alpha )
{ return _CvMAT_UN_LOGIC_( a.a, alpha, _CvMAT_LOGIC_::AND, 1 ); }
inline _CvMAT_UN_LOGIC_ operator & ( double alpha, const _CvMAT_NOT_& a )
{ return _CvMAT_UN_LOGIC_( a.a, alpha, _CvMAT_LOGIC_::AND, 1 ); }
inline _CvMAT_UN_LOGIC_ operator | ( const CvMAT& a, double alpha )
{ return _CvMAT_UN_LOGIC_( &a, alpha, _CvMAT_LOGIC_::OR, 0 ); }
inline _CvMAT_UN_LOGIC_ operator | ( double alpha, const CvMAT& a )
{ return _CvMAT_UN_LOGIC_( &a, alpha, _CvMAT_LOGIC_::OR, 0 ); }
inline _CvMAT_UN_LOGIC_ operator | ( const _CvMAT_NOT_& a, double alpha )
{ return _CvMAT_UN_LOGIC_( a.a, alpha, _CvMAT_LOGIC_::OR, 1 ); }
inline _CvMAT_UN_LOGIC_ operator | ( double alpha, const _CvMAT_NOT_& a )
{ return _CvMAT_UN_LOGIC_( a.a, alpha, _CvMAT_LOGIC_::OR, 1 ); }
inline _CvMAT_UN_LOGIC_ operator ^ ( const CvMAT& a, double alpha )
{ return _CvMAT_UN_LOGIC_( &a, alpha, _CvMAT_LOGIC_::XOR, 0 ); }
inline _CvMAT_UN_LOGIC_ operator ^ ( double alpha, const CvMAT& a )
{ return _CvMAT_UN_LOGIC_( &a, alpha, _CvMAT_LOGIC_::XOR, 0 ); }
inline _CvMAT_UN_LOGIC_ operator ^ ( const _CvMAT_NOT_& a, double alpha )
{ return _CvMAT_UN_LOGIC_( a.a, alpha, _CvMAT_LOGIC_::XOR, 1 ); }
inline _CvMAT_UN_LOGIC_ operator ^ ( double alpha, const _CvMAT_NOT_& a )
{ return _CvMAT_UN_LOGIC_( a.a, alpha, _CvMAT_LOGIC_::XOR, 1 ); }
/*
* PART IV. Comparison operations
*/
inline _CvMAT_CMP_ operator > ( const CvMAT& a, const CvMAT& b )
{ return _CvMAT_CMP_( &a, &b, CV_CMP_GT ); }
inline _CvMAT_CMP_ operator >= ( const CvMAT& a, const CvMAT& b )
{ return _CvMAT_CMP_( &a, &b, CV_CMP_GE ); }
inline _CvMAT_CMP_ operator < ( const CvMAT& a, const CvMAT& b )
{ return _CvMAT_CMP_( &a, &b, CV_CMP_LT ); }
inline _CvMAT_CMP_ operator <= ( const CvMAT& a, const CvMAT& b )
{ return _CvMAT_CMP_( &a, &b, CV_CMP_LE ); }
inline _CvMAT_CMP_ operator == ( const CvMAT& a, const CvMAT& b )
{ return _CvMAT_CMP_( &a, &b, CV_CMP_EQ ); }
inline _CvMAT_CMP_ operator != ( const CvMAT& a, const CvMAT& b )
{ return _CvMAT_CMP_( &a, &b, CV_CMP_NE ); }
inline _CvMAT_CMP_ operator > ( const CvMAT& a, double alpha )
{ return _CvMAT_CMP_( &a, alpha, CV_CMP_GT ); }
inline _CvMAT_CMP_ operator > ( double alpha, const CvMAT& a )
{ return _CvMAT_CMP_( &a, alpha, CV_CMP_LT ); }
inline _CvMAT_CMP_ operator >= ( const CvMAT& a, double alpha )
{ return _CvMAT_CMP_( &a, alpha, CV_CMP_GE ); }
inline _CvMAT_CMP_ operator >= ( double alpha, const CvMAT& a )
{ return _CvMAT_CMP_( &a, alpha, CV_CMP_LE ); }
inline _CvMAT_CMP_ operator < ( const CvMAT& a, double alpha )
{ return _CvMAT_CMP_( &a, alpha, CV_CMP_LT ); }
inline _CvMAT_CMP_ operator < ( double alpha, const CvMAT& a )
{ return _CvMAT_CMP_( &a, alpha, CV_CMP_GT ); }
inline _CvMAT_CMP_ operator <= ( const CvMAT& a, double alpha )
{ return _CvMAT_CMP_( &a, alpha, CV_CMP_LE ); }
inline _CvMAT_CMP_ operator <= ( double alpha, const CvMAT& a )
{ return _CvMAT_CMP_( &a, alpha, CV_CMP_GE ); }
inline _CvMAT_CMP_ operator == ( const CvMAT& a, double alpha )
{ return _CvMAT_CMP_( &a, alpha, CV_CMP_EQ ); }
inline _CvMAT_CMP_ operator == ( double alpha, const CvMAT& a )
{ return _CvMAT_CMP_( &a, alpha, CV_CMP_EQ ); }
inline _CvMAT_CMP_ operator != ( const CvMAT& a, double alpha )
{ return _CvMAT_CMP_( &a, alpha, CV_CMP_NE ); }
inline _CvMAT_CMP_ operator != ( double alpha, const CvMAT& a )
{ return _CvMAT_CMP_( &a, alpha, CV_CMP_NE ); }
/*
* PART V. Speedup for some augmented assignments to CvMAT
*/
inline CvMAT& CvMAT::operator += ( const _CvMAT_SCALE_& scale_mat )
{ return (*this = *this + scale_mat); }
inline CvMAT& CvMAT::operator += ( const _CvMAT_SCALE_SHIFT_& scale_mat )
{ return (*this = *this + scale_mat); }
inline CvMAT& CvMAT::operator += ( const _CvMAT_MUL_& mmul )
{ return (*this = mmul + *this); }
inline CvMAT& CvMAT::operator -= ( const _CvMAT_SCALE_& scale_mat )
{ return (*this = *this - scale_mat); }
inline CvMAT& CvMAT::operator -= ( const _CvMAT_SCALE_SHIFT_& scale_mat )
{ return (*this = *this - scale_mat); }
inline CvMAT& CvMAT::operator -= ( const _CvMAT_MUL_& mmul )
{ return (*this = -mmul + *this); }
inline CvMAT& CvMAT::operator *= ( const _CvMAT_SCALE_& scale_mat )
{ return (*this = *this * scale_mat); }
inline CvMAT& CvMAT::operator *= ( const _CvMAT_SCALE_SHIFT_& scale_mat )
{ return (*this = *this * scale_mat); }
/****************************************************************************************\
* misc. operations on temporary matrices (+,-,*) *
\****************************************************************************************/
/*
* the base proxy class implementation
*/
/* a.*b */
inline _CvMAT_DOT_OP_ _CvMAT_BASE_OP_::mul( const CvMAT& a ) const
{ return ((CvMAT)*this).mul(a); }
/* a.*b*alpha */
inline _CvMAT_DOT_OP_ _CvMAT_BASE_OP_::mul( const _CvMAT_SCALE_& a ) const
{ return ((CvMAT)*this).mul(a); }
/* a./b */
inline _CvMAT_DOT_OP_ _CvMAT_BASE_OP_::div( const CvMAT& a ) const
{ return ((CvMAT)*this).div(a); }
/* a./(b*alpha) */
inline _CvMAT_DOT_OP_ _CvMAT_BASE_OP_::div( const _CvMAT_SCALE_& a ) const
{ return ((CvMAT)*this).div(a); }
/* a.max(b) */
inline _CvMAT_DOT_OP_ _CvMAT_BASE_OP_::min( const CvMAT& a ) const
{ return ((CvMAT)*this).min(a); }
/* a.min(b) */
inline _CvMAT_DOT_OP_ _CvMAT_BASE_OP_::max( const CvMAT& a ) const
{ return ((CvMAT)*this).max(a); }
/* a.max(alpha) */
inline _CvMAT_DOT_OP_ _CvMAT_BASE_OP_::min( double alpha ) const
{ return ((CvMAT)*this).min(alpha); }
/* a.min(alpha) */
inline _CvMAT_DOT_OP_ _CvMAT_BASE_OP_::max( double alpha ) const
{ return ((CvMAT)*this).max(alpha); }
inline _CvMAT_INV_ _CvMAT_BASE_OP_::inv( int method ) const
{ return ((CvMAT)*this).inv(method); }
inline _CvMAT_T_ _CvMAT_BASE_OP_::t() const
{ return ((CvMAT)*this).t(); }
inline _CvMAT_CVT_ _CvMAT_BASE_OP_::cvt( int newdepth, double scale, double shift ) const
{ return ((CvMAT)*this).cvt( newdepth, scale, shift ); }
inline CvMAT _CvMAT_BASE_OP_::row( int r ) const
{ return CvMAT((CvMAT)*this, 0, r ); }
inline CvMAT _CvMAT_BASE_OP_::rowrange( int row1, int row2 ) const
{
CvMAT m = (CvMAT)*this;
assert( 0 <= row1 && row1 < row2 && row2 <= m.height );
return CvMAT( m, cvRect( 0, row1, m.width, row2 - row1 ));
}
inline CvMAT _CvMAT_BASE_OP_::col( int c ) const
{ return CvMAT( (CvMAT)*this, 1, c ); }
inline CvMAT _CvMAT_BASE_OP_::colrange( int col1, int col2 ) const
{
CvMAT m = (CvMAT)*this;
assert( 0 <= col1 && col1 < col2 && col2 <= m.width );
return CvMAT( m, cvRect( col1, 0, col2 - col1, m.height ));
}
inline CvMAT _CvMAT_BASE_OP_::rect( CvRect r ) const
{ return CvMAT( (CvMAT)*this, r ); }
inline CvMAT _CvMAT_BASE_OP_::diag( int d ) const
{ return CvMAT( (CvMAT)*this, -1, d ); }
inline double _CvMAT_BASE_OP_::det() const
{ return ((CvMAT)*this).det(); }
inline double _CvMAT_BASE_OP_::norm( int norm_type ) const
{ return ((CvMAT)*this).norm( norm_type ); }
inline CvScalar _CvMAT_BASE_OP_::sum() const
{ return ((CvMAT)*this).sum(); }
inline double _CvMAT_BASE_OP_::min( CvPoint* minloc ) const
{ return ((CvMAT)*this).min( minloc ); }
inline double _CvMAT_BASE_OP_::max( CvPoint* maxloc ) const
{ return ((CvMAT)*this).max( maxloc ); }
/****************************************************************************************/
/* proxy classes implementation. */
/* part I. constructors */
/****************************************************************************************/
/* constructors */
inline _CvMAT_COPY_::_CvMAT_COPY_( const CvMAT* _a ) : a((CvMAT*)_a) {}
inline _CvMAT_CVT_::_CvMAT_CVT_( const CvMAT* _a, int _newdepth,
double _scale, double _shift ) :
a(*(CvMAT*)_a), newdepth(_newdepth), scale(_scale), shift(_shift) {}
inline _CvMAT_T_::_CvMAT_T_( const CvMAT* _a ) : a(*(CvMAT*)_a), alpha(1) {}
inline _CvMAT_T_::_CvMAT_T_( const CvMAT* _a, double _alpha ) :
a(*(CvMAT*)_a), alpha(_alpha) {}
inline _CvMAT_INV_::_CvMAT_INV_( const CvMAT* _a, int _method ) :
a(*(CvMAT*)_a), method(_method) {}
inline _CvMAT_MUL_::_CvMAT_MUL_( const CvMAT* _a, const CvMAT* _b, int _t_ab ) :
a((CvMAT*)_a), b((CvMAT*)_b), alpha(1), t_ab(_t_ab) {}
inline _CvMAT_MUL_::_CvMAT_MUL_( const CvMAT* _a, const CvMAT* _b,
double _alpha, int _t_ab ) :
a((CvMAT*)_a), b((CvMAT*)_b), alpha(_alpha), t_ab(_t_ab) {}
inline _CvMAT_MUL_ADD_::_CvMAT_MUL_ADD_( const CvMAT* _a, const CvMAT* _b,
const CvMAT* _c, int _t_abc ) :
a((CvMAT*)_a), b((CvMAT*)_b), c((CvMAT*)_c), t_abc(_t_abc) {}
inline _CvMAT_MUL_ADD_::_CvMAT_MUL_ADD_( const CvMAT* _a, const CvMAT* _b, double _alpha,
const CvMAT* _c, double _beta, int _t_abc ) :
a((CvMAT*)_a), b((CvMAT*)_b), alpha(_alpha),
c((CvMAT*)_c), beta(_beta), t_abc(_t_abc) {}
inline _CvMAT_ADD_::_CvMAT_ADD_( const CvMAT* _a, const CvMAT* _b, double _beta ) :
a((CvMAT*)_a), b((CvMAT*)_b), beta(_beta) {}
inline _CvMAT_ADD_EX_::_CvMAT_ADD_EX_( const CvMAT* _a, double _alpha,
const CvMAT* _b, double _beta, double _gamma ) :
a((CvMAT*)_a), alpha(_alpha), b((CvMAT*)_b), beta(_beta), gamma(_gamma) {}
inline _CvMAT_SCALE_::_CvMAT_SCALE_( const CvMAT* _a, double _alpha ) :
a((CvMAT*)_a), alpha(_alpha) {}
inline _CvMAT_SCALE_SHIFT_::_CvMAT_SCALE_SHIFT_( const CvMAT* _a,
double _alpha, double _beta ) :
a((CvMAT*)_a), alpha(_alpha), beta(_beta) {}
inline _CvMAT_LOGIC_::_CvMAT_LOGIC_( const CvMAT* _a, const CvMAT* _b,
_CvMAT_LOGIC_::Op _op, int _flags ) :
a((CvMAT*)_a), b((CvMAT*)_b), op(_op), flags(_flags) {}
inline _CvMAT_UN_LOGIC_::_CvMAT_UN_LOGIC_( const CvMAT* _a, double _alpha,
_CvMAT_LOGIC_::Op _op, int _flags ) :
a((CvMAT*)_a), alpha(_alpha), op(_op), flags(_flags) {}
inline _CvMAT_NOT_::_CvMAT_NOT_( const CvMAT* _a ) :
a((CvMAT*)_a) {}
inline _CvMAT_DOT_OP_::_CvMAT_DOT_OP_( const CvMAT* _a, const CvMAT* _b,
int _op, double _alpha ) :
a(*_a), b((CvMAT*)_b), op(_op), alpha(_alpha) {}
inline _CvMAT_SOLVE_::_CvMAT_SOLVE_( const CvMAT* _a, const CvMAT* _b, int _method ) :
a((CvMAT*)_a), b((CvMAT*)_b), method(_method) {}
inline _CvMAT_CMP_::_CvMAT_CMP_( const CvMAT* _a, const CvMAT* _b, int _cmp_op ) :
a((CvMAT*)_a), b((CvMAT*)_b), alpha(0), cmp_op(_cmp_op) {}
inline _CvMAT_CMP_::_CvMAT_CMP_( const CvMAT* _a, double _alpha, int _cmp_op ) :
a((CvMAT*)_a), b(0), alpha(_alpha), cmp_op(_cmp_op) {}
/****************************************************************************************/
/* proxy classes implementation. */
/* part II. conversion to CvMAT */
/****************************************************************************************/
inline _CvMAT_T_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_INV_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_MUL_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_SCALE_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_SCALE_SHIFT_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_ADD_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_ADD_EX_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_MUL_ADD_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_LOGIC_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_UN_LOGIC_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_NOT_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_DOT_OP_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_SOLVE_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_CMP_::operator CvMAT() const
{ return CvMAT( *this ); }
inline _CvMAT_CVT_::operator CvMAT() const
{ return CvMAT(*this); }
inline _CvMAT_COPY_::operator CvMAT() const
{ return *a; }
/****************************************************************************************/
/* proxy classes implementation. */
/* part III. custom overrided methods */
/****************************************************************************************/
inline _CvMAT_DOT_OP_ _CvMAT_SCALE_::mul( const CvMAT& mat ) const
{ return _CvMAT_DOT_OP_( a, &mat, '*', alpha ); }
inline _CvMAT_DOT_OP_ _CvMAT_SCALE_::mul( const _CvMAT_SCALE_& mat ) const
{ return _CvMAT_DOT_OP_( a, mat.a, '*', alpha*mat.alpha ); }
inline _CvMAT_DOT_OP_ _CvMAT_SCALE_::div( const CvMAT& mat ) const
{ return _CvMAT_DOT_OP_( a, &mat, '/', alpha ); }
inline _CvMAT_DOT_OP_ _CvMAT_SCALE_::div( const _CvMAT_SCALE_& mat ) const
{ return _CvMAT_DOT_OP_( a, mat.a, '/', alpha/mat.alpha ); }
inline _CvMAT_DOT_OP_ operator * ( const _CvMAT_DOT_OP_& dot_op, double alpha )
{ return _CvMAT_DOT_OP_( &dot_op.a, dot_op.b, dot_op.op, dot_op.alpha * alpha ); }
inline _CvMAT_DOT_OP_ operator * ( double alpha, const _CvMAT_DOT_OP_& dot_op )
{ return _CvMAT_DOT_OP_( &dot_op.a, dot_op.b, dot_op.op, dot_op.alpha * alpha ); }
inline _CvMAT_DOT_OP_ operator / ( double alpha, const CvMAT& mat )
{ return _CvMAT_DOT_OP_( &mat, 0, '/', alpha ); }
inline _CvMAT_DOT_OP_ operator / ( double alpha, const _CvMAT_SCALE_& mat )
{ return _CvMAT_DOT_OP_( mat.a, 0, '/', alpha/mat.alpha ); }
inline double _CvMAT_T_::det() const
{ return a.det(); }
inline double _CvMAT_T_::norm( int norm_type ) const
{ return a.norm( norm_type ); }
inline double _CvMAT_ADD_::norm( int norm_type ) const
{
if( beta == -1 )
return cvNorm( a, b, norm_type );
else
return ((CvMAT)*this).norm( norm_type );
}
inline _CvMAT_DOT_OP_ _CvMAT_ADD_::abs() const
{
if( beta == -1 )
return _CvMAT_DOT_OP_( a, b, 'a', 0 );
else
return ((CvMAT)*this).abs();
}
inline _CvMAT_DOT_OP_ _CvMAT_SCALE_SHIFT_::abs() const
{
if( alpha == 1 )
return _CvMAT_DOT_OP_( a, 0, 'a', -beta );
else
return ((CvMAT)*this).abs();
}
#endif /* __cplusplus */
#endif /*_CVMAT_HPP_*/
| [
"[email protected]"
]
| [
[
[
1,
2326
]
]
]
|
ca378c69df763de9b5bdd4d0b5729024972b591c | 58ef4939342d5253f6fcb372c56513055d589eb8 | /WallpaperChanger/WallpaperChange/source/SMS/inc/smsdatagramsender.h | cdc629c3a43581116c79c7a09fd18e0420e0087d | []
| no_license | flaithbheartaigh/lemonplayer | 2d77869e4cf787acb0aef51341dc784b3cf626ba | ea22bc8679d4431460f714cd3476a32927c7080e | refs/heads/master | 2021-01-10T11:29:49.953139 | 2011-04-25T03:15:18 | 2011-04-25T03:15:18 | 50,263,327 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,299 | h | /*
* ==============================================================================
* Name : smsdatagramsender.h
* Copyright (c) 2007 Symbian Ltd. All rights reserved.
* ==============================================================================
*/
#ifndef __SMSDATAGRAMSENDER_H__
#define __SMSDATAGRAMSENDER_H__
// INCLUDES
#include "Datagram.h"
#include "SMSDatagramService.h"
// FORWARD DECLARATIONS
//
// CLASS DECLARATION
/**
* MSmsDatagramSenderObserver sender observer interface
* Observer for sent messages
*/
class MSmsDatagramSenderObserver
{
public:
virtual void MsgSentL(TDesC& aMsg)=0;
virtual void MsgSentErr(const TInt& aError) = 0;
};
class CSmsDatagramSender: public CActive
{
public:
static CSmsDatagramSender* NewL(MSmsDatagramSenderObserver& aMsgOvserver);
~CSmsDatagramSender();
public:
void SendAsyncL(const TDesC& aMessage, const TDesC& aPhoneNumber);
virtual void DoCancel();
virtual void RunL();
private:
CSmsDatagramSender(MSmsDatagramSenderObserver& aMsgOvserver);
void ConstructL();
private:
CSMSDatagramService* iSendService;
CDatagram* iDatagram;
MSmsDatagramSenderObserver& iMsgObserver; //not owned by this class
};
#endif // __SMSDATAGRAMSENDER_H__
// End of File
| [
"zengcity@415e30b0-1e86-11de-9c9a-2d325a3e6494"
]
| [
[
[
1,
55
]
]
]
|
1c32ec01704e9a2d72fad8089692839b8145f6a5 | 2b80036db6f86012afcc7bc55431355fc3234058 | /src/square/player.cpp | 7ac7d658037cf173c6f81284a0b7ad27c2384b21 | [
"BSD-3-Clause"
]
| permissive | leezhongshan/musikcube | d1e09cf263854bb16acbde707cb6c18b09a0189f | e7ca6a5515a5f5e8e499bbdd158e5cb406fda948 | refs/heads/master | 2021-01-15T11:45:29.512171 | 2011-02-25T14:09:21 | 2011-02-25T14:09:21 | null | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 2,093 | cpp | //////////////////////////////////////////////////////////////////////////////
// Copyright © 2007, Björn Olievier
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the author nor the names of other contributors may
// be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
//////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ConsoleUI.h"
using namespace musik::square;
#ifdef WIN32
int _tmain(int argc, _TCHAR* argv[])
#else
int main(int argc, char* argv[])
#endif
{
ConsoleUI* instance = new ConsoleUI();
instance->Run();
delete instance;
return 0;
}
| [
"onnerby@6a861d04-ae47-0410-a6da-2d49beace72e",
"urioxis@6a861d04-ae47-0410-a6da-2d49beace72e"
]
| [
[
[
1,
39
],
[
41,
41
],
[
45,
51
]
],
[
[
40,
40
],
[
42,
44
]
]
]
|
a0c6edee50bfc9b22413dce7bc1f2dd6e943d7b6 | 74e7667ad65cbdaa869c6e384fdd8dc7e94aca34 | /MicroFrameworkPK_v4_1/BuildOutput/public/Release/Client/stubs/system_xml_native.cpp | 8581c6acfb50dadd10056ca12e6cafbc657f4bb8 | [
"BSD-3-Clause",
"OpenSSL",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
]
| permissive | gezidan/NETMF-LPC | 5093ab223eb9d7f42396344ea316cbe50a2f784b | db1880a03108db6c7f611e6de6dbc45ce9b9adce | refs/heads/master | 2021-01-18T10:59:42.467549 | 2011-06-28T08:11:24 | 2011-06-28T08:11:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,759 | cpp | //-----------------------------------------------------------------------------
//
// ** DO NOT EDIT THIS FILE! **
// This file was generated by a tool
// re-running the tool will overwrite this file.
//
//-----------------------------------------------------------------------------
#include "system_xml_native.h"
static const CLR_RT_MethodHandler method_lookup[] =
{
NULL,
NULL,
NULL,
NULL,
NULL,
Library_system_xml_native_System_Xml_XmlNameTable::Get___STRING__STRING,
Library_system_xml_native_System_Xml_XmlNameTable::Add___STRING__STRING,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
Library_system_xml_native_System_Xml_XmlReader::LookupNamespace___STRING__STRING,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
Library_system_xml_native_System_Xml_XmlReader::Initialize___VOID__U4,
Library_system_xml_native_System_Xml_XmlReader::ReadInternal___I4__U4,
NULL,
NULL,
NULL,
NULL,
Library_system_xml_native_System_Xml_XmlReader::StringRefEquals___STATIC__BOOLEAN__STRING__STRING,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
};
const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_System_Xml =
{
"System.Xml",
0xA46E1384,
method_lookup
};
| [
"[email protected]"
]
| [
[
[
1,
95
]
]
]
|
1f353342dba98e74db2e0d64f93ff8af24ec79d0 | 36d0ddb69764f39c440089ecebd10d7df14f75f3 | /プログラム/Game/Object/GameScene/BackGround.cpp | 9e24a3db5b8faa1467870c364620d8badf57b2e7 | []
| no_license | weimingtom/tanuki-mo-issyo | 3f57518b4e59f684db642bf064a30fc5cc4715b3 | ab57362f3228354179927f58b14fa76b3d334472 | refs/heads/master | 2021-01-10T01:36:32.162752 | 2009-04-19T10:37:37 | 2009-04-19T10:37:37 | 48,733,344 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 1,624 | cpp | /*******************************************************************************/
/*
* @file BackGround.cpp.
*
* @brief 背景.
*
* @date 2008/12/26.
*
* @version 1.00.
*
* @author Ryoma Kawasue.
*/
/*******************************************************************************/
/*===== インクルード ==========================================================*/
#include "BackGround.h"
/*=============================================================================*/
/**
* @brief コンストラクタ.
*
* @param[in] 引数名 引数説明.
*/
BackGround::BackGround(IGameDevice& device, GameSceneState& gameSceneState):
m_device(device),m_gameSceneState(gameSceneState),m_isTerminated(false)
{
}
/*=============================================================================*/
/**
* @brief デストラクタ.
*
*/
BackGround::~BackGround()
{
}
/*=============================================================================*/
/**
* @brief 関数説明.
*
* @param[in] 引数名 引数説明.
* @return 戻り値説明.
*/
void BackGround::Initialize()
{
}
void BackGround::Terminate()
{
m_isTerminated = true;
}
bool BackGround::IsTerminated()
{
return m_isTerminated;
}
void BackGround::RenderObject()
{
SpriteDesc sd;
sd.rect = Rect(0,0,(float)WINDOW_WIDTH,(float)WINDOW_HEIGHT);
sd.textureID = TEXTUREID_BACKGROUND;
m_device.GetGraphicDevice().Render( sd );
}
void BackGround::UpdateObject(float frameTimer)
{
}
/*===== EOF ===================================================================*/ | [
"rs.drip@aa49b5b2-a402-11dd-98aa-2b35b7097d33"
]
| [
[
[
1,
73
]
]
]
|
29d25c89a2d1a8cb23349f1607eb8d5e126befae | f177993b13e97f9fecfc0e751602153824dfef7e | /ImPro/ImProFilters/BGMappingFilter/BGMappingProp.h | 0b3a763840f5431c6f5e0e2755917d3a664e1dd0 | []
| no_license | svn2github/imtophooksln | 7bd7412947d6368ce394810f479ebab1557ef356 | bacd7f29002135806d0f5047ae47cbad4c03f90e | refs/heads/master | 2020-05-20T04:00:56.564124 | 2010-09-24T09:10:51 | 2010-09-24T09:10:51 | 11,787,598 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,645 | h | #pragma once
#include "MFCBasePropertyPage.h"
#include "resource.h"
#include "afxwin.h"
#include "IBGMappingFilter.h"
// CHomoWarpMFCPropertyPage dialog
// {54A10265-D314-48b4-9518-F9896C1A6C68}
DEFINE_GUID(CLSID_BGMappingPropertyPage,
0x54a10265, 0xd314, 0x48b4, 0x95, 0x18, 0xf9, 0x89, 0x6c, 0x1a, 0x6c, 0x68);
class CBGMappingPorpertyPage : public CMFCBasePropertyPage
{
DECLARE_DYNAMIC(CBGMappingPorpertyPage)
public:
CBGMappingPorpertyPage(IUnknown *pUnk); // standard constructor
virtual ~CBGMappingPorpertyPage();
// Dialog Data
protected:
DECLARE_MESSAGE_MAP()
protected:
IBGMappingFilter *m_pFilter;
public:
// Dialog Data
enum {IDD = IDD_BGMappingPropPage};
//override CBasePropertyPage Method
virtual HRESULT OnConnect(IUnknown *pUnk);
virtual HRESULT OnDisconnect(void);
virtual BOOL OnReceiveMessage(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
virtual HRESULT OnActivate(void);
virtual HRESULT OnApplyChanges(void);
static CUnknown *WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr);
public:
HRESULT updateSliderTxt();
HWND m_threshold;
HWND m_txt;
HWND m_erodeValue;
HWND m_Btxt;
HWND m_subValue;
HWND m_Wtxt;
HWND m_BGadjustValue;
HWND m_Atxt;
CButton* m_checkCamFlip;
CButton* m_checkLayoutFlip;
CButton* m_checkOutputFlip;
CButton* m_checkShowWindow;
CButton* m_checkSaveImg;
public: //inherit from CMFCBaseProperty Page
virtual int GetDialogResourceID();
virtual int GetTitileResourceID();
afx_msg void OnNMCustomdrawSlider1(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnBnClickedButton1();
};
| [
"ndhumuscle@fa729b96-8d43-11de-b54f-137c5e29c83a",
"claire3kao@fa729b96-8d43-11de-b54f-137c5e29c83a"
]
| [
[
[
1,
48
],
[
51,
54
],
[
57,
66
]
],
[
[
49,
50
],
[
55,
56
]
]
]
|
fa4062e1718c575eb62a6bea70c53c8db330dc32 | 8f5d0d23e857e58ad88494806bc60c5c6e13f33d | /Texture/cPCXImage.cpp | 7c8616ba1ab1b697b40c81e5d46d321f33d71304 | []
| no_license | markglenn/projectlife | edb14754118ec7b0f7d83bd4c92b2e13070dca4f | a6fd3502f2c2713a8a1a919659c775db5309f366 | refs/heads/master | 2021-01-01T15:31:30.087632 | 2011-01-30T16:03:41 | 2011-01-30T16:03:41 | 1,704,290 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,084 | cpp | #include "cPCXImage.h"
// Include Paul Nettle's memory manager
#include "../Memory/mmgr.h"
REGISTER_CLASS (cImage, cPCXImage, ".PCX")
/////////////////////////////////////////////////////////////////////////////////////
cPCXImage::cPCXImage(void)
/////////////////////////////////////////////////////////////////////////////////////
{
}
/////////////////////////////////////////////////////////////////////////////////////
cPCXImage::~cPCXImage(void)
/////////////////////////////////////////////////////////////////////////////////////
{
}
/////////////////////////////////////////////////////////////////////////////////////
bool cPCXImage::LoadTexture (cIFile* file)
/////////////////////////////////////////////////////////////////////////////////////
{
unsigned int idx = 0;
unsigned char c;
int numRepeat;
unsigned char *data, pal[768];
if (!file)
return false;
file->Read (&m_header, sizeof (PCXHeader));
// Check if it is a valid ZSoft PCX file
if (m_header.manufacturer != 10)
return false;
m_width = m_header.xmax - m_header.xmin + 1;
m_height = m_header.ymax - m_header.ymin + 1;
data = new unsigned char[m_height * m_header.bytesPerLine];
// Decompress the data
file->Seek (128, SEEK_SET);
while (idx < (m_width * m_height) )
{
file->Read(&c, 1);
if (c > 0xbf)
{
numRepeat = 0x3f & c;
file->Read(&c, 1);
for (int i = 0; i < numRepeat; i++)
data[idx++] = c;
}
else
data[idx++] = c;
}
// Move to the palette
file->Seek (-769, SEEK_END);
file->Read (&c, 1);
// Make sure there is a palette
if (c != 12)
{
delete[] data;
return false;
}
file->Read (&pal, 768);
m_bpp = 24;
m_image = new unsigned char [m_width * m_height * 3];
// Insert the palette into the final image
for (unsigned int i = 0; i < m_width * m_height; i++)
{
m_image[(3 * i)] = pal[(data[i] * 3)];
m_image[(3 * i) + 1] = pal[(data[i] * 3) + 1];
m_image[(3 * i) + 2] = pal[(data[i] * 3) + 2];
}
delete[] data;
return true;
}
| [
"[email protected]"
]
| [
[
[
1,
89
]
]
]
|
b857a7330bcde9266cc92c1d6989fbe4a34118f8 | 3449de09f841146a804930f2a51ccafbc4afa804 | /C++/MpegMux/VideoStream.h | 2c336b787557f6fa11b79eb9dcc9bcf4f6cd95e0 | []
| no_license | davies/daviescode | 0c244f4aebee1eb909ec3de0e4e77db3a5bbacee | bb00ee0cfe5b7d5388485c59211ebc9ba2d6ecbd | refs/heads/master | 2020-06-04T23:32:27.360979 | 2007-08-19T06:31:49 | 2007-08-19T06:31:49 | 32,641,672 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 469 | h | #ifndef __VIDEOSTREAM_H__
#define __VIDEOSTREAM_H__
#include "common\BitStream.h"
#define MAX_SEQUENCES 120000 //30*60*60
class VideoStream : public BitStream
{
public:
VideoStream(const string _filename = "",bool write = false);
~VideoStream();
void CreateIndex(double delay = 0.0);
unsigned int seqCount;
unsigned int seqIndex[MAX_SEQUENCES];
double seqTime[MAX_SEQUENCES];
double bit_rate;
double frame_rate;
private:
};
#endif
| [
"davies.liu@32811f3b-991a-0410-9d68-c977761b5317"
]
| [
[
[
1,
23
]
]
]
|
4a8c88861d354f9e72d03a111de8882bce0fc649 | 8b0840f68733f5e6ca06ca53e6afcb66341cd4ef | /HouseOfPhthah/Terrain.cpp | eaff859969210c080e9266f045a553dc119cf26f | []
| no_license | adkoba/the-house-of-phthah | 886ee45ee67953cfd67e676fbccb61a12a095e20 | 5be2084b49fe1fbafb22545c4d31d3b6458bf90f | refs/heads/master | 2021-01-18T16:04:29.460707 | 2010-03-20T16:32:09 | 2010-03-20T16:32:09 | 32,143,404 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,374 | cpp | #include "Terrain.h"
#include <OgreRenderSystem.h>
#include <OgreRoot.h>
#include "Macros.h"
#include "Globals.h"
CTerrainListener::CTerrainListener(Camera* camera):
mCamera(camera),
mRaySceneQuery(NULL)
{
}
CTerrainListener::~CTerrainListener()
{
// make sure not to delete the camera!!
mCamera = NULL;
// is it really clean?
//SceneManager::destroyQuery(mRaySceneQuery);
SAFE_DELETE( mRaySceneQuery )
}
bool CTerrainListener::frameRenderingQueued(const FrameEvent& evt)
{
if( FrameListener::frameRenderingQueued(evt) == false )
return false;
assert(mCamera&&mRaySceneQuery&&"Problem in CTerrainListener::frameRenderingQueued()");
// clamp to terrain - Translation of camera on Y added to prevent computation error
mUpdateRay.setOrigin(mCamera->getPosition()+Vector3(0.0,100.0,0.0));
mUpdateRay.setDirection(Vector3::NEGATIVE_UNIT_Y);
mRaySceneQuery->setRay(mUpdateRay);
RaySceneQueryResult& qryResult = mRaySceneQuery->execute();
RaySceneQueryResult::iterator i = qryResult.begin();
if (i != qryResult.end() && i->worldFragment)
{
if( mCamera->getPosition().y < i->worldFragment->singleIntersection.y + 10.0 )
{
mCamera->setPosition(mCamera->getPosition().x,
i->worldFragment->singleIntersection.y + 10.0,
mCamera->getPosition().z);
}
}
return true;
}
CTerrain::CTerrain():
mListener(NULL),
mTerrainId("")
{
}
CTerrain::~CTerrain()
{
// do I have to detach it from Ogre::Root first?
SAFE_DELETE( mListener )
// do I have to detach something from any tree?
}
void CTerrain::createTerrain(const String TerrainId)
{
assert(TerrainId!=""&&"Problem in CTerrain::createTerrain()");
mTerrainId = TerrainId;
Root* root = Root::getSingletonPtr();
SceneManager* sceneMgr = root->getSceneManager(CGlobals::MainSceneName);
Camera* camera = sceneMgr->getCamera(CGlobals::TerrainCameraName);
mListener = new CTerrainListener(camera);
mListener->setRaySceneQuery( sceneMgr->createRayQuery( Ray(camera->getPosition(), Vector3::NEGATIVE_UNIT_Y) ) );
root->addFrameListener(mListener);
sceneMgr->setWorldGeometry( mTerrainId );
// Infinite far plane?
if (root->getRenderSystem()->getCapabilities()->hasCapability(RSC_INFINITE_FAR_PLANE))
{
camera->setFarClipDistance(0);
}
}
| [
"franstreb@4d33156a-524b-11de-a3da-17e148e7a168"
]
| [
[
[
1,
83
]
]
]
|
10a57fc3037115b962d407bcca632f1280a86906 | c6f4fe2766815616b37beccf07db82c0da27e6c1 | /SpaceshipShield.cpp | cff78c4b0abd168fb9b476690a0a996dcb129c17 | []
| no_license | fragoulis/gpm-sem1-spacegame | c600f300046c054f7ab3cbf7193ccaad1503ca09 | 85bdfb5b62e2964588f41d03a295b2431ff9689f | refs/heads/master | 2023-06-09T03:43:53.175249 | 2007-12-13T03:03:30 | 2007-12-13T03:03:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,679 | cpp | #include "gl/glee.h"
#include "SpaceshipShield.h"
#include "Spaceship.h"
#include "SimpleMaterial.h"
#include "VisualVertexArraySphere.h"
#include "CollisionDynamicBSphere.h"
#include "SpaceshipShieldCollisionResponse.h"
#include "Clock.h"
#include "Timer.h"
#include "ShaderMgr.h"
#include "Config.h"
#include "MultiTexture.h"
using namespace tlib;
// ----------------------------------------------------------------------------
void SpaceshipShield::init( Spaceship *oShip )
{
// Set object's type
setType( SPACESHIP_SHIELD );
// Assign the spaceship pointer
m_oShip = oShip;
m_oShip->setShield( this );
Config cfg("config.txt");
cfg.loadBlock("shield");
// Read animation time
float fNoiseDuration, fGlowDuration;
cfg.getFloat("noise_time", &fNoiseDuration);
cfg.getFloat("glow_time", &fGlowDuration);
// Request a timer from the application clock
m_NoiseTimer = Clock::Instance().GetTimer();
m_NoiseTimer->setDuration(fNoiseDuration);
m_NoiseTimer->start();
m_GlowTimer = Clock::Instance().GetTimer();
m_GlowTimer->setDuration(1.0f);
m_GlowTimer->setScale( 1.0f / fGlowDuration );
// Initialize material component
OCSimpleMaterial *cMat = new OCSimpleMaterial;
cMat->setAmbient( Color::black() );
cMat->setDiffuse( Color::white() );
setComponent( cMat );
// Read shield's radius
float fRadius;
cfg.getFloat("radius", &fRadius);
// Read shield's stacks
int iStacks;
cfg.getInt("stacks", &iStacks);
// Read shield's slices
int iSlices;
cfg.getInt("slices", &iSlices);
// Read textures
string sColorMap, sNoiseMap;
cfg.getString("color_map", sColorMap);
cfg.getString("noise_map", sNoiseMap);
OCMultiTexture *cTex = new OCMultiTexture(2);
cTex->set(0, sColorMap.c_str());
cTex->setName(0, "colorMap");
cTex->set(1, sNoiseMap.c_str());
cTex->setName(1, "noiseMap");
setComponent( cTex );
// Initialize visual component
setComponent( new OCVisualVertexArraySphere( fRadius, iStacks, iSlices ) );
// Initialize collision component
setComponent( new OCCollisionDynamicBSphere( fRadius ) );
// Initialize collision response component
setComponent( new SpaceshipShieldCollisionResponse );
}
// ----------------------------------------------------------------------------
void SpaceshipShield::update()
{
setPos( m_oShip->getPos() );
}
// ----------------------------------------------------------------------------
void SpaceshipShield::render() const
{
if( !isActive() ) return;
// User shield rendering program
ShaderMgr::Instance().begin( ShaderMgr::HIT_GLOW );
{
glUniform1f( ShaderMgr::Instance().getUniform("noise_timer"),
(float)m_NoiseTimer->getElapsedTime() );
float glowTimer = 1.0f;
if( m_GlowTimer->isRunning() ) {
glowTimer = (float)m_GlowTimer->getElapsedTime();
}
glUniform1f( ShaderMgr::Instance().getUniform("glow_timer"), glowTimer );
// Enable blending
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE );
{
// Draw the shield
((IOCVisual*)getComponent("visual"))->render();
}
glDisable( GL_BLEND );
}
ShaderMgr::Instance().end();
}
// ----------------------------------------------------------------------------
void SpaceshipShield::setCollPoint( const Vector3f& vCollPoint ) {
m_GlowTimer->restart();
m_vCollPoint = vCollPoint;
} | [
"john.fragkoulis@201bd241-053d-0410-948a-418211174e54"
]
| [
[
[
1,
121
]
]
]
|
7b9c77132b93610f20e7a6aad4ae4545b449cfaa | 1db5ea1580dfa95512b8bfa211c63bafd3928ec5 | /Task.h | 30b7d945f4e843ddeaf3db7653c1b4b244e570c6 | []
| no_license | armontoubman/scbatbot | 3b9dd4532fbb78406b41dd0d8f08926bd710ad7b | bee2b0bf0281b8c2bd6edc4c10a597041ea4be9b | refs/heads/master | 2023-04-18T12:08:13.655631 | 2010-09-17T23:03:26 | 2010-09-17T23:03:26 | 361,411,133 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 498 | h | #pragma once
#include <BWAPI.h>
#include <UnitGroup.h>
class Task {
public:
Task();
Task(int t, BWAPI::Position pos);
Task(int t, BWAPI::Position pos, bool eCA, bool eCG, int eS, int eMS);
int type;
/*
types:
1 scout
2 combat
3 prepare
4 detector
5 defend
*/
bool enemyContainsAir;
bool enemyContainsGround;
int enemySize;
int enemyMilitarySize;
BWAPI::Position position;
bool operator==(const Task& param) const;
bool operator<(const Task& rhs) const;
}; | [
"armontoubman@a850bb65-3c1a-43af-a1ba-18f3eb5da290"
]
| [
[
[
1,
25
]
]
]
|
9fca2d79217bdfe57d51684e57f8baa4b552569c | 9590b067bcd6087a7ae97a77788818562649bd02 | /Sources/Internal/Render/RenderResource.h | 84d5ac43eedf3f7f4992a324af0dee3a61714472 | []
| no_license | vaad2/dava.framework | b2ce2ad737c374a28e9d13112db1951a965870e5 | bc0589048287a9b303b794854b75c98eb61baa8e | refs/heads/master | 2020-11-27T05:12:12.268778 | 2011-12-01T13:09:34 | 2011-12-01T13:09:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,235 | h | /*==================================================================================
Copyright (c) 2008, DAVA Consulting, LLC
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the DAVA Consulting, LLC nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE DAVA CONSULTING, LLC AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL DAVA CONSULTING, LLC BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Revision History:
* Created by Vitaliy Borodovsky
=====================================================================================*/
#ifndef __DAVAENGINE_RESOURCE_H__
#define __DAVAENGINE_RESOURCE_H__
#include "Base/BaseObject.h"
namespace DAVA
{
/**
\ingroup render
\brief Base class for render system resources. All render system resources must be derived from this class.
*/
class RenderResource : public BaseObject
{
public:
RenderResource();
virtual ~RenderResource();
/**
\brief This function is called when you need to save resource to system memory for easy restore later.
This function should be overloaded for resouces that do not regenerating every frame, like rendertargets.
So if application lost focus framework call this function to save resources to system memory for each restore when device will be lost
*/
virtual void SaveToSystemMemory();
/**
\brief Resource that lost send this message to release old unused data and prepare to be reloaded
This function must be overloaded in all resources that can be lost and it should free all data used by resource and prepare itself for reload
*/
virtual void Lost();
/**
\brief Invalidate resource data. Restore it from original location if needed.
*/
virtual void Invalidate();
static List<RenderResource*> resourceList;
static void LostAllResources();
static void InvalidateAllResources();
static void SaveAllResourcesToSystemMem();
};
};
#endif // __DAVAENGINE_RESOURCE_H__ | [
"[email protected]"
]
| [
[
[
1,
76
]
]
]
|
6b33cb4df0f8b95bf66a6b06076a030394831392 | be2e23022d2eadb59a3ac3932180a1d9c9dee9c2 | /NpcServer/NpcKernel/NpcManager.h | a0aaba298267568a6d6aa5072adfe1873adf198e | []
| no_license | cronoszeu/revresyksgpr | 78fa60d375718ef789042c452cca1c77c8fa098e | 5a8f637e78f7d9e3e52acdd7abee63404de27e78 | refs/heads/master | 2020-04-16T17:33:10.793895 | 2010-06-16T12:52:45 | 2010-06-16T12:52:45 | 35,539,807 | 0 | 2 | null | null | null | null | GB18030 | C++ | false | false | 1,831 | h |
#pragma once
#include "define.h"
#include "npc.h"
#include "GameObjSet.h"
#include "NpcGenerator.h"
#include "T_SingleMap.h"
#include "T_MyQueue.h"
const int MAXNPC_PER_ONTIMER = 20; // 每次ONTIMER调用生成几个
#ifdef _DEBUG
const int AGENT_GEN_DELAY_SECS = 1; //
#else
const int AGENT_GEN_DELAY_SECS = 10; //
#endif
typedef IGameObjSet<INpc> INpcSet;
typedef CGameObjSet<INpc> CNpcSet;
typedef CSingleMap<INpc> INpcBigSet;
typedef CSingleMap<INpc> CNpcBigSet;
typedef IGameObjSet<CNpcGenerator> INpcGenSet;
typedef CGameObjSet<CNpcGenerator> CNpcGenSet;
typedef IGameObjSet<CNpcType> INpcTypeSet;
typedef CGameObjSet<CNpcType> CNpcTypeSet;
struct NpcInfoStruct;
class CNpcManager
{
public:
CNpcManager();
virtual ~CNpcManager();
bool Create();
virtual ULONG Release() { delete this; return 0; }
INpc* QueryNpc(OBJID id) { return QuerySet()->GetObj(id); }
CAgent* QueryAgent(OBJID id) { INpc* pNpc=QuerySet()->GetObj(id); if(pNpc) return pNpc->QueryInterface(TYPE_OF(CAgent)); return NULL; }
CAgent* QueryAgent(LPCTSTR szName);
INpcBigSet* QuerySet() { CHECKF(m_pNpcSet); return m_pNpcSet; }
INpcGenSet* QueryGenSet() { CHECKF(m_pNpcGenSet); return m_pNpcGenSet; }
INpcTypeSet* QueryNpcTypeSet() { CHECKF(m_pNpcTypeSet); return m_pNpcTypeSet; }
typedef CMyQueue<OBJID> NPCID_RECYCLE;
NPCID_RECYCLE* QueryRecycle() { return &m_setRecycle; }
public:
void OnTimer(DWORD nCurr);
int CountActiveNpc();
public: // for generator
OBJID SpawnNewNpcID();
protected:
INpcBigSet* m_pNpcSet;
INpcGenSet* m_pNpcGenSet;
INpcTypeSet* m_pNpcTypeSet;
CMyQueue<CAgent*> m_setAgentGen;
private: // ctrl
OBJID m_idLastNewNpc;
int m_idxCurrGen;
int m_nStep;
CMyQueue<OBJID> m_setRecycle;
CTimeOut m_tAgentDelay;
};
| [
"rpgsky.com@cc92e6ba-efcf-11de-bf31-4dec8810c1c1"
]
| [
[
[
1,
70
]
]
]
|
70976abe87302e83f3935b24473577b855bb0c98 | b9b99474453d2a30451e51ba86381f306cf372e9 | /include/gliese/GameSpace.h | cfb8d4c8a0eeb478866a748482d1ce60d732c334 | []
| no_license | lagenar/pacman | d34c6edfde524ad8514714cc4905c4854f6c8e70 | 2845b0d0247450ea5fc10b24ccc185c75f07f4a2 | refs/heads/master | 2021-01-21T13:49:33.019555 | 2009-12-02T00:27:10 | 2009-12-02T00:27:10 | 369,156 | 3 | 1 | null | 2020-10-20T14:20:59 | 2009-11-11T17:21:07 | C | UTF-8 | C++ | false | false | 3,125 | h | #ifndef GAMESPACE_H_
#define GAMESPACE_H_
#include "LogicObject.h"
#include "Rectangle.h"
#include "cassert"
#include "list"
#include "string"
#include "iostream"
/**
* La clase GameSpace representa la estructura de datos que permite acceder a
* los objetos lógicos a través de sus coordenadas en el espacio bidimensional
* que constituye el area de juego.
*/
class GameSpace
{
public:
GameSpace(int width, int height, int sectorWidth, int sectorHeight);
virtual ~GameSpace();
/**
* Devuelve el ancho del espacio de juego, en unidades lógicas.
* @return ancho del espacio de juego.
*/
int getWidth() const;
/**
* Devuelve el alto del espacio de juego, en unidades lógicas.
* @return alto del espacio de juego.
*/
int getHeight() const;
/**
* Agrega un objeto lógico al área de juego.
* @param obj objeto lógico.
*/
void add(LogicObject * obj);
/**
* Elimina un objeto lógico al área de juego.
* @param obj objeto lógico.
*/
void remove(LogicObject * obj);
/**
* Devuelve los objetos que ocupan en forma total o parcial el area
* rectangular indicada.
* @param area area sobre el cual se buscarán los objetos.
* @param objects objetos constantes cuya posición se encuentra dentro del area indicada.
*/
void getObjects(const Rectangle & area, std::list<const LogicObject *> & objects) const;
/**
* Devuelve los objetos que ocupan en forma total o parcial el area
* rectangular indicada.
* @param area area sobre el cual se buscarán los objetos.
* @param objects objetos cuya posición se encuentra dentro del area indicada.
*/
void getObjects(const Rectangle & area, std::list<LogicObject *> & objects);
/**
* Devuelve los objetos que ocupan en forma total o parcial el area
* rectangular indicada y que cumplan con el filtro por tipo.
* @param area area sobre el cual se buscarán los objetos.
* @param type tipo de los objetos
* @param objects objetos constantes cuya posición se encuentra dentro del area indicada.
*/
void getObjects(const Rectangle & area, const LogicObject::Type & type, std::list<const LogicObject *> & objects) const;
/**
* Devuelve los objetos que ocupan en forma total o parcial el area
* rectangular indicada y que cumplan con el filtro por tipo.
* @param area area sobre el cual se buscarán los objetos.
* @param type tipo de los objetos
* @param objects objetos cuya posición se encuentra dentro del area indicada.
*/
void getObjects(const Rectangle & area, const LogicObject::Type & type, std::list<LogicObject *> & objects);
virtual GameSpace * newInstance() const;
private:
class SpaceSector;
private:
const SpaceSector & getSector(int x, int y) const;
SpaceSector & getSector(int x, int y);
private:
SpaceSector * * sectors;
int width, height;
int sectorWidth, sectorHeight;
};
#endif /*GAMESPACE_H_*/
| [
"[email protected]"
]
| [
[
[
1,
100
]
]
]
|
83669039d4ecba6eb55c5823aea7b0e9e9a76b45 | 942b88e59417352fbbb1a37d266fdb3f0f839d27 | /src/color.cxx | 560ebf1642790f4fcd64532f1346a42273054c30 | [
"BSD-2-Clause"
]
| permissive | take-cheeze/ARGSS... | 2c1595d924c24730cc714d017edb375cfdbae9ef | 2f2830e8cc7e9c4a5f21f7649287cb6a4924573f | refs/heads/master | 2016-09-05T15:27:26.319404 | 2010-12-13T09:07:24 | 2010-12-13T09:07:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,027 | cxx | //////////////////////////////////////////////////////////////////////////////////
/// ARGSS - Copyright (c) 2009 - 2010, Alejandro Marzini (vgvgf)
/// All rights reserved.
///
/// Redistribution and use in source and binary forms, with or without
/// modification, are permitted provided that the following conditions are met:
/// * Redistributions of source code must retain the above copyright
/// notice, this list of conditions and the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright
/// notice, this list of conditions and the following disclaimer in the
/// documentation and/or other materials provided with the distribution.
///
/// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY
/// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
/// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
/// DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
/// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
/// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
/// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
/// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
/// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
/// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
/// Headers
////////////////////////////////////////////////////////////
#include "color.hxx"
#include <argss/color.hxx>
////////////////////////////////////////////////////////////
/// Constructor
////////////////////////////////////////////////////////////
Color::Color()
: red(0.0f)
, green(0.0f)
, blue(0.0f)
, alpha(0.0f)
{
}
Color::Color(VALUE color)
: red((float)NUM2DBL(rb_iv_get(color, "@red")))
, green((float)NUM2DBL(rb_iv_get(color, "@green")))
, blue((float)NUM2DBL(rb_iv_get(color, "@blue")))
, alpha((float)NUM2DBL(rb_iv_get(color, "@alpha")))
{
}
Color::Color(int ired, int igreen, int iblue, int ialpha)
: red((float)ired)
, green((float)igreen)
, blue((float)iblue)
, alpha((float)ialpha)
{
}
Color::Color(Color const& src)
: red(src.red)
, green(src.green)
, blue(src.blue)
, alpha(src.alpha)
{
}
////////////////////////////////////////////////////////////
/// Destructor
////////////////////////////////////////////////////////////
Color::~Color()
{
}
////////////////////////////////////////////////////////////
/// set
////////////////////////////////////////////////////////////
void Color::set(VALUE color)
{
red = (float)NUM2DBL(rb_iv_get(color, "@red"));
green = (float)NUM2DBL(rb_iv_get(color, "@green"));
blue = (float)NUM2DBL(rb_iv_get(color, "@blue"));
alpha = (float)NUM2DBL(rb_iv_get(color, "@alpha"));
}
////////////////////////////////////////////////////////////
/// get ARGSS
////////////////////////////////////////////////////////////
VALUE Color::getARGSS()
{
VALUE args[4] = {rb_float_new(red), rb_float_new(green), rb_float_new(blue), rb_float_new(alpha)};
return rb_class_new_instance(4, args, ARGSS::AColor::getID());
}
////////////////////////////////////////////////////////////
/// get Uint32
////////////////////////////////////////////////////////////
Uint32 Color::getUint32() const
{
return ((Uint8)red) | (((Uint8)green) << 8) | (((Uint8)blue) << 16) | (((Uint8)alpha) << 24);
}
////////////////////////////////////////////////////////////
/// Static create Color from Uint32
////////////////////////////////////////////////////////////
Color Color::NewUint32(Uint32 color)
{
int r = (color & 0x000000ff);
int g = (color & 0x0000ff00) >> 8;
int b = (color & 0x00ff0000) >> 16;
int a = (color & 0xff000000) >> 24;
return Color(r, g, b, a);
}
| [
"[email protected]"
]
| [
[
[
1,
108
]
]
]
|
2d60eab6984675a9c007c90ce81d4520c3f80678 | bd37f7b494990542d0d9d772368239a2d44e3b2d | /server/src/Parser.cpp | d8988de89dd1930f0b98f300686c43d6c47071ad | []
| no_license | nicosuarez/pacmantaller | b559a61355517383d704f313b8c7648c8674cb4c | 0e0491538ba1f99b4420340238b09ce9a43a3ee5 | refs/heads/master | 2020-12-11T02:11:48.900544 | 2007-12-19T21:49:27 | 2007-12-19T21:49:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,497 | cpp | /* Parser
* Implementacion Independiente
* Archivo : parser.cpp
* Version : 2.0
*/
#include "Parser.h"
#define EMPTY ""
/******************************************************************************/
/* Implementacion */
/*------------------------------*/
using namespace std;
string Parser::strip(string s)
{
return s.substr(s.find_first_not_of(' '), s.find_last_not_of(' ')+1);
}
/*----------------------------------------------------------------------------*/
void Parser::cargarConfiguracion(char* pathConfig)
{
ifstream fileConfig;
string s = "";
fileConfig.open(pathConfig);
if(!fileConfig.fail())
{
tConf conf;
while (getline(fileConfig, s))
{
if (s == EMPTY) // vacío
continue;
if (s[0] == '#') // comentario
continue;
if (s.find('=') == string::npos)
{
cerr << ERR_PARSER_CONIFG << "\n";
fileConfig.close();
exit(2);
}
string key = s.substr(0, s.find('='));
string val = s.substr(s.find('=')+1, string::npos);
conf[strip(key)] = strip(val);
}
cargarConfiguracion(conf);
}
else
{
cerr << ERR_PARSER_CONFIG_FILE_NOT_FOUND << " " << pathConfig <<"\n";
fileConfig.close();
exit(3);
}
fileConfig.close();
}
/*----------------------------------------------------------------------------*/
void Parser::cargarConfiguracion(tConf config)
{
string mundoXmlPath=EMPTY,archivoLog=EMPTY;
int port=0,minJugadores=2,maxJugadores=5,vidas=1;
bool com_fantasmas=false;
mundoXmlPath=config[CFG_MUNDO];
StrToken::stringTo<int>(port,config[CFG_PUERTO]);
StrToken::stringTo<int>(minJugadores,config[CFG_MIN_JUGADORES]);
StrToken::stringTo<int>(maxJugadores,config[CFG_MAX_JUGADORES]);
StrToken::stringTo<int>(vidas,config[CFG_VIDAS]);
StrToken::stringTo<bool>(com_fantasmas,config[CFG_COM_FANTASMAS]);
archivoLog=config[CFG_LOG_FILE];
//Se setea el objecto singleton de configuracion.
Config::setInstance(mundoXmlPath,port,minJugadores,
maxJugadores,com_fantasmas,vidas,archivoLog);
}
/*----------------------------------------------------------------------------*/
void Parser::validarParametros(int cantParam)
{
if(cantParam!=2)
{
std::cout<<"Cantidad de parametros invalido.\n";
exit(ERR_MAL_EJECUTADO);
}
}
| [
"scamjayi@5682bcf5-5c3f-0410-a8fd-ab24993f6fe8"
]
| [
[
[
1,
85
]
]
]
|
593b74dda40dc15e826832310d6050752292eefb | e7c45d18fa1e4285e5227e5984e07c47f8867d1d | /Common/ModelsC/MG/MG_SEP.H | 903786fd2eb0cd562d169361da4b44ff8758094e | []
| no_license | abcweizhuo/Test3 | 0f3379e528a543c0d43aad09489b2444a2e0f86d | 128a4edcf9a93d36a45e5585b70dee75e4502db4 | refs/heads/master | 2021-01-17T01:59:39.357645 | 2008-08-20T00:00:29 | 2008-08-20T00:00:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,340 | h | //================== SysCAD - Copyright Kenwalt (Pty) Ltd ===================
// $Nokeywords: $
//===========================================================================
// SysCAD Copyright Kenwalt (Pty) Ltd 1992
#ifndef __MG_SEP_H
#define __MG_SEP_H
#ifndef __SC_DEFS_H
#include "sc_defs.h"
#endif
#define BASIC1
#ifndef __MODELS_H
#include "models.h"
#endif
//#ifndef __M_SRCSNK_H
// #include "m_srcsnk.h"
//#endif
//#ifndef __SURGE_H
// #include "surge.h"
//#endif
//#ifndef __M_TANK_GP_H
// #include "tank_gp.h"
//#endif
#ifndef __FLWNODE_H
#include <flwnode.h>
#endif
#ifndef __SM_OIL_H
#include "sm_oil.h"
#endif
#ifndef __SP_CONT_H
#include "sp_cont.h"
#endif
#ifdef __MG_SEP_CPP
#define DllImportExport DllExport
#else
#define DllImportExport
#endif
// --------------------------------------------------------------------------
DEFINE_TAGOBJ(Flare);
_FWDDEF(FlashTank);
_FWDDEF(Flare);
class Flare : public MN_SrcSnk
{
public:
double PSetP, PGapP;
//flag Flash;
double TempO;
Strng FlareTag;
pFlashTank FlareDrum;
Flare (pTagObjClass pClass_, pchar TagIn, pTaggedObject pAttach, TagObjAttachment eAttach);
virtual ~Flare (){};
// void Initialise();
virtual void BuildDataDefn(DataDefnBlk &DDB);
virtual flag DataXchg(DataChangeBlk & DCB);
virtual flag ValidateData(ValidateDataBlk & VDB);
// virtual flag EvalFlowEquations(CSpPropInfo *pProps, int iJoinId, int FE);
virtual flag EvalFlowEquations(CSpPropInfo *pProps, int IONo, int FE);
virtual void EvalProducts();
virtual void EvalDerivs();
virtual void EvalDiscrete();
virtual void EvalJoinPressures();
};
// --------------------------------------------------------------------------
DEFINE_TAGOBJ(FlashTank);
class FlashTank : public Tank
{
public:
//flag Flash, FlashIn;
//double P_Rqd;
// double EvapTau, VFrac_H, VFrac_L;
FlashTank(pTagObjClass pClass_, pchar TagIn, pTaggedObject pAttach, TagObjAttachment eAttach);
virtual ~FlashTank(){};
// void Initialise();
double mDewPt(pMdlNode This);
double mH2oVVFrac(pMdlNode This);
virtual void BuildDataDefn(DataDefnBlk &DDB);
virtual flag ValidateData(ValidateDataBlk & VDB);
// void EvalDerivs_Flash_____(rSpContainer M);
//virtual void EvalDerivs();
virtual void ConvergeStates();
private:
};
// --------------------------------------------------------------------------
/* cnm**
DEFINE_TAGOBJ(FlareDrum);
_FWDDEF(FlareDrum);
class FlareDrum : public FlashTank
{
public:
double FlareRate;
FlareDrum(pTagObjClass pClass_, pchar TagIn, pTaggedObject pAttach, TagObjAttachment eAttach);
virtual ~FlareDrum(){};
// void Initialise();
virtual void BuildDataDefn(DataDefnBlk &DDB);
flag DataXchg(DataChangeBlk & DCB);
virtual void EvalProducts();
virtual void EvalDerivs();
virtual void Dyn_EvalState();
private:
};
**/
// --------------------------------------------------------------------------
DEFINE_TAGOBJ(VL_Sep);
_FWDDEF(VL_Sep);
class VL_Sep : public FlashTank
{
public:
VL_Sep (pTagObjClass pClass_, pchar TagIn, pTaggedObject pAttach, TagObjAttachment eAttach);
virtual ~VL_Sep (){};
//virtual void EvalProducts();
//virtual void EvalDerivs();
private:
};
// --------------------------------------------------------------------------
DEFINE_TAGOBJ(VLL_Sep);
_FWDDEF(VLL_Sep);
class VLL_Sep : public FlashTank
{
public:
double BootVolume;
double H2ORemEff; // hss 20/01/97 Defines efficiency of water removal from the boot
double H2oSettled;
double dH2oSettled;
dword H2OValidFlags;
Integrator * pH2oSettled;
Integrator * pMEGSettled;
double ExtraH2oSettled;
double MEGSettled; //hss 12/01/2000 Add facility to remove MEG via the boot.
double dMEGSettled;
double TotalSettled;
VLL_Sep (pTagObjClass pClass_, pchar TagIn, pTaggedObject pAttach, TagObjAttachment eAttach);
virtual ~VLL_Sep ();
// void Initialise();
virtual void BuildDataDefn(DataDefnBlk &DDB);
virtual flag DataXchg(DataChangeBlk & DCB);
virtual flag ValidateData(ValidateDataBlk & VDB);
virtual flag InitialiseSolution();
virtual void EvalProducts();
virtual void EvalDerivs();
virtual void ApplyDerivs(double dTime, flag DoDbg);
virtual void ConvergeStates();
virtual flag EvalPressureSens();
protected:
void SetVLEMixFrac(double H2OSettled);
};
// ---------------------------------------------------------------------------
const word xidBH2oIf = 50000;
const word xidBootLev = 50001;
const word xidBSettle = 50002;
const word xidBSetTau = 50003;
const word xidFlrRate = 50004;
// ---------------------------------------------------------------------------
#undef DllImportExport
#endif
| [
"[email protected]"
]
| [
[
[
1,
184
]
]
]
|
6cbc74b527222d2cbea63fe3a892e01d20305813 | 1e01b697191a910a872e95ddfce27a91cebc57dd | /DtaDesignScript.cpp | 4532df15fd336e46f83bf3ddd9c4d3a6992e8c52 | []
| no_license | canercandan/codeworker | 7c9871076af481e98be42bf487a9ec1256040d08 | a68851958b1beef3d40114fd1ceb655f587c49ad | refs/heads/master | 2020-05-31T22:53:56.492569 | 2011-01-29T19:12:59 | 2011-01-29T19:12:59 | 1,306,254 | 7 | 5 | null | null | null | null | IBM852 | C++ | false | false | 7,032 | cpp | /* "CodeWorker": a scripting language for parsing and generating text.
Copyright (C) 1996-1997, 1999-2002 CÚdric Lemaire
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
To contact the author: [email protected]
*/
#ifdef WIN32
#pragma warning (disable : 4786)
#endif
#include "UtlException.h"
#include "ScpStream.h"
#include "DtaScriptVariable.h"
#include "ExprScriptVariable.h"
#include "GrfSetInputLocation.h"
#include "GrfAttachInputToSocket.h"
#include "GrfDetachInputFromSocket.h"
#include "GrfGoBack.h"
#include "DtaProtectedAreasBag.h"
#include "CGRuntime.h"
#include "DtaDesignScript.h"
namespace CodeWorker {
DtaDesignScript::DtaDesignScript(/*DtaScriptVariable* pVisibility, */GrfBlock* pParentBlock) : DtaScript(/*pVisibility, */pParentBlock), _pProtectedAreasBag(NULL) {
}
DtaDesignScript::~DtaDesignScript() {
if (_pProtectedAreasBag != NULL) delete _pProtectedAreasBag;
}
DtaProtectedAreasBag& DtaDesignScript::getProtectedAreasBag() {
if (_pProtectedAreasBag == NULL) {
_pProtectedAreasBag = new DtaProtectedAreasBag;
_pProtectedAreasBag->recoverProtectedCodes(*CGRuntime::_pInputStream);
}
return *_pProtectedAreasBag;
}
DtaScriptFactory::SCRIPT_TYPE DtaDesignScript::getType() const { return DtaScriptFactory::FREE_SCRIPT; }
bool DtaDesignScript::isAParseScript() const { return true; }
void DtaDesignScript::traceEngine() const {
if (getFilenamePtr() == NULL) CGRuntime::traceLine("free-parsing script (no filename):");
else CGRuntime::traceLine("free-parsing script \"" + std::string(getFilenamePtr()) + "\":");
traceInternalEngine();
}
void DtaDesignScript::handleUnknownCommand(const std::string& sCommand, ScpStream& script, GrfBlock& block) {
DtaScript::handleUnknownCommand(sCommand, script, block);
}
//##markup##"parsing"
//##begin##"parsing"
void DtaDesignScript::parseAttachInputToSocket(GrfBlock& block, ScpStream& script, ExprScriptVariable* pMethodCaller) {
GrfAttachInputToSocket* pAttachInputToSocket = new GrfAttachInputToSocket;
if (requiresParsingInformation()) pAttachInputToSocket->setParsingInformation(getFilenamePtr(), script);
block.add(pAttachInputToSocket);
script.skipEmpty();
if (!script.isEqualTo('(')) throw UtlException(script, "syntax error: '(' expected");
script.skipEmpty();
if (pMethodCaller == NULL) pAttachInputToSocket->setSocket(parseExpression(block, script));
else pAttachInputToSocket->setSocket(pMethodCaller);
if (!script.isEqualTo(')')) throw UtlException(script, "syntax error: ')' expected");
script.skipEmpty();
if (!script.isEqualTo(';')) throw UtlException(script, "syntax error: ';' expected");
}
void DtaDesignScript::parseDetachInputFromSocket(GrfBlock& block, ScpStream& script, ExprScriptVariable* pMethodCaller) {
GrfDetachInputFromSocket* pDetachInputFromSocket = new GrfDetachInputFromSocket;
if (requiresParsingInformation()) pDetachInputFromSocket->setParsingInformation(getFilenamePtr(), script);
block.add(pDetachInputFromSocket);
script.skipEmpty();
if (!script.isEqualTo('(')) throw UtlException(script, "syntax error: '(' expected");
script.skipEmpty();
if (pMethodCaller == NULL) pDetachInputFromSocket->setSocket(parseExpression(block, script));
else pDetachInputFromSocket->setSocket(pMethodCaller);
if (!script.isEqualTo(')')) throw UtlException(script, "syntax error: ')' expected");
script.skipEmpty();
if (!script.isEqualTo(';')) throw UtlException(script, "syntax error: ';' expected");
}
void DtaDesignScript::parseGoBack(GrfBlock& block, ScpStream& script, ExprScriptVariable* pMethodCaller) {
GrfGoBack* pGoBack = new GrfGoBack;
if (requiresParsingInformation()) pGoBack->setParsingInformation(getFilenamePtr(), script);
block.add(pGoBack);
script.skipEmpty();
if (!script.isEqualTo('(')) throw UtlException(script, "syntax error: '(' expected");
script.skipEmpty();
if (!script.isEqualTo(')')) throw UtlException(script, "syntax error: ')' expected");
script.skipEmpty();
if (!script.isEqualTo(';')) throw UtlException(script, "syntax error: ';' expected");
}
void DtaDesignScript::parseSetInputLocation(GrfBlock& block, ScpStream& script, ExprScriptVariable* pMethodCaller) {
GrfSetInputLocation* pSetInputLocation = new GrfSetInputLocation;
if (requiresParsingInformation()) pSetInputLocation->setParsingInformation(getFilenamePtr(), script);
block.add(pSetInputLocation);
script.skipEmpty();
if (!script.isEqualTo('(')) throw UtlException(script, "syntax error: '(' expected");
script.skipEmpty();
if (pMethodCaller == NULL) pSetInputLocation->setLocation(parseExpression(block, script));
else pSetInputLocation->setLocation(pMethodCaller);
if (!script.isEqualTo(')')) throw UtlException(script, "syntax error: ')' expected");
script.skipEmpty();
if (!script.isEqualTo(';')) throw UtlException(script, "syntax error: ';' expected");
}
//##end##"parsing"
SEQUENCE_INTERRUPTION_LIST DtaDesignScript::loadDesign(const char* sFile, DtaScriptVariable& thisContext) {
setFilename(sFile);
return execute(thisContext);
}
SEQUENCE_INTERRUPTION_LIST DtaDesignScript::execute(DtaScriptVariable& thisContext) {
SEQUENCE_INTERRUPTION_LIST result = NO_INTERRUPTION;
ScpStream* pOldInputStream = CGRuntime::_pInputStream;
CGRuntime::_pInputStream = new ScpStream(getFilenamePtr(), ScpStream::IN | ScpStream::PATH);
try {
result = DtaScript::execute(thisContext);
} catch(UtlException& e) {
int iLine = CGRuntime::_pInputStream->getLineCount();
CGRuntime::_pInputStream->close();
delete CGRuntime::_pInputStream;
CGRuntime::_pInputStream = pOldInputStream;
std::string sException = e.getMessage();
std::string sMessage;
if (getFilenamePtr() == NULL) sMessage += "(unknown)";
else sMessage += getFilenamePtr();
char tcNumber[32];
sprintf(tcNumber, "(%d):", iLine);
sMessage += tcNumber;
sMessage += CGRuntime::endl() + sException;
throw UtlException(e.getTraceStack(), sMessage);
} catch(std::exception&) {
CGRuntime::_pInputStream->close();
delete CGRuntime::_pInputStream;
CGRuntime::_pInputStream = pOldInputStream;
throw;
}
CGRuntime::_pInputStream->close();
delete CGRuntime::_pInputStream;
CGRuntime::_pInputStream = pOldInputStream;
return result;
}
}
| [
"cedric.p.r.lemaire@28b3f5f3-d42e-7560-b87f-5f53cf622bc4"
]
| [
[
[
1,
161
]
]
]
|
b30db92801d0ecc251b1d3e7dc2e4aa35f0b9f7f | 9bccf7cb7a70b8d165f83cf0ea5ea02d6955b7e4 | /pa_asio/pa_asio.cpp | 8566ff764730f25703701e8b4d101779a4b80cdb | [
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
]
| permissive | dirocco/portaudio | 246a57ddf221114360f5d27ec5718e14b044bd81 | 75498a1cb12b0644d23a21e8ec5bed5f302e131d | refs/heads/master | 2020-05-18T05:18:44.159191 | 2009-05-26T00:34:22 | 2009-05-26T00:34:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 164,912 | cpp | /*
* $Id: pa_asio.cpp,v 1.2 2003/04/29 02:24:22 darreng Exp $
* Portable Audio I/O Library for ASIO Drivers
*
* Author: Stephane Letz
* Based on the Open Source API proposed by Ross Bencina
* Copyright (c) 2000-2001 Stephane Letz, Phil Burk
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* Any person wishing to distribute modifications to the Software is
* requested to send the modifications to the original developer so that
* they can be incorporated into the canonical version.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* Modification History
08-03-01 First version : Stephane Letz
08-06-01 Tweaks for PC, use C++, buffer allocation, Float32 to Int32 conversion : Phil Burk
08-20-01 More conversion, PA_StreamTime, Pa_GetHostError : Stephane Letz
08-21-01 PaUInt8 bug correction, implementation of ASIOSTFloat32LSB and ASIOSTFloat32MSB native formats : Stephane Letz
08-24-01 MAX_INT32_FP hack, another Uint8 fix : Stephane and Phil
08-27-01 Implementation of hostBufferSize < userBufferSize case, better management of the ouput buffer when
the stream is stopped : Stephane Letz
08-28-01 Check the stream pointer for null in bufferSwitchTimeInfo, correct bug in bufferSwitchTimeInfo when
the stream is stopped : Stephane Letz
10-12-01 Correct the PaHost_CalcNumHostBuffers function: computes FramesPerHostBuffer to be the lowest that
respect requested FramesPerUserBuffer and userBuffersPerHostBuffer : Stephane Letz
10-26-01 Management of hostBufferSize and userBufferSize of any size : Stephane Letz
10-27-01 Improve calculus of hostBufferSize to be multiple or divisor of userBufferSize if possible : Stephane and Phil
10-29-01 Change MAX_INT32_FP to (2147483520.0f) to prevent roundup to 0x80000000 : Phil Burk
10-31-01 Clear the ouput buffer and user buffers in PaHost_StartOutput, correct bug in GetFirstMultiple : Stephane Letz
11-06-01 Rename functions : Stephane Letz
11-08-01 New Pa_ASIO_Adaptor_Init function to init Callback adpatation variables, cleanup of Pa_ASIO_Callback_Input: Stephane Letz
11-29-01 Break apart device loading to debug random failure in Pa_ASIO_QueryDeviceInfo ; Phil Burk
01-03-02 Desallocate all resources in PaHost_Term for cases where Pa_CloseStream is not called properly : Stephane Letz
02-01-02 Cleanup, test of multiple-stream opening : Stephane Letz
19-02-02 New Pa_ASIO_loadDriver that calls CoInitialize on each thread on Windows : Stephane Letz
09-04-02 Correct error code management in PaHost_Term, removes various compiler warning : Stephane Letz
12-04-02 Add Mac includes for <Devices.h> and <Timer.h> : Phil Burk
13-04-02 Removes another compiler warning : Stephane Letz
30-04-02 Pa_ASIO_QueryDeviceInfo bug correction, memory allocation checking, better error handling : D Viens, P Burk, S Letz
01-12-02 Fix Pa_GetDefaultInputDeviceID and Pa_GetDefaultOuputDeviceID result when no driver are available : S Letz
05-12-02 More debug messages : S Letz
01-23-03 Increased max channels to 128. Fixed comparison of (OutputChannels > kMaxInputChannels) : P Burk
02-17-03 Better termination handling : PaHost_CloseStream is called in PaHost_term is the the stream was not explicitely closed by the application : S Letz
04-02-03 More robust ASIO driver buffer size initialization : some buggy drivers (like the Hoontech DSP24) give incorrect [min, preferred, max] values
They should work with the preferred size value, thus if Pa_ASIO_CreateBuffers fails with the hostBufferSize computed in PaHost_CalcNumHostBuffers,
we try again with the preferred size. Fix an old (never detected?) bug in the buffer adapdation code : S Letz
TO DO :
- Check Pa_StopSteam and Pa_AbortStream
- Optimization for Input only or Ouput only (really necessary ??)
*/
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include "portaudio.h"
#include "pa_host.h"
#include "pa_trace.h"
#include "asiosys.h"
#include "asio.h"
#include "asiodrivers.h"
#if MAC
#include <Devices.h>
#include <Timer.h>
#include <Math64.h>
#else
#include <math.h>
#include <windows.h>
#include <mmsystem.h>
#endif
enum {
// number of input and outputs supported by the host application
// you can change these to higher or lower values
kMaxInputChannels = 128,
kMaxOutputChannels = 128
};
/* ASIO specific device information. */
typedef struct internalPortAudioDevice
{
PaDeviceInfo pad_Info;
} internalPortAudioDevice;
/* ASIO driver internal data storage */
typedef struct PaHostSoundControl
{
// ASIOInit()
ASIODriverInfo pahsc_driverInfo;
// ASIOGetChannels()
int32 pahsc_NumInputChannels;
int32 pahsc_NumOutputChannels;
// ASIOGetBufferSize() - sizes in frames per buffer
int32 pahsc_minSize;
int32 pahsc_maxSize;
int32 pahsc_preferredSize;
int32 pahsc_granularity;
// ASIOGetSampleRate()
ASIOSampleRate pahsc_sampleRate;
// ASIOOutputReady()
bool pahsc_postOutput;
// ASIOGetLatencies ()
int32 pahsc_inputLatency;
int32 pahsc_outputLatency;
// ASIOCreateBuffers ()
ASIOBufferInfo bufferInfos[kMaxInputChannels + kMaxOutputChannels]; // buffer info's
// ASIOGetChannelInfo()
ASIOChannelInfo pahsc_channelInfos[kMaxInputChannels + kMaxOutputChannels]; // channel info's
// The above two arrays share the same indexing, as the data in them are linked together
// Information from ASIOGetSamplePosition()
// data is converted to double floats for easier use, however 64 bit integer can be used, too
double nanoSeconds;
double samples;
double tcSamples; // time code samples
// bufferSwitchTimeInfo()
ASIOTime tInfo; // time info state
unsigned long sysRefTime; // system reference time, when bufferSwitch() was called
// Signal the end of processing in this example
bool stopped;
ASIOCallbacks pahsc_asioCallbacks;
int32 pahsc_userInputBufferFrameOffset; // Position in Input user buffer
int32 pahsc_userOutputBufferFrameOffset; // Position in Output user buffer
int32 pahsc_hostOutputBufferFrameOffset; // Position in Output ASIO buffer
int32 past_FramesPerHostBuffer; // Number of frames in ASIO buffer
int32 pahsc_InputBufferOffset; // Number of null frames for input buffer alignement
int32 pahsc_OutputBufferOffset; // Number of null frames for ouput buffer alignement
#if MAC
UInt64 pahsc_EntryCount;
UInt64 pahsc_LastExitCount;
#elif WINDOWS
LARGE_INTEGER pahsc_EntryCount;
LARGE_INTEGER pahsc_LastExitCount;
#endif
PaTimestamp pahsc_NumFramesDone;
internalPortAudioStream *past;
} PaHostSoundControl;
//----------------------------------------------------------
#define PRINT(x) { printf x; fflush(stdout); }
#define ERR_RPT(x) PRINT(x)
#define DBUG(x) /* PRINT(x) */
#define DBUGX(x) /* PRINT(x) */
/* We are trying to be compatible with CARBON but this has not been thoroughly tested. */
#define CARBON_COMPATIBLE (0)
#define PA_MAX_DEVICE_INFO (32)
#define MIN_INT8 (-0x80)
#define MAX_INT8 (0x7F)
#define MIN_INT8_FP ((float)-0x80)
#define MAX_INT8_FP ((float)0x7F)
#define MIN_INT16_FP ((float)-0x8000)
#define MAX_INT16_FP ((float)0x7FFF)
#define MIN_INT16 (-0x8000)
#define MAX_INT16 (0x7FFF)
#define MAX_INT32_FP (2147483520.0f) /* 0x0x7FFFFF80 - seems safe */
/************************************************************************************/
/****************** Data ************************************************************/
/************************************************************************************/
static int sNumDevices = 0;
static internalPortAudioDevice sDevices[PA_MAX_DEVICE_INFO] = { 0 };
static int32 sPaHostError = 0;
static int sDefaultOutputDeviceID = 0;
static int sDefaultInputDeviceID = 0;
PaHostSoundControl asioDriverInfo = {0};
#ifdef MAC
static bool swap = true;
#elif WINDOWS
static bool swap = false;
#endif
// Prototypes
static void bufferSwitch(long index, ASIOBool processNow);
static ASIOTime *bufferSwitchTimeInfo(ASIOTime *timeInfo, long index, ASIOBool processNow);
static void sampleRateChanged(ASIOSampleRate sRate);
static long asioMessages(long selector, long value, void* message, double* opt);
static void Pa_StartUsageCalculation( internalPortAudioStream *past );
static void Pa_EndUsageCalculation( internalPortAudioStream *past );
static void Pa_ASIO_Convert_Inter_Input(
ASIOBufferInfo* nativeBuffer,
void* inputBuffer,
long NumInputChannels,
long NumOuputChannels,
long framePerBuffer,
long hostFrameOffset,
long userFrameOffset,
ASIOSampleType nativeFormat,
PaSampleFormat paFormat,
PaStreamFlags flags,
long index);
static void Pa_ASIO_Convert_Inter_Output(
ASIOBufferInfo* nativeBuffer,
void* outputBuffer,
long NumInputChannels,
long NumOuputChannels,
long framePerBuffer,
long hostFrameOffset,
long userFrameOffset,
ASIOSampleType nativeFormat,
PaSampleFormat paFormat,
PaStreamFlags flags,
long index);
static void Pa_ASIO_Clear_Output(ASIOBufferInfo* nativeBuffer,
ASIOSampleType nativeFormat,
long NumInputChannels,
long NumOuputChannels,
long index,
long hostFrameOffset,
long frames);
static void Pa_ASIO_Callback_Input(long index);
static void Pa_ASIO_Callback_Output(long index, long framePerBuffer);
static void Pa_ASIO_Callback_End();
static void Pa_ASIO_Clear_User_Buffers();
// Some external references
extern AsioDrivers* asioDrivers ;
bool loadAsioDriver(char *name);
unsigned long get_sys_reference_time();
/************************************************************************************/
/****************** Macro ************************************************************/
/************************************************************************************/
#define SwapLong(v) ((((v)>>24)&0xFF)|(((v)>>8)&0xFF00)|(((v)&0xFF00)<<8)|(((v)&0xFF)<<24)) ;
#define SwapShort(v) ((((v)>>8)&0xFF)|(((v)&0xFF)<<8)) ;
#define ClipShort(v) (((v)<MIN_INT16)?MIN_INT16:(((v)>MAX_INT16)?MAX_INT16:(v)))
#define ClipChar(v) (((v)<MIN_INT8)?MIN_INT8:(((v)>MAX_INT8)?MAX_INT8:(v)))
#define ClipFloat(v) (((v)<-1.0f)?-1.0f:(((v)>1.0f)?1.0f:(v)))
#ifndef min
#define min(a,b) ((a)<(b)?(a):(b))
#endif
#ifndef max
#define max(a,b) ((a)>=(b)?(a):(b))
#endif
static bool Pa_ASIO_loadAsioDriver(char *name)
{
#ifdef WINDOWS
CoInitialize(0);
#endif
return loadAsioDriver(name);
}
// Utilities for alignement buffer size computation
static int PGCD (int a, int b) {return (b == 0) ? a : PGCD (b,a%b);}
static int PPCM (int a, int b) {return (a*b) / PGCD (a,b);}
// Takes the size of host buffer and user buffer : returns the number of frames needed for buffer adaptation
static int Pa_ASIO_CalcFrameShift (int M, int N)
{
int res = 0;
for (int i = M; i < PPCM (M,N) ; i+=M) { res = max (res, i%N); }
return res;
}
// We have the following relation :
// Pa_ASIO_CalcFrameShift (M,N) + M = Pa_ASIO_CalcFrameShift (N,M) + N
/* ASIO sample type to PortAudio sample type conversion */
static PaSampleFormat Pa_ASIO_Convert_SampleFormat(ASIOSampleType type)
{
switch (type) {
case ASIOSTInt16MSB:
case ASIOSTInt16LSB:
case ASIOSTInt32MSB16:
case ASIOSTInt32LSB16:
return paInt16;
case ASIOSTFloat32MSB:
case ASIOSTFloat32LSB:
case ASIOSTFloat64MSB:
case ASIOSTFloat64LSB:
return paFloat32;
case ASIOSTInt32MSB:
case ASIOSTInt32LSB:
case ASIOSTInt32MSB18:
case ASIOSTInt32MSB20:
case ASIOSTInt32MSB24:
case ASIOSTInt32LSB18:
case ASIOSTInt32LSB20:
case ASIOSTInt32LSB24:
return paInt32;
case ASIOSTInt24MSB:
case ASIOSTInt24LSB:
return paInt24;
default:
return paCustomFormat;
}
}
//--------------------------------------------------------------------------------------------------------------------
static void PaHost_CalcBufferOffset(internalPortAudioStream *past)
{
if (asioDriverInfo.past_FramesPerHostBuffer > past->past_FramesPerUserBuffer){
// Computes the MINIMUM value of null frames shift for the output buffer alignement
asioDriverInfo.pahsc_OutputBufferOffset = Pa_ASIO_CalcFrameShift (asioDriverInfo.past_FramesPerHostBuffer,past->past_FramesPerUserBuffer);
asioDriverInfo.pahsc_InputBufferOffset = 0;
DBUG(("PaHost_CalcBufferOffset : Minimum BufferOffset for Output = %d\n", asioDriverInfo.pahsc_OutputBufferOffset));
}else{
//Computes the MINIMUM value of null frames shift for the input buffer alignement
asioDriverInfo.pahsc_InputBufferOffset = Pa_ASIO_CalcFrameShift (asioDriverInfo.past_FramesPerHostBuffer,past->past_FramesPerUserBuffer);
asioDriverInfo.pahsc_OutputBufferOffset = 0;
DBUG(("PaHost_CalcBufferOffset : Minimum BufferOffset for Input = %d\n", asioDriverInfo.pahsc_InputBufferOffset));
}
}
//--------------------------------------------------------------------------------------------------------------------
/* Allocate ASIO buffers, initialise channels */
static ASIOError Pa_ASIO_CreateBuffers (PaHostSoundControl *asioDriverInfo, long InputChannels,
long OutputChannels, long framesPerBuffer)
{
ASIOError err;
int i;
ASIOBufferInfo *info = asioDriverInfo->bufferInfos;
// Check parameters
if ((InputChannels > kMaxInputChannels) || (OutputChannels > kMaxOutputChannels)) return ASE_InvalidParameter;
for(i = 0; i < InputChannels; i++, info++){
info->isInput = ASIOTrue;
info->channelNum = i;
info->buffers[0] = info->buffers[1] = 0;
}
for(i = 0; i < OutputChannels; i++, info++){
info->isInput = ASIOFalse;
info->channelNum = i;
info->buffers[0] = info->buffers[1] = 0;
}
// Set up the asioCallback structure and create the ASIO data buffer
asioDriverInfo->pahsc_asioCallbacks.bufferSwitch = &bufferSwitch;
asioDriverInfo->pahsc_asioCallbacks.sampleRateDidChange = &sampleRateChanged;
asioDriverInfo->pahsc_asioCallbacks.asioMessage = &asioMessages;
asioDriverInfo->pahsc_asioCallbacks.bufferSwitchTimeInfo = &bufferSwitchTimeInfo;
DBUG(("Pa_ASIO_CreateBuffers : ASIOCreateBuffers with inputChannels = %ld \n", InputChannels));
DBUG(("Pa_ASIO_CreateBuffers : ASIOCreateBuffers with OutputChannels = %ld \n", OutputChannels));
DBUG(("Pa_ASIO_CreateBuffers : ASIOCreateBuffers with size = %ld \n", framesPerBuffer));
err = ASIOCreateBuffers( asioDriverInfo->bufferInfos, InputChannels+OutputChannels,
framesPerBuffer, &asioDriverInfo->pahsc_asioCallbacks);
if (err != ASE_OK) return err;
// Initialise buffers
for (i = 0; i < InputChannels + OutputChannels; i++)
{
asioDriverInfo->pahsc_channelInfos[i].channel = asioDriverInfo->bufferInfos[i].channelNum;
asioDriverInfo->pahsc_channelInfos[i].isInput = asioDriverInfo->bufferInfos[i].isInput;
err = ASIOGetChannelInfo(&asioDriverInfo->pahsc_channelInfos[i]);
if (err != ASE_OK) break;
}
err = ASIOGetLatencies(&asioDriverInfo->pahsc_inputLatency, &asioDriverInfo->pahsc_outputLatency);
DBUG(("Pa_ASIO_CreateBuffers : InputLatency = %ld latency = %ld msec \n",
asioDriverInfo->pahsc_inputLatency,
(long)((asioDriverInfo->pahsc_inputLatency*1000)/ asioDriverInfo->past->past_SampleRate)));
DBUG(("Pa_ASIO_CreateBuffers : OuputLatency = %ld latency = %ld msec \n",
asioDriverInfo->pahsc_outputLatency,
(long)((asioDriverInfo->pahsc_outputLatency*1000)/ asioDriverInfo->past->past_SampleRate)));
return err;
}
/*
Query ASIO driver info :
First we get all available ASIO drivers located in the ASIO folder,
then try to load each one. For each loaded driver, get all needed informations.
*/
static PaError Pa_ASIO_QueryDeviceInfo( internalPortAudioDevice * ipad )
{
#define NUM_STANDARDSAMPLINGRATES 3 /* 11.025, 22.05, 44.1 */
#define NUM_CUSTOMSAMPLINGRATES 9 /* must be the same number of elements as in the array below */
#define MAX_NUMSAMPLINGRATES (NUM_STANDARDSAMPLINGRATES+NUM_CUSTOMSAMPLINGRATES)
ASIOSampleRate possibleSampleRates[]
= {8000.0, 9600.0, 11025.0, 12000.0, 16000.0, 22050.0, 24000.0, 32000.0, 44100.0, 48000.0, 88200.0, 96000.0};
ASIOChannelInfo channelInfos;
long InputChannels,OutputChannels;
double *sampleRates;
char* names[PA_MAX_DEVICE_INFO] ;
PaDeviceInfo *dev;
int i;
int numDrivers;
ASIOError asioError;
/* Allocate names */
for (i = 0 ; i < PA_MAX_DEVICE_INFO ; i++) {
names[i] = (char*)PaHost_AllocateFastMemory(32);
/* check memory */
if(!names[i]) return paInsufficientMemory;
}
/* MUST BE CHECKED : to force fragments loading on Mac */
Pa_ASIO_loadAsioDriver("dummy");
/* Get names of all available ASIO drivers */
asioDrivers->getDriverNames(names,PA_MAX_DEVICE_INFO);
/* Check all available ASIO drivers */
#if MAC
numDrivers = asioDrivers->getNumFragments();
#elif WINDOWS
numDrivers = asioDrivers->asioGetNumDev();
#endif
DBUG(("PaASIO_QueryDeviceInfo: number of installed drivers = %d\n", numDrivers ));
for (int driver = 0 ; driver < numDrivers ; driver++)
{
#if WINDOWS
asioDriverInfo.pahsc_driverInfo.asioVersion = 2; // FIXME - is this right? PLB
asioDriverInfo.pahsc_driverInfo.sysRef = GetDesktopWindow(); // FIXME - is this right? PLB
#endif
DBUG(("---------------------------------------\n"));
DBUG(("PaASIO_QueryDeviceInfo: Driver name = %s\n", names[driver]));
/* If the driver can be loaded : */
if ( !Pa_ASIO_loadAsioDriver(names[driver]) ){
DBUG(("PaASIO_QueryDeviceInfo could not loadAsioDriver %s\n", names[driver]));
} else {
DBUG(("PaASIO_QueryDeviceInfo: loadAsioDriver OK\n"));
if((asioError = ASIOInit(&asioDriverInfo.pahsc_driverInfo)) != ASE_OK){
DBUG(("PaASIO_QueryDeviceInfo: ASIOInit returned %d for %s\n", asioError, names[driver]));
}else {
DBUG(("PaASIO_QueryDeviceInfo: ASIOInit OK \n"));
if(ASIOGetChannels(&InputChannels, &OutputChannels) != ASE_OK){
DBUG(("PaASIO_QueryDeviceInfo could not ASIOGetChannels for %s\n", names[driver]));
}else {
DBUG(("PaASIO_QueryDeviceInfo: ASIOGetChannels OK \n"));
/* Gets the name */
dev = &(ipad[sNumDevices].pad_Info);
dev->name = names[driver];
names[driver] = 0;
/* Gets Input and Output channels number */
dev->maxInputChannels = InputChannels;
dev->maxOutputChannels = OutputChannels;
DBUG(("PaASIO_QueryDeviceInfo: InputChannels = %d\n", InputChannels ));
DBUG(("PaASIO_QueryDeviceInfo: OutputChannels = %d\n", OutputChannels ));
/* Make room in case device supports all rates. */
sampleRates = (double*)PaHost_AllocateFastMemory(MAX_NUMSAMPLINGRATES * sizeof(double));
/* check memory */
if (!sampleRates) {
ASIOExit();
return paInsufficientMemory;
}
dev->sampleRates = sampleRates;
dev->numSampleRates = 0;
/* Loop through the possible sampling rates and check each to see if the device supports it. */
for (int index = 0; index < MAX_NUMSAMPLINGRATES; index++) {
if (ASIOCanSampleRate(possibleSampleRates[index]) != ASE_NoClock) {
DBUG(("PaASIO_QueryDeviceInfo: possible sample rate = %d\n", (long)possibleSampleRates[index]));
dev->numSampleRates += 1;
*sampleRates = possibleSampleRates[index];
sampleRates++;
}
}
/* We assume that all channels have the same SampleType, so check the first */
channelInfos.channel = 0;
channelInfos.isInput = 1;
if ((asioError = ASIOGetChannelInfo(&channelInfos)) == ASE_NotPresent) {
DBUG(("PaASIO_QueryDeviceInfo: ASIOGetChannelInfo returned %d \n",asioError));
}
dev->nativeSampleFormats = Pa_ASIO_Convert_SampleFormat(channelInfos.type);
/* unload the driver */
if ((asioError = ASIOExit()) != ASE_OK) {
DBUG(("PaASIO_QueryDeviceInfo: ASIOExit returned %d \n",asioError));
}
sNumDevices++;
}
}
}
}
/* free only unused names */
for (i = 0 ; i < PA_MAX_DEVICE_INFO ; i++) if (names[i]) PaHost_FreeFastMemory(names[i],32);
return paNoError;
}
//----------------------------------------------------------------------------------
// TAKEN FROM THE ASIO SDK:
void sampleRateChanged(ASIOSampleRate sRate)
{
// do whatever you need to do if the sample rate changed
// usually this only happens during external sync.
// Audio processing is not stopped by the driver, actual sample rate
// might not have even changed, maybe only the sample rate status of an
// AES/EBU or S/PDIF digital input at the audio device.
// You might have to update time/sample related conversion routines, etc.
}
//----------------------------------------------------------------------------------
// TAKEN FROM THE ASIO SDK:
long asioMessages(long selector, long value, void* message, double* opt)
{
// currently the parameters "value", "message" and "opt" are not used.
long ret = 0;
switch(selector)
{
case kAsioSelectorSupported:
if(value == kAsioResetRequest
|| value == kAsioEngineVersion
|| value == kAsioResyncRequest
|| value == kAsioLatenciesChanged
// the following three were added for ASIO 2.0, you don't necessarily have to support them
|| value == kAsioSupportsTimeInfo
|| value == kAsioSupportsTimeCode
|| value == kAsioSupportsInputMonitor)
ret = 1L;
break;
case kAsioBufferSizeChange:
//printf("kAsioBufferSizeChange \n");
break;
case kAsioResetRequest:
// defer the task and perform the reset of the driver during the next "safe" situation
// You cannot reset the driver right now, as this code is called from the driver.
// Reset the driver is done by completely destruct is. I.e. ASIOStop(), ASIODisposeBuffers(), Destruction
// Afterwards you initialize the driver again.
asioDriverInfo.stopped; // In this sample the processing will just stop
ret = 1L;
break;
case kAsioResyncRequest:
// This informs the application, that the driver encountered some non fatal data loss.
// It is used for synchronization purposes of different media.
// Added mainly to work around the Win16Mutex problems in Windows 95/98 with the
// Windows Multimedia system, which could loose data because the Mutex was hold too long
// by another thread.
// However a driver can issue it in other situations, too.
ret = 1L;
break;
case kAsioLatenciesChanged:
// This will inform the host application that the drivers were latencies changed.
// Beware, it this does not mean that the buffer sizes have changed!
// You might need to update internal delay data.
ret = 1L;
//printf("kAsioLatenciesChanged \n");
break;
case kAsioEngineVersion:
// return the supported ASIO version of the host application
// If a host applications does not implement this selector, ASIO 1.0 is assumed
// by the driver
ret = 2L;
break;
case kAsioSupportsTimeInfo:
// informs the driver wether the asioCallbacks.bufferSwitchTimeInfo() callback
// is supported.
// For compatibility with ASIO 1.0 drivers the host application should always support
// the "old" bufferSwitch method, too.
ret = 1;
break;
case kAsioSupportsTimeCode:
// informs the driver wether application is interested in time code info.
// If an application does not need to know about time code, the driver has less work
// to do.
ret = 0;
break;
}
return ret;
}
//----------------------------------------------------------------------------------
// conversion from 64 bit ASIOSample/ASIOTimeStamp to double float
#if NATIVE_INT64
#define ASIO64toDouble(a) (a)
#else
const double twoRaisedTo32 = 4294967296.;
#define ASIO64toDouble(a) ((a).lo + (a).hi * twoRaisedTo32)
#endif
static ASIOTime *bufferSwitchTimeInfo(ASIOTime *timeInfo, long index, ASIOBool processNow)
{
// the actual processing callback.
// Beware that this is normally in a seperate thread, hence be sure that you take care
// about thread synchronization. This is omitted here for simplicity.
// static processedSamples = 0;
int result = 0;
// store the timeInfo for later use
asioDriverInfo.tInfo = *timeInfo;
// get the time stamp of the buffer, not necessary if no
// synchronization to other media is required
if (timeInfo->timeInfo.flags & kSystemTimeValid)
asioDriverInfo.nanoSeconds = ASIO64toDouble(timeInfo->timeInfo.systemTime);
else
asioDriverInfo.nanoSeconds = 0;
if (timeInfo->timeInfo.flags & kSamplePositionValid)
asioDriverInfo.samples = ASIO64toDouble(timeInfo->timeInfo.samplePosition);
else
asioDriverInfo.samples = 0;
if (timeInfo->timeCode.flags & kTcValid)
asioDriverInfo.tcSamples = ASIO64toDouble(timeInfo->timeCode.timeCodeSamples);
else
asioDriverInfo.tcSamples = 0;
// get the system reference time
asioDriverInfo.sysRefTime = get_sys_reference_time();
#if 0
// a few debug messages for the Windows device driver developer
// tells you the time when driver got its interrupt and the delay until the app receives
// the event notification.
static double last_samples = 0;
char tmp[128];
sprintf (tmp, "diff: %d / %d ms / %d ms / %d samples \n", asioDriverInfo.sysRefTime - (long)(asioDriverInfo.nanoSeconds / 1000000.0), asioDriverInfo.sysRefTime, (long)(asioDriverInfo.nanoSeconds / 1000000.0), (long)(asioDriverInfo.samples - last_samples));
OutputDebugString (tmp);
last_samples = asioDriverInfo.samples;
#endif
// To avoid the callback accessing a desallocated stream
if( asioDriverInfo.past == NULL) return 0L;
// Keep sample position
asioDriverInfo.pahsc_NumFramesDone = timeInfo->timeInfo.samplePosition.lo;
/* Has a user callback returned '1' to indicate finished at the last ASIO callback? */
if( asioDriverInfo.past->past_StopSoon ) {
Pa_ASIO_Clear_Output(asioDriverInfo.bufferInfos,
asioDriverInfo.pahsc_channelInfos[0].type,
asioDriverInfo.pahsc_NumInputChannels ,
asioDriverInfo.pahsc_NumOutputChannels,
index,
0,
asioDriverInfo.past_FramesPerHostBuffer);
asioDriverInfo.past->past_IsActive = 0;
// Finally if the driver supports the ASIOOutputReady() optimization, do it here, all data are in place
if (asioDriverInfo.pahsc_postOutput) ASIOOutputReady();
}else {
/* CPU usage */
Pa_StartUsageCalculation(asioDriverInfo.past);
Pa_ASIO_Callback_Input(index);
// Finally if the driver supports the ASIOOutputReady() optimization, do it here, all data are in place
if (asioDriverInfo.pahsc_postOutput) ASIOOutputReady();
Pa_ASIO_Callback_End();
/* CPU usage */
Pa_EndUsageCalculation(asioDriverInfo.past);
}
return 0L;
}
//----------------------------------------------------------------------------------
void bufferSwitch(long index, ASIOBool processNow)
{
// the actual processing callback.
// Beware that this is normally in a seperate thread, hence be sure that you take care
// about thread synchronization. This is omitted here for simplicity.
// as this is a "back door" into the bufferSwitchTimeInfo a timeInfo needs to be created
// though it will only set the timeInfo.samplePosition and timeInfo.systemTime fields and the according flags
ASIOTime timeInfo;
memset (&timeInfo, 0, sizeof (timeInfo));
// get the time stamp of the buffer, not necessary if no
// synchronization to other media is required
if(ASIOGetSamplePosition(&timeInfo.timeInfo.samplePosition, &timeInfo.timeInfo.systemTime) == ASE_OK)
timeInfo.timeInfo.flags = kSystemTimeValid | kSamplePositionValid;
// Call the real callback
bufferSwitchTimeInfo (&timeInfo, index, processNow);
}
//----------------------------------------------------------------------------------
unsigned long get_sys_reference_time()
{
// get the system reference time
#if WINDOWS
return timeGetTime();
#elif MAC
static const double twoRaisedTo32 = 4294967296.;
UnsignedWide ys;
Microseconds(&ys);
double r = ((double)ys.hi * twoRaisedTo32 + (double)ys.lo);
return (unsigned long)(r / 1000.);
#endif
}
/*************************************************************
** Calculate 2 LSB dither signal with a triangular distribution.
** Ranged properly for adding to a 32 bit integer prior to >>15.
*/
#define DITHER_BITS (15)
#define DITHER_SCALE (1.0f / ((1<<DITHER_BITS)-1))
inline static long Pa_TriangularDither( void )
{
static unsigned long previous = 0;
static unsigned long randSeed1 = 22222;
static unsigned long randSeed2 = 5555555;
long current, highPass;
/* Generate two random numbers. */
randSeed1 = (randSeed1 * 196314165) + 907633515;
randSeed2 = (randSeed2 * 196314165) + 907633515;
/* Generate triangular distribution about 0. */
current = (((long)randSeed1)>>(32-DITHER_BITS)) + (((long)randSeed2)>>(32-DITHER_BITS));
/* High pass filter to reduce audibility. */
highPass = current - previous;
previous = current;
return highPass;
}
// TO BE COMPLETED WITH ALL SUPPORTED PA SAMPLE TYPES
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Input_Int16_Float32 (ASIOBufferInfo* nativeBuffer, float *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset,int userFrameOffset, bool swap)
{
long temp;
int i,j;
for( j=0; j<NumInputChannels; j++ ) {
short *asioBufPtr = &((short*)nativeBuffer[j].buffers[index])[hostFrameOffset];
float *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapShort(temp);
*userBufPtr = (1.0f / MAX_INT16_FP) * temp;
userBufPtr += NumInputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Input_Int32_Float32 (ASIOBufferInfo* nativeBuffer, float *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset,int userFrameOffset,bool swap)
{
long temp;
int i,j;
for( j=0; j<NumInputChannels; j++ ) {
long *asioBufPtr = &((long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
float *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
*userBufPtr = (1.0f / MAX_INT32_FP) * temp;
userBufPtr += NumInputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
// MUST BE TESTED
static void Input_Float32_Float32 (ASIOBufferInfo* nativeBuffer, float *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset,int userFrameOffset,bool swap)
{
unsigned long temp;
int i,j;
for( j=0; j<NumInputChannels; j++ ) {
unsigned long *asioBufPtr = &((unsigned long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
float *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
*userBufPtr = (float)temp;
userBufPtr += NumInputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Input_Int16_Int32 (ASIOBufferInfo* nativeBuffer, long *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset,int userFrameOffset,bool swap)
{
long temp;
int i,j;
for( j=0; j<NumInputChannels; j++ ) {
short *asioBufPtr = &((short*)nativeBuffer[j].buffers[index])[hostFrameOffset];
long *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapShort(temp);
*userBufPtr = temp<<16;
userBufPtr += NumInputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Input_Int32_Int32 (ASIOBufferInfo* nativeBuffer, long *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset,int userFrameOffset,bool swap)
{
long temp;
int i,j;
for( j=0; j<NumInputChannels; j++ ) {
long *asioBufPtr = &((long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
long *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
*userBufPtr = temp;
userBufPtr += NumInputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
// MUST BE TESTED
static void Input_Float32_Int32 (ASIOBufferInfo* nativeBuffer, long *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset,int userFrameOffset,bool swap)
{
unsigned long temp;
int i,j;
for( j=0; j<NumInputChannels; j++ ) {
unsigned long *asioBufPtr = &((unsigned long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
long *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
*userBufPtr = (long)((float)temp * MAX_INT32_FP); // Is temp a value between -1.0 and 1.0 ??
userBufPtr += NumInputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Input_Int16_Int16 (ASIOBufferInfo* nativeBuffer, short *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset,int userFrameOffset,bool swap)
{
long temp;
int i,j;
for( j=0; j<NumInputChannels; j++ ) {
short *asioBufPtr = &((short*)nativeBuffer[j].buffers[index])[hostFrameOffset];
short *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapShort(temp);
*userBufPtr = (short)temp;
userBufPtr += NumInputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Input_Int32_Int16 (ASIOBufferInfo* nativeBuffer, short *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset, int userFrameOffset,uint32 flags,bool swap)
{
long temp;
int i,j;
if( flags & paDitherOff )
{
for( j=0; j<NumInputChannels; j++ ) {
long *asioBufPtr = &((long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
short *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
*userBufPtr = (short)(temp>>16);
userBufPtr += NumInputChannels;
}
}
}
else
{
for( j=0; j<NumInputChannels; j++ ) {
long *asioBufPtr = &((long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
short *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
temp = (temp >> 1) + Pa_TriangularDither();
temp = temp >> 15;
temp = (short) ClipShort(temp);
*userBufPtr = (short)temp;
userBufPtr += NumInputChannels;
}
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
// MUST BE TESTED
static void Input_Float32_Int16 (ASIOBufferInfo* nativeBuffer, short *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset,int userFrameOffset,uint32 flags,bool swap)
{
unsigned long temp;
int i,j;
if( flags & paDitherOff )
{
for( j=0; j<NumInputChannels; j++ ) {
unsigned long *asioBufPtr = &((unsigned long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
short *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
*userBufPtr = (short)((float)temp * MAX_INT16_FP); // Is temp a value between -1.0 and 1.0 ??
userBufPtr += NumInputChannels;
}
}
}
else
{
for( j=0; j<NumInputChannels; j++ ) {
unsigned long *asioBufPtr = &((unsigned long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
short *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
float dither = Pa_TriangularDither()*DITHER_SCALE;
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
temp = (short)(((float)temp * MAX_INT16_FP) + dither);
temp = ClipShort(temp);
*userBufPtr = (short)temp;
userBufPtr += NumInputChannels;
}
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Input_Int16_Int8 (ASIOBufferInfo* nativeBuffer, char *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset,int userFrameOffset, uint32 flags,bool swap)
{
long temp;
int i,j;
if( flags & paDitherOff )
{
for( j=0; j<NumInputChannels; j++ ) {
short *asioBufPtr = &((short*)nativeBuffer[j].buffers[index])[hostFrameOffset];
char *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapShort(temp);
*userBufPtr = (char)(temp>>8);
userBufPtr += NumInputChannels;
}
}
}
else
{
for( j=0; j<NumInputChannels; j++ ) {
short *asioBufPtr = &((short*)nativeBuffer[j].buffers[index])[hostFrameOffset];
char *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapShort(temp);
temp += Pa_TriangularDither() >> 8;
temp = ClipShort(temp);
*userBufPtr = (char)(temp>>8);
userBufPtr += NumInputChannels;
}
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Input_Int32_Int8 (ASIOBufferInfo* nativeBuffer, char *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset, int userFrameOffset, uint32 flags,bool swap)
{
long temp;
int i,j;
if( flags & paDitherOff )
{
for( j=0; j<NumInputChannels; j++ ) {
long *asioBufPtr = &((long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
char *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
*userBufPtr = (char)(temp>>24);
userBufPtr += NumInputChannels;
}
}
}
else
{
for( j=0; j<NumInputChannels; j++ ) {
long *asioBufPtr = &((long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
char *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
temp = temp>>16; // Shift to get a 16 bit value, then use the 16 bits to 8 bits code (MUST BE CHECHED)
temp += Pa_TriangularDither() >> 8;
temp = ClipShort(temp);
*userBufPtr = (char)(temp >> 8);
userBufPtr += NumInputChannels;
}
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
// MUST BE TESTED
static void Input_Float32_Int8 (ASIOBufferInfo* nativeBuffer, char *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset,int userFrameOffset, uint32 flags,bool swap)
{
unsigned long temp;
int i,j;
if( flags & paDitherOff )
{
for( j=0; j<NumInputChannels; j++ ) {
unsigned long *asioBufPtr = &((unsigned long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
char *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
*userBufPtr = (char)((float)temp*MAX_INT8_FP); // Is temp a value between -1.0 and 1.0 ??
userBufPtr += NumInputChannels;
}
}
}
else
{
for( j=0; j<NumInputChannels; j++ ) {
unsigned long *asioBufPtr = &((unsigned long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
char *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
float dither = Pa_TriangularDither()*DITHER_SCALE;
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
temp = (char)(((float)temp * MAX_INT8_FP) + dither);
temp = ClipChar(temp);
*userBufPtr = (char)temp;
userBufPtr += NumInputChannels;
}
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Input_Int16_IntU8 (ASIOBufferInfo* nativeBuffer, unsigned char *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset,int userFrameOffset, uint32 flags,bool swap)
{
long temp;
int i,j;
if( flags & paDitherOff )
{
for( j=0; j<NumInputChannels; j++ ) {
short *asioBufPtr = &((short*)nativeBuffer[j].buffers[index])[hostFrameOffset];
unsigned char *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapShort(temp);
*userBufPtr = (unsigned char)((temp>>8) + 0x80);
userBufPtr += NumInputChannels;
}
}
}
else
{
for( j=0; j<NumInputChannels; j++ ) {
short *asioBufPtr = &((short*)nativeBuffer[j].buffers[index])[hostFrameOffset];
unsigned char *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapShort(temp);
temp += Pa_TriangularDither() >> 8;
temp = ClipShort(temp);
*userBufPtr = (unsigned char)((temp>>8) + 0x80);
userBufPtr += NumInputChannels;
}
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Input_Int32_IntU8 (ASIOBufferInfo* nativeBuffer, unsigned char *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset, int userFrameOffset,uint32 flags,bool swap)
{
long temp;
int i,j;
if( flags & paDitherOff )
{
for( j=0; j<NumInputChannels; j++ ) {
long *asioBufPtr = &((long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
unsigned char *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
*userBufPtr = (unsigned char)((temp>>24) + 0x80);
userBufPtr += NumInputChannels;
}
}
}
else
{
for( j=0; j<NumInputChannels; j++ ) {
long *asioBufPtr = &((long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
unsigned char *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
temp = temp>>16; // Shift to get a 16 bit value, then use the 16 bits to 8 bits code (MUST BE CHECHED)
temp += Pa_TriangularDither() >> 8;
temp = ClipShort(temp);
*userBufPtr = (unsigned char)((temp>>8) + 0x80);
userBufPtr += NumInputChannels;
}
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
// MUST BE TESTED
static void Input_Float32_IntU8 (ASIOBufferInfo* nativeBuffer, unsigned char *inBufPtr, int framePerBuffer, int NumInputChannels, int index, int hostFrameOffset,int userFrameOffset, uint32 flags,bool swap)
{
unsigned long temp;
int i,j;
if( flags & paDitherOff )
{
for( j=0; j<NumInputChannels; j++ ) {
unsigned long *asioBufPtr = &((unsigned long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
unsigned char *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
*userBufPtr = (unsigned char)(((float)temp*MAX_INT8_FP) + 0x80);
userBufPtr += NumInputChannels;
}
}
}
else
{
for( j=0; j<NumInputChannels; j++ ) {
unsigned long *asioBufPtr = &((unsigned long*)nativeBuffer[j].buffers[index])[hostFrameOffset];
unsigned char *userBufPtr = &inBufPtr[j+(userFrameOffset*NumInputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
float dither = Pa_TriangularDither()*DITHER_SCALE;
temp = asioBufPtr[i];
if (swap) temp = SwapLong(temp);
temp = (char)(((float)temp * MAX_INT8_FP) + dither);
temp = ClipChar(temp);
*userBufPtr = (unsigned char)(temp + 0x80);
userBufPtr += NumInputChannels;
}
}
}
}
// OUPUT
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Output_Float32_Int16 (ASIOBufferInfo* nativeBuffer, float *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset, int userFrameOffset,uint32 flags, bool swap)
{
long temp;
int i,j;
if( flags & paDitherOff )
{
if( flags & paClipOff ) /* NOTHING */
{
for( j=0; j<NumOuputChannels; j++ ) {
short *asioBufPtr = &((short*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
float *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = (short) (*userBufPtr * MAX_INT16_FP);
if (swap) temp = SwapShort(temp);
asioBufPtr[i] = (short)temp;
userBufPtr += NumOuputChannels;
}
}
}
else /* CLIP */
{
for( j=0; j<NumOuputChannels; j++ ) {
short *asioBufPtr = &((short*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
float *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
temp = (long) (*userBufPtr * MAX_INT16_FP);
temp = ClipShort(temp);
if (swap) temp = SwapShort(temp);
asioBufPtr[i] = (short)temp;
userBufPtr += NumOuputChannels;
}
}
}
}
else
{
/* If you dither then you have to clip because dithering could push the signal out of range! */
for( j=0; j<NumOuputChannels; j++ ) {
short *asioBufPtr = &((short*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
float *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for (i= 0; i < framePerBuffer; i++)
{
float dither = Pa_TriangularDither()*DITHER_SCALE;
temp = (long) ((*userBufPtr * MAX_INT16_FP) + dither);
temp = ClipShort(temp);
if (swap) temp = SwapShort(temp);
asioBufPtr[i] = (short)temp;
userBufPtr += NumOuputChannels;
}
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Output_Float32_Int32 (ASIOBufferInfo* nativeBuffer, float *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset, int userFrameOffset,uint32 flags,bool swap)
{
long temp;
int i,j;
if( flags & paClipOff )
{
for (j= 0; j < NumOuputChannels; j++)
{
long *asioBufPtr = &((long*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
float *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = (long) (*userBufPtr * MAX_INT32_FP);
if (swap) temp = SwapLong(temp);
asioBufPtr[i] = temp;
userBufPtr += NumOuputChannels;
}
}
}
else // CLIP *
{
for (j= 0; j < NumOuputChannels; j++)
{
long *asioBufPtr = &((long*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
float *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
float temp1 = *userBufPtr;
temp1 = ClipFloat(temp1);
temp = (long) (temp1*MAX_INT32_FP);
if (swap) temp = SwapLong(temp);
asioBufPtr[i] = temp;
userBufPtr += NumOuputChannels;
}
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
// MUST BE TESTED
static void Output_Float32_Float32 (ASIOBufferInfo* nativeBuffer, float *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset, int userFrameOffset,uint32 flags,bool swap)
{
long temp;
int i,j;
if( flags & paClipOff )
{
for (j= 0; j < NumOuputChannels; j++)
{
float *asioBufPtr = &((float*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
float *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = (long) *userBufPtr;
if (swap) temp = SwapLong(temp);
asioBufPtr[i] = (float)temp;
userBufPtr += NumOuputChannels;
}
}
}
else /* CLIP */
{
for (j= 0; j < NumOuputChannels; j++)
{
float *asioBufPtr = &((float*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
float *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
float temp1 = *userBufPtr;
temp1 = ClipFloat(temp1); // Is is necessary??
temp = (long) temp1;
if (swap) temp = SwapLong(temp);
asioBufPtr[i] = (float)temp;
userBufPtr += NumOuputChannels;
}
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Output_Int32_Int16(ASIOBufferInfo* nativeBuffer, long *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset,int userFrameOffset,uint32 flags,bool swap)
{
long temp;
int i,j;
if( flags & paDitherOff )
{
for (j= 0; j < NumOuputChannels; j++)
{
short *asioBufPtr = &((short*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
long *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = (short) ((*userBufPtr) >> 16);
if (swap) temp = SwapShort(temp);
asioBufPtr[i] = (short)temp;
userBufPtr += NumOuputChannels;
}
}
}
else
{
for (j= 0; j < NumOuputChannels; j++)
{
short *asioBufPtr = &((short*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
long *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = (*userBufPtr >> 1) + Pa_TriangularDither();
temp = temp >> 15;
temp = (short) ClipShort(temp);
if (swap) temp = SwapShort(temp);
asioBufPtr[i] = (short)temp;
userBufPtr += NumOuputChannels;
}
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Output_Int32_Int32(ASIOBufferInfo* nativeBuffer, long *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset,int userFrameOffset,uint32 flags,bool swap)
{
long temp;
int i,j;
for (j= 0; j < NumOuputChannels; j++)
{
long *asioBufPtr = &((long*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
long *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = *userBufPtr;
if (swap) temp = SwapLong(temp);
asioBufPtr[i] = temp;
userBufPtr += NumOuputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
// MUST BE CHECKED
static void Output_Int32_Float32(ASIOBufferInfo* nativeBuffer, long *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset,int userFrameOffset,uint32 flags,bool swap)
{
long temp;
int i,j;
for (j= 0; j < NumOuputChannels; j++)
{
float *asioBufPtr = &((float*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
long *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = *userBufPtr;
if (swap) temp = SwapLong(temp);
asioBufPtr[i] = ((float)temp) * (1.0f / MAX_INT32_FP);
userBufPtr += NumOuputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Output_Int16_Int16(ASIOBufferInfo* nativeBuffer, short *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset, int userFrameOffset,bool swap)
{
long temp;
int i,j;
for (j= 0; j < NumOuputChannels; j++)
{
short *asioBufPtr = &((short*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
short *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = *userBufPtr;
if (swap) temp = SwapShort(temp);
asioBufPtr[i] = (short)temp;
userBufPtr += NumOuputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Output_Int16_Int32(ASIOBufferInfo* nativeBuffer, short *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset,int userFrameOffset, bool swap)
{
long temp;
int i,j;
for (j= 0; j < NumOuputChannels; j++)
{
long *asioBufPtr = &((long*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
short *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = (*userBufPtr)<<16;
if (swap) temp = SwapLong(temp);
asioBufPtr[i] = temp;
userBufPtr += NumOuputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
// MUST BE CHECKED
static void Output_Int16_Float32(ASIOBufferInfo* nativeBuffer, short *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset,int userFrameOffset, bool swap)
{
long temp;
int i,j;
for (j= 0; j < NumOuputChannels; j++)
{
float *asioBufPtr = &((float*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
short *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = *userBufPtr;
asioBufPtr[i] = ((float)temp) * (1.0f / MAX_INT16_FP);
userBufPtr += NumOuputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Output_Int8_Int16(ASIOBufferInfo* nativeBuffer, char *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset,int userFrameOffset, bool swap)
{
long temp;
int i,j;
for (j= 0; j < NumOuputChannels; j++)
{
short *asioBufPtr = &((short*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
char *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = (short)(*userBufPtr)<<8;
if (swap) temp = SwapShort(temp);
asioBufPtr[i] = (short)temp;
userBufPtr += NumOuputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Output_Int8_Int32(ASIOBufferInfo* nativeBuffer, char *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset,int userFrameOffset, bool swap)
{
long temp;
int i,j;
for (j= 0; j < NumOuputChannels; j++)
{
long *asioBufPtr = &((long*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
char *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = (short)(*userBufPtr)<<24;
if (swap) temp = SwapLong(temp);
asioBufPtr[i] = temp;
userBufPtr += NumOuputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
// MUST BE CHECKED
static void Output_Int8_Float32(ASIOBufferInfo* nativeBuffer, char *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset,int userFrameOffset, bool swap)
{
long temp;
int i,j;
for (j= 0; j < NumOuputChannels; j++)
{
long *asioBufPtr = &((long*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
char *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = *userBufPtr;
asioBufPtr[i] = (long)(((float)temp) * (1.0f / MAX_INT8_FP));
userBufPtr += NumOuputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Output_IntU8_Int16(ASIOBufferInfo* nativeBuffer, unsigned char *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset,int userFrameOffset, bool swap)
{
long temp;
int i,j;
for (j= 0; j < NumOuputChannels; j++)
{
short *asioBufPtr = &((short*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
unsigned char *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = ((short)((*userBufPtr) - 0x80)) << 8;
if (swap) temp = SwapShort(temp);
asioBufPtr[i] = (short)temp;
userBufPtr += NumOuputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Output_IntU8_Int32(ASIOBufferInfo* nativeBuffer, unsigned char *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset,int userFrameOffset, bool swap)
{
long temp;
int i,j;
for (j= 0; j < NumOuputChannels; j++)
{
long *asioBufPtr = &((long*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
unsigned char *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = ((short)((*userBufPtr) - 0x80)) << 24;
if (swap) temp = SwapLong(temp);
asioBufPtr[i] = temp;
userBufPtr += NumOuputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
// MUST BE CHECKED
static void Output_IntU8_Float32(ASIOBufferInfo* nativeBuffer, unsigned char *outBufPtr, int framePerBuffer, int NumInputChannels, int NumOuputChannels, int index, int hostFrameOffset,int userFrameOffset, bool swap)
{
long temp;
int i,j;
for (j= 0; j < NumOuputChannels; j++)
{
float *asioBufPtr = &((float*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
unsigned char *userBufPtr = &outBufPtr[j+(userFrameOffset*NumOuputChannels)];
for( i=0; i<framePerBuffer; i++ )
{
temp = ((short)((*userBufPtr) - 0x80)) << 24;
asioBufPtr[i] = ((float)temp) * (1.0f / MAX_INT32_FP);
userBufPtr += NumOuputChannels;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Pa_ASIO_Clear_Output_16 (ASIOBufferInfo* nativeBuffer, long frames, long NumInputChannels, long NumOuputChannels, long index, long hostFrameOffset)
{
int i,j;
for( j=0; j<NumOuputChannels; j++ ) {
short *asioBufPtr = &((short*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
for (i= 0; i < frames; i++) {asioBufPtr[i] = 0; }
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Pa_ASIO_Clear_Output_32 (ASIOBufferInfo* nativeBuffer, long frames, long NumInputChannels, long NumOuputChannels, long index, long hostFrameOffset)
{
int i,j;
for( j=0; j<NumOuputChannels; j++ ) {
long *asioBufPtr = &((long*)nativeBuffer[j+NumInputChannels].buffers[index])[hostFrameOffset];
for (i= 0; i < frames; i++) {asioBufPtr[i] = 0; }
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Pa_ASIO_Adaptor_Init()
{
if (asioDriverInfo.past->past_FramesPerUserBuffer <= asioDriverInfo.past_FramesPerHostBuffer) {
asioDriverInfo.pahsc_hostOutputBufferFrameOffset = asioDriverInfo.pahsc_OutputBufferOffset;
asioDriverInfo.pahsc_userInputBufferFrameOffset = 0; // empty
asioDriverInfo.pahsc_userOutputBufferFrameOffset = asioDriverInfo.past->past_FramesPerUserBuffer; // empty
DBUG(("Pa_ASIO_Adaptor_Init : shift output\n"));
DBUG(("Pa_ASIO_Adaptor_Init : userInputBufferFrameOffset %d\n",asioDriverInfo.pahsc_userInputBufferFrameOffset));
DBUG(("Pa_ASIO_Adaptor_Init : userOutputBufferFrameOffset %d\n",asioDriverInfo.pahsc_userOutputBufferFrameOffset));
DBUG(("Pa_ASIO_Adaptor_Init : hostOutputBufferFrameOffset %d\n",asioDriverInfo.pahsc_hostOutputBufferFrameOffset));
}else {
asioDriverInfo.pahsc_hostOutputBufferFrameOffset = 0; // empty
asioDriverInfo.pahsc_userInputBufferFrameOffset = asioDriverInfo.pahsc_InputBufferOffset;
asioDriverInfo.pahsc_userOutputBufferFrameOffset = asioDriverInfo.past->past_FramesPerUserBuffer; // empty
DBUG(("Pa_ASIO_Adaptor_Init : shift input\n"));
DBUG(("Pa_ASIO_Adaptor_Init : userInputBufferFrameOffset %d\n",asioDriverInfo.pahsc_userInputBufferFrameOffset));
DBUG(("Pa_ASIO_Adaptor_Init : userOutputBufferFrameOffset %d\n",asioDriverInfo.pahsc_userOutputBufferFrameOffset));
DBUG(("Pa_ASIO_Adaptor_Init : hostOutputBufferFrameOffset %d\n",asioDriverInfo.pahsc_hostOutputBufferFrameOffset));
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
// FIXME : optimization for Input only or output only modes (really necessary ??)
static void Pa_ASIO_Callback_Input(long index)
{
internalPortAudioStream *past = asioDriverInfo.past;
long framesInputHostBuffer = asioDriverInfo.past_FramesPerHostBuffer; // number of frames available into the host input buffer
long framesInputUserBuffer; // number of frames needed to complete the user input buffer
long framesOutputHostBuffer; // number of frames needed to complete the host output buffer
long framesOuputUserBuffer; // number of frames available into the user output buffer
long userResult;
long tmp;
/* Fill host ASIO output with remaining frames in user output */
framesOutputHostBuffer = asioDriverInfo.past_FramesPerHostBuffer - asioDriverInfo.pahsc_hostOutputBufferFrameOffset;
framesOuputUserBuffer = asioDriverInfo.past->past_FramesPerUserBuffer - asioDriverInfo.pahsc_userOutputBufferFrameOffset;
tmp = min(framesOutputHostBuffer, framesOuputUserBuffer);
framesOutputHostBuffer -= tmp;
Pa_ASIO_Callback_Output(index,tmp);
/* Available frames in hostInputBuffer */
while (framesInputHostBuffer > 0) {
/* Number of frames needed to complete an user input buffer */
framesInputUserBuffer = asioDriverInfo.past->past_FramesPerUserBuffer - asioDriverInfo.pahsc_userInputBufferFrameOffset;
if (framesInputHostBuffer >= framesInputUserBuffer) {
/* Convert ASIO input to user input */
Pa_ASIO_Convert_Inter_Input (asioDriverInfo.bufferInfos,
past->past_InputBuffer,
asioDriverInfo.pahsc_NumInputChannels ,
asioDriverInfo.pahsc_NumOutputChannels,
framesInputUserBuffer,
asioDriverInfo.past_FramesPerHostBuffer - framesInputHostBuffer,
asioDriverInfo.pahsc_userInputBufferFrameOffset,
asioDriverInfo.pahsc_channelInfos[0].type,
past->past_InputSampleFormat,
past->past_Flags,
index);
/* Call PortAudio callback */
userResult = asioDriverInfo.past->past_Callback(past->past_InputBuffer, past->past_OutputBuffer,
past->past_FramesPerUserBuffer,past->past_FrameCount,past->past_UserData );
/* User callback has asked us to stop in the middle of the host buffer */
if( userResult != 0) {
/* Put 0 in the end of the output buffer */
Pa_ASIO_Clear_Output(asioDriverInfo.bufferInfos,
asioDriverInfo.pahsc_channelInfos[0].type,
asioDriverInfo.pahsc_NumInputChannels ,
asioDriverInfo.pahsc_NumOutputChannels,
index,
asioDriverInfo.pahsc_hostOutputBufferFrameOffset,
asioDriverInfo.past_FramesPerHostBuffer - asioDriverInfo.pahsc_hostOutputBufferFrameOffset);
past->past_StopSoon = 1;
return;
}
/* Full user ouput buffer : write offset */
asioDriverInfo.pahsc_userOutputBufferFrameOffset = 0;
/* Empty user input buffer : read offset */
asioDriverInfo.pahsc_userInputBufferFrameOffset = 0;
/* Fill host ASIO output */
tmp = min (past->past_FramesPerUserBuffer,framesOutputHostBuffer);
Pa_ASIO_Callback_Output(index,tmp);
framesOutputHostBuffer -= tmp;
framesInputHostBuffer -= framesInputUserBuffer;
}else {
/* Convert ASIO input to user input */
Pa_ASIO_Convert_Inter_Input (asioDriverInfo.bufferInfos,
past->past_InputBuffer,
asioDriverInfo.pahsc_NumInputChannels ,
asioDriverInfo.pahsc_NumOutputChannels,
framesInputHostBuffer,
asioDriverInfo.past_FramesPerHostBuffer - framesInputHostBuffer,
asioDriverInfo.pahsc_userInputBufferFrameOffset,
asioDriverInfo.pahsc_channelInfos[0].type,
past->past_InputSampleFormat,
past->past_Flags,
index);
/* Update pahsc_userInputBufferFrameOffset */
asioDriverInfo.pahsc_userInputBufferFrameOffset += framesInputHostBuffer;
/* Update framesInputHostBuffer */
framesInputHostBuffer = 0;
}
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Pa_ASIO_Callback_Output(long index, long framePerBuffer)
{
internalPortAudioStream *past = asioDriverInfo.past;
if (framePerBuffer > 0) {
/* Convert user output to ASIO ouput */
Pa_ASIO_Convert_Inter_Output (asioDriverInfo.bufferInfos,
past->past_OutputBuffer,
asioDriverInfo.pahsc_NumInputChannels,
asioDriverInfo.pahsc_NumOutputChannels,
framePerBuffer,
asioDriverInfo.pahsc_hostOutputBufferFrameOffset,
asioDriverInfo.pahsc_userOutputBufferFrameOffset,
asioDriverInfo.pahsc_channelInfos[0].type,
past->past_InputSampleFormat,
past->past_Flags,
index);
/* Update hostOuputFrameOffset */
asioDriverInfo.pahsc_hostOutputBufferFrameOffset += framePerBuffer;
/* Update userOutputFrameOffset */
asioDriverInfo.pahsc_userOutputBufferFrameOffset += framePerBuffer;
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Pa_ASIO_Callback_End()
{
/* Empty ASIO ouput : write offset */
asioDriverInfo.pahsc_hostOutputBufferFrameOffset = 0;
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Pa_ASIO_Clear_User_Buffers()
{
if( asioDriverInfo.past->past_InputBuffer != NULL )
{
memset( asioDriverInfo.past->past_InputBuffer, 0, asioDriverInfo.past->past_InputBufferSize );
}
if( asioDriverInfo.past->past_OutputBuffer != NULL )
{
memset( asioDriverInfo.past->past_OutputBuffer, 0, asioDriverInfo.past->past_OutputBufferSize );
}
}
//-------------------------------------------------------------------------------------------------------------------------------------------------------
static void Pa_ASIO_Clear_Output(ASIOBufferInfo* nativeBuffer,
ASIOSampleType nativeFormat,
long NumInputChannels,
long NumOuputChannels,
long index,
long hostFrameOffset,
long frames)
{
switch (nativeFormat) {
case ASIOSTInt16MSB:
case ASIOSTInt16LSB:
case ASIOSTInt32MSB16:
case ASIOSTInt32LSB16:
Pa_ASIO_Clear_Output_16(nativeBuffer, frames, NumInputChannels, NumOuputChannels, index, hostFrameOffset);
break;
case ASIOSTFloat64MSB:
case ASIOSTFloat64LSB:
break;
case ASIOSTFloat32MSB:
case ASIOSTFloat32LSB:
case ASIOSTInt32MSB:
case ASIOSTInt32LSB:
case ASIOSTInt32MSB18:
case ASIOSTInt32MSB20:
case ASIOSTInt32MSB24:
case ASIOSTInt32LSB18:
case ASIOSTInt32LSB20:
case ASIOSTInt32LSB24:
Pa_ASIO_Clear_Output_32(nativeBuffer, frames, NumInputChannels, NumOuputChannels, index, hostFrameOffset);
break;
case ASIOSTInt24MSB:
case ASIOSTInt24LSB:
break;
default:
break;
}
}
//---------------------------------------------------------------------------------------
static void Pa_ASIO_Convert_Inter_Input(
ASIOBufferInfo* nativeBuffer,
void* inputBuffer,
long NumInputChannels,
long NumOuputChannels,
long framePerBuffer,
long hostFrameOffset,
long userFrameOffset,
ASIOSampleType nativeFormat,
PaSampleFormat paFormat,
PaStreamFlags flags,
long index)
{
if((NumInputChannels > 0) && (nativeBuffer != NULL))
{
/* Convert from native format to PA format. */
switch(paFormat)
{
case paFloat32:
{
float *inBufPtr = (float *) inputBuffer;
switch (nativeFormat) {
case ASIOSTInt16LSB:
Input_Int16_Float32(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset, userFrameOffset, swap);
break;
case ASIOSTInt16MSB:
Input_Int16_Float32(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset, userFrameOffset,!swap);
break;
case ASIOSTInt32LSB:
Input_Int32_Float32(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset, userFrameOffset,swap);
break;
case ASIOSTInt32MSB:
Input_Int32_Float32(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset, userFrameOffset,!swap);
break;
case ASIOSTFloat32LSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
Input_Float32_Float32(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset, userFrameOffset,swap);
break;
case ASIOSTFloat32MSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
Input_Float32_Float32(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset, userFrameOffset,!swap);
break;
case ASIOSTInt24LSB: // used for 20 bits as well
case ASIOSTInt24MSB: // used for 20 bits as well
case ASIOSTFloat64LSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
// these are used for 32 bit data buffer, with different alignment of the data inside
// 32 bit PCI bus systems can more easily used with these
case ASIOSTInt32LSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32LSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32LSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32LSB24: // 32 bit data with 24 bit alignment
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
DBUG(("Not yet implemented : please report the problem\n"));
break;
}
break;
}
case paInt32:
{
long *inBufPtr = (long *)inputBuffer;
switch (nativeFormat) {
case ASIOSTInt16LSB:
Input_Int16_Int32(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, swap);
break;
case ASIOSTInt16MSB:
Input_Int16_Int32(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, !swap);
break;
case ASIOSTInt32LSB:
Input_Int32_Int32(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, swap);
break;
case ASIOSTInt32MSB:
Input_Int32_Int32(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, !swap);
break;
case ASIOSTFloat32LSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
Input_Float32_Int32(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, swap);
break;
case ASIOSTFloat32MSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
Input_Float32_Int32(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, !swap);
break;
case ASIOSTInt24LSB: // used for 20 bits as well
case ASIOSTInt24MSB: // used for 20 bits as well
case ASIOSTFloat64LSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
// these are used for 32 bit data buffer, with different alignment of the data inside
// 32 bit PCI bus systems can more easily used with these
case ASIOSTInt32LSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32LSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32LSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32LSB24: // 32 bit data with 24 bit alignment
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
DBUG(("Not yet implemented : please report the problem\n"));
break;
}
break;
}
case paInt16:
{
short *inBufPtr = (short *) inputBuffer;
switch (nativeFormat) {
case ASIOSTInt16LSB:
Input_Int16_Int16(nativeBuffer, inBufPtr, framePerBuffer , NumInputChannels, index , hostFrameOffset,userFrameOffset, swap);
break;
case ASIOSTInt16MSB:
Input_Int16_Int16(nativeBuffer, inBufPtr, framePerBuffer , NumInputChannels, index , hostFrameOffset,userFrameOffset, !swap);
break;
case ASIOSTInt32LSB:
Input_Int32_Int16(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, flags,swap);
break;
case ASIOSTInt32MSB:
Input_Int32_Int16(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, flags,!swap);
break;
case ASIOSTFloat32LSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
Input_Float32_Int16(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, flags,swap);
break;
case ASIOSTFloat32MSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
Input_Float32_Int16(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, flags,!swap);
break;
case ASIOSTInt24LSB: // used for 20 bits as well
case ASIOSTInt24MSB: // used for 20 bits as well
case ASIOSTFloat64LSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
// these are used for 32 bit data buffer, with different alignment of the data inside
// 32 bit PCI bus systems can more easily used with these
case ASIOSTInt32LSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32LSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32LSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32LSB24: // 32 bit data with 24 bit alignment
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
DBUG(("Not yet implemented : please report the problem\n"));
break;
}
break;
}
case paInt8:
{
/* Convert 16 bit data to 8 bit chars */
char *inBufPtr = (char *) inputBuffer;
switch (nativeFormat) {
case ASIOSTInt16LSB:
Input_Int16_Int8(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset,flags,swap);
break;
case ASIOSTInt16MSB:
Input_Int16_Int8(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, flags,!swap);
break;
case ASIOSTInt32LSB:
Input_Int32_Int8(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, flags,swap);
break;
case ASIOSTInt32MSB:
Input_Int32_Int8(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, flags,!swap);
break;
case ASIOSTFloat32LSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
Input_Float32_Int8(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, flags,swap);
break;
case ASIOSTFloat32MSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
Input_Float32_Int8(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, flags,!swap);
break;
case ASIOSTInt24LSB: // used for 20 bits as well
case ASIOSTInt24MSB: // used for 20 bits as well
case ASIOSTFloat64LSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
// these are used for 32 bit data buffer, with different alignment of the data inside
// 32 bit PCI bus systems can more easily used with these
case ASIOSTInt32LSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32LSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32LSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32LSB24: // 32 bit data with 24 bit alignment
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
DBUG(("Not yet implemented : please report the problem\n"));
break;
}
break;
}
case paUInt8:
{
/* Convert 16 bit data to 8 bit unsigned chars */
unsigned char *inBufPtr = (unsigned char *)inputBuffer;
switch (nativeFormat) {
case ASIOSTInt16LSB:
Input_Int16_IntU8(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, flags,swap);
break;
case ASIOSTInt16MSB:
Input_Int16_IntU8(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, flags,!swap);
break;
case ASIOSTInt32LSB:
Input_Int32_IntU8(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset,flags,swap);
break;
case ASIOSTInt32MSB:
Input_Int32_IntU8(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset, flags,!swap);
break;
case ASIOSTFloat32LSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
Input_Float32_IntU8(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset,flags,swap);
break;
case ASIOSTFloat32MSB: // IEEE 754 32 bit float, as found on Intel x86 architecture
Input_Float32_IntU8(nativeBuffer, inBufPtr, framePerBuffer, NumInputChannels, index, hostFrameOffset,userFrameOffset,flags,!swap);
break;
case ASIOSTInt24LSB: // used for 20 bits as well
case ASIOSTInt24MSB: // used for 20 bits as well
case ASIOSTFloat64LSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
// these are used for 32 bit data buffer, with different alignment of the data inside
// 32 bit PCI bus systems can more easily used with these
case ASIOSTInt32LSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32LSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32LSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32LSB24: // 32 bit data with 24 bit alignment
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
DBUG(("Not yet implemented : please report the problem\n"));
break;
}
break;
}
default:
break;
}
}
}
//---------------------------------------------------------------------------------------
static void Pa_ASIO_Convert_Inter_Output(ASIOBufferInfo* nativeBuffer,
void* outputBuffer,
long NumInputChannels,
long NumOuputChannels,
long framePerBuffer,
long hostFrameOffset,
long userFrameOffset,
ASIOSampleType nativeFormat,
PaSampleFormat paFormat,
PaStreamFlags flags,
long index)
{
if((NumOuputChannels > 0) && (nativeBuffer != NULL))
{
/* Convert from PA format to native format */
switch(paFormat)
{
case paFloat32:
{
float *outBufPtr = (float *) outputBuffer;
switch (nativeFormat) {
case ASIOSTInt16LSB:
Output_Float32_Int16(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset, userFrameOffset, flags, swap);
break;
case ASIOSTInt16MSB:
Output_Float32_Int16(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset, userFrameOffset, flags,!swap);
break;
case ASIOSTInt32LSB:
Output_Float32_Int32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset, userFrameOffset, flags,swap);
break;
case ASIOSTInt32MSB:
Output_Float32_Int32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, flags,!swap);
break;
case ASIOSTFloat32LSB:
Output_Float32_Float32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset,flags,swap);
break;
case ASIOSTFloat32MSB:
Output_Float32_Float32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, flags,!swap);
break;
case ASIOSTInt24LSB: // used for 20 bits as well
case ASIOSTInt24MSB: // used for 20 bits as well
case ASIOSTFloat64LSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
// these are used for 32 bit data buffer, with different alignment of the data inside
// 32 bit PCI bus systems can more easily used with these
case ASIOSTInt32LSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32LSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32LSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32LSB24: // 32 bit data with 24 bit alignment
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
DBUG(("Not yet implemented : please report the problem\n"));
break;
}
break;
}
case paInt32:
{
long *outBufPtr = (long *) outputBuffer;
switch (nativeFormat) {
case ASIOSTInt16LSB:
Output_Int32_Int16(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, flags,swap);
break;
case ASIOSTInt16MSB:
Output_Int32_Int16(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, flags,!swap);
break;
case ASIOSTInt32LSB:
Output_Int32_Int32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, flags,swap);
break;
case ASIOSTInt32MSB:
Output_Int32_Int32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, flags,!swap);
break;
case ASIOSTFloat32LSB:
Output_Int32_Float32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, flags,swap);
break;
case ASIOSTFloat32MSB:
Output_Int32_Float32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, flags,!swap);
break;
case ASIOSTInt24LSB: // used for 20 bits as well
case ASIOSTInt24MSB: // used for 20 bits as well
case ASIOSTFloat64LSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
// these are used for 32 bit data buffer, with different alignment of the data inside
// 32 bit PCI bus systems can more easily used with these
case ASIOSTInt32LSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32LSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32LSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32LSB24: // 32 bit data with 24 bit alignment
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
DBUG(("Not yet implemented : please report the problem\n"));
break;
}
break;
}
case paInt16:
{
short *outBufPtr = (short *) outputBuffer;
switch (nativeFormat) {
case ASIOSTInt16LSB:
Output_Int16_Int16(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, swap);
break;
case ASIOSTInt16MSB:
Output_Int16_Int16(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, !swap);
break;
case ASIOSTInt32LSB:
Output_Int16_Int32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, swap);
break;
case ASIOSTInt32MSB:
Output_Int16_Int32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, !swap);
break;
case ASIOSTFloat32LSB:
Output_Int16_Float32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, swap);
break;
case ASIOSTFloat32MSB:
Output_Int16_Float32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, !swap);
break;
case ASIOSTInt24LSB: // used for 20 bits as well
case ASIOSTInt24MSB: // used for 20 bits as well
case ASIOSTFloat64LSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
// these are used for 32 bit data buffer, with different alignment of the data inside
// 32 bit PCI bus systems can more easily used with these
case ASIOSTInt32LSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32LSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32LSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32LSB24: // 32 bit data with 24 bit alignment
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
DBUG(("Not yet implemented : please report the problem\n"));
break;
}
break;
}
case paInt8:
{
char *outBufPtr = (char *) outputBuffer;
switch (nativeFormat) {
case ASIOSTInt16LSB:
Output_Int8_Int16(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, swap);
break;
case ASIOSTInt16MSB:
Output_Int8_Int16(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, !swap);
break;
case ASIOSTInt32LSB:
Output_Int8_Int32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, swap);
break;
case ASIOSTInt32MSB:
Output_Int8_Int32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, !swap);
break;
case ASIOSTFloat32LSB:
Output_Int8_Float32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, swap);
break;
case ASIOSTFloat32MSB:
Output_Int8_Float32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, !swap);
break;
case ASIOSTInt24LSB: // used for 20 bits as well
case ASIOSTInt24MSB: // used for 20 bits as well
case ASIOSTFloat64LSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
// these are used for 32 bit data buffer, with different alignment of the data inside
// 32 bit PCI bus systems can more easily used with these
case ASIOSTInt32LSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32LSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32LSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32LSB24: // 32 bit data with 24 bit alignment
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
DBUG(("Not yet implemented : please report the problem\n"));
break;
}
break;
}
case paUInt8:
{
unsigned char *outBufPtr = (unsigned char *) outputBuffer;
switch (nativeFormat) {
case ASIOSTInt16LSB:
Output_IntU8_Int16(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, swap);
break;
case ASIOSTInt16MSB:
Output_IntU8_Int16(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, !swap);
break;
case ASIOSTInt32LSB:
Output_IntU8_Int32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, swap);
break;
case ASIOSTInt32MSB:
Output_IntU8_Int32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, !swap);
break;
case ASIOSTFloat32LSB:
Output_IntU8_Float32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, swap);
break;
case ASIOSTFloat32MSB:
Output_IntU8_Float32(nativeBuffer, outBufPtr, framePerBuffer, NumInputChannels, NumOuputChannels, index, hostFrameOffset,userFrameOffset, !swap);
break;
case ASIOSTInt24LSB: // used for 20 bits as well
case ASIOSTInt24MSB: // used for 20 bits as well
case ASIOSTFloat64LSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
case ASIOSTFloat64MSB: // IEEE 754 64 bit double float, as found on Intel x86 architecture
// these are used for 32 bit data buffer, with different alignment of the data inside
// 32 bit PCI bus systems can more easily used with these
case ASIOSTInt32LSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32LSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32LSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32LSB24: // 32 bit data with 24 bit alignment
case ASIOSTInt32MSB16: // 32 bit data with 16 bit alignment
case ASIOSTInt32MSB18: // 32 bit data with 18 bit alignment
case ASIOSTInt32MSB20: // 32 bit data with 20 bit alignment
case ASIOSTInt32MSB24: // 32 bit data with 24 bit alignment
DBUG(("Not yet implemented : please report the problem\n"));
break;
}
break;
}
default:
break;
}
}
}
/* Load a ASIO driver corresponding to the required device */
static PaError Pa_ASIO_loadDevice (long device)
{
PaDeviceInfo * dev = &(sDevices[device].pad_Info);
if (!Pa_ASIO_loadAsioDriver((char *) dev->name)) return paHostError;
if (ASIOInit(&asioDriverInfo.pahsc_driverInfo) != ASE_OK) return paHostError;
if (ASIOGetChannels(&asioDriverInfo.pahsc_NumInputChannels, &asioDriverInfo.pahsc_NumOutputChannels) != ASE_OK) return paHostError;
if (ASIOGetBufferSize(&asioDriverInfo.pahsc_minSize, &asioDriverInfo.pahsc_maxSize, &asioDriverInfo.pahsc_preferredSize, &asioDriverInfo.pahsc_granularity) != ASE_OK) return paHostError;
if(ASIOOutputReady() == ASE_OK)
asioDriverInfo.pahsc_postOutput = true;
else
asioDriverInfo.pahsc_postOutput = false;
return paNoError;
}
//---------------------------------------------------
static int GetHighestBitPosition (unsigned long n)
{
int pos = -1;
while( n != 0 )
{
pos++;
n = n >> 1;
}
return pos;
}
//------------------------------------------------------------------------------------------
static int GetFirstMultiple(long min, long val ){ return ((min + val - 1) / val) * val; }
//------------------------------------------------------------------------------------------
static int GetFirstPossibleDivisor(long max, long val )
{
for (int i = 2; i < 20; i++) {if (((val%i) == 0) && ((val/i) <= max)) return (val/i); }
return val;
}
//------------------------------------------------------------------------
static int IsPowerOfTwo( unsigned long n ) { return ((n & (n-1)) == 0); }
/*******************************************************************
* Determine size of native ASIO audio buffer size
* Input parameters : FramesPerUserBuffer, NumUserBuffers
* Output values : FramesPerHostBuffer, OutputBufferOffset or InputtBufferOffset
*/
static PaError PaHost_CalcNumHostBuffers( internalPortAudioStream *past )
{
PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData;
long requestedBufferSize;
long firstMultiple, firstDivisor;
// Compute requestedBufferSize
if( past->past_NumUserBuffers < 1 ){
requestedBufferSize = past->past_FramesPerUserBuffer;
}else{
requestedBufferSize = past->past_NumUserBuffers * past->past_FramesPerUserBuffer;
}
// Adjust FramesPerHostBuffer using requestedBufferSize, ASIO minSize and maxSize,
if (requestedBufferSize < asioDriverInfo.pahsc_minSize){
firstMultiple = GetFirstMultiple(asioDriverInfo.pahsc_minSize, requestedBufferSize);
if (firstMultiple <= asioDriverInfo.pahsc_maxSize)
asioDriverInfo.past_FramesPerHostBuffer = firstMultiple;
else
asioDriverInfo.past_FramesPerHostBuffer = asioDriverInfo.pahsc_minSize;
}else if (requestedBufferSize > asioDriverInfo.pahsc_maxSize){
firstDivisor = GetFirstPossibleDivisor(asioDriverInfo.pahsc_maxSize, requestedBufferSize);
if ((firstDivisor >= asioDriverInfo.pahsc_minSize) && (firstDivisor <= asioDriverInfo.pahsc_maxSize))
asioDriverInfo.past_FramesPerHostBuffer = firstDivisor;
else
asioDriverInfo.past_FramesPerHostBuffer = asioDriverInfo.pahsc_maxSize;
}else{
asioDriverInfo.past_FramesPerHostBuffer = requestedBufferSize;
}
// If ASIO buffer size needs to be a power of two
if( asioDriverInfo.pahsc_granularity < 0 ){
// Needs to be a power of two.
if( !IsPowerOfTwo( asioDriverInfo.past_FramesPerHostBuffer ) )
{
int highestBit = GetHighestBitPosition(asioDriverInfo.past_FramesPerHostBuffer);
asioDriverInfo.past_FramesPerHostBuffer = 1 << (highestBit + 1);
}
}
DBUG(("----------------------------------\n"));
DBUG(("PaHost_CalcNumHostBuffers : minSize = %ld \n",asioDriverInfo.pahsc_minSize));
DBUG(("PaHost_CalcNumHostBuffers : preferredSize = %ld \n",asioDriverInfo.pahsc_preferredSize));
DBUG(("PaHost_CalcNumHostBuffers : maxSize = %ld \n",asioDriverInfo.pahsc_maxSize));
DBUG(("PaHost_CalcNumHostBuffers : granularity = %ld \n",asioDriverInfo.pahsc_granularity));
DBUG(("PaHost_CalcNumHostBuffers : User buffer size = %d\n", asioDriverInfo.past->past_FramesPerUserBuffer ));
DBUG(("PaHost_CalcNumHostBuffers : ASIO buffer size = %d\n", asioDriverInfo.past_FramesPerHostBuffer ));
return paNoError;
}
/***********************************************************************/
int Pa_CountDevices()
{
PaError err ;
if( sNumDevices <= 0 )
{
/* Force loading of ASIO drivers */
err = Pa_ASIO_QueryDeviceInfo(sDevices);
if( err != paNoError ) goto error;
}
return sNumDevices;
error:
PaHost_Term();
DBUG(("Pa_CountDevices: returns %d\n", err ));
return err;
}
/***********************************************************************/
PaError PaHost_Init( void )
{
/* Have we already initialized the device info? */
PaError err = (PaError) Pa_CountDevices();
return ( err < 0 ) ? err : paNoError;
}
/***********************************************************************/
PaError PaHost_Term( void )
{
int i;
PaDeviceInfo *dev;
double *rates;
PaError result = paNoError;
if (sNumDevices > 0) {
/* Free allocated sample rate arrays and names*/
for( i=0; i<sNumDevices; i++ ){
dev = &sDevices[i].pad_Info;
rates = (double *) dev->sampleRates;
if ((rates != NULL)) PaHost_FreeFastMemory(rates, MAX_NUMSAMPLINGRATES * sizeof(double));
dev->sampleRates = NULL;
if(dev->name != NULL) PaHost_FreeFastMemory((void *) dev->name, 32);
dev->name = NULL;
}
sNumDevices = 0;
/* If the stream has been closed with PaHost_CloseStream, asioDriverInfo.past == null, otherwise close it now */
if(asioDriverInfo.past != NULL) Pa_CloseStream(asioDriverInfo.past);
/* remove the loaded ASIO driver */
asioDrivers->removeCurrentDriver();
}
return result;
}
/***********************************************************************/
PaError PaHost_OpenStream( internalPortAudioStream *past )
{
PaError result = paNoError;
ASIOError err;
int32 device;
/* Check if a stream already runs */
if (asioDriverInfo.past != NULL) return paHostError;
/* Check the device number */
if ((past->past_InputDeviceID != paNoDevice)
&&(past->past_OutputDeviceID != paNoDevice)
&&(past->past_InputDeviceID != past->past_OutputDeviceID))
{
return paInvalidDeviceId;
}
/* Allocation */
memset(&asioDriverInfo, 0, sizeof(PaHostSoundControl));
past->past_DeviceData = (void*) &asioDriverInfo;
/* FIXME */
asioDriverInfo.past = past;
/* load the ASIO device */
device = (past->past_InputDeviceID < 0) ? past->past_OutputDeviceID : past->past_InputDeviceID;
result = Pa_ASIO_loadDevice(device);
if (result != paNoError) goto error;
/* Check ASIO parameters and input parameters */
if ((past->past_NumInputChannels > asioDriverInfo.pahsc_NumInputChannels)
|| (past->past_NumOutputChannels > asioDriverInfo.pahsc_NumOutputChannels)) {
result = paInvalidChannelCount;
goto error;
}
/* Set sample rate */
if (ASIOSetSampleRate(past->past_SampleRate) != ASE_OK) {
result = paInvalidSampleRate;
goto error;
}
/* if OK calc buffer size */
result = PaHost_CalcNumHostBuffers( past );
if (result != paNoError) goto error;
/*
Allocating input and output buffers number for the real past_NumInputChannels and past_NumOutputChannels
optimize the data transfer.
*/
asioDriverInfo.pahsc_NumInputChannels = past->past_NumInputChannels;
asioDriverInfo.pahsc_NumOutputChannels = past->past_NumOutputChannels;
/* Allocate ASIO buffers and callback*/
err = Pa_ASIO_CreateBuffers(&asioDriverInfo,
asioDriverInfo.pahsc_NumInputChannels,
asioDriverInfo.pahsc_NumOutputChannels,
asioDriverInfo.past_FramesPerHostBuffer);
/*
Some buggy drivers (like the Hoontech DSP24) give incorrect [min, preferred, max] values
They should work with the preferred size value, thus if Pa_ASIO_CreateBuffers fails with
the hostBufferSize computed in PaHost_CalcNumHostBuffers, we try again with the preferred size.
*/
if (err != ASE_OK) {
DBUG(("PaHost_OpenStream : Pa_ASIO_CreateBuffers failed with the requested framesPerBuffer = %ld \n", asioDriverInfo.past_FramesPerHostBuffer));
err = Pa_ASIO_CreateBuffers(&asioDriverInfo,
asioDriverInfo.pahsc_NumInputChannels,
asioDriverInfo.pahsc_NumOutputChannels,
asioDriverInfo.pahsc_preferredSize);
if (err == ASE_OK) {
// Adjust FramesPerHostBuffer to take the preferredSize instead of the value computed in PaHost_CalcNumHostBuffers
asioDriverInfo.past_FramesPerHostBuffer = asioDriverInfo.pahsc_preferredSize;
DBUG(("PaHost_OpenStream : Adjust FramesPerHostBuffer to take the preferredSize instead of the value computed in PaHost_CalcNumHostBuffers\n"));
} else {
DBUG(("PaHost_OpenStream : Pa_ASIO_CreateBuffers failed with the preferred framesPerBuffer = %ld \n", asioDriverInfo.pahsc_preferredSize));
}
}
/* Compute buffer adapdation offset */
PaHost_CalcBufferOffset(past);
if (err == ASE_OK)
return paNoError;
else if (err == ASE_NoMemory)
result = paInsufficientMemory;
else if (err == ASE_InvalidParameter)
result = paInvalidChannelCount;
else if (err == ASE_InvalidMode)
result = paBufferTooBig;
else
result = paHostError;
error:
ASIOExit();
return result;
}
/***********************************************************************/
PaError PaHost_CloseStream( internalPortAudioStream *past )
{
PaHostSoundControl *pahsc;
PaError result = paNoError;
if( past == NULL ) return paBadStreamPtr;
pahsc = (PaHostSoundControl *) past->past_DeviceData;
if( pahsc == NULL ) return paNoError;
#if PA_TRACE_START_STOP
AddTraceMessage( "PaHost_CloseStream: pahsc_HWaveOut ", (int) pahsc->pahsc_HWaveOut );
#endif
/* Free data and device for output. */
past->past_DeviceData = NULL;
asioDriverInfo.past = NULL;
/* Dispose */
if(ASIODisposeBuffers() != ASE_OK) result = paHostError;
if(ASIOExit() != ASE_OK) result = paHostError;
return result;
}
/***********************************************************************/
PaError PaHost_StartOutput( internalPortAudioStream *past )
{
/* Clear the index 0 host output buffer */
Pa_ASIO_Clear_Output(asioDriverInfo.bufferInfos,
asioDriverInfo.pahsc_channelInfos[0].type,
asioDriverInfo.pahsc_NumInputChannels,
asioDriverInfo.pahsc_NumOutputChannels,
0,
0,
asioDriverInfo.past_FramesPerHostBuffer);
/* Clear the index 1 host output buffer */
Pa_ASIO_Clear_Output(asioDriverInfo.bufferInfos,
asioDriverInfo.pahsc_channelInfos[0].type,
asioDriverInfo.pahsc_NumInputChannels,
asioDriverInfo.pahsc_NumOutputChannels,
1,
0,
asioDriverInfo.past_FramesPerHostBuffer);
Pa_ASIO_Clear_User_Buffers();
Pa_ASIO_Adaptor_Init();
return paNoError;
}
/***********************************************************************/
PaError PaHost_StopOutput( internalPortAudioStream *past, int abort )
{
/* Nothing to do ?? */
return paNoError;
}
/***********************************************************************/
PaError PaHost_StartInput( internalPortAudioStream *past )
{
/* Nothing to do ?? */
return paNoError;
}
/***********************************************************************/
PaError PaHost_StopInput( internalPortAudioStream *past, int abort )
{
/* Nothing to do */
return paNoError;
}
/***********************************************************************/
PaError PaHost_StartEngine( internalPortAudioStream *past )
{
// TO DO : count of samples
past->past_IsActive = 1;
return (ASIOStart() == ASE_OK) ? paNoError : paHostError;
}
/***********************************************************************/
PaError PaHost_StopEngine( internalPortAudioStream *past, int abort )
{
// TO DO : count of samples
past->past_IsActive = 0;
return (ASIOStop() == ASE_OK) ? paNoError : paHostError;
}
/***********************************************************************/
// TO BE CHECKED
PaError PaHost_StreamActive( internalPortAudioStream *past )
{
PaHostSoundControl *pahsc;
if( past == NULL ) return paBadStreamPtr;
pahsc = (PaHostSoundControl *) past->past_DeviceData;
if( pahsc == NULL ) return paInternalError;
return (PaError) past->past_IsActive;
}
/*************************************************************************/
PaTimestamp Pa_StreamTime( PortAudioStream *stream )
{
PaHostSoundControl *pahsc;
internalPortAudioStream *past = (internalPortAudioStream *) stream;
if( past == NULL ) return paBadStreamPtr;
pahsc = (PaHostSoundControl *) past->past_DeviceData;
return pahsc->pahsc_NumFramesDone;
}
/*************************************************************************
* Allocate memory that can be accessed in real-time.
* This may need to be held in physical memory so that it is not
* paged to virtual memory.
* This call MUST be balanced with a call to PaHost_FreeFastMemory().
*/
void *PaHost_AllocateFastMemory( long numBytes )
{
#if MAC
void *addr = NewPtrClear( numBytes );
if( (addr == NULL) || (MemError () != 0) ) return NULL;
#if (CARBON_COMPATIBLE == 0)
if( HoldMemory( addr, numBytes ) != noErr )
{
DisposePtr( (Ptr) addr );
return NULL;
}
#endif
return addr;
#elif WINDOWS
void *addr = malloc( numBytes ); /* FIXME - do we need physical memory? */
if( addr != NULL ) memset( addr, 0, numBytes );
return addr;
#endif
}
/*************************************************************************
* Free memory that could be accessed in real-time.
* This call MUST be balanced with a call to PaHost_AllocateFastMemory().
*/
void PaHost_FreeFastMemory( void *addr, long numBytes )
{
#if MAC
if( addr == NULL ) return;
#if CARBON_COMPATIBLE
(void) numBytes;
#else
UnholdMemory( addr, numBytes );
#endif
DisposePtr( (Ptr) addr );
#elif WINDOWS
if( addr != NULL ) free( addr );
#endif
}
/*************************************************************************/
void Pa_Sleep( long msec )
{
#if MAC
int32 sleepTime, endTime;
/* Convert to ticks. Round up so we sleep a MINIMUM of msec time. */
sleepTime = ((msec * 60) + 999) / 1000;
if( sleepTime < 1 ) sleepTime = 1;
endTime = TickCount() + sleepTime;
do{
DBUGX(("Sleep for %d ticks.\n", sleepTime ));
WaitNextEvent( 0, NULL, sleepTime, NULL ); /* Use this just to sleep without getting events. */
sleepTime = endTime - TickCount();
} while( sleepTime > 0 );
#elif WINDOWS
Sleep( msec );
#endif
}
/*************************************************************************/
const PaDeviceInfo* Pa_GetDeviceInfo( PaDeviceID id )
{
if( (id < 0) || ( id >= Pa_CountDevices()) ) return NULL;
return &sDevices[id].pad_Info;
}
/*************************************************************************/
PaDeviceID Pa_GetDefaultInputDeviceID( void )
{
return (sNumDevices > 0) ? sDefaultInputDeviceID : paNoDevice;
}
/*************************************************************************/
PaDeviceID Pa_GetDefaultOutputDeviceID( void )
{
return (sNumDevices > 0) ? sDefaultOutputDeviceID : paNoDevice;
}
/*************************************************************************/
int Pa_GetMinNumBuffers( int framesPerUserBuffer, double sampleRate )
{
// TO BE IMPLEMENTED : using the ASIOGetLatency call??
return 2;
}
/*************************************************************************/
int32 Pa_GetHostError( void )
{
int32 err = sPaHostError;
sPaHostError = 0;
return err;
}
#ifdef MAC
/**************************************************************************/
static void Pa_StartUsageCalculation( internalPortAudioStream *past )
{
PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData;
UnsignedWide widePad;
if( pahsc == NULL ) return;
/* Query system timer for usage analysis and to prevent overuse of CPU. */
Microseconds( &widePad );
pahsc->pahsc_EntryCount = UnsignedWideToUInt64( widePad );
}
/**************************************************************************/
static void Pa_EndUsageCalculation( internalPortAudioStream *past )
{
UnsignedWide widePad;
UInt64 CurrentCount;
long InsideCount;
long TotalCount;
PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData;
if( pahsc == NULL ) return;
/* Measure CPU utilization during this callback. Note that this calculation
** assumes that we had the processor the whole time.
*/
#define LOWPASS_COEFFICIENT_0 (0.9)
#define LOWPASS_COEFFICIENT_1 (0.99999 - LOWPASS_COEFFICIENT_0)
Microseconds( &widePad );
CurrentCount = UnsignedWideToUInt64( widePad );
if( past->past_IfLastExitValid )
{
InsideCount = (long) U64Subtract(CurrentCount, pahsc->pahsc_EntryCount);
TotalCount = (long) U64Subtract(CurrentCount, pahsc->pahsc_LastExitCount);
/* Low pass filter the result because sometimes we get called several times in a row.
* That can cause the TotalCount to be very low which can cause the usage to appear
* unnaturally high. So we must filter numerator and denominator separately!!!
*/
past->past_AverageInsideCount = (( LOWPASS_COEFFICIENT_0 * past->past_AverageInsideCount) +
(LOWPASS_COEFFICIENT_1 * InsideCount));
past->past_AverageTotalCount = (( LOWPASS_COEFFICIENT_0 * past->past_AverageTotalCount) +
(LOWPASS_COEFFICIENT_1 * TotalCount));
past->past_Usage = past->past_AverageInsideCount / past->past_AverageTotalCount;
}
pahsc->pahsc_LastExitCount = CurrentCount;
past->past_IfLastExitValid = 1;
}
#elif WINDOWS
/********************************* BEGIN CPU UTILIZATION MEASUREMENT ****/
static void Pa_StartUsageCalculation( internalPortAudioStream *past )
{
PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData;
if( pahsc == NULL ) return;
/* Query system timer for usage analysis and to prevent overuse of CPU. */
QueryPerformanceCounter( &pahsc->pahsc_EntryCount );
}
static void Pa_EndUsageCalculation( internalPortAudioStream *past )
{
LARGE_INTEGER CurrentCount = { 0, 0 };
LONGLONG InsideCount;
LONGLONG TotalCount;
/*
** Measure CPU utilization during this callback. Note that this calculation
** assumes that we had the processor the whole time.
*/
#define LOWPASS_COEFFICIENT_0 (0.9)
#define LOWPASS_COEFFICIENT_1 (0.99999 - LOWPASS_COEFFICIENT_0)
PaHostSoundControl *pahsc = (PaHostSoundControl *) past->past_DeviceData;
if( pahsc == NULL ) return;
if( QueryPerformanceCounter( &CurrentCount ) )
{
if( past->past_IfLastExitValid )
{
InsideCount = CurrentCount.QuadPart - pahsc->pahsc_EntryCount.QuadPart;
TotalCount = CurrentCount.QuadPart - pahsc->pahsc_LastExitCount.QuadPart;
/* Low pass filter the result because sometimes we get called several times in a row.
* That can cause the TotalCount to be very low which can cause the usage to appear
* unnaturally high. So we must filter numerator and denominator separately!!!
*/
past->past_AverageInsideCount = (( LOWPASS_COEFFICIENT_0 * past->past_AverageInsideCount) +
(LOWPASS_COEFFICIENT_1 * InsideCount));
past->past_AverageTotalCount = (( LOWPASS_COEFFICIENT_0 * past->past_AverageTotalCount) +
(LOWPASS_COEFFICIENT_1 * TotalCount));
past->past_Usage = past->past_AverageInsideCount / past->past_AverageTotalCount;
}
pahsc->pahsc_LastExitCount = CurrentCount;
past->past_IfLastExitValid = 1;
}
}
#endif
| [
"gsilber",
"darreng"
]
| [
[
[
1,
1
],
[
3,
31
],
[
33,
59
],
[
69,
100
],
[
103,
188
],
[
191,
313
],
[
315,
360
],
[
381,
390
],
[
392,
410
],
[
414,
429
],
[
431,
432
],
[
434,
484
],
[
487,
494
],
[
499,
500
],
[
506,
506
],
[
508,
508
],
[
512,
512
],
[
568,
568
],
[
573,
573
],
[
576,
584
],
[
586,
1719
],
[
1725,
1728
],
[
1733,
1737
],
[
1739,
1748
],
[
1750,
1755
],
[
1757,
2579
],
[
2586,
2639
],
[
2644,
2645
],
[
2647,
2712
],
[
2743,
2753
],
[
2756,
2775
],
[
2780,
2945
],
[
2947,
2951
],
[
2953,
3068
]
],
[
[
2,
2
],
[
32,
32
],
[
60,
68
],
[
101,
102
],
[
189,
190
],
[
314,
314
],
[
361,
380
],
[
391,
391
],
[
411,
413
],
[
430,
430
],
[
433,
433
],
[
485,
486
],
[
495,
498
],
[
501,
505
],
[
507,
507
],
[
509,
511
],
[
513,
567
],
[
569,
572
],
[
574,
575
],
[
585,
585
],
[
1720,
1724
],
[
1729,
1732
],
[
1738,
1738
],
[
1749,
1749
],
[
1756,
1756
],
[
2580,
2585
],
[
2640,
2643
],
[
2646,
2646
],
[
2713,
2742
],
[
2754,
2755
],
[
2776,
2779
],
[
2946,
2946
],
[
2952,
2952
],
[
3069,
3072
]
]
]
|
bdd2dba2c04ae6aa50c3e8d307bf6340a66241a6 | f25e9e8fd224f81cefd6d900f6ce64ce77abb0ae | /Exercises/Old Solutions/OpenGL_Tests/OpenGL_Tests/main.cpp | 293c8a0e2e32595a8c628c345f7678e103ebcd39 | []
| no_license | giacomof/gameengines2010itu | 8407be66d1aff07866d3574a03804f2f5bcdfab1 | bc664529a429394fe5743d5a76a3d3bf5395546b | refs/heads/master | 2016-09-06T05:02:13.209432 | 2010-12-12T22:18:19 | 2010-12-12T22:18:19 | 35,165,366 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,898 | cpp | #include <windows.h> // Header File For Windows
#include <stdio.h> // Header File For Standard Input/Output
#include <gl\gl.h> // Header File For The OpenGL32 Library
#include <gl\glu.h> // Header File For The GLu32 Library
#include "bmp.h";
#include <math.h>
HDC hDC=NULL; // Private GDI Device Context
HGLRC hRC=NULL; // Permanent Rendering Context
HWND hWnd=NULL; // Holds Our Window Handle
HINSTANCE hInstance; // Holds The Instance Of The Application
bool keys[256]; // Array Used For The Keyboard Routine
bool active=TRUE; // Window Active Flag Set To TRUE By Default
bool fullscreen=FALSE; // Fullscreen Flag Set To Fullscreen Mode By Default
bool light; // Lighting ON/OFF (with L button)
bool lp; // L button Pressed?
bool fp; // F button Pressed?
GLfloat xrot; // X Rotation
GLfloat yrot; // Y Rotation
GLfloat xspeed; // X Rotation Speed
GLfloat yspeed; // Y Rotation Speed
GLfloat z=-5.0f; // Depth Into The Screen
GLfloat LightAmbient[]= { 0.5f, 0.5f, 0.5f, 1.0f };
GLfloat LightDiffuse[]= { 1.0f, 1.0f, 1.0f, 1.0f };
GLfloat LightPosition[]= { 0.0f, 0.0f, 2.0f, 1.0f };
GLuint filter; // Which Filter To Use
GLuint texture[3]; // Storage For 3 Textures
float xpos, zpos, walkbias, yProt, lookupdown, sceneroty, walkbiasangle, heading, piover180;
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration For WndProc
void loadObjects()
{
glBindTexture(GL_TEXTURE_2D, texture[filter]);
glBegin(GL_QUADS);
// Front Face
glNormal3f( 0.0f, 0.0f, 1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
// Back Face
glNormal3f( 0.0f, 0.0f,-1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
// Top Face
glNormal3f( 0.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
// Bottom Face
glNormal3f( 0.0f,-1.0f, 0.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
// Right face
glNormal3f( 1.0f, 0.0f, 0.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f( 1.0f, -1.0f, -1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f( 1.0f, 1.0f, -1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f( 1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f( 1.0f, -1.0f, 1.0f);
// Left Face
glNormal3f(-1.0f, 0.0f, 0.0f);
glTexCoord2f(0.0f, 0.0f); glVertex3f(-1.0f, -1.0f, -1.0f);
glTexCoord2f(1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f);
glTexCoord2f(1.0f, 1.0f); glVertex3f(-1.0f, 1.0f, 1.0f);
glTexCoord2f(0.0f, 1.0f); glVertex3f(-1.0f, 1.0f, -1.0f);
glEnd();
}
void updateRotations()
{
glRotatef(xrot,1.0f,0.0f,0.0f);
glRotatef(yrot,0.0f,1.0f,0.0f);
}
void updateRotationSpeeds()
{
xrot+=xspeed;
yrot+=yspeed;
}
void setupPlayerStats()
{
GLfloat xtrans = -xpos; // Used For Player Translation On The X Axis
GLfloat ztrans = -zpos; // Used For Player Translation On The Z Axis
GLfloat ytrans = -walkbias-0.25f; // Used For Bouncing Motion Up And Down
GLfloat sceneroty = 360.0f - yProt; // 360 Degree Angle For Player Direction
}
void updatePlayerMovements()
{
glRotatef(lookupdown,1.0f,0,0); // Rotate Up And Down To Look Up And Down
glRotatef(sceneroty,0,1.0f,0); // Rotate Depending On Direction Player Is Facing
}
/* ************************************************************************* */
/* ************** I have changed the way NeHe loades the BMP *************** */
/* ************** ...because I couldn't get Glaux to work... *************** */
/* ************************************************************************* */
AUX_RGBImageRec *LoadBMP(char *Filename) // Loads A Bitmap Image
{
FILE *File=NULL; // File Handle
if (!Filename) // Make Sure A Filename Was Given
{
return NULL; // If Not Return NULL
}
File=fopen(Filename,"r"); // Check To See If The File Exists
if (File) // Does The File Exist?
{
fclose(File); // Close The Handle
return auxDIBImageLoad(Filename); // Load The Bitmap And Return A Pointer
}
return NULL; // If Load Failed Return NULL
}
int LoadGLTextures() // Load Bitmaps And Convert To Textures
{
int Status=FALSE; // Status Indicator
AUX_RGBImageRec *TextureImage[1]; // Create Storage Space For The Texture
memset(TextureImage,0,sizeof(void *)*1); // Set The Pointer To NULL
// Load The Bitmap, Check For Errors, If Bitmap's Not Found Quit
if (TextureImage[0]=LoadBMP("Data/Crate.bmp"))
{
Status=TRUE; // Set The Status To TRUE
glGenTextures(3, &texture[0]); // Create Three Textures
// Create Nearest Filtered Texture
glBindTexture(GL_TEXTURE_2D, texture[0]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
// Create Linear Filtered Texture
glBindTexture(GL_TEXTURE_2D, texture[1]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
glTexImage2D(GL_TEXTURE_2D, 0, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, 0, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
// Create MipMapped / Trilinear Texture
glBindTexture(GL_TEXTURE_2D, texture[2]);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR_MIPMAP_NEAREST);
gluBuild2DMipmaps(GL_TEXTURE_2D, 3, TextureImage[0]->sizeX, TextureImage[0]->sizeY, GL_RGB, GL_UNSIGNED_BYTE, TextureImage[0]->data);
}
if (TextureImage[0]) // If Texture Exists
{
if (TextureImage[0]->data) free(TextureImage[0]->data); // If Texture Image Exists Free The Texture Image Memory
free(TextureImage[0]); // Free The Image Structure
}
return Status; // Return The Status
}
GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize The GL Window
{
if (height==0) // Prevent A Divide By Zero By
{
height=1; // Making Height Equal One
}
glViewport(0,0,width,height); // Reset The Current Viewport
glMatrixMode(GL_PROJECTION); // Select The Projection Matrix
glLoadIdentity(); // Reset The Projection Matrix
// Calculate The Aspect Ratio Of The Window
gluPerspective(60.0f,(GLfloat)width/(GLfloat)height, 1.0, 1024.0);
glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix
glLoadIdentity(); // Reset The Modelview Matrix
}
int InitGL(GLvoid) // All Setup For OpenGL Goes Here
{
if (!LoadGLTextures()) // Jump To Texture Loading Routine
{
return FALSE; // If Texture Didn't Load Return FALSE
}
glEnable(GL_TEXTURE_2D); // Enable Texture Mapping
glShadeModel(GL_SMOOTH); // Enable Smooth Shading
glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background
glClearDepth(1.0f); // Depth Buffer Setup
glEnable(GL_DEPTH_TEST); // Enables Depth Testing
glDepthFunc(GL_LEQUAL); // The Type Of Depth Testing To Do
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Really Nice Perspective Calculations
glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); // Setup The Ambient Light
glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse); // Setup The Diffuse Light
glLightfv(GL_LIGHT1, GL_POSITION,LightPosition); // Position The Light
glEnable(GL_LIGHT1); // Enable Light One
return TRUE; // Initialization Went OK
}
int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear The Screen And The Depth Buffer
glLoadIdentity(); // Reset The View
glTranslatef(0.0f,0.0f,z); // this brings the object a little bit far away from the camera
// update rotations
updateRotations();
// load player position, direction, etc...
setupPlayerStats();
// create the cube
loadObjects();
// update rotation speed
updateRotationSpeeds();
return TRUE; // Keep Going
}
GLvoid KillGLWindow(GLvoid) // Properly Kill The Window
{
if (fullscreen) // Are We In Fullscreen Mode?
{
ChangeDisplaySettings(NULL,0); // If So Switch Back To The Desktop
ShowCursor(TRUE); // Show Mouse Pointer
}
if (hRC) // Do We Have A Rendering Context?
{
if (!wglMakeCurrent(NULL,NULL)) // Are We Able To Release The DC And RC Contexts?
{
MessageBox(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
}
if (!wglDeleteContext(hRC)) // Are We Able To Delete The RC?
{
MessageBox(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
}
hRC=NULL; // Set RC To NULL
}
if (hDC && !ReleaseDC(hWnd,hDC)) // Are We Able To Release The DC
{
MessageBox(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
hDC=NULL; // Set DC To NULL
}
if (hWnd && !DestroyWindow(hWnd)) // Are We Able To Destroy The Window?
{
MessageBox(NULL,"Could Not Release hWnd.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
hWnd=NULL; // Set hWnd To NULL
}
if (!UnregisterClass("OpenGL",hInstance)) // Are We Able To Unregister Class
{
MessageBox(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION);
hInstance=NULL; // Set hInstance To NULL
}
}
/* This Code Creates Our OpenGL Window. Parameters Are: *
* title - Title To Appear At The Top Of The Window *
* width - Width Of The GL Window Or Fullscreen Mode *
* height - Height Of The GL Window Or Fullscreen Mode *
* bits - Number Of Bits To Use For Color (8/16/24/32) *
* fullscreenflag - Use Fullscreen Mode (TRUE) Or Windowed Mode (FALSE) */
BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag)
{
GLuint PixelFormat; // Holds The Results After Searching For A Match
WNDCLASS wc; // Windows Class Structure
DWORD dwExStyle; // Window Extended Style
DWORD dwStyle; // Window Style
RECT WindowRect; // Grabs Rectangle Upper Left / Lower Right Values
WindowRect.left=(long)0; // Set Left Value To 0
WindowRect.right=(long)width; // Set Right Value To Requested Width
WindowRect.top=(long)0; // Set Top Value To 0
WindowRect.bottom=(long)height; // Set Bottom Value To Requested Height
fullscreen=fullscreenflag; // Set The Global Fullscreen Flag
hInstance = GetModuleHandle(NULL); // Grab An Instance For Our Window
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Redraw On Size, And Own DC For Window.
wc.lpfnWndProc = (WNDPROC) WndProc; // WndProc Handles Messages
wc.cbClsExtra = 0; // No Extra Window Data
wc.cbWndExtra = 0; // No Extra Window Data
wc.hInstance = hInstance; // Set The Instance
wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); // Load The Default Icon
wc.hCursor = LoadCursor(NULL, IDC_ARROW); // Load The Arrow Pointer
wc.hbrBackground = NULL; // No Background Required For GL
wc.lpszMenuName = NULL; // We Don't Want A Menu
wc.lpszClassName = "OpenGL"; // Set The Class Name
if (!RegisterClass(&wc)) // Attempt To Register The Window Class
{
MessageBox(NULL,"Failed To Register The Window Class.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
if (fullscreen) // Attempt Fullscreen Mode?
{
DEVMODE dmScreenSettings; // Device Mode
memset(&dmScreenSettings,0,sizeof(dmScreenSettings)); // Makes Sure Memory's Cleared
dmScreenSettings.dmSize=sizeof(dmScreenSettings); // Size Of The Devmode Structure
dmScreenSettings.dmPelsWidth = width; // Selected Screen Width
dmScreenSettings.dmPelsHeight = height; // Selected Screen Height
dmScreenSettings.dmBitsPerPel = bits; // Selected Bits Per Pixel
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
// Try To Set Selected Mode And Get Results. NOTE: CDS_FULLSCREEN Gets Rid Of Start Bar.
if (ChangeDisplaySettings(&dmScreenSettings,CDS_FULLSCREEN)!=DISP_CHANGE_SUCCESSFUL)
{
// If The Mode Fails, Offer Two Options. Quit Or Use Windowed Mode.
if (MessageBox(NULL,"The Requested Fullscreen Mode Is Not Supported By\nYour Video Card. Use Windowed Mode Instead?","NeHe GL",MB_YESNO|MB_ICONEXCLAMATION)==IDYES)
{
fullscreen=FALSE; // Windowed Mode Selected. Fullscreen = FALSE
}
else
{
// Pop Up A Message Box Letting User Know The Program Is Closing.
MessageBox(NULL,"Program Will Now Close.","ERROR",MB_OK|MB_ICONSTOP);
return FALSE; // Return FALSE
}
}
}
if (fullscreen) // Are We Still In Fullscreen Mode?
{
dwExStyle=WS_EX_APPWINDOW; // Window Extended Style
dwStyle=WS_POPUP; // Windows Style
ShowCursor(FALSE); // Hide Mouse Pointer
}
else
{
dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; // Window Extended Style
dwStyle=WS_OVERLAPPEDWINDOW; // Windows Style
}
AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); // Adjust Window To True Requested Size
// Create The Window
if (!(hWnd=CreateWindowEx( dwExStyle, // Extended Style For The Window
"OpenGL", // Class Name
title, // Window Title
dwStyle | // Defined Window Style
WS_CLIPSIBLINGS | // Required Window Style
WS_CLIPCHILDREN, // Required Window Style
0, 0, // Window Position
WindowRect.right-WindowRect.left, // Calculate Window Width
WindowRect.bottom-WindowRect.top, // Calculate Window Height
NULL, // No Parent Window
NULL, // No Menu
hInstance, // Instance
NULL))) // Dont Pass Anything To WM_CREATE
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Window Creation Error.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
static PIXELFORMATDESCRIPTOR pfd= // pfd Tells Windows How We Want Things To Be
{
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
1, // Version Number
PFD_DRAW_TO_WINDOW | // Format Must Support Window
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
PFD_DOUBLEBUFFER, // Must Support Double Buffering
PFD_TYPE_RGBA, // Request An RGBA Format
bits, // Select Our Color Depth
0, 0, 0, 0, 0, 0, // Color Bits Ignored
0, // No Alpha Buffer
0, // Shift Bit Ignored
0, // No Accumulation Buffer
0, 0, 0, 0, // Accumulation Bits Ignored
16, // 16Bit Z-Buffer (Depth Buffer)
0, // No Stencil Buffer
0, // No Auxiliary Buffer
PFD_MAIN_PLANE, // Main Drawing Layer
0, // Reserved
0, 0, 0 // Layer Masks Ignored
};
if (!(hDC=GetDC(hWnd))) // Did We Get A Device Context?
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Can't Create A GL Device Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
if (!(PixelFormat=ChoosePixelFormat(hDC,&pfd))) // Did Windows Find A Matching Pixel Format?
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Can't Find A Suitable PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
if(!SetPixelFormat(hDC,PixelFormat,&pfd)) // Are We Able To Set The Pixel Format?
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Can't Set The PixelFormat.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
if (!(hRC=wglCreateContext(hDC))) // Are We Able To Get A Rendering Context?
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Can't Create A GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
if(!wglMakeCurrent(hDC,hRC)) // Try To Activate The Rendering Context
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Can't Activate The GL Rendering Context.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
ShowWindow(hWnd,SW_SHOW); // Show The Window
SetForegroundWindow(hWnd); // Slightly Higher Priority
SetFocus(hWnd); // Sets Keyboard Focus To The Window
ReSizeGLScene(width, height); // Set Up Our Perspective GL Screen
if (!InitGL()) // Initialize Our Newly Created GL Window
{
KillGLWindow(); // Reset The Display
MessageBox(NULL,"Initialization Failed.","ERROR",MB_OK|MB_ICONEXCLAMATION);
return FALSE; // Return FALSE
}
return TRUE; // Success
}
LRESULT CALLBACK WndProc( HWND hWnd, // Handle For This Window
UINT uMsg, // Message For This Window
WPARAM wParam, // Additional Message Information
LPARAM lParam) // Additional Message Information
{
switch (uMsg) // Check For Windows Messages
{
case WM_ACTIVATE: // Watch For Window Activate Message
{
if (!HIWORD(wParam)) // Check Minimization State
{
active=TRUE; // Program Is Active
}
else
{
active=FALSE; // Program Is No Longer Active
}
return 0; // Return To The Message Loop
}
case WM_SYSCOMMAND: // Intercept System Commands
{
switch (wParam) // Check System Calls
{
case SC_SCREENSAVE: // Screensaver Trying To Start?
case SC_MONITORPOWER: // Monitor Trying To Enter Powersave?
return 0; // Prevent From Happening
}
break; // Exit
}
case WM_CLOSE: // Did We Receive A Close Message?
{
PostQuitMessage(0); // Send A Quit Message
return 0; // Jump Back
}
case WM_KEYDOWN: // Is A Key Being Held Down?
{
keys[wParam] = TRUE; // If So, Mark It As TRUE
return 0; // Jump Back
}
case WM_KEYUP: // Has A Key Been Released?
{
keys[wParam] = FALSE; // If So, Mark It As FALSE
return 0; // Jump Back
}
case WM_SIZE: // Resize The OpenGL Window
{
ReSizeGLScene(LOWORD(lParam),HIWORD(lParam)); // LoWord=Width, HiWord=Height
return 0; // Jump Back
}
}
// Pass All Unhandled Messages To DefWindowProc
return DefWindowProc(hWnd,uMsg,wParam,lParam);
}
int WINAPI WinMain( HINSTANCE hInstance, // Instance
HINSTANCE hPrevInstance, // Previous Instance
LPSTR lpCmdLine, // Command Line Parameters
int nCmdShow) // Window Show State
{
MSG msg; // Windows Message Structure
BOOL done=FALSE; // Bool Variable To Exit Loop
fullscreen=FALSE; // Windowed Mode
// Create Our OpenGL Window
if (!CreateGLWindow("NeHe's Textures, Lighting & Keyboard Tutorial",640,480,16,fullscreen))
{
return 0; // Quit If Window Was Not Created
}
while(!done) // Loop That Runs While done=FALSE
{
if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // Is There A Message Waiting?
{
if (msg.message==WM_QUIT) // Have We Received A Quit Message?
{
done=TRUE; // If So done=TRUE
}
else // If Not, Deal With Window Messages
{
TranslateMessage(&msg); // Translate The Message
DispatchMessage(&msg); // Dispatch The Message
}
}
else // If There Are No Messages
{
// Draw The Scene. Watch For ESC Key And Quit Messages From DrawGLScene()
if ((active && !DrawGLScene()) || keys[VK_ESCAPE]) // Active? Was There A Quit Received?
{
done=TRUE; // ESC or DrawGLScene Signalled A Quit
}
else // Not Time To Quit, Update Screen
{
SwapBuffers(hDC); // Swap Buffers (Double Buffering)
// LIGHT ON/OF MANAGEMENT
if (keys['L'] && !lp)
{
lp=TRUE;
light=!light;
if (!light)
{
glDisable(GL_LIGHTING);
}
else
{
glEnable(GL_LIGHTING);
}
}
if (!keys['L'])
{
lp=FALSE;
}
// FILTERS MANAGEMENT
if (keys['F'] && !fp)
{
fp=TRUE;
filter+=1;
if (filter>2)
{
filter=0;
}
}
if (!keys['F'])
{
fp=FALSE;
}
// CHEST MOVEMENTS MANAGEMENT
if (keys[VK_PRIOR])
{
z-=0.00001f;
}
if (keys[VK_NEXT])
{
z+=0.00001f;
}
if (keys[VK_UP])
{
xspeed-=0.00001f;
}
if (keys[VK_DOWN])
{
xspeed+=0.00001f;
}
if (keys[VK_RIGHT])
{
yspeed+=0.00001f;
}
if (keys[VK_LEFT])
{
yspeed-=0.00001f;
}
// PLAYER MOVEMENTS MANAGEMENT
if (keys[VK_NUMPAD6]) // Is The Right Arrow Being Pressed?
{
yProt -= 1.5f; // Rotate The Scene To The Left
}
if (keys[VK_NUMPAD4]) // Is The Left Arrow Being Pressed?
{
yProt += 1.5f; // Rotate The Scene To The Right
}
if (keys[VK_NUMPAD8]) // Is The Up Arrow Being Pressed?
{
xpos -= (float)sin(heading*piover180) * 0.05f; // Move On The X-Plane Based On Player Direction
zpos -= (float)cos(heading*piover180) * 0.05f; // Move On The Z-Plane Based On Player Direction
if (walkbiasangle >= 359.0f) // Is walkbiasangle>=359?
{
walkbiasangle = 0.0f; // Make walkbiasangle Equal 0
}
else // Otherwise
{
walkbiasangle+= 10; // If walkbiasangle < 359 Increase It By 10
}
walkbias = (float)sin(walkbiasangle * piover180)/20.0f; // Causes The Player To Bounce
}
if (keys[VK_NUMPAD5]) // Is The Down Arrow Being Pressed?
{
xpos += (float)sin(heading*piover180) * 0.05f; // Move On The X-Plane Based On Player Direction
zpos += (float)cos(heading*piover180) * 0.05f; // Move On The Z-Plane Based On Player Direction
if (walkbiasangle <= 1.0f) // Is walkbiasangle<=1?
{
walkbiasangle = 359.0f; // Make walkbiasangle Equal 359
}
else // Otherwise
{
walkbiasangle-= 10; // If walkbiasangle > 1 Decrease It By 10
}
walkbias = (float)sin(walkbiasangle * piover180)/20.0f; // Causes The Player To Bounce
}
}
}
}
// Shutdown
KillGLWindow(); // Kill The Window
return (msg.wParam); // Exit The Program
}
| [
"[email protected]@1a5f623d-5e27-cfcb-749e-01bf3eb0ad9d"
]
| [
[
[
1,
671
]
]
]
|
5d576483f2f933316a5073bcd254ea81af014c84 | 11dfb7197905169a3f0544eeaf507fe108d50f7e | /CCDCamWrapper/CCDCamWrapper/stdafx.cpp | 112e151d01f380dc00139b01b8af48139e033eb8 | []
| no_license | rahulbhadani/adaptive-optics | 67791a49ecbb085ac8effdc44e5177b0357b0fa7 | e2b296664b7674e87a5a68ec7b794144b37ae74d | refs/heads/master | 2020-04-28T00:08:24.585833 | 2011-08-09T22:28:11 | 2011-08-09T22:28:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 300 | cpp | // stdafx.cpp : source file that includes just the standard includes
// CCDCamWrapper.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
| [
"[email protected]"
]
| [
[
[
1,
8
]
]
]
|
72da74d76f97295ec16daea21fffc77337086867 | ab41c2c63e554350ca5b93e41d7321ca127d8d3a | /glm/gtx/vector_angle.inl | eec01dad708717674c6ff97fa1d353192b35e0e7 | []
| no_license | burner/e3rt | 2dc3bac2b7face3b1606ee1430e7ecfd4523bf2e | 775470cc9b912a8c1199dd1069d7e7d4fc997a52 | refs/heads/master | 2021-01-11T08:08:00.665300 | 2010-04-26T11:42:42 | 2010-04-26T11:42:42 | 337,021 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,459 | inl | ///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2009 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2005-12-30
// Updated : 2008-09-29
// Licence : This source is under MIT License
// File : glm/gtx/vector_angle.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
namespace glm{
namespace gtx{
namespace vector_angle{
template <typename genType>
inline typename genType::value_type angle
(
genType const & x,
genType const & y
)
{
return degrees(acos(dot(x, y)));
}
//! \todo epsilon is hard coded to 0.01
template <typename valType>
inline valType orientedAngle
(
detail::tvec2<valType> const & x,
detail::tvec2<valType> const & y
)
{
valType Angle = acos(dot(x, y));
valType c = cos(Angle);
valType s = sin(Angle);
detail::tvec2<valType> TransformedVector = detail::tvec2<valType>(c * y.x - s * y.y, s * y.x + c * y.y);
if(all(equalEpsilonGTX(x, TransformedVector, valType(0.01))))
return -degrees(Angle);
else
return degrees(Angle);
}
//! \todo epsilon is hard coded to 0.01
template <typename valType>
inline valType orientedAngle
(
detail::tvec3<valType> const & x,
detail::tvec3<valType> const & y
)
{
valType Angle = degrees(acos(dot(x, y)));
detail::tvec3<valType> TransformedVector = rotate(detail::tquat<valType>(), Angle, cross(x, y)) * y;
if(all(equalEpsilon(x, TransformedVector, valType(0.01))))
return -degrees(Angle);
else
return degrees(Angle);
}
//! \todo epsilon is hard coded to 0.01
template <typename valType>
inline valType orientedAngle
(
detail::tvec4<valType> const & x,
detail::tvec4<valType> const & y
)
{
valType Angle = degrees(acos(dot(x, y)));
detail::tvec4<valType> TransformedVector = rotate(detail::tquat<valType>(), Angle, cross(x, y)) * y;
if(all(equalEpsilon(x, TransformedVector, valType(0.01))))
return -degrees(Angle);
else
return degrees(Angle);
}
template <typename valType>
inline valType orientedAngleFromRef
(
detail::tvec2<valType> const & x,
detail::tvec2<valType> const & y,
detail::tvec3<valType> const & ref
)
{
valType Angle = glm::acos(glm::dot(x, y));
if(glm::dot(ref, detail::tvec3<valType>(glm::cross(x, y), valType(0))) < valType(0))
return -glm::degrees(Angle);
else
return glm::degrees(Angle);
}
template <typename valType>
inline valType orientedAngleFromRef
(
detail::tvec3<valType> const & x,
detail::tvec3<valType> const & y,
detail::tvec3<valType> const & ref
)
{
valType Angle = glm::acos(glm::dot(x, y));
if(glm::dot(ref, glm::cross(x, y)) < valType(0))
return -glm::degrees(Angle);
else
return glm::degrees(Angle);
}
template <typename valType>
inline valType orientedAngleFromRef
(
detail::tvec4<valType> const & x,
detail::tvec4<valType> const & y,
detail::tvec3<valType> const & ref
)
{
valType Angle = glm::acos(glm::dot(x, y));
if(glm::dot(ref, glm::cross(detail::tvec3<valType>(x), detail::tvec3<valType>(y))) < valType(0))
return -glm::degrees(Angle);
else
return glm::degrees(Angle);
}
}//namespace vector_angle
}//namespace gtx
}//namespace glm
| [
"[email protected]"
]
| [
[
[
1,
124
]
]
]
|
998c167d9286d0be07448a2781401a64c18d582e | ad80c85f09a98b1bfc47191c0e99f3d4559b10d4 | /code/src/kernel/ndirectory.cc | 088abd57dbc49ef7fe5790ba05e1c36b50fc2280 | []
| no_license | DSPNerd/m-nebula | 76a4578f5504f6902e054ddd365b42672024de6d | 52a32902773c10cf1c6bc3dabefd2fd1587d83b3 | refs/heads/master | 2021-12-07T18:23:07.272880 | 2009-07-07T09:47:09 | 2009-07-07T09:47:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,009 | cc | #define N_IMPLEMENTS nDirectory
#define N_KERNEL
//------------------------------------------------------------------------------
// (C) 2002 RadonLabs GmbH
//------------------------------------------------------------------------------
#include "kernel/ndirectory.h"
//------------------------------------------------------------------------------
/**
history:
- 30-Jan-2002 peter created
- 15-Feb-2003 cubejk linux support added
*/
nDirectory::nDirectory(nFileServer2* server) : fs(server)
{
// mark directory as closed
path[0] = 0;
empty = true;
this->numEntries=-1;
#if defined(__LINUX__) || defined(__MACOSX__)
this->dir = NULL;
this->d_ent = NULL;
#endif
}
//------------------------------------------------------------------------------
/**
*/
nDirectory::~nDirectory()
{
if(this->IsOpen())
{
n_printf("Warning: Directory destroyed before closing\n");
this->Close();
}
}
//------------------------------------------------------------------------------
/**
opens the specified directory
@param dirName the name of the directory to open
@return success
history:
- 30-Jan-2002 peter created
- 15-Feb-2003 cubejk linux support added
*/
bool
nDirectory::Open(const char* dirName)
{
n_assert(!this->IsOpen());
n_assert(dirName);
n_assert(strlen(dirName)>0);
// the filename must be made 'absolute', if it not already is.
// a filename is deemed to be 'absolute' if it beginns with '/', '\'
// or a driveletter. (the 2nd char is a ':')
this->fs->MakeAbsoluteMangled(dirName, this->path);
#ifdef __WIN32__
DWORD attr;
bool retval;
this->handle = NULL;
// test the file existence and that it is a directory...
attr = GetFileAttributes(this->path.c_str());
if ((attr != 0xffffffff) && (attr & FILE_ATTRIBUTE_DIRECTORY))
{
this->empty = !(this->SetToFirstEntry());
retval=true;
}
else
{
this->path[0] = 0;
retval=false;
}
return retval;
#else
bool retval = false;
struct stat attr;
// test the file existence and that it is a directory...
if (stat(this->path,&attr) == 0)
{
if (S_ISDIR(attr.st_mode))
{
this->dir = opendir(this->path);
if (this->dir != NULL)
{
this->empty = !(this->SetToFirstEntry());
retval = true;
}
}
else
{
this->path[0] = 0;
}
}
return retval;
#endif
}
//------------------------------------------------------------------------------
/**
closes the directory
history:
- 30-Jan-2002 peter created
- 15-Feb-2003 cubejk linux support added
*/
void
nDirectory::Close()
{
n_assert(this->IsOpen());
#ifdef __WIN32__
if (this->handle) {
FindClose(this->handle);
this->handle = NULL;
}
#else
if (this->dir != NULL)
if (closedir(this->dir) == 0)
{
this->dir = NULL;
this->d_ent = NULL; //pointer cleanup
}
else
{
char buf[255];
sprintf(buf, "Can't close Directory: %s!",this->path);
n_warn (buf);
}
#endif
this->numEntries = -1;
this->path[0] = 0;
}
//------------------------------------------------------------------------------
/**
asks if directory is empty
@return true if empty
history:
- 30-Jan-2002 peter created
- 15-Feb-2003 cubejk linux support added
*/
bool
nDirectory::IsEmpty()
{
n_assert(this->IsOpen());
return this->empty;
}
//------------------------------------------------------------------------------
/**
sets search index to first entry in directory
and selects the first entry
@return success
history:
- 30-Jan-2002 peter created
- 15-Feb-2003 cubejk linux support added
*/
bool
nDirectory::SetToFirstEntry()
{
n_assert(this->IsOpen());
#ifdef __WIN32__
this->ix = -1;
if(this->handle)
FindClose(this->handle);
stl_string tmpName(this->path);
tmpName += "/*.*";
this->handle = FindFirstFileA(tmpName.c_str(), &(this->findData));
if (this->handle == INVALID_HANDLE_VALUE)
return false;
while ((strcmp(this->findData.cFileName, "..") ==0) || (strcmp(this->findData.cFileName, ".") ==0))
if(!FindNextFileA(this->handle, &this->findData))
return false;
this->ix = 0;
return true;
#else
n_assert (this->dir != NULL)
rewinddir(this->dir);
//skip '.' and '..'
do
{
this->d_ent = readdir(this->dir);
if (this->d_ent == NULL)
{
//break if there is no first entry
this->ix = -1;
return false;
}
}
while (this->d_ent->d_name[0] == '.'
|| (this->d_ent->d_name[0]=='.' && this->d_ent->d_name[1]=='.')
);
this->ix = 0;
return true;
#endif
}
//------------------------------------------------------------------------------
/**
selects next directory entry
@return success
history:
- 30-Jan-2002 peter created
- 15-Feb-2003 cubejk linux support added
*/
bool
nDirectory::SetToNextEntry()
{
n_assert(this->IsOpen());
#ifdef __WIN32__
n_assert(this->handle);
n_assert(this->handle != INVALID_HANDLE_VALUE);
bool suc = (FindNextFileA(this->handle,&(this->findData)) != 0) ? true : false;
if(suc)
this->ix++;
return suc;
#else
n_assert (this->dir != NULL)
this->d_ent = readdir(this->dir);
if (this->d_ent != NULL)
{
this->ix++;
return true;
}
return false;
#endif
}
//------------------------------------------------------------------------------
/**
gets name of actual directory entry
@return the name
history:
- 30-Jan-2002 peter created
- 15-Feb-2003 cubejk linux support added
*/
const char*
nDirectory::GetEntryName()
{
n_assert(this->IsOpen());
#ifdef __WIN32__
n_assert(this->handle);
n_assert(this->handle != INVALID_HANDLE_VALUE);
this->apath = this->path;
this->apath += '/';
this->apath += this->findData.cFileName;
return this->apath.c_str();
#else
n_assert(this->dir != NULL);
n_assert(this->d_ent != NULL);
this->apath = this->path;
this->apath += '/';
this->apath += this->d_ent->d_name;
return this->apath.c_str();
#endif
}
//------------------------------------------------------------------------------
/**
gets type of actual directory entry
@return FILE or DIRECTORY
history:
- 30-Jan-2002 peter created
- 15-Feb-2003 cubejk linux support added
*/
nDirectory::nEntryType
nDirectory::GetEntryType()
{
n_assert(this->IsOpen());
#ifdef __WIN32__
n_assert(this->handle);
n_assert(this->handle != INVALID_HANDLE_VALUE);
if(this->findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
return DIRECTORY;
else
return FILE;
#else
struct stat attr;
stat(this->GetEntryName(),&attr);
if (S_ISREG(attr.st_mode))
return FILE;
if (S_ISDIR(attr.st_mode))
return DIRECTORY;
return INVALID;
#endif
}
//------------------------------------------------------------------------------
/**
gets number of entries in directory
@return number of entries
history:
- 30-Jan-2002 peter created
- 15-Feb-2003 cubejk don't change the actual seek position
cache the result by the first run
*/
int
nDirectory::GetNumEntries()
{
n_assert(this->IsOpen());
if(this->numEntries >=0)
{
//use the cached count
return this->numEntries;
}
else
{
int temp_ix = this->ix;
this->numEntries = 0;
if(this->SetToFirstEntry())
{
this->numEntries++;
while(this->SetToNextEntry())
this->numEntries++;
}
//go back to old position
if(this->SetToFirstEntry())
{
while (this->ix < temp_ix)
this->SetToNextEntry();
}
return this->numEntries;
}
}
//------------------------------------------------------------------------------
/**
gets name of entry at specified position in directory
@param index number of entry
@return name of entry
history:
- 30-Jan-2002 peter created
*/
const char*
nDirectory::GetEntryName(int index)
{
n_assert(this->IsOpen());
n_assert(!this->empty);
if (index < this->ix)
if(!this->SetToFirstEntry())
return 0;
while (this->ix < index)
if (!this->SetToNextEntry())
return 0;
return this->GetEntryName();
}
//------------------------------------------------------------------------------
/**
gets type of entry at specified position in directory
@param index number of entry
@return FILE or DIRECTORY or INVALID if there is no entry with number index
history:
- 30-Jan-2002 peter created
*/
nDirectory::nEntryType
nDirectory::GetEntryType(int index)
{
n_assert(this->IsOpen());
n_assert(!this->empty);
if (index < this->ix)
if(!this->SetToFirstEntry())
return INVALID;
while (this->ix < index)
if (!this->SetToNextEntry())
return INVALID;
return this->GetEntryType();
}
| [
"plushe@411252de-2431-11de-b186-ef1da62b6547"
]
| [
[
[
1,
425
]
]
]
|
82e27fb296ff759a502761f4fa88bb315f02c2ff | 91b964984762870246a2a71cb32187eb9e85d74e | /SRC/OFFI SRC!/_Multimedia/WaveStream/cgwave.cpp | dad89e86577f89622f59f16a6fff9afa958d323c | []
| no_license | willrebuild/flyffsf | e5911fb412221e00a20a6867fd00c55afca593c7 | d38cc11790480d617b38bb5fc50729d676aef80d | refs/heads/master | 2021-01-19T20:27:35.200154 | 2011-02-10T12:34:43 | 2011-02-10T12:34:43 | 32,710,780 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,335 | cpp | /*===========================================================================*\
|
| File: cgwave.cpp
|
| Description:
|
|-----------------------------------------------------------------------------
|
| Copyright (C) 1995-1996 Microsoft Corporation. All Rights Reserved.
|
| Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation
|
\*===========================================================================*/
/**************************************************************************
(C) Copyright 1995-1996 Microsoft Corp. All rights reserved.
You have a royalty-free right to use, modify, reproduce and
distribute the Sample Files (and/or any modified version) in
any way you find useful, provided that you agree that
Microsoft has no warranty obligations or liability for any
Sample Application Files which are modified.
we do not recomend you base your game on IKlowns, start with one of
the other simpler sample apps in the GDK
**************************************************************************/
//** include files **
//#ifndef __WATCOMC__
//#define WIN32_LEAN_AND_MEAN
//#endif
#include "stdafx.h"
#include <mmsystem.h>
#include "cgwave.h"
//** local definitions **
//** external functions **
//** external data **
//** public data **
//** private data **
//** public functions **
//** private functions **
HMMIO PmmioOpen(LPSTR szFilename, LPMMIOINFO lpmmioinfo, DWORD dwOpenFlags)
{
HMMIO hmmio;
// CHAR err[MAX_PATH];
hmmio = mmioOpen( szFilename, lpmmioinfo, dwOpenFlags);
if (hmmio==NULL) {
TRACE("%s open error!", szFilename );
//sprintf( err, "%s open error!", szFilename );
//AfxMessageBox(err);
return NULL;
}
FILE *tp = fopen( szFilename, "rb" );
mmioSeek(hmmio, 0, SEEK_SET);
fclose(tp);
return hmmio;
}
// ----------------------------------------------------------
// WaveOpenFile -
// This function will open a wave input file and prepare
// it for reading, so the data can be easily read with
// WaveReadFile. Returns 0 if successful, the error code
// if not.
// pszFileName - Input filename to load.
// phmmioIn - Pointer to handle which will
// be used for further mmio routines.
// ppwfxInfo - Ptr to ptr to WaveFormatEx
// structure with all info about the file.
// ----------------------------------------------------------
int WaveOpenFile(
char *pszPackName,
char *pszFileName,
HMMIO *phmmioIn,
WAVEFORMATEX **ppwfxInfo,
MMCKINFO *pckInRIFF
)
{
HMMIO hmmioIn;
MMCKINFO ckIn; // chunk info. for general use.
PCMWAVEFORMAT pcmWaveFormat; // Temporary PCM format structure to load in.
WORD cbExtraAlloc; // Extra bytes for waveformatex structure for weird formats.
int nError; // Return value.
// Initialization...
*ppwfxInfo = NULL;
nError = 0;
hmmioIn = NULL;
if ((hmmioIn = PmmioOpen( pszFileName, NULL, MMIO_ALLOCBUF | MMIO_READ)) == NULL)
{
nError = ER_CANNOTOPEN;
goto ERROR_READING_WAVE;
}
if ((nError = (int)mmioDescend(hmmioIn, pckInRIFF, NULL, 0)) != 0)
{
goto ERROR_READING_WAVE;
}
if ((pckInRIFF->ckid != FOURCC_RIFF) || (pckInRIFF->fccType != mmioFOURCC('W', 'A', 'V', 'E')))
{
nError = ER_NOTWAVEFILE;
goto ERROR_READING_WAVE;
}
/* Search the input file for for the 'fmt ' chunk. */
ckIn.ckid = mmioFOURCC('f', 'm', 't', ' ');
if ((nError = (int)mmioDescend(hmmioIn, &ckIn, pckInRIFF, MMIO_FINDCHUNK)) != 0)
{
goto ERROR_READING_WAVE;
}
/* Expect the 'fmt' chunk to be at least as large as <PCMWAVEFORMAT>;
* if there are extra parameters at the end, we'll ignore them */
if (ckIn.cksize < (long) sizeof(PCMWAVEFORMAT))
{
nError = ER_NOTWAVEFILE;
goto ERROR_READING_WAVE;
}
/* Read the 'fmt ' chunk into <pcmWaveFormat>.*/
if (mmioRead(hmmioIn, (HPSTR) &pcmWaveFormat, (long) sizeof(pcmWaveFormat)) != (long) sizeof(pcmWaveFormat))
{
nError = ER_CANNOTREAD;
goto ERROR_READING_WAVE;
}
// Ok, allocate the waveformatex, but if its not pcm
// format, read the next word, and thats how many extra
// bytes to allocate.
if (pcmWaveFormat.wf.wFormatTag == WAVE_FORMAT_PCM)
cbExtraAlloc = 0;
else
{
// Read in length of extra bytes.
if (mmioRead(hmmioIn, (LPSTR) &cbExtraAlloc,
(long) sizeof(cbExtraAlloc)) != (long) sizeof(cbExtraAlloc))
{
nError = ER_CANNOTREAD;
goto ERROR_READING_WAVE;
}
}
// Ok, now allocate that waveformatex structure.
if ((*ppwfxInfo = (LPWAVEFORMATEX)GlobalAlloc(GMEM_FIXED, sizeof(WAVEFORMATEX)+cbExtraAlloc)) == NULL)
{
nError = ER_MEM;
goto ERROR_READING_WAVE;
}
// Copy the bytes from the pcm structure to the waveformatex structure
memcpy(*ppwfxInfo, &pcmWaveFormat, sizeof(pcmWaveFormat));
(*ppwfxInfo)->cbSize = cbExtraAlloc;
// Now, read those extra bytes into the structure, if cbExtraAlloc != 0.
if (cbExtraAlloc != 0)
{
if (mmioRead(hmmioIn, (LPSTR) (((BYTE*)&((*ppwfxInfo)->cbSize))+sizeof(cbExtraAlloc)),
(long) (cbExtraAlloc)) != (long) (cbExtraAlloc))
{
nError = ER_NOTWAVEFILE;
goto ERROR_READING_WAVE;
}
}
/* Ascend the input file out of the 'fmt ' chunk. */
if ((nError = mmioAscend(hmmioIn, &ckIn, 0)) != 0)
{
goto ERROR_READING_WAVE;
}
goto TEMPCLEANUP;
ERROR_READING_WAVE:
if (*ppwfxInfo != NULL)
{
GlobalFree(*ppwfxInfo);
*ppwfxInfo = NULL;
}
if (hmmioIn != NULL)
{
mmioClose(hmmioIn, 0);
hmmioIn = NULL;
}
TEMPCLEANUP:
*phmmioIn = hmmioIn;
return(nError);
}
// ----------------------------------------------------------
// WaveStartDataRead -
// This routine has to be called before WaveReadFile as
// it searchs for the chunk to descend into for reading,
// that is, the 'data' chunk. For simplicity, this used
// to be in the open routine, but was taken out and moved
// to a separate routine so there was more control on the
// chunks that are before the data chunk, such as 'fact',
// etc...
// ----------------------------------------------------------
int WaveStartDataRead(
HMMIO *phmmioIn,
MMCKINFO *pckIn,
MMCKINFO *pckInRIFF
)
{
int nError;
nError = 0;
// Do a nice little seek...
if ((nError = mmioSeek(*phmmioIn, pckInRIFF->dwDataOffset
+ sizeof(FOURCC), SEEK_SET)) == -1)
{
//Assert(FALSE);
goto ERROR_READING_WAVE;
}
nError = 0;
// Search the input file for for the 'data' chunk.
pckIn->ckid = mmioFOURCC('d', 'a', 't', 'a');
if ((nError = mmioDescend(*phmmioIn, pckIn, pckInRIFF, MMIO_FINDCHUNK)) != 0)
{
goto ERROR_READING_WAVE;
}
goto CLEANUP;
ERROR_READING_WAVE:
CLEANUP:
return(nError);
}
// ----------------------------------------------------------
// WaveReadFile -
// This will read wave data from the wave file. Make
// sure we're descended into the data chunk, else this
// will fail bigtime!
// hmmioIn - Handle to mmio.
// cbRead - # of bytes to read.
// pbDest - Destination buffer to put bytes.
// cbActualRead - # of bytes actually read.
// ----------------------------------------------------------
int WaveReadFile(
HMMIO hmmioIn,
UINT cbRead,
BYTE *pbDest,
MMCKINFO *pckIn,
UINT *cbActualRead
)
{
MMIOINFO mmioinfoIn; // current status of <hmmioIn>
int nError;
UINT cT, cbDataIn;
nError = 0;
if (nError = mmioGetInfo(hmmioIn, &mmioinfoIn, 0) != 0)
{
goto ERROR_CANNOT_READ;
}
cbDataIn = cbRead;
if (cbDataIn > pckIn->cksize)
cbDataIn = pckIn->cksize;
pckIn->cksize -= cbDataIn;
for (cT = 0; cT < cbDataIn; cT++)
{
// Copy the bytes from the io to the buffer.
if (mmioinfoIn.pchNext == mmioinfoIn.pchEndRead)
{
if ((nError = mmioAdvance(hmmioIn, &mmioinfoIn, MMIO_READ)) != 0)
{
goto ERROR_CANNOT_READ;
}
if (mmioinfoIn.pchNext == mmioinfoIn.pchEndRead)
{
nError = ER_CORRUPTWAVEFILE;
goto ERROR_CANNOT_READ;
}
}
// Actual copy.
*((BYTE*)pbDest+cT) = *((BYTE*)mmioinfoIn.pchNext++);
}
if ((nError = mmioSetInfo(hmmioIn, &mmioinfoIn, 0)) != 0)
{
goto ERROR_CANNOT_READ;
}
*cbActualRead = cbDataIn;
goto FINISHED_READING;
ERROR_CANNOT_READ:
*cbActualRead = 0;
FINISHED_READING:
return(nError);
}
// ----------------------------------------------------------
// WaveCloseFile -
// This will close the wave file openned with WaveOpenFile.
// phmmioIn - Pointer to the handle to input MMIO.
// ppwfxSrc - Pointer to pointer to WaveFormatEx structure.
//
// Returns 0 if successful, non-zero if there was a warning.
// ----------------------------------------------------------
int WaveCloseReadFile(
HMMIO *phmmio,
WAVEFORMATEX **ppwfxSrc
)
{
if (*ppwfxSrc != NULL)
{
GlobalFree(*ppwfxSrc);
*ppwfxSrc = NULL;
}
if (*phmmio != NULL)
{
mmioClose(*phmmio, 0);
*phmmio = NULL;
}
return(0);
}
| [
"[email protected]@e2c90bd7-ee55-cca0-76d2-bbf4e3699278"
]
| [
[
[
1,
356
]
]
]
|
6bb3ac02fc512225b6b91d03671908d6c5a0a67d | 854ee643a4e4d0b7a202fce237ee76b6930315ec | /arcemu_svn/src/arcemu-world/MiscHandler.cpp | 794a69a4d9b0b8f973cf48ca6a165eedadc2a187 | []
| no_license | miklasiak/projekt | df37fa82cf2d4a91c2073f41609bec8b2f23cf66 | 064402da950555bf88609e98b7256d4dc0af248a | refs/heads/master | 2021-01-01T19:29:49.778109 | 2008-11-10T17:14:14 | 2008-11-10T17:14:14 | 34,016,391 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 65,275 | cpp | /*
* ArcEmu MMORPG Server
* Copyright (C) 2005-2007 Ascent Team <http://www.ascentemu.com/>
* Copyright (C) 2008 <http://www.ArcEmu.org/>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "StdAfx.h"
void WorldSession::HandleRepopRequestOpcode( WorldPacket & recv_data )
{
sLog.outDebug( "WORLD: Recvd CMSG_REPOP_REQUEST Message" );
if(_player->m_CurrentTransporter)
_player->m_CurrentTransporter->RemovePlayer(_player);
GetPlayer()->RepopRequestedPlayer();
}
void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
{
if(!_player->IsInWorld()) return;
// uint8 slot = 0;
uint32 itemid = 0;
uint32 amt = 1;
uint8 lootSlot = 0;
uint8 error = 0;
SlotResult slotresult;
Item *add;
Loot *pLoot = NULL;
if(_player->isCasting())
_player->InterruptSpell();
GameObject * pGO = NULL;
Creature * pCreature = NULL;
uint32 guidtype = GET_TYPE_FROM_GUID(_player->GetLootGUID());
if(guidtype == HIGHGUID_TYPE_UNIT)
{
pCreature = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(GetPlayer()->GetLootGUID()));
if (!pCreature)return;
pLoot=&pCreature->loot;
}
else if(guidtype == HIGHGUID_TYPE_GAMEOBJECT)
{
pGO = _player->GetMapMgr()->GetGameObject(GET_LOWGUID_PART(GetPlayer()->GetLootGUID()));
if(!pGO)return;
pLoot=&pGO->loot;
}else if( guidtype == HIGHGUID_TYPE_ITEM )
{
Item *pItem = _player->GetItemInterface()->GetItemByGUID(_player->GetLootGUID());
if(!pItem)
return;
pLoot = pItem->loot;
}else if( guidtype == HIGHGUID_TYPE_PLAYER )
{
Player * pl = _player->GetMapMgr()->GetPlayer((uint32)GetPlayer()->GetLootGUID());
if(!pl) return;
pLoot = &pl->loot;
}
if(!pLoot) return;
recv_data >> lootSlot;
if (lootSlot >= pLoot->items.size())
{
sLog.outDebug("AutoLootItem: Player %s might be using a hack! (slot %d, size %d)",
GetPlayer()->GetName(), lootSlot, pLoot->items.size());
return;
}
amt = pLoot->items.at(lootSlot).iItemsCount;
if( pLoot->items.at(lootSlot).roll != NULL )
return;
if (!pLoot->items.at(lootSlot).ffa_loot)
{
if (!amt)//Test for party loot
{
GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL, NULL,INV_ERR_ALREADY_LOOTED);
return;
}
}
else
{
//make sure this player can still loot it in case of ffa_loot
LooterSet::iterator itr = pLoot->items.at(lootSlot).has_looted.find(_player->GetLowGUID());
if (pLoot->items.at(lootSlot).has_looted.end() != itr)
{
GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL, NULL,INV_ERR_ALREADY_LOOTED);
return;
}
}
itemid = pLoot->items.at(lootSlot).item.itemproto->ItemId;
ItemPrototype* it = pLoot->items.at(lootSlot).item.itemproto;
if((error = _player->GetItemInterface()->CanReceiveItem(it, 1)) != 0)
{
_player->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, error);
return;
}
if(pGO)
CALL_GO_SCRIPT_EVENT(pGO, OnLootTaken)(_player, it);
else if(pCreature)
CALL_SCRIPT_EVENT(pCreature, OnLootTaken)(_player, it);
add = GetPlayer()->GetItemInterface()->FindItemLessMax(itemid, amt, false);
sHookInterface.OnLoot(_player, pCreature, 0, itemid);
if (!add)
{
slotresult = GetPlayer()->GetItemInterface()->FindFreeInventorySlot(it);
if(!slotresult.Result)
{
GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_INVENTORY_FULL);
return;
}
sLog.outDebug("AutoLootItem MISC");
Item *item = objmgr.CreateItem( itemid, GetPlayer());
item->SetUInt32Value(ITEM_FIELD_STACK_COUNT,amt);
if(pLoot->items.at(lootSlot).iRandomProperty!=NULL)
{
item->SetRandomProperty(pLoot->items.at(lootSlot).iRandomProperty->ID);
item->ApplyRandomProperties(false);
}
else if(pLoot->items.at(lootSlot).iRandomSuffix != NULL)
{
item->SetRandomSuffix(pLoot->items.at(lootSlot).iRandomSuffix->id);
item->ApplyRandomProperties(false);
}
if( GetPlayer()->GetItemInterface()->SafeAddItem(item,slotresult.ContainerSlot, slotresult.Slot) )
{
sQuestMgr.OnPlayerItemPickup(GetPlayer(),item);
_player->GetSession()->SendItemPushResult(item,false,true,true,true,slotresult.ContainerSlot,slotresult.Slot,1);
}
else
item->DeleteMe();
}
else
{
add->SetCount(add->GetUInt32Value(ITEM_FIELD_STACK_COUNT) + amt);
add->m_isDirty = true;
sQuestMgr.OnPlayerItemPickup(GetPlayer(),add);
_player->GetSession()->SendItemPushResult(add, false, false, true, false, _player->GetItemInterface()->GetBagSlotByGuid(add->GetGUID()), 0xFFFFFFFF,amt);
}
//in case of ffa_loot update only the player who recives it.
if (!pLoot->items.at(lootSlot).ffa_loot)
{
pLoot->items.at(lootSlot).iItemsCount = 0;
// this gets sent to all looters
WorldPacket data(1);
data.SetOpcode(SMSG_LOOT_REMOVED);
data << lootSlot;
Player * plr;
for(LooterSet::iterator itr = pLoot->looters.begin(); itr != pLoot->looters.end(); ++itr)
{
if((plr = _player->GetMapMgr()->GetPlayer(*itr)) != 0)
plr->GetSession()->SendPacket(&data);
}
}
else
{
pLoot->items.at(lootSlot).has_looted.insert(_player->GetLowGUID());
WorldPacket data(1);
data.SetOpcode(SMSG_LOOT_REMOVED);
data << lootSlot;
_player->GetSession()->SendPacket(&data);
}
/* WorldPacket idata(45);
if(it->Class == ITEM_CLASS_QUEST)
{
uint32 pcount = _player->GetItemInterface()->GetItemCount(it->ItemId, true);
BuildItemPushResult(&idata, _player->GetGUID(), ITEM_PUSH_TYPE_LOOT, amt, itemid, pLoot->items.at(lootSlot).iRandomProperty ? pLoot->items.at(lootSlot).iRandomProperty->ID : 0,0xFF,0,0xFFFFFFFF,pcount);
}
else BuildItemPushResult(&idata, _player->GetGUID(), ITEM_PUSH_TYPE_LOOT, amt, itemid, pLoot->items.at(lootSlot).iRandomProperty ? pLoot->items.at(lootSlot).iRandomProperty->ID : 0);
if(_player->InGroup())
_player->GetGroup()->SendPacketToAll(&idata);
else
SendPacket(&idata);*/
/* any left yet? (for fishing bobbers) */
if(pGO && pGO->GetEntry() ==GO_FISHING_BOBBER)
{
int count=0;
for(vector<__LootItem>::iterator itr = pLoot->items.begin(); itr != pLoot->items.end(); ++itr)
count += (*itr).iItemsCount;
if(!count)
pGO->ExpireAndDelete();
}
}
void WorldSession::HandleLootMoneyOpcode( WorldPacket & recv_data )
{
if(!_player->IsInWorld()) return;
Loot * pLoot = NULL;
uint64 lootguid=GetPlayer()->GetLootGUID();
if(!lootguid)
return; // duno why this happens
if(_player->isCasting())
_player->InterruptSpell();
WorldPacket pkt;
Unit * pt = 0;
uint32 guidtype = GET_TYPE_FROM_GUID(lootguid);
if(guidtype == HIGHGUID_TYPE_UNIT)
{
Creature* pCreature = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(lootguid));
if(!pCreature)return;
pLoot=&pCreature->loot;
pt = pCreature;
}
else if(guidtype == HIGHGUID_TYPE_GAMEOBJECT)
{
GameObject* pGO = _player->GetMapMgr()->GetGameObject(GET_LOWGUID_PART(lootguid));
if(!pGO)return;
pLoot=&pGO->loot;
}
else if(guidtype == HIGHGUID_TYPE_CORPSE)
{
Corpse *pCorpse = objmgr.GetCorpse((uint32)lootguid);
if(!pCorpse)return;
pLoot=&pCorpse->loot;
}
else if(guidtype == HIGHGUID_TYPE_PLAYER)
{
Player * pPlayer = _player->GetMapMgr()->GetPlayer((uint32)lootguid);
if(!pPlayer) return;
pLoot = &pPlayer->loot;
pPlayer->bShouldHaveLootableOnCorpse = false;
pt = pPlayer;
}
else if( guidtype == HIGHGUID_TYPE_ITEM )
{
Item *pItem = _player->GetItemInterface()->GetItemByGUID(lootguid);
if(!pItem)
return;
pLoot = pItem->loot;
}
if (!pLoot)
{
//bitch about cheating maybe?
return;
}
uint32 money = pLoot->gold;
pLoot->gold=0;
WorldPacket data(1);
data.SetOpcode(SMSG_LOOT_CLEAR_MONEY);
// send to all looters
Player * plr;
for(LooterSet::iterator itr = pLoot->looters.begin(); itr != pLoot->looters.end(); ++itr)
{
if((plr = _player->GetMapMgr()->GetPlayer(*itr)) != 0)
plr->GetSession()->SendPacket(&data);
}
if(!_player->InGroup())
{
if(money)
{
GetPlayer()->ModUnsigned32Value( PLAYER_FIELD_COINAGE , money);
sHookInterface.OnLoot(_player, pt, money, 0);
}
}
else
{
//this code is wrong mustbe party not raid!
Group* party = _player->GetGroup();
if(party)
{
/*uint32 share = money/party->MemberCount();*/
vector<Player*> targets;
targets.reserve(party->MemberCount());
GroupMembersSet::iterator itr;
SubGroup * sgrp;
party->getLock().Acquire();
for(uint32 i = 0; i < party->GetSubGroupCount(); i++)
{
sgrp = party->GetSubGroup(i);
for(itr = sgrp->GetGroupMembersBegin(); itr != sgrp->GetGroupMembersEnd(); ++itr)
{
if((*itr)->m_loggedInPlayer && (*itr)->m_loggedInPlayer->GetZoneId() == _player->GetZoneId() && _player->GetInstanceID() == (*itr)->m_loggedInPlayer->GetInstanceID())
targets.push_back((*itr)->m_loggedInPlayer);
}
}
party->getLock().Release();
if(!targets.size())
return;
uint32 share = money / uint32(targets.size());
pkt.SetOpcode(SMSG_LOOT_MONEY_NOTIFY);
pkt << share;
for(vector<Player*>::iterator itr = targets.begin(); itr != targets.end(); ++itr)
{
(*itr)->ModUnsigned32Value(PLAYER_FIELD_COINAGE, share);
(*itr)->GetSession()->SendPacket(&pkt);
}
}
}
}
void WorldSession::HandleLootOpcode( WorldPacket & recv_data )
{
if(!_player->IsInWorld())
return;
uint64 guid;
recv_data >> guid;
if ( !guid ) return;
if(_player->isCasting())
_player->InterruptSpell();
_player->RemoveStealth(); // cebernic:RemoveStealth on looting. Blizzlike
if(_player->InGroup() && !_player->m_bg)
{
Group * party = _player->GetGroup();
if(party)
{
if(party->GetMethod() == PARTY_LOOT_MASTER)
{
WorldPacket data(SMSG_LOOT_MASTER_LIST, 330); // wont be any larger
data << (uint8)party->MemberCount();
uint32 real_count = 0;
SubGroup *s;
GroupMembersSet::iterator itr;
party->Lock();
for(uint32 i = 0; i < party->GetSubGroupCount(); ++i)
{
s = party->GetSubGroup(i);
for(itr = s->GetGroupMembersBegin(); itr != s->GetGroupMembersEnd(); ++itr)
{
if((*itr)->m_loggedInPlayer && _player->GetZoneId() == (*itr)->m_loggedInPlayer->GetZoneId())
{
data << (*itr)->m_loggedInPlayer->GetGUID();
++real_count;
}
}
}
party->Unlock();
*(uint8*)&data.contents()[0] = real_count;
party->SendPacketToAll(&data);
}
/* //this commented code is not used because it was never tested and finished !
else if(party->GetMethod() == PARTY_LOOT_RR)
{
Creature *target=GetPlayer()->GetMapMgr()->GetCreature(guid); //maybe we should extend this to other object types too
if(target)
{
if(target->TaggerGuid==GetPlayer()->GetGUID())
GetPlayer()->SendLoot(guid,LOOT_CORPSE);
else return;
}
}*/
}
}
GetPlayer()->SendLoot(guid,LOOT_CORPSE);
}
void WorldSession::HandleLootReleaseOpcode( WorldPacket & recv_data )
{
if(!_player->IsInWorld()) return;
uint64 guid;
recv_data >> guid;
WorldPacket data(SMSG_LOOT_RELEASE_RESPONSE, 9);
data << guid << uint8( 1 );
SendPacket( &data );
_player->SetLootGUID(0);
_player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
_player->m_currentLoot = 0;
if( GET_TYPE_FROM_GUID( guid ) == HIGHGUID_TYPE_UNIT )
{
Creature* pCreature = _player->GetMapMgr()->GetCreature( GET_LOWGUID_PART(guid) );
if( pCreature == NULL )
return;
// remove from looter set
pCreature->loot.looters.erase(_player->GetLowGUID());
if( pCreature->loot.gold <= 0)
{
for( std::vector<__LootItem>::iterator i = pCreature->loot.items.begin(); i != pCreature->loot.items.end(); i++ )
if( i->iItemsCount > 0 )
{
ItemPrototype* proto = i->item.itemproto;
if( proto->Class != 12 )
return;
if( _player->HasQuestForItem( i->item.itemproto->ItemId ) )
return;
}
pCreature->BuildFieldUpdatePacket( _player, UNIT_DYNAMIC_FLAGS, 0 );
if( !pCreature->Skinned )
{
if( lootmgr.IsSkinnable( pCreature->GetEntry() ) )
{
pCreature->BuildFieldUpdatePacket( _player, UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE );
}
}
}
}
else if( GET_TYPE_FROM_GUID( guid ) == HIGHGUID_TYPE_GAMEOBJECT )
{
GameObject* pGO = _player->GetMapMgr()->GetGameObject( (uint32)guid );
if( pGO == NULL )
return;
switch( pGO->GetUInt32Value( GAMEOBJECT_TYPE_ID ) )
{
case GAMEOBJECT_TYPE_FISHINGNODE:
{
pGO->loot.looters.erase(_player->GetLowGUID());
if(pGO->IsInWorld())
{
pGO->RemoveFromWorld(true);
}
delete pGO;
}break;
case GAMEOBJECT_TYPE_CHEST:
{
pGO->loot.looters.erase( _player->GetLowGUID() );
//check for locktypes
Lock* pLock = dbcLock.LookupEntry( pGO->GetInfo()->SpellFocus );
if( pLock )
{
for( uint32 i=0; i < 5; i++ )
{
if( pLock->locktype[i] )
{
if( pLock->locktype[i] == 1 ) //Item or Quest Required;
{
pGO->Despawn((sQuestMgr.GetGameObjectLootQuest(pGO->GetEntry()) ? 180000 + ( RandomUInt( 180000 ) ) : 900000 + ( RandomUInt( 600000 ) ) ) );
return;
}
else if( pLock->locktype[i] == 2 ) //locktype;
{
//herbalism and mining;
if( pLock->lockmisc[i] == LOCKTYPE_MINING || pLock->lockmisc[i] == LOCKTYPE_HERBALISM )
{
//we still have loot inside.
if( pGO->HasLoot() )
{
pGO->SetUInt32Value( GAMEOBJECT_STATE, 1 );
// TODO : redo this temporary fix, because for some reason hasloot is true even when we loot everything
// my guess is we need to set up some even that rechecks the GO in 10 seconds or something
//pGO->Despawn( 600000 + ( RandomUInt( 300000 ) ) );
return;
}
if( pGO->CanMine() )
{
pGO->loot.items.clear();
pGO->UseMine();
return;
}
else
{
pGO->CalcMineRemaining( true );
pGO->Despawn( 900000 + ( RandomUInt( 600000 ) ) );
return;
}
}
else
{
if(pGO->HasLoot())
{
pGO->SetUInt32Value(GAMEOBJECT_STATE, 1);
return;
}
pGO->Despawn(sQuestMgr.GetGameObjectLootQuest(pGO->GetEntry()) ? 180000 + ( RandomUInt( 180000 ) ) : (IS_INSTANCE(pGO->GetMapId()) ? 0 : 900000 + ( RandomUInt( 600000 ) ) ) );
return;
}
}
else //other type of locks that i dont bother to split atm ;P
{
if(pGO->HasLoot())
{
pGO->SetUInt32Value(GAMEOBJECT_STATE, 1);
return;
}
pGO->Despawn(sQuestMgr.GetGameObjectLootQuest(pGO->GetEntry()) ? 180000 + ( RandomUInt( 180000 ) ) : (IS_INSTANCE(pGO->GetMapId()) ? 0 : 900000 + ( RandomUInt( 600000 ) ) ) );
return;
}
}
}
}
else
{
if( pGO->HasLoot() )
{
pGO->SetUInt32Value(GAMEOBJECT_STATE, 1);
return;
}
pGO->Despawn(sQuestMgr.GetGameObjectLootQuest(pGO->GetEntry()) ? 180000 + ( RandomUInt( 180000 ) ) : (IS_INSTANCE(pGO->GetMapId()) ? 0 : 900000 + ( RandomUInt( 600000 ) ) ) );
return;
}
}
default:
break;
}
}
else if(GET_TYPE_FROM_GUID(guid) == HIGHGUID_TYPE_CORPSE)
{
Corpse *pCorpse = objmgr.GetCorpse((uint32)guid);
if(pCorpse)
pCorpse->SetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS, 0);
}
else if(GET_TYPE_FROM_GUID(guid) == HIGHGUID_TYPE_PLAYER)
{
Player *plr = objmgr.GetPlayer((uint32)guid);
if(plr)
{
plr->bShouldHaveLootableOnCorpse = false;
plr->loot.items.clear();
plr->RemoveFlag(UNIT_DYNAMIC_FLAGS, U_DYN_FLAG_LOOTABLE);
}
}
else if(GUID_HIPART(guid))
{
// suicide!
_player->GetItemInterface()->SafeFullRemoveItemByGuid(guid);
}
}
void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
{
uint32 min_level;
uint32 max_level;
uint32 class_mask;
uint32 race_mask;
uint32 zone_count;
uint32 * zones = 0;
uint32 name_count;
string * names = 0;
string chatname;
string unkstr;
bool cname;
uint32 i;
recv_data >> min_level >> max_level;
recv_data >> chatname >> unkstr >> race_mask >> class_mask;
recv_data >> zone_count;
if(zone_count > 0 && zone_count < 10)
{
zones = new uint32[zone_count];
for(i = 0; i < zone_count; ++i)
recv_data >> zones[i];
}
else
{
zone_count = 0;
}
recv_data >> name_count;
if(name_count > 0 && name_count < 10)
{
names = new string[name_count];
for(i = 0; i < name_count; ++i)
recv_data >> names[i];
}
else
{
name_count = 0;
}
if(chatname.length() > 0)
cname = true;
else
cname = false;
sLog.outDebug( "WORLD: Recvd CMSG_WHO Message with %u zones and %u names", zone_count, name_count );
bool gm = false;
uint32 team = _player->GetTeam();
if(HasGMPermissions())
gm = true;
uint32 sent_count = 0;
uint32 total_count = 0;
PlayerStorageMap::const_iterator itr,iend;
Player * plr;
uint32 lvl;
bool add;
WorldPacket data;
data.SetOpcode(SMSG_WHO);
data << uint64(0);
objmgr._playerslock.AcquireReadLock();
iend=objmgr._players.end();
itr=objmgr._players.begin();
while(itr !=iend && sent_count < 49) /* WhoList should display 49 names not including your own */
{
plr = itr->second;
++itr;
if(!plr->GetSession() || !plr->IsInWorld())
continue;
if(!sWorld.show_gm_in_who_list && !HasGMPermissions())
{
if(plr->GetSession()->HasGMPermissions())
continue;
}
// Team check
if(!gm && plr->GetTeam() != team && !plr->GetSession()->HasGMPermissions() &&!sWorld.interfaction_misc)
continue;
++total_count;
// Add by default, if we don't have any checks
add = true;
// Chat name
if(cname && chatname != *plr->GetNameString())
continue;
// Level check
lvl = plr->m_uint32Values[UNIT_FIELD_LEVEL];
if(min_level && max_level)
{
// skip players outside of level range
if(lvl < min_level || lvl > max_level)
continue;
}
// Zone id compare
if(zone_count)
{
// people that fail the zone check don't get added
add = false;
for(i = 0; i < zone_count; ++i)
{
if(zones[i] == plr->GetZoneId())
{
add = true;
break;
}
}
}
if(!((class_mask >> 1) & plr->getClassMask()) || !((race_mask >> 1) & plr->getRaceMask()))
add = false;
// skip players that fail zone check
if(!add)
continue;
// name check
if(name_count)
{
// people that fail name check don't get added
add = false;
for(i = 0; i < name_count; ++i)
{
if(!strnicmp(names[i].c_str(), plr->GetName(), names[i].length()))
{
add = true;
break;
}
}
}
if(!add)
continue;
// if we're here, it means we've passed all testing
// so add the names :)
data << plr->GetName();
if(plr->m_playerInfo->guild)
data << plr->m_playerInfo->guild->GetGuildName();
else
data << uint8(0); // Guild name
data << plr->m_uint32Values[UNIT_FIELD_LEVEL];
data << uint32(plr->getClass());
data << uint32(plr->getRace());
data << uint8(0); // new string added in 2.4.0
data << uint32(plr->GetZoneId());
++sent_count;
}
objmgr._playerslock.ReleaseReadLock();
data.wpos(0);
data << sent_count;
data << sent_count;
SendPacket(&data);
// free up used memory
if(zones)
delete [] zones;
if(names)
delete [] names;
}
void WorldSession::HandleLogoutRequestOpcode( WorldPacket & recv_data )
{
Player *pPlayer = GetPlayer();
WorldPacket data( SMSG_LOGOUT_RESPONSE, 5 );
sLog.outDebug( "WORLD: Recvd CMSG_LOGOUT_REQUEST Message" );
if(pPlayer)
{
sHookInterface.OnLogoutRequest(pPlayer);
if(HasGMPermissions())
{
//Logout on NEXT sessionupdate to preserve processing of dead packets (all pending ones should be processed)
SetLogoutTimer(1);
return;
}
if( pPlayer->CombatStatus.IsInCombat() || //can't quit still in combat
pPlayer->DuelingWith != NULL ) //can't quit still dueling or attacking
{
data << uint32(1) << uint8(0);
SendPacket( &data );
return;
}
if(pPlayer->m_isResting || // We are resting so log out instantly
pPlayer->GetTaxiState()) // or we are on a taxi
{
//Logout on NEXT sessionupdate to preserve processing of dead packets (all pending ones should be processed)
SetLogoutTimer(1);
return;
}
data << uint32(0); //Filler
data << uint8(0); //Logout accepted
SendPacket( &data );
//stop player from moving
pPlayer->SetMovement(MOVE_ROOT,1);
// Set the "player locked" flag, to prevent movement
pPlayer->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOCK_PLAYER);
//make player sit
pPlayer->SetStandState(STANDSTATE_SIT);
SetLogoutTimer(20000);
}
/*
> 0 = You can't Logout Now
*/
}
void WorldSession::HandlePlayerLogoutOpcode( WorldPacket & recv_data )
{
sLog.outDebug( "WORLD: Recvd CMSG_PLAYER_LOGOUT Message" );
if(!HasGMPermissions())
{
// send "You do not have permission to use this"
SendNotification(NOTIFICATION_MESSAGE_NO_PERMISSION);
} else {
LogoutPlayer(true);
}
}
void WorldSession::HandleLogoutCancelOpcode( WorldPacket & recv_data )
{
sLog.outDebug( "WORLD: Recvd CMSG_LOGOUT_CANCEL Message" );
Player *pPlayer = GetPlayer();
if(!pPlayer)
return;
//Cancel logout Timer
SetLogoutTimer(0);
//tell client about cancel
OutPacket(SMSG_LOGOUT_CANCEL_ACK);
//unroot player
pPlayer->SetMovement(MOVE_UNROOT,5);
// Remove the "player locked" flag, to allow movement
pPlayer->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOCK_PLAYER);
//make player stand
pPlayer->SetStandState(STANDSTATE_STAND);
sLog.outDebug( "WORLD: sent SMSG_LOGOUT_CANCEL_ACK Message" );
}
void WorldSession::HandleZoneUpdateOpcode( WorldPacket & recv_data )
{
uint32 newZone;
WPAssert(GetPlayer());
recv_data >> newZone;
if (GetPlayer()->GetZoneId() == newZone)
return;
sWeatherMgr.SendWeather(GetPlayer());
_player->ZoneUpdate(newZone);
//clear buyback
_player->GetItemInterface()->EmptyBuyBack();
}
void WorldSession::HandleSetTargetOpcode( WorldPacket & recv_data )
{
uint64 guid ;
recv_data >> guid;
if(guid == 0) // deselected target
{
// wait dude, 5 seconds -.-
_player->CombatStatusHandler_ResetPvPTimeout();
//_player->CombatStatus.ClearPrimaryAttackTarget();
}
if( GetPlayer( ) != 0 ){
GetPlayer( )->SetTarget(guid);
}
}
void WorldSession::HandleSetSelectionOpcode( WorldPacket & recv_data )
{
uint64 guid;
recv_data >> guid;
_player->SetSelection(guid);
if(_player->m_comboPoints)
_player->UpdateComboPoints();
_player->SetUInt64Value(UNIT_FIELD_TARGET, guid);
if(guid == 0) // deselected target
{
_player->CombatStatusHandler_ResetPvPTimeout();
//_player->CombatStatus.ClearPrimaryAttackTarget();
}
}
void WorldSession::HandleStandStateChangeOpcode( WorldPacket & recv_data )
{
uint8 animstate;
recv_data >> animstate;
_player->SetStandState(animstate);
}
void WorldSession::HandleBugOpcode( WorldPacket & recv_data )
{
uint32 suggestion, contentlen;
std::string content;
uint32 typelen;
std::string type;
recv_data >> suggestion >> contentlen >> content >> typelen >> type;
if( suggestion == 0 )
sLog.outDebug( "WORLD: Received CMSG_BUG [Bug Report]" );
else
sLog.outDebug( "WORLD: Received CMSG_BUG [Suggestion]" );
sLog.outDebug( type.c_str( ) );
sLog.outDebug( content.c_str( ) );
}
void WorldSession::HandleCorpseReclaimOpcode(WorldPacket &recv_data)
{
sLog.outDetail("WORLD: Received CMSG_RECLAIM_CORPSE");
uint64 guid;
recv_data >> guid;
if ( !guid ) return;
Corpse* pCorpse = objmgr.GetCorpse( (uint32)guid );
if( pCorpse == NULL ) return;
// Check that we're reviving from a corpse, and that corpse is associated with us.
if( pCorpse->GetUInt32Value( CORPSE_FIELD_OWNER ) != _player->GetLowGUID() && pCorpse->GetUInt32Value( CORPSE_FIELD_FLAGS ) == 5 )
{
WorldPacket data( SMSG_RESURRECT_FAILED, 4 );
data << uint32(1); // this is a real guess!
SendPacket(&data);
return;
}
// Check we are actually in range of our corpse
if ( pCorpse->GetDistance2dSq( _player ) > CORPSE_MINIMUM_RECLAIM_RADIUS_SQ )
{
WorldPacket data( SMSG_RESURRECT_FAILED, 4 );
data << uint32(1);
SendPacket(&data);
return;
}
// Check death clock before resurrect they must wait for release to complete
// cebernic: changes for better logic
if( time(NULL) < pCorpse->GetDeathClock() + CORPSE_RECLAIM_TIME )
{
WorldPacket data( SMSG_RESURRECT_FAILED, 4 );
data << uint32(1);
SendPacket(&data);
return;
}
GetPlayer()->ResurrectPlayer();
GetPlayer()->SetUInt32Value(UNIT_FIELD_HEALTH, GetPlayer()->GetUInt32Value(UNIT_FIELD_MAXHEALTH)/2 );
}
void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data)
{
if ( !_player->IsInWorld() ) return;
sLog.outDetail("WORLD: Received CMSG_RESURRECT_RESPONSE");
if ( _player->isAlive() )
return;
uint64 guid;
uint8 status;
recv_data >> guid;
recv_data >> status;
// need to check guid
Player * pl = _player->GetMapMgr()->GetPlayer( (uint32)guid );
if ( pl == NULL )
pl = objmgr.GetPlayer( (uint32)guid );
// checking valid resurrecter fixes exploits
if ( pl == NULL || status != 1 || !_player->m_resurrecter || _player->m_resurrecter != guid )
{
_player->m_resurrectHealth = 0;
_player->m_resurrectMana = 0;
_player->m_resurrecter = 0;
return;
}
_player->ResurrectPlayer();
_player->SetMovement(MOVE_UNROOT, 1);
}
void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data)
{
//sLog.outDetail("WORLD: Received CMSG_UPDATE_ACCOUNT_DATA");
uint32 uiID;
if(!sWorld.m_useAccountData)
return;
recv_data >> uiID;
if(uiID > 8)
{
// Shit..
sLog.outString("WARNING: Accountdata > 8 (%d) was requested to be updated by %s of account %d!", uiID, GetPlayer()->GetName(), this->GetAccountId());
return;
}
uint32 uiDecompressedSize;
recv_data >> uiDecompressedSize;
uLongf uid = uiDecompressedSize;
// client wants to 'erase' current entries
if(uiDecompressedSize == 0)
{
SetAccountData(uiID, NULL, false,0);
return;
}
if(uiDecompressedSize>100000)
{
Disconnect();
return;
}
if(uiDecompressedSize >= 65534)
{
// BLOB fields can't handle any more than this.
return;
}
size_t ReceivedPackedSize = recv_data.size() - 8;
char* data = new char[uiDecompressedSize+1];
memset(data,0,uiDecompressedSize+1); /* fix umr here */
if(uiDecompressedSize > ReceivedPackedSize) // if packed is compressed
{
int32 ZlibResult;
ZlibResult = uncompress((uint8*)data, &uid, recv_data.contents() + 8, (uLong)ReceivedPackedSize);
switch (ZlibResult)
{
case Z_OK: //0 no error decompression is OK
SetAccountData(uiID, data, false,uiDecompressedSize);
sLog.outDetail("WORLD: Successfully decompressed account data %d for %s, and updated storage array.", uiID, GetPlayer()->GetName());
break;
case Z_ERRNO: //-1
case Z_STREAM_ERROR: //-2
case Z_DATA_ERROR: //-3
case Z_MEM_ERROR: //-4
case Z_BUF_ERROR: //-5
case Z_VERSION_ERROR: //-6
{
delete [] data;
sLog.outString("WORLD WARNING: Decompression of account data %d for %s FAILED.", uiID, GetPlayer()->GetName());
break;
}
default:
delete [] data;
sLog.outString("WORLD WARNING: Decompression gave a unknown error: %x, of account data %d for %s FAILED.", ZlibResult, uiID, GetPlayer()->GetName());
break;
}
}
else
{
memcpy(data,recv_data.contents() + 8,uiDecompressedSize);
SetAccountData(uiID, data, false,uiDecompressedSize);
}
}
void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
{
//sLog.outDetail("WORLD: Received CMSG_REQUEST_ACCOUNT_DATA");
uint32 id;
if(!sWorld.m_useAccountData)
return;
recv_data >> id;
if(id > 8)
{
// Shit..
sLog.outString("WARNING: Accountdata > 8 (%d) was requested by %s of account %d!", id, GetPlayer()->GetName(), this->GetAccountId());
return;
}
AccountDataEntry* res = GetAccountData(id);
WorldPacket data ;
data.SetOpcode(SMSG_UPDATE_ACCOUNT_DATA);
data << id;
// if red does not exists if ID == 7 and if there is no data send 0
if (!res || !res->data) // if error, send a NOTHING packet
{
data << (uint32)0;
}
else
{
data << res->sz;
uLongf destsize;
if(res->sz>200)
{
data.resize( res->sz+800 ); // give us plenty of room to work with..
if ( ( compress(const_cast<uint8*>(data.contents()) + (sizeof(uint32)*2), &destsize, (const uint8*)res->data, res->sz)) != Z_OK)
{
sLog.outError("Error while compressing ACCOUNT_DATA");
return;
}
data.resize(destsize+8);
}
else
data.append( res->data,res->sz);
}
SendPacket(&data);
}
void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
{
sLog.outDebug( "WORLD: Received CMSG_SET_ACTION_BUTTON" );
uint8 button, misc, type;
uint16 action;
recv_data >> button >> action >> misc >> type;
sLog.outDebug( "BUTTON: %u ACTION: %u TYPE: %u MISC: %u", button, action, type, misc );
if(action==0)
{
sLog.outDebug( "MISC: Remove action from button %u", button );
//remove the action button from the db
GetPlayer()->setAction(button, 0, 0, 0);
}
else
{
if(button >= 120)
return;
if(type == 64 || type == 65)
{
sLog.outDebug( "MISC: Added Macro %u into button %u", action, button );
GetPlayer()->setAction(button,action,misc,type);
}
else if(type == 128)
{
sLog.outDebug( "MISC: Added Item %u into button %u", action, button );
GetPlayer()->setAction(button,action,misc,type);
}
else if(type == 0)
{
sLog.outDebug( "MISC: Added Spell %u into button %u", action, button );
GetPlayer()->setAction(button,action,type,misc);
}
}
#ifdef OPTIMIZED_PLAYER_SAVING
_player->save_Actions();
#endif
}
void WorldSession::HandleSetWatchedFactionIndexOpcode(WorldPacket &recvPacket)
{
uint32 factionid;
recvPacket >> factionid;
GetPlayer()->SetUInt32Value(PLAYER_FIELD_WATCHED_FACTION_INDEX, factionid);
#ifdef OPTIMIZED_PLAYER_SAVING
_player->save_Misc();
#endif
}
void WorldSession::HandleTogglePVPOpcode(WorldPacket& recv_data)
{
_player->PvPToggle();
}
void WorldSession::HandleAmmoSetOpcode(WorldPacket & recv_data)
{
uint32 ammoId;
recv_data >> ammoId;
if(!ammoId)
return;
ItemPrototype * xproto=ItemPrototypeStorage.LookupEntry(ammoId);
if(!xproto)
return;
if(xproto->Class != ITEM_CLASS_PROJECTILE || GetPlayer()->GetItemInterface()->GetItemCount(ammoId) == 0)
{
sCheatLog.writefromsession(GetPlayer()->GetSession(), "Definately cheating. tried to add %u as ammo.", ammoId);
GetPlayer()->GetSession()->Disconnect();
return;
}
if(xproto->RequiredLevel)
{
if(GetPlayer()->getLevel() < xproto->RequiredLevel)
{
GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL,NULL,INV_ERR_ITEM_RANK_NOT_ENOUGH);
_player->SetUInt32Value(PLAYER_AMMO_ID, 0);
_player->CalcDamage();
return;
}
}
if(xproto->RequiredSkill)
{
if(!GetPlayer()->_HasSkillLine(xproto->RequiredSkill))
{
GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL,NULL,INV_ERR_ITEM_RANK_NOT_ENOUGH);
_player->SetUInt32Value(PLAYER_AMMO_ID, 0);
_player->CalcDamage();
return;
}
if(xproto->RequiredSkillRank)
{
if(_player->_GetSkillLineCurrent(xproto->RequiredSkill, false) < xproto->RequiredSkillRank)
{
GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL,NULL,INV_ERR_ITEM_RANK_NOT_ENOUGH);
_player->SetUInt32Value(PLAYER_AMMO_ID, 0);
_player->CalcDamage();
return;
}
}
}
_player->SetUInt32Value(PLAYER_AMMO_ID, ammoId);
_player->CalcDamage();
#ifdef OPTIMIZED_PLAYER_SAVING
_player->save_Misc();
#endif
}
#define OPEN_CHEST 11437
void WorldSession::HandleGameObjectUse(WorldPacket & recv_data)
{
if(!_player->IsInWorld()) return;
uint64 guid;
recv_data >> guid;
SpellCastTargets targets;
Spell *spell = NULL;;
SpellEntry *spellInfo = NULL;;
sLog.outDebug("WORLD: CMSG_GAMEOBJ_USE: [GUID %d]", guid);
GameObject *obj = _player->GetMapMgr()->GetGameObject((uint32)guid);
if (!obj) return;
GameObjectInfo *goinfo= obj->GetInfo();
if (!goinfo) return;
Player *plyr = GetPlayer();
CALL_GO_SCRIPT_EVENT(obj, OnActivate)(_player);
_player->RemoveStealth(); // cebernic:RemoveStealth due to GO was using. Blizzlike
uint32 type = obj->GetUInt32Value(GAMEOBJECT_TYPE_ID);
switch (type)
{
case GAMEOBJECT_TYPE_CHAIR:
{
/*WorldPacket data(MSG_MOVE_HEARTBEAT, 66);
data << plyr->GetNewGUID();
data << uint8(0);
data << uint64(0);
data << obj->GetPositionX() << obj->GetPositionY() << obj->GetPositionZ() << obj->GetOrientation();
plyr->SendMessageToSet(&data, true);*/
plyr->SafeTeleport( plyr->GetMapId(), plyr->GetInstanceID(), obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), obj->GetOrientation() );
plyr->SetStandState(STANDSTATE_SIT_MEDIUM_CHAIR);
plyr->m_lastRunSpeed = 0; //counteract mount-bug; reset speed to zero to force update SetPlayerSpeed in next line.
//plyr->SetPlayerSpeed(RUN,plyr->m_base_runSpeed); <--cebernic : Oh No,this could be wrong. If I have some mods existed,this just on baserunspeed as a fixed value?
plyr->UpdateSpeed();
}break;
case GAMEOBJECT_TYPE_CHEST://cast da spell
{
spellInfo = dbcSpell.LookupEntry( OPEN_CHEST );
spell = SpellPool.PooledNew();
spell->Init(plyr, spellInfo, true, NULL);
_player->m_currentSpell = spell;
targets.m_unitTarget = obj->GetGUID();
spell->prepare(&targets);
}break;
case GAMEOBJECT_TYPE_FISHINGNODE:
{
obj->UseFishingNode(plyr);
}break;
case GAMEOBJECT_TYPE_DOOR:
{
// cebernic modified this state =0 org =1
if((obj->GetUInt32Value(GAMEOBJECT_STATE) == 0) ) //&& (obj->GetUInt32Value(GAMEOBJECT_FLAGS) == 33) )
obj->EventCloseDoor();
else
{
obj->SetUInt32Value(GAMEOBJECT_FLAGS, obj->GetUInt32Value( GAMEOBJECT_FLAGS ) | 1); // lock door
obj->SetUInt32Value(GAMEOBJECT_STATE, 0);
sEventMgr.AddEvent(obj,&GameObject::EventCloseDoor,EVENT_GAMEOBJECT_DOOR_CLOSE,20000,1,0);
}
}break;
case GAMEOBJECT_TYPE_FLAGSTAND:
{
// battleground/warsong gulch flag
if(plyr->m_bg)
plyr->m_bg->HookFlagStand(plyr, obj);
}break;
case GAMEOBJECT_TYPE_FLAGDROP:
{
// Dropped flag
if(plyr->m_bg)
plyr->m_bg->HookFlagDrop(plyr, obj);
}break;
case GAMEOBJECT_TYPE_QUESTGIVER:
{
// Questgiver
if(obj->HasQuests())
{
sQuestMgr.OnActivateQuestGiver(obj, plyr);
}
}break;
case GAMEOBJECT_TYPE_SPELLCASTER:
{
if (obj->m_summoner != NULL && obj->m_summoner->IsPlayer() && plyr != static_cast<Player*>(obj->m_summoner))
{
if (static_cast<Player*>(obj->m_summoner)->GetGroup() == NULL)
break;
else if (static_cast<Player*>(obj->m_summoner)->GetGroup() != plyr->GetGroup())
break;
}
SpellEntry *info = dbcSpell.LookupEntry(goinfo->SpellFocus);
if(!info)
break;
Spell * spell = SpellPool.PooledNew();
spell->Init(plyr, info, false, NULL);
//spell->SpellByOther = true;
SpellCastTargets targets;
targets.m_unitTarget = plyr->GetGUID();
spell->prepare(&targets);
if ( obj->charges > 0 && !--obj->charges )
obj->ExpireAndDelete();
}break;
case GAMEOBJECT_TYPE_RITUAL:
{
// store the members in the ritual, cast sacrifice spell, and summon.
uint32 i = 0;
if(!obj->m_ritualmembers || !obj->m_ritualspell || !obj->m_ritualcaster /*|| !obj->m_ritualtarget*/)
return;
for ( i = 0; i < goinfo->SpellFocus; i++ )
{
if(!obj->m_ritualmembers[i])
{
obj->m_ritualmembers[i] = plyr->GetLowGUID();
plyr->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, obj->GetGUID());
plyr->SetUInt32Value(UNIT_CHANNEL_SPELL, obj->m_ritualspell);
break;
}else if(obj->m_ritualmembers[i] == plyr->GetLowGUID())
{
// we're deselecting :(
obj->m_ritualmembers[i] = 0;
plyr->SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
plyr->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0);
return;
}
}
if ( i == goinfo->SpellFocus - 1 )
{
obj->m_ritualspell = 0;
Player * plr;
for ( i = 0; i < goinfo->SpellFocus; i++ )
{
plr = _player->GetMapMgr()->GetPlayer(obj->m_ritualmembers[i]);
if ( plr )
{
plr->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, 0);
plr->SetUInt32Value(UNIT_CHANNEL_SPELL, 0);
}
}
SpellEntry *info = NULL;
if( goinfo->ID == 36727 ) // summon portal
{
if ( !obj->m_ritualtarget )
return;
info = dbcSpell.LookupEntry( goinfo->sound1 );
if ( !info )
break;
Player * target = objmgr.GetPlayer( obj->m_ritualtarget );
if( target == NULL || !target->IsInWorld() )
return;
spell = SpellPool.PooledNew();
spell->Init( _player->GetMapMgr()->GetPlayer( obj->m_ritualcaster ), info, true, NULL );
SpellCastTargets targets;
targets.m_unitTarget = target->GetGUID();
spell->prepare( &targets );
}
else if ( goinfo->ID == 177193 ) // doom portal
{
Player *psacrifice = NULL;
Spell * spell = NULL;
// kill the sacrifice player
psacrifice = _player->GetMapMgr()->GetPlayer(obj->m_ritualmembers[(int)(rand()%(goinfo->SpellFocus-1))]);
Player * pCaster = obj->GetMapMgr()->GetPlayer(obj->m_ritualcaster);
if(!psacrifice || !pCaster)
return;
info = dbcSpell.LookupEntry(goinfo->sound4);
if(!info)
break;
spell = SpellPool.PooledNew();
spell->Init(psacrifice, info, true, NULL);
targets.m_unitTarget = psacrifice->GetGUID();
spell->prepare(&targets);
// summons demon
info = dbcSpell.LookupEntry(goinfo->sound1);
spell = SpellPool.PooledNew();
spell->Init(pCaster, info, true, NULL);
SpellCastTargets targets;
targets.m_unitTarget = pCaster->GetGUID();
spell->prepare(&targets);
}
else if ( goinfo->ID == 179944 ) // Summoning portal for meeting stones
{
Player * plr = _player->GetMapMgr()->GetPlayer(obj->m_ritualtarget);
if(!plr)
return;
Player * pleader = _player->GetMapMgr()->GetPlayer(obj->m_ritualcaster);
if(!pleader)
return;
info = dbcSpell.LookupEntry(goinfo->sound1);
Spell * spell = SpellPool.PooledNew();
spell->Init( pleader, info, true, NULL );
SpellCastTargets targets( plr->GetGUID() );
spell->prepare(&targets);
/* expire the gameobject */
obj->ExpireAndDelete();
}
else if ( goinfo->ID == 186811 || goinfo->ID == 181622 )
{
info = dbcSpell.LookupEntry( goinfo->sound1 );
if ( info == NULL )
return;
Spell * spell = SpellPool.PooledNew();
spell->Init( _player->GetMapMgr()->GetPlayer( obj->m_ritualcaster ), info, true, NULL );
SpellCastTargets targets( obj->m_ritualcaster );
spell->prepare( &targets );
obj->ExpireAndDelete();
}
}
}break;
case GAMEOBJECT_TYPE_GOOBER:
{
//Quest related mostly
}
case GAMEOBJECT_TYPE_CAMERA://eye of azora
{
/*WorldPacket pkt(SMSG_TRIGGER_CINEMATIC,4);
pkt << (uint32)1;//i ve found only on such item,id =1
SendPacket(&pkt);*/
/* these are usually scripted effects. but in the case of some, (e.g. orb of translocation) the spellid is located in unknown1 */
/*SpellEntry * sp = dbcSpell.LookupEntryForced(goinfo->Unknown1);
if(sp != NULL)
_player->CastSpell(_player,sp,true); - WTF? Cast spell 1 ?*/
if(goinfo->Unknown1)
{
uint32 cinematicid = goinfo->Unknown1;
plyr->GetSession()->OutPacket(SMSG_TRIGGER_CINEMATIC, 4, &cinematicid);
}
}break;
case GAMEOBJECT_TYPE_MEETINGSTONE: // Meeting Stone
{
/* Use selection */
Player * pPlayer = objmgr.GetPlayer((uint32)_player->GetSelection());
if(!pPlayer || _player->GetGroup() != pPlayer->GetGroup() || !_player->GetGroup())
return;
GameObjectInfo * info = GameObjectNameStorage.LookupEntry(179944);
if(!info)
return;
/* Create the summoning portal */
GameObject * pGo = _player->GetMapMgr()->CreateGameObject(179944);
pGo->CreateFromProto(179944, _player->GetMapId(), _player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), 0);
pGo->m_ritualcaster = _player->GetLowGUID();
pGo->m_ritualtarget = pPlayer->GetLowGUID();
pGo->m_ritualspell = 18540; // meh
pGo->PushToWorld(_player->GetMapMgr());
/* member one: the (w00t) caster */
pGo->m_ritualmembers[0] = _player->GetLowGUID();
_player->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pGo->GetGUID());
_player->SetUInt32Value(UNIT_CHANNEL_SPELL, pGo->m_ritualspell);
/* expire after 2mins*/
sEventMgr.AddEvent(pGo, &GameObject::_Expire, EVENT_GAMEOBJECT_EXPIRE, 120000, 1,0);
}break;
}
}
void WorldSession::HandleTutorialFlag( WorldPacket & recv_data )
{
uint32 iFlag;
recv_data >> iFlag;
uint32 wInt = (iFlag / 32);
uint32 rInt = (iFlag % 32);
if(wInt >= 7)
{
Disconnect();
return;
}
uint32 tutflag = GetPlayer()->GetTutorialInt( wInt );
tutflag |= (1 << rInt);
GetPlayer()->SetTutorialInt( wInt, tutflag );
sLog.outDebug("Received Tutorial Flag Set {%u}.", iFlag);
}
void WorldSession::HandleTutorialClear( WorldPacket & recv_data )
{
for ( uint32 iI = 0; iI < 8; iI++)
GetPlayer()->SetTutorialInt( iI, 0xFFFFFFFF );
}
void WorldSession::HandleTutorialReset( WorldPacket & recv_data )
{
for ( uint32 iI = 0; iI < 8; iI++)
GetPlayer()->SetTutorialInt( iI, 0x00000000 );
}
void WorldSession::HandleSetSheathedOpcode( WorldPacket & recv_data )
{
uint32 active;
recv_data >> active;
_player->SetByte(UNIT_FIELD_BYTES_2,0,(uint8)active);
}
void WorldSession::HandlePlayedTimeOpcode( WorldPacket & recv_data )
{
uint32 playedt = (uint32)UNIXTIME - _player->m_playedtime[2];
if(playedt)
{
_player->m_playedtime[0] += playedt;
_player->m_playedtime[1] += playedt;
_player->m_playedtime[2] += playedt;
}
WorldPacket data(SMSG_PLAYED_TIME, 8);
data << (uint32)_player->m_playedtime[1];
data << (uint32)_player->m_playedtime[0];
SendPacket(&data);
}
void WorldSession::HandleInspectOpcode( WorldPacket & recv_data )
{
CHECK_PACKET_SIZE( recv_data, 8 );
CHECK_INWORLD_RETURN
uint64 guid;
uint32 talent_points = 0x0000003D;
ByteBuffer m_Packed_GUID;
recv_data >> guid;
Player * player = _player->GetMapMgr()->GetPlayer( (uint32)guid );
if( player == NULL )
{
sLog.outError( "HandleInspectOpcode: guid was null" );
return;
}
_player->SetUInt64Value(UNIT_FIELD_TARGET, guid);
_player->SetSelection( guid );
if(_player->m_comboPoints)
_player->UpdateComboPoints();
WorldPacket data( SMSG_INSPECT_TALENTS, 4 + talent_points );
m_Packed_GUID.appendPackGUID( player->GetGUID());
uint32 guid_size;
guid_size = (uint32)m_Packed_GUID.size();
data.append(m_Packed_GUID);
data << uint32( talent_points );
uint32 talent_tab_pos = 0;
uint32 talent_max_rank;
uint32 talent_tab_id;
uint32 talent_index;
uint32 rank_index,rank_index2;
uint32 rank_slot,rank_slot7;
uint32 rank_offset,rank_offset7;
uint32 mask;
for( uint32 i = 0; i < talent_points; ++i )
data << uint8( 0 );
for( uint32 i = 0; i < 3; ++i )
{
talent_tab_id = sWorld.InspectTalentTabPages[player->getClass()][i];
for( uint32 j = 0; j < dbcTalent.GetNumRows(); ++j )
{
TalentEntry const* talent_info = dbcTalent.LookupRow( j );
//sLog.outDebug( "HandleInspectOpcode: i(%i) j(%i)", i, j );
if( talent_info == NULL )
continue;
//sLog.outDebug( "HandleInspectOpcode: talent_info->TalentTree(%i) talent_tab_id(%i)", talent_info->TalentTree, talent_tab_id );
if( talent_info->TalentTree != talent_tab_id )
continue;
talent_max_rank = 0;
for( uint32 k = 5; k > 0; --k )
{
//sLog.outDebug( "HandleInspectOpcode: k(%i) RankID(%i) HasSpell(%i) TalentTree(%i) Tab(%i)", k, talent_info->RankID[k - 1], player->HasSpell( talent_info->RankID[k - 1] ), talent_info->TalentTree, talent_tab_id );
if( talent_info->RankID[k - 1] != 0 && player->HasSpell( talent_info->RankID[k - 1] ) )
{
talent_max_rank = k;
break;
}
}
//sLog.outDebug( "HandleInspectOpcode: RankID(%i) talent_max_rank(%i)", talent_info->RankID[talent_max_rank-1], talent_max_rank );
if( talent_max_rank <= 0 )
continue;
talent_index = talent_tab_pos;
std::map< uint32, uint32 >::iterator itr = sWorld.InspectTalentTabPos.find( talent_info->TalentID );
if( itr != sWorld.InspectTalentTabPos.end() )
talent_index += itr->second;
//else
//sLog.outDebug( "HandleInspectOpcode: talent(%i) rank_id(%i) talent_index(%i) talent_tab_pos(%i) rank_index(%i) rank_slot(%i) rank_offset(%i)", talent_info->TalentID, talent_info->RankID[talent_max_rank-1], talent_index, talent_tab_pos, rank_index, rank_slot, rank_offset );
// not learned talent
if(!talent_max_rank)
continue;
rank_index = talent_index + talent_max_rank - 1;
// slot/offset in 7-bit bytes
rank_slot7 = rank_index / 7;
rank_offset7 = rank_index % 7;
// rank pos with skipped 8 bit
rank_index2 = rank_slot7 * 8 + rank_offset7;
// slot/offset in 8-bit bytes with skipped high bit
rank_slot = rank_index2 / 8;
rank_offset = rank_index2 % 8;
// apply mask
mask = data.read<uint8>(guid_size + 4 + rank_slot);
mask |= (1 << rank_offset);
data.put<uint8>(guid_size + 4 + rank_slot, mask & 0xFF);
sLog.outDebug( "HandleInspectOpcode: talent(%i) talent_max_rank(%i) rank_id(%i) talent_index(%i) talent_tab_pos(%i) rank_index(%i) rank_slot(%i) rank_offset(%i) mask(%i)", talent_info->TalentID, talent_max_rank, talent_info->RankID[talent_max_rank-1], talent_index, talent_tab_pos, rank_index, rank_slot, rank_offset , mask);
}
std::map< uint32, uint32 >::iterator itr = sWorld.InspectTalentTabSize.find( talent_tab_id );
if( itr != sWorld.InspectTalentTabSize.end() )
talent_tab_pos += itr->second;
}
SendPacket( &data );
}
void WorldSession::HandleSetActionBarTogglesOpcode(WorldPacket &recvPacket)
{
uint8 cActionBarId;
recvPacket >> cActionBarId;
sLog.outDebug("Received CMSG_SET_ACTIONBAR_TOGGLES for actionbar id %d.", cActionBarId);
GetPlayer()->SetByte(PLAYER_FIELD_BYTES,2, cActionBarId);
}
// Handlers for acknowledgement opcodes (removes some 'unknown opcode' flood from the logs)
void WorldSession::HandleAcknowledgementOpcodes( WorldPacket & recv_data )
{
if(!_player)
return;
switch(recv_data.GetOpcode())
{
case CMSG_MOVE_WATER_WALK_ACK:
_player->m_waterwalk = _player->m_setwaterwalk;
break;
case CMSG_MOVE_SET_FLY_ACK:
_player->FlyCheat = _player->m_setflycheat;
break;
}
/* uint16 opcode = recv_data.GetOpcode();
std::stringstream ss;
ss << "Received ";
switch( opcode )
{
case CMSG_MOVE_FEATHER_FALL_ACK: ss << "Move_Feather_Fall"; break;
case CMSG_MOVE_WATER_WALK_ACK: ss << "Move_Water_Walk"; break;
case CMSG_MOVE_KNOCK_BACK_ACK: ss << "Move_Knock_Back"; break;
case CMSG_MOVE_HOVER_ACK: ss << "Move_Hover"; break;
case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: ss << "Force_Walk_Speed_Change"; break;
case CMSG_FORCE_SWIM_SPEED_CHANGE_ACK: ss << "Force_Swim_Speed_Change"; break;
case CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK: ss << "Force_Swim_Back_Speed_Change"; break;
case CMSG_FORCE_TURN_RATE_CHANGE_ACK: ss << "Force_Turn_Rate_Change"; break;
case CMSG_FORCE_RUN_SPEED_CHANGE_ACK: ss << "Force_Run_Speed_Change"; break;
case CMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK: ss << "Force_Run_Back_Speed_Change"; break;
case CMSG_FORCE_MOVE_ROOT_ACK: ss << "Force_Move_Root"; break;
case CMSG_FORCE_MOVE_UNROOT_ACK: ss << "Force_Move_Unroot"; break;
default: ss << "Unknown"; break;
}
ss << " Acknowledgement. PktSize: " << recv_data.size();
sLog.outDebug( ss.str().c_str() );*/
/*uint16 opcode = recv_data.GetOpcode();
if (opcode == CMSG_FORCE_RUN_SPEED_CHANGE_ACK)
{
uint64 GUID;
uint32 Flags, unk0, unk1, d_time;
float X, Y, Z, O, speed;
recv_data >> GUID;
recv_data >> unk0 >> Flags;
if (Flags & (0x2000 | 0x6000)) //0x2000 == jumping 0x6000 == Falling
{
uint32 unk2, unk3, unk4, unk5;
float OldSpeed;
recv_data >> d_time;
recv_data >> X >> Y >> Z >> O;
recv_data >> unk2 >> unk3; //no idea, maybe unk2 = flags2
recv_data >> unk4 >> unk5; //no idea
recv_data >> OldSpeed >> speed;
}
else //single check
{
recv_data >> d_time;
recv_data >> X >> Y >> Z >> O;
recv_data >> unk1 >> speed;
}
// if its not good kick player???
if (_player->GetPlayerSpeed() != speed)
{
sLog.outError("SpeedChange player:%s is NOT correct, its set to: %f he seems to be cheating",_player->GetName(), speed);
}
}*/
}
void WorldSession::HandleSelfResurrectOpcode(WorldPacket& recv_data)
{
uint32 self_res_spell = _player->GetUInt32Value(PLAYER_SELF_RES_SPELL);
if(self_res_spell)
{
SpellEntry * sp=dbcSpell.LookupEntry(self_res_spell);
Spell *s=SpellPool.PooledNew();
s->Init(_player,sp,true,NULL);
SpellCastTargets tgt;
tgt.m_unitTarget=_player->GetGUID();
s->prepare(&tgt);
}
}
void WorldSession::HandleRandomRollOpcode(WorldPacket &recv_data)
{
uint32 min, max;
recv_data >> min >> max;
sLog.outDetail("WORLD: Received MSG_RANDOM_ROLL: %u-%u", min, max);
WorldPacket data(20);
data.SetOpcode(MSG_RANDOM_ROLL);
data << min << max;
uint32 roll;
if(max > RAND_MAX)
max = RAND_MAX;
if(min > max)
min = max;
// generate number
roll = RandomUInt(max - min) + min;
// append to packet, and guid
data << roll << _player->GetGUID();
// send to set
if(_player->InGroup())
_player->GetGroup()->SendPacketToAll(&data);
else
SendPacket(&data);
}
void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recv_data)
{
if(!_player->IsInWorld()) return;
// uint8 slot = 0;
uint32 itemid = 0;
uint32 amt = 1;
uint8 error = 0;
SlotResult slotresult;
Creature *pCreature = NULL;
GameObject *pGameObject = NULL; //cebernic added it
Object *pObj= NULL;
Loot *pLoot = NULL;
/* struct:
{CLIENT} Packet: (0x02A3) CMSG_LOOT_MASTER_GIVE PacketSize = 17
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|39 23 05 00 81 02 27 F0 01 7B FC 02 00 00 00 00 |9#....'..{......|
|00 |. |
-------------------------------------------------------------------
uint64 creatureguid
uint8 slotid
uint64 target_playerguid
*/
uint64 creatureguid, target_playerguid;
uint8 slotid;
recv_data >> creatureguid >> slotid >> target_playerguid;
if(_player->GetGroup() == NULL || _player->GetGroup()->GetLooter() != _player->m_playerInfo)
return;
Player *player = _player->GetMapMgr()->GetPlayer((uint32)target_playerguid);
if(!player)
return;
// cheaterz!
if(_player->GetLootGUID() != creatureguid)
return;
//now its time to give the loot to the target player
if(GET_TYPE_FROM_GUID(GetPlayer()->GetLootGUID()) == HIGHGUID_TYPE_UNIT)
{
pCreature = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(creatureguid));
if (!pCreature)return;
pLoot=&pCreature->loot;
}
else
if(GET_TYPE_FROM_GUID(GetPlayer()->GetLootGUID()) == HIGHGUID_TYPE_GAMEOBJECT) // cebernic added it support gomastergive
{
pGameObject = _player->GetMapMgr()->GetGameObject(GET_LOWGUID_PART(creatureguid));
if (!pGameObject)return;
pGameObject->SetUInt32Value(GAMEOBJECT_STATE,0);
pLoot=&pGameObject->loot;
}
if(!pLoot)
return;
if ( pCreature )
pObj = pCreature;
else
pObj = pGameObject;
if ( !pObj )
return;
// telling him or not.
/*float targetDist = player->CalcDistance(pObj);
if(targetDist > 130.0f) {
_player->GetSession()->SendNotification("so far!"));
return;
}*/
if (slotid >= pLoot->items.size())
{
sLog.outDebug("AutoLootItem: Player %s might be using a hack! (slot %d, size %d)",
GetPlayer()->GetName(), slotid, pLoot->items.size());
return;
}
amt = pLoot->items.at(slotid).iItemsCount;
if (!pLoot->items.at(slotid).ffa_loot)
{
if (!amt)//Test for party loot
{
GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL, NULL,INV_ERR_ALREADY_LOOTED);
return;
}
}
else
{
//make sure this player can still loot it in case of ffa_loot
LooterSet::iterator itr = pLoot->items.at(slotid).has_looted.find(player->GetLowGUID());
if (pLoot->items.at(slotid).has_looted.end() != itr)
{
GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL, NULL,INV_ERR_ALREADY_LOOTED);
return;
}
}
itemid = pLoot->items.at(slotid).item.itemproto->ItemId;
ItemPrototype* it = pLoot->items.at(slotid).item.itemproto;
if((error = player->GetItemInterface()->CanReceiveItem(it, 1)) != 0)
{
_player->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, error);
return;
}
if(pCreature)
CALL_SCRIPT_EVENT(pCreature, OnLootTaken)(player, it);
slotresult = player->GetItemInterface()->FindFreeInventorySlot(it);
if(!slotresult.Result)
{
GetPlayer()->GetItemInterface()->BuildInventoryChangeError(NULL, NULL, INV_ERR_INVENTORY_FULL);
return;
}
Item *item = objmgr.CreateItem( itemid, player);
item->SetUInt32Value(ITEM_FIELD_STACK_COUNT,amt);
if(pLoot->items.at(slotid).iRandomProperty!=NULL)
{
item->SetRandomProperty(pLoot->items.at(slotid).iRandomProperty->ID);
item->ApplyRandomProperties(false);
}
else if(pLoot->items.at(slotid).iRandomSuffix != NULL)
{
item->SetRandomSuffix(pLoot->items.at(slotid).iRandomSuffix->id);
item->ApplyRandomProperties(false);
}
if( player->GetItemInterface()->SafeAddItem(item,slotresult.ContainerSlot, slotresult.Slot) )
{
player->GetSession()->SendItemPushResult(item,false,true,true,true,slotresult.ContainerSlot,slotresult.Slot,1);
sQuestMgr.OnPlayerItemPickup(player,item);
}
else
item->DeleteMe();
pLoot->items.at(slotid).iItemsCount=0;
// this gets sent to all looters
if (!pLoot->items.at(slotid).ffa_loot)
{
pLoot->items.at(slotid).iItemsCount=0;
// this gets sent to all looters
WorldPacket data(1);
data.SetOpcode(SMSG_LOOT_REMOVED);
data << slotid;
Player * plr;
for(LooterSet::iterator itr = pLoot->looters.begin(); itr != pLoot->looters.end(); ++itr)
{
if((plr = _player->GetMapMgr()->GetPlayer(*itr)) != 0)
plr->GetSession()->SendPacket(&data);
}
}
else
{
pLoot->items.at(slotid).has_looted.insert(player->GetLowGUID());
}
/* WorldPacket idata(45);
if(it->Class == ITEM_CLASS_QUEST)
{
uint32 pcount = player->GetItemInterface()->GetItemCount(it->ItemId, true);
BuildItemPushResult(&idata, GetPlayer()->GetGUID(), ITEM_PUSH_TYPE_LOOT, amt, itemid, pLoot->items.at(slotid).iRandomProperty ? pLoot->items.at(slotid).iRandomProperty->ID : 0,0xFF,0,0xFFFFFFFF,pcount);
}
else
{
BuildItemPushResult(&idata, player->GetGUID(), ITEM_PUSH_TYPE_LOOT, amt, itemid, pLoot->items.at(slotid).iRandomProperty ? pLoot->items.at(slotid).iRandomProperty->ID : 0);
}
if(_player->InGroup())
_player->GetGroup()->SendPacketToAll(&idata);
else
SendPacket(&idata);*/
}
void WorldSession::HandleLootRollOpcode(WorldPacket& recv_data)
{
if(!_player->IsInWorld()) return;
/* struct:
{CLIENT} Packet: (0x02A0) CMSG_LOOT_ROLL PacketSize = 13
|------------------------------------------------|----------------|
|00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F |0123456789ABCDEF|
|------------------------------------------------|----------------|
|11 4D 0B 00 BD 06 01 F0 00 00 00 00 02 |.M........... |
-------------------------------------------------------------------
uint64 creatureguid
uint21 slotid
uint8 choice
*/
uint64 creatureguid;
uint32 slotid;
uint8 choice;
recv_data >> creatureguid >> slotid >> choice;
LootRoll *li = NULL;
uint32 guidtype = GET_TYPE_FROM_GUID(creatureguid);
if (guidtype == HIGHGUID_TYPE_GAMEOBJECT)
{
GameObject* pGO = _player->GetMapMgr()->GetGameObject((uint32)creatureguid);
if (!pGO)
return;
if (slotid >= pGO->loot.items.size() || pGO->loot.items.size() == 0)
return;
if (pGO->GetInfo() && pGO->GetInfo()->Type == GAMEOBJECT_TYPE_CHEST)
li = pGO->loot.items[slotid].roll;
}
else if (guidtype == HIGHGUID_TYPE_UNIT)
{
// Creatures
Creature *pCreature = _player->GetMapMgr()->GetCreature(GET_LOWGUID_PART(creatureguid));
if (!pCreature)
return;
if (slotid >= pCreature->loot.items.size() || pCreature->loot.items.size() == 0)
return;
li = pCreature->loot.items[slotid].roll;
}
else
return;
if(!li)
return;
li->PlayerRolled(_player, choice);
}
void WorldSession::HandleOpenItemOpcode(WorldPacket &recv_data)
{
if(!_player->IsInWorld()) return;
CHECK_PACKET_SIZE(recv_data, 2);
int8 slot, containerslot;
recv_data >> containerslot >> slot;
Item *pItem = _player->GetItemInterface()->GetInventoryItem(containerslot, slot);
if(!pItem)
return;
// gift wrapping handler
if(pItem->GetUInt32Value(ITEM_FIELD_GIFTCREATOR) && pItem->wrapped_item_id)
{
ItemPrototype * it = ItemPrototypeStorage.LookupEntry(pItem->wrapped_item_id);
pItem->SetUInt32Value(ITEM_FIELD_GIFTCREATOR,0);
pItem->SetUInt32Value(OBJECT_FIELD_ENTRY,pItem->wrapped_item_id);
pItem->wrapped_item_id=0;
pItem->SetProto(it);
if(it->Bonding==ITEM_BIND_ON_PICKUP)
pItem->SetUInt32Value(ITEM_FIELD_FLAGS,1);
else
pItem->SetUInt32Value(ITEM_FIELD_FLAGS,0);
if(it->MaxDurability)
{
pItem->SetUInt32Value(ITEM_FIELD_DURABILITY,it->MaxDurability);
pItem->SetUInt32Value(ITEM_FIELD_MAXDURABILITY,it->MaxDurability);
}
pItem->m_isDirty=true;
pItem->SaveToDB(containerslot,slot, false, NULL);
return;
}
Lock *lock = dbcLock.LookupEntry( pItem->GetProto()->LockId );
uint32 removeLockItems[5] = {0,0,0,0,0};
if(lock) // locked item
{
for(int i=0;i<5;i++)
{
if(lock->locktype[i] == 1 && lock->lockmisc[i] > 0)
{
int8 slot = _player->GetItemInterface()->GetInventorySlotById(lock->lockmisc[i]);
if(slot != ITEM_NO_SLOT_AVAILABLE && slot >= INVENTORY_SLOT_ITEM_START && slot < INVENTORY_SLOT_ITEM_END)
{
removeLockItems[i] = lock->lockmisc[i];
}
else
{
_player->GetItemInterface()->BuildInventoryChangeError(pItem,NULL,INV_ERR_ITEM_LOCKED);
return;
}
}
else if(lock->locktype[i] == 2 && pItem->locked)
{
_player->GetItemInterface()->BuildInventoryChangeError(pItem,NULL,INV_ERR_ITEM_LOCKED);
return;
}
}
for(int i=0;i<5;i++)
if(removeLockItems[i])
_player->GetItemInterface()->RemoveItemAmt(removeLockItems[i],1);
}
// fill loot
_player->SetLootGUID(pItem->GetGUID());
if(!pItem->loot)
{
pItem->loot = new Loot;
lootmgr.FillItemLoot(pItem->loot, pItem->GetEntry());
}
_player->SendLoot(pItem->GetGUID(), LOOT_DISENCHANTING);
}
void WorldSession::HandleCompleteCinematic(WorldPacket &recv_data)
{
// when a Cinematic is started the player is going to sit down, when its finished its standing up.
_player->SetStandState(STANDSTATE_STAND);
};
void WorldSession::HandleResetInstanceOpcode(WorldPacket& recv_data)
{
sInstanceMgr.ResetSavedInstances(_player);
}
void EncodeHex(const char* source, char* dest, uint32 size)
{
char temp[5];
for(uint32 i = 0; i < size; ++i)
{
snprintf(temp, 5, "%02X", source[i]);
strcat(dest, temp);
}
}
void DecodeHex(const char* source, char* dest, uint32 size)
{
char temp = 0;
char* acc = const_cast<char*>(source);
for(uint32 i = 0; i < size; ++i)
{
sscanf("%02X", &temp);
acc = ((char*)&source[2]);
strcat(dest, &temp);
}
}
void WorldSession::HandleToggleCloakOpcode(WorldPacket &recv_data)
{
//////////////////////////
// PLAYER_FLAGS = 3104 / 0x00C20 / 0000000000000000000110000100000
// ^
// This bit, on = toggled OFF, off = toggled ON.. :S
//uint32 SetBit = 0 | (1 << 11);
if(_player->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_NOCLOAK))
_player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAG_NOCLOAK);
else
_player->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_NOCLOAK);
}
void WorldSession::HandleToggleHelmOpcode(WorldPacket &recv_data)
{
//////////////////////////
// PLAYER_FLAGS = 3104 / 0x00C20 / 0000000000000000000110000100000
// ^
// This bit, on = toggled OFF, off = toggled ON.. :S
//uint32 SetBit = 0 | (1 << 10);
if(_player->HasFlag(PLAYER_FLAGS, PLAYER_FLAG_NOHELM))
_player->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAG_NOHELM);
else
_player->SetFlag(PLAYER_FLAGS, PLAYER_FLAG_NOHELM);
}
void WorldSession::HandleDungeonDifficultyOpcode(WorldPacket& recv_data)
{
uint32 data;
recv_data >> data;
Group * m_Group = _player->GetGroup();
if(m_Group && _player->IsGroupLeader())
{
m_Group->m_difficulty = data;
_player->iInstanceType = data;
sInstanceMgr.ResetSavedInstances(_player);
m_Group->Lock();
for(uint32 i = 0; i < m_Group->GetSubGroupCount(); ++i)
{
for(GroupMembersSet::iterator itr = m_Group->GetSubGroup(i)->GetGroupMembersBegin(); itr != m_Group->GetSubGroup(i)->GetGroupMembersEnd(); ++itr)
{
if((*itr)->m_loggedInPlayer)
{
(*itr)->m_loggedInPlayer->iInstanceType = data;
(*itr)->m_loggedInPlayer->SendDungeonDifficulty();
}
}
}
m_Group->Unlock();
}
else if(!_player->GetGroup())
{
_player->iInstanceType = data;
sInstanceMgr.ResetSavedInstances(_player);
}
#ifdef OPTIMIZED_PLAYER_SAVING
_player->save_InstanceType();
#endif
}
void WorldSession::HandleSummonResponseOpcode(WorldPacket & recv_data)
{
uint32 unk;
uint32 SummonerGUID;
uint8 IsClickOk;
recv_data >> SummonerGUID >> unk >> IsClickOk;
if(!IsClickOk)
return;
if(!_player->m_summoner)
{
SendNotification(NOTIFICATION_MESSAGE_NO_PERMISSION);
return;
}
if(_player->CombatStatus.IsInCombat())
return;
_player->SafeTeleport( _player->m_summonMapId, _player->m_summonInstanceId, _player->m_summonPos );
_player->m_summoner = _player->m_summonInstanceId = _player->m_summonMapId = 0;
}
void WorldSession::HandleDismountOpcode(WorldPacket& recv_data)
{
sLog.outDebug( "WORLD: Received CMSG_DISMOUNT" );
if( !_player->IsInWorld() || _player->GetTaxiState())
return;
if( _player->m_MountSpellId )
_player->RemoveAura( _player->m_MountSpellId );
}
void WorldSession::HandleSetAutoLootPassOpcode(WorldPacket & recv_data)
{
uint32 on;
recv_data >> on;
if( _player->IsInWorld() )
_player->BroadcastMessage(_player->GetSession()->LocalizedWorldSrv(67), on ? _player->GetSession()->LocalizedWorldSrv(68) : _player->GetSession()->LocalizedWorldSrv(69));
_player->m_passOnLoot = (on!=0) ? true : false;
}
| [
"[email protected]@3074cc92-8d2b-11dd-8ab4-67102e0efeef",
"[email protected]@3074cc92-8d2b-11dd-8ab4-67102e0efeef"
]
| [
[
[
1,
1
],
[
5,
111
],
[
113,
135
],
[
137,
154
],
[
156,
177
],
[
179,
279
],
[
281,
339
],
[
341,
342
],
[
345,
437
],
[
439,
442
],
[
467,
467
],
[
469,
471
],
[
480,
482
],
[
485,
485
],
[
488,
488
],
[
490,
490
],
[
496,
496
],
[
499,
502
],
[
504,
505
],
[
507,
513
],
[
515,
516
],
[
519,
520
],
[
536,
536
],
[
541,
634
],
[
636,
639
],
[
641,
649
],
[
651,
685
],
[
687,
742
],
[
744,
749
],
[
752,
752
],
[
755,
757
],
[
760,
760
],
[
762,
765
],
[
774,
876
],
[
882,
915
],
[
917,
917
],
[
919,
929
],
[
932,
937
],
[
941,
953
],
[
955,
956
],
[
958,
965
],
[
972,
974
],
[
976,
1243
],
[
1245,
1245
],
[
1249,
1249
],
[
1251,
1252
],
[
1254,
1264
],
[
1267,
1270
],
[
1273,
1273
],
[
1275,
1282
],
[
1285,
1287
],
[
1291,
1316
],
[
1325,
1327
],
[
1330,
1331
],
[
1333,
1333
],
[
1335,
1343
],
[
1345,
1361
],
[
1363,
1365
],
[
1367,
1368
],
[
1370,
1375
],
[
1378,
1378
],
[
1380,
1380
],
[
1383,
1383
],
[
1386,
1386
],
[
1389,
1389
],
[
1392,
1392
],
[
1394,
1406
],
[
1410,
1411
],
[
1413,
1413
],
[
1416,
1416
],
[
1419,
1419
],
[
1421,
1430
],
[
1434,
1438
],
[
1450,
1462
],
[
1464,
1464
],
[
1472,
1475
],
[
1477,
1499
],
[
1501,
1565
],
[
1567,
1569
],
[
1571,
1576
],
[
1579,
1580
],
[
1583,
1583
],
[
1592,
1596
],
[
1600,
1601
],
[
1604,
1604
],
[
1607,
1647
],
[
1658,
1658
],
[
1672,
1680
],
[
1682,
1688
],
[
1690,
1695
],
[
1698,
1703
],
[
1705,
1773
],
[
1776,
1776
],
[
1778,
1794
],
[
1802,
1802
],
[
1804,
1808
],
[
1810,
1811
],
[
1813,
1824
],
[
1827,
1863
],
[
1872,
1872
],
[
1890,
1922
],
[
1924,
1959
],
[
1961,
1975
],
[
1977,
2047
],
[
2050,
2159
],
[
2161,
2204
],
[
2206,
2206
],
[
2210,
2212
],
[
2214,
2222
],
[
2224,
2241
],
[
2245,
2245
],
[
2247,
2247
],
[
2249,
2258
],
[
2260,
2265
],
[
2267,
2280
],
[
2282,
2284
]
],
[
[
2,
4
],
[
112,
112
],
[
136,
136
],
[
155,
155
],
[
178,
178
],
[
280,
280
],
[
340,
340
],
[
343,
344
],
[
438,
438
],
[
443,
466
],
[
468,
468
],
[
472,
479
],
[
483,
484
],
[
486,
487
],
[
489,
489
],
[
491,
495
],
[
497,
498
],
[
503,
503
],
[
506,
506
],
[
514,
514
],
[
517,
518
],
[
521,
535
],
[
537,
540
],
[
635,
635
],
[
640,
640
],
[
650,
650
],
[
686,
686
],
[
743,
743
],
[
750,
751
],
[
753,
754
],
[
758,
759
],
[
761,
761
],
[
766,
773
],
[
877,
881
],
[
916,
916
],
[
918,
918
],
[
930,
931
],
[
938,
940
],
[
954,
954
],
[
957,
957
],
[
966,
971
],
[
975,
975
],
[
1244,
1244
],
[
1246,
1248
],
[
1250,
1250
],
[
1253,
1253
],
[
1265,
1266
],
[
1271,
1272
],
[
1274,
1274
],
[
1283,
1284
],
[
1288,
1290
],
[
1317,
1324
],
[
1328,
1329
],
[
1332,
1332
],
[
1334,
1334
],
[
1344,
1344
],
[
1362,
1362
],
[
1366,
1366
],
[
1369,
1369
],
[
1376,
1377
],
[
1379,
1379
],
[
1381,
1382
],
[
1384,
1385
],
[
1387,
1388
],
[
1390,
1391
],
[
1393,
1393
],
[
1407,
1409
],
[
1412,
1412
],
[
1414,
1415
],
[
1417,
1418
],
[
1420,
1420
],
[
1431,
1433
],
[
1439,
1449
],
[
1463,
1463
],
[
1465,
1471
],
[
1476,
1476
],
[
1500,
1500
],
[
1566,
1566
],
[
1570,
1570
],
[
1577,
1578
],
[
1581,
1582
],
[
1584,
1591
],
[
1597,
1599
],
[
1602,
1603
],
[
1605,
1606
],
[
1648,
1657
],
[
1659,
1671
],
[
1681,
1681
],
[
1689,
1689
],
[
1696,
1697
],
[
1704,
1704
],
[
1774,
1775
],
[
1777,
1777
],
[
1795,
1801
],
[
1803,
1803
],
[
1809,
1809
],
[
1812,
1812
],
[
1825,
1826
],
[
1864,
1871
],
[
1873,
1889
],
[
1923,
1923
],
[
1960,
1960
],
[
1976,
1976
],
[
2048,
2049
],
[
2160,
2160
],
[
2205,
2205
],
[
2207,
2209
],
[
2213,
2213
],
[
2223,
2223
],
[
2242,
2244
],
[
2246,
2246
],
[
2248,
2248
],
[
2259,
2259
],
[
2266,
2266
],
[
2281,
2281
]
]
]
|
b88c3af92a123ee0c94c897fb878b2baac98b013 | 27d5670a7739a866c3ad97a71c0fc9334f6875f2 | /CPP/Targets/MapLib/Shared/include/Unix/FileDBufRequester.h | 900c2fa51fd6f29eec2eb0a3a51f7e9d3801021c | [
"BSD-3-Clause"
]
| permissive | ravustaja/Wayfinder-S60-Navigator | ef506c418b8c2e6498ece6dcae67e583fb8a4a95 | 14d1b729b2cea52f726874687e78f17492949585 | refs/heads/master | 2021-01-16T20:53:37.630909 | 2010-06-28T09:51:10 | 2010-06-28T09:51:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,509 | h | /*
Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FILEDATABUFFERREQUESTER_H
#define FILEDATABUFFERREQUESTER_H
#include "config.h"
#include "DBufRequester.h"
#include "MC2SimpleString.h"
#include<map>
/**
* Class requesting databuffers from file and a parent
* requester.
*/
class FileDBufRequester : public DBufRequester {
public:
/**
* Creates a new FileDBufRequester.
* @param parent Who to ask if the buffer isn't in file.
* @param path The path to the directory
* @param maxMem Approx max mem in bytes. TODO Implement.
*/
FileDBufRequester(DBufRequester* parent,
const char* path,
uint32 maxMem);
/**
* Deletes all stuff.
*/
virtual ~FileDBufRequester();
/**
* Makes it ok for the Requester to delete the BitBuffer
* or to put it in the cache. Requesters which use other
* requesters should hand the objects back to their parents
* and requesters which are top-requesters should delete them.
* It is important that the descr is the correct one.
*/
void release(const MC2SimpleString& descr,
BitBuffer* obj);
/**
* If the DBufRequester already has the map in cache it
* should return it here or NULL. The BitBuffer should be
* returned in release as usual.
* @param descr Key for databuffer.
* @return Cached BitBuffer or NULL.
*/
BitBuffer* requestCached(const MC2SimpleString& descr);
private:
/// Writes the buffer to file.
bool writeToFile(const MC2SimpleString& descr,
BitBuffer* buffer);
/// Returns a string with the filename for the descr.
MC2SimpleString getFileName(const MC2SimpleString& descr);
/// Read a buffer from file.
BitBuffer* readFromFile(const MC2SimpleString& descr);
/// The path to the dir of the files
MC2SimpleString m_path;
};
#endif
| [
"[email protected]"
]
| [
[
[
1,
80
]
]
]
|
4e6c210f490ffdd1d02c6ba60ed2c3ad2d4139e8 | ef23e388061a637f82b815d32f7af8cb60c5bb1f | /src/mame/includes/namcond1.h | 7a544fd29465845263bb1638dea7e30c3fe45a54 | []
| no_license | marcellodash/psmame | 76fd877a210d50d34f23e50d338e65a17deff066 | 09f52313bd3b06311b910ed67a0e7c70c2dd2535 | refs/heads/master | 2021-05-29T23:57:23.333706 | 2011-06-23T20:11:22 | 2011-06-23T20:11:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 776 | h | /***************************************************************************
namcond1.h
Common functions & declarations for the Namco ND-1 driver
***************************************************************************/
class namcond1_state : public driver_device
{
public:
namcond1_state(running_machine &machine, const driver_device_config_base &config)
: driver_device(machine, config) { }
UINT8 m_h8_irq5_enabled;
UINT16 *m_shared_ram;
int m_p8;
};
/*----------- defined in machine/namcond1.c -----------*/
READ16_HANDLER( namcond1_shared_ram_r );
READ16_HANDLER( namcond1_cuskey_r );
WRITE16_HANDLER( namcond1_shared_ram_w );
WRITE16_HANDLER( namcond1_cuskey_w );
MACHINE_START( namcond1 );
MACHINE_RESET( namcond1 );
| [
"Mike@localhost"
]
| [
[
[
1,
30
]
]
]
|
59fd620a86ca4f72d8392ba42ebbcc315267ae50 | 1c84fe02ecde4a78fb03d3c28dce6fef38ebaeff | /InputManager.cpp | bf46e257acc154c45f339b68369091635f6550a0 | []
| no_license | aadarshasubedi/beesiege | c29cb8c3fce910771deec5bb63bcb32e741c1897 | 2128b212c5c5a68e146d3f888bb5a8201c8104f7 | refs/heads/master | 2016-08-12T08:37:10.410041 | 2007-12-16T20:57:33 | 2007-12-16T20:57:33 | 36,995,410 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,832 | cpp | /**
* Handles user input. Singleton class.
*/
#include "InputManager.h"
#include "GameManager.h"
#include "GameApp.h"
//-------------------------------------------------------------------
/**
* Ctor
*
*/
InputManager::InputManager()
{
}
//-------------------------------------------------------------------
/**
* Dtor
*
*/
InputManager::~InputManager()
{
}
//-------------------------------------------------------------------
/**
* Processes keyboard and mouse input
*
* @param inputSystem
* @param gameApp
*/
void InputManager::ProcessInput(NiInputSystemPtr inputSystem, GameApp* gameApp)
{
ProcessKeyboard(inputSystem->GetKeyboard(), gameApp);
ProcessMouse(inputSystem->GetMouse(), gameApp);
}
//-------------------------------------------------------------------
/**
* Processes keyboard
*
* @param keyboard
* @param gameApp
*/
void InputManager::ProcessKeyboard(NiInputKeyboard* keyboard,GameApp* gameApp)
{
GameManager* gameMgr = GameManager::Get();
if (keyboard != 0)
{
if (gameMgr->IsGameOver())
{
if (keyboard->KeyWasPressed(NiInputKeyboard::KEY_Y))
{
gameMgr->RestartGame();
return;
}
}
else
{
// move queen forward
if (keyboard->KeyIsDown(NiInputKeyboard::KEY_W))
{
gameMgr->GetQueen()->SetMoveForward();
}
// move queen backward
else if (keyboard->KeyIsDown(NiInputKeyboard::KEY_S))
{
gameMgr->GetQueen()->SetMoveBackward();
}
// move queen left
if (keyboard->KeyIsDown(NiInputKeyboard::KEY_A))
{
gameMgr->GetQueen()->SetMoveLeft();
}
// move queen right
else if (keyboard->KeyIsDown(NiInputKeyboard::KEY_D))
{
gameMgr->GetQueen()->SetMoveRight();
}
// cycle through targets
if(keyboard->KeyWasPressed(NiInputKeyboard::KEY_SPACE))
{
gameMgr->GetQueen()->SetTargetEnemy();
}
// change selection mode
if(keyboard->KeyWasPressed(NiInputKeyboard::KEY_LSHIFT))
{
gameMgr->SetSelectionMode(GameManager::SELECTION_GATHERERS);
}
if(keyboard->KeyWasReleased(NiInputKeyboard::KEY_LSHIFT))
{
gameMgr->SetSelectionMode(GameManager::SELECTION_SOLDIERS);
gameMgr->GetQueen()->SetGather();
}
}
}
}
//-------------------------------------------------------------------
/**
* Processes mouse
*
* @param mouse
* @param gameApp
*/
void InputManager::ProcessMouse(NiInputMouse* mouse, GameApp* gameApp)
{
if (mouse != NULL)
{
int mx, my, mz;
mouse->GetPositionDelta(mx, my, mz);
GameManager* gameMgr = GameManager::Get();
if (gameMgr->IsGameOver())
return;
// select more soldiers
if(mouse->ButtonIsDown(NiInputMouse::NIM_LEFT))
{
gameMgr->SetStrongAttack(true);
}
// stop selecting soldiers
else if(mouse->ButtonWasReleased(NiInputMouse::NIM_LEFT))
{
gameMgr->SetStrongAttack(false);
}
if(mouse->ButtonIsDown(NiInputMouse::NIM_RIGHT))
{
if (gameMgr->GetSelectionMode() == GameManager::SELECTION_GATHERERS)
{
gameMgr->GetQueen()->SetSelectGatherers();
}
else if (gameMgr->GetSelectionMode() == GameManager::SELECTION_SOLDIERS)
{
gameMgr->GetQueen()->SetSelectSoldiers();
}
}
// stop rotating queen
if(mouse->ButtonWasReleased(NiInputMouse::NIM_RIGHT))
{
if (gameMgr->GetSelectionMode() == GameManager::SELECTION_GATHERERS)
{
gameMgr->GetQueen()->SetGather();
}
else if (gameMgr->GetSelectionMode() == GameManager::SELECTION_SOLDIERS)
{
gameMgr->GetQueen()->SetAttackEnemy();
}
}
gameMgr->GetQueen()->SetRotate((float)mx);
gameMgr->GetQueen()->SetMoveVertical((float)my);
}
}
//-------------------------------------------------------------------
| [
"[email protected]"
]
| [
[
[
1,
160
]
]
]
|
fa8353c6e2426fdbf13f82fba7ac538350d18637 | c70941413b8f7bf90173533115c148411c868bad | /core/include/vtxDefaultFileStream.h | ce1b544baf5482c847e490f5f59b0acb2c27d3ae | []
| no_license | cnsuhao/vektrix | ac6e028dca066aad4f942b8d9eb73665853fbbbe | 9b8c5fa7119ff7f3dc80fb05b7cdba335cf02c1a | refs/heads/master | 2021-06-23T11:28:34.907098 | 2011-03-27T17:39:37 | 2011-03-27T17:39:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,396 | h | /*
-----------------------------------------------------------------------------
This source file is part of "vektrix"
(the rich media and vector graphics rendering library)
For the latest info, see http://www.fuse-software.com/
Copyright (c) 2009-2010 Fuse-Software (tm)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __vtxDefaultFileStream_H__
#define __vtxDefaultFileStream_H__
#include "vtxPrerequisites.h"
#include "vtxFileStream.h"
namespace vtx
{
//-----------------------------------------------------------------------
/** FileStream implementation for direct reading from the platform's file system */
class DefaultFileStream : public FileStream
{
public:
DefaultFileStream(const String& path, const String& filename);
virtual ~DefaultFileStream();
/** @copybrief FileStream::seek */
void seek(uint pos);
/** @copybrief FileStream::tell */
uint tell();
/** @copybrief FileStream::read */
uint read(void* buf, uint count);
/** @copybrief FileStream::getLine */
String& getLine();
/** @copybrief FileStream::eof */
bool eof() const;
/** @copybrief FileStream::close */
void close();
protected:
std::ifstream mStream;
};
//-----------------------------------------------------------------------
}
#endif
| [
"stonecold_@9773a11d-1121-4470-82d2-da89bd4a628a",
"fixxxeruk@9773a11d-1121-4470-82d2-da89bd4a628a"
]
| [
[
[
1,
31
],
[
33,
69
]
],
[
[
32,
32
]
]
]
|
6863046e64b54b3e3bc9ff9905c248533eb2a5b7 | 0279b408607cffed7b4e6c480ebcb767ca1414de | /Veröffentlichungen/0.1.0/Bestandteile/Karten/KVK/Quellen/KVK.h | fe7efa63b17f8e76bfd6d89e1e0393f60a40636b | []
| no_license | BackupTheBerlios/qsmartcard-svn | 3fc6d6d5ef67be24fbd5f2ce9ddf9ea8f1460058 | ce55cb5790323b1a86782ec367409bef92b2a478 | refs/heads/master | 2020-12-25T19:15:19.683493 | 2007-04-21T15:50:58 | 2007-04-21T15:50:58 | 40,823,841 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,297 | h | /*
* Copyright (C) 2005-2006 Frank Büttner [email protected]
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef QFRANKKVK_H
#define QFRANKKVK_H
//XXYYZZ XX=Major YY=Minor ZZ=Patch
#define KVKVersion 0x000100
#include <QtCore>
#include <SmartCard.h>
class QFrankKVK: public QFrankSmartCard
{
Q_OBJECT
Q_PROPERTY(QString QFrankKVKKrankenkassenname READ Krankenkassenname)
Q_PROPERTY(qulonglong QFrankKVKKrankenkassennummer READ Krankenkassennummer)
Q_PROPERTY(uint QFrankKVKWOP READ WOP)
Q_PROPERTY(qulonglong QFrankKVKVersichertennummer READ Versichertennummer)
Q_PROPERTY(uint QFrankKVKVersichertenstatus READ Versichertenstatus)
Q_PROPERTY(QChar QFrankKVKStatusergaenzung READ Statusergaenzung)
Q_PROPERTY(QString QFrankKVKTitel READ Titel)
Q_PROPERTY(QString QFrankKVKVorname READ Vorname)
Q_PROPERTY(QString QFrankKVKNamenszusatz READ Namenszusatz)
Q_PROPERTY(QString QFrankKVKNachname READ Nachname)
Q_PROPERTY(QDate QFrankKVKGeburtsdatum READ Geburtsdatum)
Q_PROPERTY(QString QFrankKVKStrasse READ Strasse)
Q_PROPERTY(QString QFrankKVKLand READ Land)
Q_PROPERTY(QString QFrankKVKPLZ READ PLZ)
Q_PROPERTY(QString QFrankKVKOrt READ Ort)
Q_PROPERTY(QDate QFrankKVKGueltigBis READ GueltigBis)
Q_PROPERTY(bool QFrankKVKKVKLeser READ KVKLeser WRITE KVKLeserSetzen)
Q_PROPERTY(bool QFrankKVKAuslesen READ KarteAuslesen)
public:
QFrankKVK(QObject* eltern);
QString Krankenkassenname();
ulong Krankenkassennummer();
uint WOP();
qulonglong Versichertennummer();
uint Versichertenstatus();
QChar Statusergaenzung();
QString Titel();
QString Vorname();
QString Namenszusatz();
QString Nachname();
QDate Geburtsdatum();
QString Strasse();
QString Land();
QString PLZ();
QString Ort();
QDate GueltigBis();
bool KarteAuslesen();
bool KVKLeser();
void KVKLeserSetzen(bool kvk);
ulong Version();
void welchenLeser(QFrankLesegeraet *diesen);
private:
enum TAG
{
TAG_Datenanfang=0x60,
TAG_Kassenname=0x80,
TAG_Kassennummer=0x81,
TAG_Versichertennummer=0x82,
TAG_Versichertenstatus=0x83,
TAG_Titel=0x84,
TAG_Vorname=0x85,
TAG_Namenszusatz=0x86,
TAG_Nachname=0x87,
TAG_Geburtsdatum=0x88,
TAG_Strasse=0x89,
TAG_Land=0x8a,
TAG_PLZ=0x8b,
TAG_Ort=0x8c,
TAG_GueltigBis=0x8d,
TAG_WOP=0x8f,
TAG_Statusergaenzung=0x90
};
Q_DECLARE_FLAGS(TAGS, TAG)
QChar Ersetzen(char was);
QString FeldNachQString(QByteArray feld);
void VariabelnInitialisieren();
QString KrankenkassennameWert;
ulong KrankenkassennummerWert;
uint WOPWert;
qulonglong VersichertennummerWert;
uint VersichertenstatusWert;
QChar StatusergaenzungWert;
QString TitelWert;
QString VornameWert;
QString NamenszusatzWert;
QString NachnameWert;
QDate GeburtsdatumWert;
QString StrasseWert;
QString LandWert;
QString PLZWert;
QString OrtWert;
QDate GueltigBisWert;
bool PruefsummeOK(QByteArray daten);
bool KVKLeserWert;
bool IstEsEineKVK(QByteArray &daten);
bool TagFinden(QFrankKVK::TAGS welches,QByteArray &daten,bool optional=false);
QFrankLesegeraet *Leser;
#ifndef QT_NO_DEBUG
QString FeldNachHex(QByteArray feld);
#endif
};
#endif
| [
"frank@44d785f6-2729-0410-8380-9ee487a164e4"
]
| [
[
[
1,
125
]
]
]
|
dfb48ed2cbb1c8413b7e48176af0744e5441a4e4 | d9f1cc8e697ae4d1c74261ae6377063edd1c53f8 | /src/misc/Color.cpp | aa88347fc21dc6283edb061ee0288454a346ac54 | []
| no_license | commel/opencombat2005 | 344b3c00aaa7d1ec4af817e5ef9b5b036f2e4022 | d72fc2b0be12367af34d13c47064f31d55b7a8e0 | refs/heads/master | 2023-05-19T05:18:54.728752 | 2005-12-01T05:11:44 | 2005-12-01T05:11:44 | 375,630,282 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 497 | cpp | #include ".\color.h"
Color::Color(void)
{
alpha = 0xff;
red = green = blue = 0;
}
Color::Color(int r, int g, int b)
{
alpha = 0xFF;
red = (unsigned char)r;
green = (unsigned char)g;
blue = (unsigned char)b;
}
Color::~Color(void)
{
}
void
Color::Parse(unsigned int c)
{
alpha = (unsigned char)((0xFF000000 & c) >> 24);
red = (unsigned char)((0x00FF0000 & c) >> 16);
green = (unsigned char)((0x0000FF00 & c) >> 8);
blue = (unsigned char)((0x000000FF & c));
} | [
"opencombat"
]
| [
[
[
1,
28
]
]
]
|
521ecdc146b9a690b8ca7c8da35d401e5e3247c7 | 7acbb1c1941bd6edae0a4217eb5d3513929324c0 | /GLibrary-CPP/sources/GMysqlDatabase.h | 3daeff96e81b3f37292bba65e2aba32c820b9e09 | []
| no_license | hungconcon/geofreylibrary | a5bfc96e0602298b5a7b53d4afe7395a993498f1 | 3abf3e1c31a245a79fa26b4bcf2e6e86fa258e4d | refs/heads/master | 2021-01-10T10:11:51.535513 | 2009-11-30T15:29:34 | 2009-11-30T15:29:34 | 46,771,895 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 953 | h |
#ifndef __GMYSQLDATABASE_H__
# define __GMYSQLDATABASE_H__
#include "GExport.h"
#include "GISqlDatabase.h"
#include "GAlgo.h"
#include "GMap.hpp"
#include "GVector.hpp"
class GEXPORTED GMysqlDatabase //: public GISqlDatabase
{
public:
GMysqlDatabase(void);
~GMysqlDatabase(void);
bool Connect(const GString &Host, const GString &Login, const GString &Database, const GString &Pass = "", unsigned int Port = 3306);
GString GetServerVersion(void) const;
private:
void ParseInitialHandShake(const GString &Packet);
void Authentification(void);
void MakePacket(const GString &Packet);
GString PacketRecuperation(void);
private:
GSocketTcpClient _socket;
GString _receive;
char _protocolVersion;
GString _serveurCapabilities;
unsigned int _threadId;
GString _serverVersion;
GString _login;
GString _pass;
GString _scrambleBuffer;
};
#endif | [
"tincani.geoffrey@34e8d5ee-a372-11de-889f-a79cef5dd62c"
]
| [
[
[
1,
42
]
]
]
|
6ea07df5c41b86ed35e31c0e38616d2247cb1e18 | 580738f96494d426d6e5973c5b3493026caf8b6a | /Include/Vcl/designer.hpp | 581067dfe41b7ae4c3f56b7059a46d7536aa88a9 | []
| no_license | bravesoftdz/cbuilder-vcl | 6b460b4d535d17c309560352479b437d99383d4b | 7b91ef1602681e094a6a7769ebb65ffd6f291c59 | refs/heads/master | 2021-01-10T14:21:03.726693 | 2010-01-11T11:23:45 | 2010-01-11T11:23:45 | 48,485,606 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 18,741 | hpp | // Borland C++ Builder
// Copyright (c) 1995, 2002 by Borland Software Corporation
// All rights reserved
// (DO NOT EDIT: machine generated header) 'Designer.pas' rev: 6.00
#ifndef DesignerHPP
#define DesignerHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Classes.hpp> // Pascal unit
#include <SysUtils.hpp> // Pascal unit
#include <Types.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Designer
{
//-- type declarations -------------------------------------------------------
#pragma option push -b-
enum TZOrder { zoFront, zoBack };
#pragma option pop
__interface IItem;
typedef System::DelphiInterface<IItem> _di_IItem;
__interface INTERFACE_UUID("{C41303AD-CAE3-11D3-AB47-00C04FB17A72}") IItem : public IInterface
{
public:
virtual bool __fastcall Contains(const _di_IItem Item) = 0 ;
virtual void __fastcall Delete(void) = 0 ;
virtual Types::TPoint __fastcall GlobalToLocal(const Types::TPoint &Point) = 0 ;
virtual Types::TPoint __fastcall LocalToGlobal(const Types::TPoint &Point) = 0 ;
virtual bool __fastcall Equals(const _di_IItem Item) = 0 ;
virtual Types::TRect __fastcall GetBoundsRect(void) = 0 ;
virtual Types::TRect __fastcall GetExtendedRect(void) = 0 ;
virtual Types::TRect __fastcall GetClientRect(void) = 0 ;
virtual _di_IItem __fastcall GetParent(void) = 0 ;
virtual bool __fastcall IsContainer(void) = 0 ;
virtual bool __fastcall HasSelectableChildren(void) = 0 ;
virtual void __fastcall SetBoundsRect(const Types::TRect &Value) = 0 ;
virtual bool __fastcall Selectable(void) = 0 ;
virtual void __fastcall ValidateDeletable(void) = 0 ;
virtual void __fastcall Edit(void) = 0 ;
__property Types::TRect BoundsRect = {read=GetBoundsRect, write=SetBoundsRect};
__property Types::TRect ClientRect = {read=GetClientRect};
__property Types::TRect ExtendedRect = {read=GetExtendedRect};
__property _di_IItem Parent = {read=GetParent};
};
__interface IGrabHandles;
typedef System::DelphiInterface<IGrabHandles> _di_IGrabHandles;
__interface INTERFACE_UUID("{C41303A9-CAE3-11D3-AB47-00C04FB17A72}") IGrabHandles : public IInterface
{
public:
virtual _di_IItem __fastcall GetSelection(void) = 0 ;
virtual void __fastcall SetSelection(const _di_IItem Value) = 0 ;
virtual void __fastcall SetActive(bool Value) = 0 ;
virtual void __fastcall Update(void) = 0 ;
__property _di_IItem Selection = {read=GetSelection, write=SetSelection};
};
#pragma option push -b-
enum TDesignKeyCode { dkDelete, dkLeft, dkUp, dkRight, dkDown, dkTab, dkEnter, dkEscape, dkChar };
#pragma option pop
#pragma option push -b-
enum Designer__1 { gaLeft, gaTop, gaRight, gaBottom };
#pragma option pop
typedef Set<Designer__1, gaLeft, gaBottom> TMoveAffects;
#pragma option push -b-
enum TDesignBoxStyle { dbsSelection, dbsItem };
#pragma option pop
__interface IDragBoxes;
typedef System::DelphiInterface<IDragBoxes> _di_IDragBoxes;
__interface IDragBoxes : public IInterface
{
public:
virtual int __fastcall Add(const Types::TRect &Rect, TDesignBoxStyle Style) = 0 ;
virtual void __fastcall Change(int Index, const Types::TRect &New) = 0 ;
virtual void __fastcall MoveBy(int DX, int DY) = 0 ;
virtual void __fastcall Done(void) = 0 ;
};
__interface IDesignSurfaceListener;
typedef System::DelphiInterface<IDesignSurfaceListener> _di_IDesignSurfaceListener;
__interface INTERFACE_UUID("{C41303AA-CAE3-11D3-AB47-00C04FB17A72}") IDesignSurfaceListener : public IInterface
{
public:
virtual void __fastcall MouseDown(_di_IItem Sender, Classes::TShiftState Shift, int X, int Y, bool DoubleClick, TMoveAffects MoveAffects = System::Set<Designer__1, gaLeft, gaBottom> () ) = 0 ;
virtual void __fastcall MouseMove(int X, int Y) = 0 ;
virtual void __fastcall MouseUp(int X, int Y) = 0 ;
virtual void __fastcall Key(TDesignKeyCode KeyCode, Classes::TShiftState Shift, wchar_t Ch) = 0 ;
virtual void __fastcall CancelDragging(void) = 0 ;
};
__interface IDesignSurface;
typedef System::DelphiInterface<IDesignSurface> _di_IDesignSurface;
__interface INTERFACE_UUID("{C41303AB-CAE3-11D3-AB47-00C04FB17A72}") IDesignSurface : public IInterface
{
public:
virtual void __fastcall AddListener(const _di_IDesignSurfaceListener Listener) = 0 ;
virtual _di_IDragBoxes __fastcall BeginDragging(const _di_IItem Parent) = 0 ;
virtual void __fastcall Close(void) = 0 ;
virtual _di_IItem __fastcall CreateItem(const _di_IItem Parent, const Types::TRect &Rect) = 0 ;
virtual Types::TPoint __fastcall CursorPosition(void) = 0 ;
virtual void __fastcall DeleteSelection(void) = 0 ;
virtual Types::TPoint __fastcall DesignerToGlobal(const Types::TPoint &Point) = 0 ;
virtual void __fastcall DestroyItem(const _di_IItem Item) = 0 ;
virtual _di_IItem __fastcall FindNextItem(const _di_IItem Item, bool GoForward) = 0 ;
virtual void __fastcall Focus(void) = 0 ;
virtual _di_IGrabHandles __fastcall GetGrabHandles(void) = 0 ;
virtual _di_IItem __fastcall GetItems(int Index) = 0 ;
virtual int __fastcall GetItemsCount(void) = 0 ;
virtual Types::TPoint __fastcall GetOffset(void) = 0 ;
virtual _di_IItem __fastcall GetRoot(void) = 0 ;
virtual Types::TPoint __fastcall GlobalToDesigner(const Types::TPoint &Point) = 0 ;
virtual bool __fastcall GridSnapDisabled(void) = 0 ;
virtual void __fastcall RemoveListener(const _di_IDesignSurfaceListener Listener) = 0 ;
virtual void __fastcall UpdateSelection(void) = 0 ;
virtual void __fastcall ValidateModification(void) = 0 ;
virtual void __fastcall Modified(void) = 0 ;
__property _di_IGrabHandles GrabHandles = {read=GetGrabHandles};
__property _di_IItem Items[int Index] = {read=GetItems};
__property int ItemsCount = {read=GetItemsCount};
__property _di_IItem Root = {read=GetRoot};
};
__interface ITools;
typedef System::DelphiInterface<ITools> _di_ITools;
__interface INTERFACE_UUID("{C41303AF-CAE3-11D3-AB47-00C04FB17A72}") ITools : public IInterface
{
public:
virtual bool __fastcall ToolSelected(void) = 0 ;
};
__interface ISelectionsListener;
typedef System::DelphiInterface<ISelectionsListener> _di_ISelectionsListener;
__interface ISelections;
typedef System::DelphiInterface<ISelections> _di_ISelections;
__interface INTERFACE_UUID("{3D642F40-D567-11D3-BA96-0080C78ADCDB}") ISelectionsListener : public IInterface
{
public:
virtual void __fastcall SelectionChanged(const _di_ISelections Selections) = 0 ;
};
__interface INTERFACE_UUID("{C41303AC-CAE3-11D3-AB47-00C04FB17A72}") ISelections : public IInterface
{
public:
_di_IItem operator[](int Index) { return Items[Index]; }
public:
virtual int __fastcall GetCount(void) = 0 ;
virtual _di_IItem __fastcall GetItems(int Index) = 0 ;
virtual int __fastcall GetSelectionLevel(void) = 0 ;
virtual void __fastcall Add(const _di_IItem Item) = 0 ;
virtual void __fastcall AddListener(const _di_ISelectionsListener Listener) = 0 ;
virtual void __fastcall BeginSelections(void) = 0 ;
virtual void __fastcall Clear(void) = 0 ;
virtual void __fastcall EndSelections(void) = 0 ;
virtual void __fastcall Remove(const _di_IItem Item) = 0 /* overload */;
virtual void __fastcall Remove(int Index) = 0 /* overload */;
virtual void __fastcall RemoveListener(const _di_ISelectionsListener Listener) = 0 ;
virtual bool __fastcall Selected(const _di_IItem Item) = 0 ;
virtual void __fastcall Toggle(const _di_IItem Item) = 0 ;
__property int Count = {read=GetCount};
__property _di_IItem Items[int Index] = {read=GetItems/*, default*/};
__property int SelectionLevel = {read=GetSelectionLevel};
};
__interface ISurfaceDesigner;
typedef System::DelphiInterface<ISurfaceDesigner> _di_ISurfaceDesigner;
__interface INTERFACE_UUID("{BC9760BF-249C-433A-B2C9-85B59B2D3A9F}") ISurfaceDesigner : public IInterface
{
public:
virtual void __fastcall Close(void) = 0 ;
virtual void __fastcall CancelDragging(void) = 0 ;
virtual bool __fastcall GetLocked(void) = 0 ;
virtual Types::TPoint __fastcall GetGridSize(void) = 0 ;
virtual void __fastcall Lock(void) = 0 ;
virtual void __fastcall Modified(void) = 0 ;
virtual Types::TPoint __fastcall PointToGrid(const Types::TPoint &Pos, bool Force = false) = 0 ;
virtual void __fastcall SetGridSize(const Types::TPoint &Value) = 0 ;
virtual void __fastcall Unlock(void) = 0 ;
virtual bool __fastcall GetGridAligned(void) = 0 ;
virtual void __fastcall SetGridAligned(bool Value) = 0 ;
__property bool Locked = {read=GetLocked};
__property Types::TPoint GridSize = {read=GetGridSize, write=SetGridSize};
__property bool GridAligned = {read=GetGridAligned, write=SetGridAligned};
};
#pragma option push -b-
enum TDragAction { daNone, daCreate, daSelect, daMove, daSize };
#pragma option pop
class DELPHICLASS TDesigner;
class PASCALIMPLEMENTATION TDesigner : public System::TInterfacedObject
{
typedef System::TInterfacedObject inherited;
private:
_di_IDesignSurface FDesignSurface;
_di_ISelections FSelections;
_di_IGrabHandles FGrabHandles;
_di_ITools FTools;
#pragma pack(push, 1)
Types::TPoint FGridSize;
#pragma pack(pop)
#pragma pack(push, 1)
Types::TPoint FAnchor;
#pragma pack(pop)
#pragma pack(push, 1)
Types::TRect FDragRect;
#pragma pack(pop)
TMoveAffects FDragAffects;
TDragAction FDragAction;
bool FLocked;
bool FGridAlign;
_di_IItem FDragParent;
_di_IDragBoxes FBoxes;
void __fastcall DoDragCreate(void);
void __fastcall DoDragMove(void);
void __fastcall DoDragSelect(void);
void __fastcall DoDragSize(void);
void __fastcall DragBoxesMoveTo(const Types::TRect &NewRect);
void __fastcall DragBoxesOff(void);
void __fastcall DragBoxesOn(void);
_di_IItem __fastcall FindNearestItem(const _di_IItem Item, TDesignKeyCode Key);
void __fastcall ForceCommonSelectParent(const _di_IItem Parent);
Types::TRect __fastcall GetDragRect(const Types::TPoint &Pos);
void __fastcall MoveBy(const Types::TPoint &Delta, bool Size);
int __fastcall SnapToGrid(int Coord, int GridOffset, int GridSize, bool Force);
protected:
void __fastcall MouseDown(_di_IItem Sender, Classes::TShiftState Shift, int X, int Y, bool DoubleClick, TMoveAffects MoveAffects);
void __fastcall MouseMove(int X, int Y);
void __fastcall MouseUp(int X, int Y);
void __fastcall Key(TDesignKeyCode KeyCode, Classes::TShiftState Shift, wchar_t Ch);
void __fastcall Close(void);
void __fastcall CancelDragging(void);
bool __fastcall GetLocked(void);
Types::TPoint __fastcall PointToGrid(const Types::TPoint &Pos, bool Force = false);
Types::TPoint __fastcall GetGridSize();
void __fastcall SetGridSize(const Types::TPoint &Value);
bool __fastcall GetGridAligned(void);
void __fastcall SetGridAligned(bool Value);
void __fastcall BeginSelect(void);
void __fastcall ClearSelection(void);
void __fastcall DragBegin(int X, int Y);
void __fastcall DragCancel(void);
void __fastcall DragEnd(int X, int Y, bool Accept);
void __fastcall DragTo(int X, int Y);
void __fastcall Edit(const _di_IItem Item);
void __fastcall EndSelect(void);
bool __fastcall IsDesignerSelected(void);
void __fastcall Select(const _di_IItem Item, bool Extend);
_di_IItem __fastcall SelectedItem();
__property Types::TPoint Anchor = {read=FAnchor};
__property TDragAction DragAction = {read=FDragAction, nodefault};
__property TMoveAffects DragAffects = {read=FDragAffects, nodefault};
__property _di_IItem DragParent = {read=FDragParent};
__property Types::TRect DragRect = {read=FDragRect};
__property _di_IDesignSurface DesignSurface = {read=FDesignSurface};
__property _di_IGrabHandles GrabHandles = {read=FGrabHandles};
__property bool GridAlign = {read=FGridAlign, nodefault};
__property Types::TPoint GridSize = {read=FGridSize};
__property _di_ISelections Selections = {read=FSelections};
__property _di_ITools Tools = {read=FTools};
public:
__fastcall TDesigner(const _di_IDesignSurface DesignSurface, const _di_ISelections Selections, const _di_ITools Tools);
__fastcall virtual ~TDesigner(void);
void __fastcall DeleteSelection(void);
HIDESBASE void __fastcall Free(void);
virtual void __fastcall Modified(void);
void __fastcall Lock(void);
void __fastcall Unlock(void);
__property bool Locked = {read=FLocked, nodefault};
private:
void *__IDesignSurfaceListener; /* Designer::IDesignSurfaceListener */
void *__ISurfaceDesigner; /* Designer::ISurfaceDesigner */
public:
operator ISurfaceDesigner*(void) { return (ISurfaceDesigner*)&__ISurfaceDesigner; }
operator IDesignSurfaceListener*(void) { return (IDesignSurfaceListener*)&__IDesignSurfaceListener; }
};
__interface IPersistentItem;
typedef System::DelphiInterface<IPersistentItem> _di_IPersistentItem;
__interface INTERFACE_UUID("{C41303B0-CAE3-11D3-AB47-00C04FB17A72}") IPersistentItem : public IInterface
{
public:
virtual Classes::TPersistent* __fastcall GetItem(void) = 0 ;
virtual AnsiString __fastcall GetNamePath(void) = 0 ;
};
class DELPHICLASS TPersistentItem;
class PASCALIMPLEMENTATION TPersistentItem : public System::TInterfacedObject
{
typedef System::TInterfacedObject inherited;
private:
Classes::TPersistent* FInstance;
protected:
Classes::TPersistent* __fastcall GetItem(void);
AnsiString __fastcall GetNamePath();
bool __fastcall Contains(const _di_IItem Item);
void __fastcall Delete(void);
bool __fastcall Equals(const _di_IItem Item);
Types::TRect __fastcall GetBoundsRect();
Types::TRect __fastcall GetClientRect();
Types::TRect __fastcall GetExtendedRect();
_di_IItem __fastcall GetParent();
bool __fastcall IsContainer(void);
bool __fastcall HasSelectableChildren(void);
void __fastcall SetBoundsRect(const Types::TRect &Value);
void __fastcall ValidateDeletable(void);
__property Classes::TPersistent* Instance = {read=FInstance};
public:
__fastcall TPersistentItem(Classes::TPersistent* Instance);
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TPersistentItem(void) { }
#pragma option pop
private:
void *__IPersistentItem; /* Designer::IPersistentItem */
public:
operator IPersistentItem*(void) { return (IPersistentItem*)&__IPersistentItem; }
};
typedef DynamicArray<Types::TRect > Designer__5;
typedef DynamicArray<TDesignBoxStyle > Designer__6;
class DELPHICLASS TXorDragBoxes;
class PASCALIMPLEMENTATION TXorDragBoxes : public System::TInterfacedObject
{
typedef System::TInterfacedObject inherited;
private:
DynamicArray<Types::TRect > FRects;
DynamicArray<TDesignBoxStyle > FKinds;
int FUsed;
void __fastcall DrawBoxes(void);
protected:
int __fastcall Add(const Types::TRect &Rect, TDesignBoxStyle Style);
void __fastcall Change(int Index, const Types::TRect &New);
void __fastcall MoveBy(int DX, int DY);
void __fastcall Done(void);
Types::TRect __fastcall BoundingRect();
virtual void __fastcall DrawBox(const Types::TRect &Rect, TDesignBoxStyle Kind) = 0 ;
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TXorDragBoxes(void) : System::TInterfacedObject() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TXorDragBoxes(void) { }
#pragma option pop
private:
void *__IDragBoxes; /* Designer::IDragBoxes */
public:
operator IDragBoxes*(void) { return (IDragBoxes*)&__IDragBoxes; }
};
class DELPHICLASS TNullTools;
class PASCALIMPLEMENTATION TNullTools : public System::TInterfacedObject
{
typedef System::TInterfacedObject inherited;
protected:
bool __fastcall ToolSelected(void);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TNullTools(void) : System::TInterfacedObject() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TNullTools(void) { }
#pragma option pop
private:
void *__ITools; /* Designer::ITools */
public:
operator ITools*(void) { return (ITools*)&__ITools; }
};
class DELPHICLASS TSelectionListenerHelper;
class PASCALIMPLEMENTATION TSelectionListenerHelper : public System::TObject
{
typedef System::TObject inherited;
private:
Classes::_di_IInterfaceList FList;
public:
__fastcall TSelectionListenerHelper(void);
void __fastcall AddListener(const _di_ISelectionsListener Listener);
void __fastcall RemoveListener(const _di_ISelectionsListener Listener);
void __fastcall SelectionChanged(const _di_ISelections Selections);
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TSelectionListenerHelper(void) { }
#pragma option pop
};
class DELPHICLASS TSimpleSelections;
class PASCALIMPLEMENTATION TSimpleSelections : public System::TInterfacedObject
{
typedef System::TInterfacedObject inherited;
private:
Classes::_di_IInterfaceList FList;
TSelectionListenerHelper* FListeners;
int FBeginCount;
bool FDirty;
protected:
int __fastcall IndexOf(const _di_IItem Item);
void __fastcall Modified(void);
int __fastcall GetCount(void);
_di_IItem __fastcall GetItems(int Index);
int __fastcall GetSelectionLevel(void);
void __fastcall BeginSelections(void);
void __fastcall Add(const _di_IItem Item);
void __fastcall Clear(void);
void __fastcall EndSelections(void);
void __fastcall Remove(const _di_IItem Item)/* overload */;
void __fastcall Remove(int Index)/* overload */;
bool __fastcall Selected(const _di_IItem Item);
void __fastcall Toggle(const _di_IItem Item);
__property TSelectionListenerHelper* Listeners = {read=FListeners};
public:
__fastcall TSimpleSelections(void);
__fastcall virtual ~TSimpleSelections(void);
private:
void *__ISelections; /* Designer::ISelections */
public:
operator ISelections*(void) { return (ISelections*)&__ISelections; }
};
//-- var, const, procedure ---------------------------------------------------
extern PACKAGE bool __fastcall SameItem(const _di_IItem Item1, const _di_IItem Item2);
extern PACKAGE Classes::TPersistent* __fastcall ExtractPersistent(const _di_IItem Item);
extern PACKAGE Classes::TComponent* __fastcall ExtractComponent(const _di_IItem Item);
} /* namespace Designer */
using namespace Designer;
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // Designer
| [
"bitscode@7bd08ab0-fa70-11de-930f-d36749347e7b"
]
| [
[
[
1,
493
]
]
]
|
a45c8d059b969948e8d6e2aaa2ead6efdab183ff | e7c45d18fa1e4285e5227e5984e07c47f8867d1d | /SMDK/Worsley/BATC_Bayer/BATCBayerSM.cpp | 3f1feb83c841c7b053baa076c2484b62f0c74ea0 | []
| no_license | abcweizhuo/Test3 | 0f3379e528a543c0d43aad09489b2444a2e0f86d | 128a4edcf9a93d36a45e5585b70dee75e4502db4 | refs/heads/master | 2021-01-17T01:59:39.357645 | 2008-08-20T00:00:29 | 2008-08-20T00:00:29 | null | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 126,237 | cpp | //================== SysCAD - Copyright Kenwalt (Pty) Ltd ===================
// $Nokeywords: $
//===========================================================================
#include "stdafx.h"
#include "BATCBayerSM.h"
#include "math.h"
#include "md_headers.h"
#pragma comment(lib, "rpcrt4.lib")
//#pragma optimize("", off)
#define IncludeBrahma 1
#define At25 1
//===========================================================================
//
//
//
//===========================================================================
DEFINE_SPECIEMODEL(BATCBayerSM)
IMPLEMENT_SPECIEMODEL(BATCBayerSM, "BATCBayerSM", "*BATC Bayer", "Bauxite and Alumina Technology Centre Bayer Specie Model", DLL_GroupName)
//===========================================================================
// Specie Access
static MInitialiseTest InitTest("BATCBayerSMClass");
MSpeciePtr Water (InitTest, "H2O(l)", false);
MAqSpeciePtr Alumina (InitTest, "Al2O3(l)", false);
MAqSpeciePtr CausticSoda (InitTest, "NaOH(l)", false);
MAqSpeciePtr SodiumChloride (InitTest, "NaCl(l)", false);
MAqSpeciePtr SodiumSulphate (InitTest, "Na2SO4(l)", false);
MAqSpeciePtr SodiumCarbonate (InitTest, "Na2CO3(l)", false);
MAqSpeciePtr SodiumFluoride (InitTest, "NaF(l)", false);
MSpeciePtr SodiumOxalate (InitTest, "Na2C2O4(l)", false); //organic
//MSpeciePtr Organics (InitTest, "Na2C5O7(l)", false); //organic
MSpeciePtr Organics1 (InitTest, "NaOrg(l)", false); //organic NaC2.21O2.275H3.63
MAqSpeciePtr SilicateLiq (InitTest, "SiO2(l)", false);
//MAqSpeciePtr Potassium (InitTest, "K2O(l)", false);
MSpeciePtr OccSoda (InitTest, "Na2O(s)", false);
MSpeciePtr THA (InitTest, "Al2O3.3H2O(s)", false);
MSpeciePtr AluminaSolid (InitTest, "Al2O3(s)", false);
MSpeciePtr Steam (InitTest, "H2O(g)", true);
// ==========================================================================
// Specie Properties Modal Global Parameters
const double MW_C = 12.011;
const double MW_Cl = 35.4527;
const double MW_F = 18.9984032;
const double MW_SO4 = 96.0636; //32.066+(4*15.9994)
//enum DLM_DefineLiquorMethod { DLM_TotOrganics, DLM_TOC };
enum BDM_BayerDensityMethod { BDM_Original, BDM_WRS, BDM_BPD1, BDM_BPD2, BDM_BRAHMA, BDM_BRAHMA_OLD, BDM_BRAHMA25 };
enum CPM_HeatCapacityMethod { CPM_Original, CPM_WRS };
enum ASM_AlSolubilityMethod { ASM_LiqInfo5, ASM_LiqInfo6, ASM_BRAHMA };
enum BPM_BPEMethod { BPM_Dewey, BPM_Adamson, BPM_BPD1, BPM_BPD2 };
double BATCBayerSM::sm_dMinSolCp = 1.046;
double BATCBayerSM::sm_dH2OTestFrac0 = 1.0;//0.98;
double BATCBayerSM::sm_dH2OTestFrac1 = 1.0;//0.95;
double BATCBayerSM::KEq_A1 = -55320;
double BATCBayerSM::KEq_B1 = 0.4592752;
double BATCBayerSM::KEq_C1 = 139.8;
//byte BATCBayerSM::sm_iRqdCalcMethod = DLM_TOC;
byte BATCBayerSM::sm_iDensityMethod = BDM_WRS;//BDM_Original;
byte BATCBayerSM::sm_iCPMethod = CPM_WRS;//CPM_Original;
byte BATCBayerSM::sm_iASatMethod = ASM_LiqInfo6;
byte BATCBayerSM::sm_iBPEMethod = BPM_Dewey;
// ==========================================================================
//
// A helper class to assist with calculating iterative concentration and density
// calculations.
//
// ==========================================================================
bool CBayerConcs::NaFactorOK=0;
MArrayI CBayerConcs::NaFactor;
CBayerConcs::CBayerConcs(BATCBayerSM *pMdl)
{
MInitialise(); // this must be called to initialise the SMDK library if neccessary
pBayerMdl = pMdl;
Zero();
if (!NaFactorOK)
{
for (int sn=0; sn<gs_MVDefn.Count(); sn++)
NaFactor[sn]=1.0; //For all the species without sodium ions
NaFactor[::CausticSoda] = 1.0 * ::SodiumCarbonate.MW / (2.0 * ::CausticSoda.MW);
NaFactor[::SodiumCarbonate] = 1.0;
NaFactor[::SodiumOxalate] = 2.0 * ::SodiumCarbonate.MW / (2.0 * ::SodiumOxalate.MW);
NaFactor[::SodiumChloride] = 1.0 * ::SodiumCarbonate.MW / (2.0 * ::SodiumChloride.MW);
NaFactor[::SodiumSulphate] = 2.0 * ::SodiumCarbonate.MW / (2.0 * ::SodiumSulphate.MW);
NaFactor[::SodiumFluoride] = 1.0 * ::SodiumCarbonate.MW / (2.0 * ::SodiumFluoride.MW);
//NaFactor[::SodiumSilicate] = 1.0 * ::SodiumCarbonate.MW / (2.0 * ::SodiumSilicate.MW);
//NaFactor[::Organics] = 2.0 * ::SodiumCarbonate.MW / (2.0 * ::Organics.MW);
NaFactor[::Organics1] = 1.0 * ::SodiumCarbonate.MW / (2.0 * ::Organics1.MW);
NaFactorOK = true;
}
}
// --------------------------------------------------------------------------
void CBayerConcs::Zero()
{
Density25 = 1100.0;
for (int sn=0; sn<gs_MVDefn.Count(); sn++)
Liq[sn] = 0.0;
}
// --------------------------------------------------------------------------
bool CBayerConcs::Converge(MArray & MA)
{
double TLiq = MA.Mass(MP_Liq);
if (TLiq<1.0e-9)
{
Zero();
return true;
}
static MToleranceBlock s_Tol(TBF_Both, "BABayerSM:Density", 1e-12, 1e-8, 100);
const double Tc = 25.0;
const double T_ = C2K(Tc);
// Converge Liquor Conc. All sodium concentrations expressed as Na2CO3
int IterCount = s_Tol.GetMaxIters();//100;
double OldDensity = Density25;
while (1)
{
for (int sn=0; sn<gs_MVDefn.Count(); sn++)
{
if (gs_MVDefn[sn].IsLiquid())
Liq[sn] = MA[sn] / TLiq * Density25 * NaFactor[sn];
}
Density25 = Range(0.0001, LiquorDensity(T_, MA), 10000.0);
if (fabs(OldDensity - Density25) < s_Tol.GetAbs() || --IterCount==0)
break;
OldDensity = Density25;
} // end of while
Density25 = Max(0.001, Density25);
return (IterCount>0);
}
//---------------------------------------------------------------------------
double CBayerConcs::LTotalSodium(MArray & MA)
{
//Expressed as Na2CO3
double TSodium =
( MA[CausticSoda] * NaFactor[::CausticSoda]
+ MA[SodiumCarbonate]
+ MA[SodiumOxalate] * NaFactor[::SodiumOxalate]
+ MA[SodiumChloride] * NaFactor[::SodiumChloride]
+ MA[SodiumSulphate] * NaFactor[::SodiumSulphate]
+ MA[SodiumFluoride] * NaFactor[::SodiumFluoride]
//+ MA[Organics] * NaFactor[::Organics]
+ MA[Organics1] * NaFactor[::Organics1] );
//+ MA[SodiumSilicate] * NaFactor[::SodiumSilicate] );
return TSodium;
}
//---------------------------------------------------------------------------
double CBayerConcs::LTotalInorganicSodium(MArray & MA)
{
//Expressed as Na2CO3
double TInorganicSodium =
( MA[CausticSoda] * NaFactor[::CausticSoda]
+ MA[SodiumCarbonate]
+ MA[SodiumChloride] * NaFactor[::SodiumChloride]
+ MA[SodiumSulphate] * NaFactor[::SodiumSulphate]
+ MA[SodiumFluoride] * NaFactor[::SodiumFluoride] );
return TInorganicSodium;
}
// --------------------------------------------------------------------------
double CBayerConcs::LiquorDensEqn1(double Tc, double WTNa, double WAlumina)
{
double RHO25 = 0.982
+( 0.01349855*WTNa)
+(-0.00024948*WTNa*WTNa)
+( 0.00000273*WTNa*WTNa*WTNa)
+( 0.00208035*WAlumina)
+( 0.00004113*WAlumina*WAlumina)
+(-0.00000728*WAlumina*WAlumina*WAlumina)
+( 0.00033367*WTNa*WAlumina); // Density at 25
if (Tc==25.0)
return (RHO25 * 1000.0); // kg/m^3
double RHO = RHO25 * (1.0
-(0.0005021858*0.85*(Tc-25))
-(0.0000011881*0.85*(Tc-25)*(Tc-25)) ); // Density at T
return (RHO * 1000.0); // kg/m^3
}
// --------------------------------------------------------------------------
double CBayerConcs::LiquorDensEqn2(double T_, double S, double CtoS, double AtoC, double CltoS, double FtoS, double SO4toS, double TOCtoS)
{
double K2OtoS = 0.0; //not used
double c = S * CtoS * 0.001;
double a = c * AtoC;
double RHOH2O = WaterDensity(T_);
double CI = c - S * K2OtoS * 0.001;
double WNaOH = (321.0 * CI - 333.0 * a) * 2.3521;
double WNaAl = a * 1607.887;
double TOStoS = TOCtoS * 2.0;
double Fact = 1.376; //Fact = 1.376 for low temp 1.26428 for high temp plant combines the MW with gOC/gOrg
double WTOS = S * TOStoS * Fact;
double WKOH = S * K2OtoS * 1.191239;
double WNaCl = S * CltoS * 1.64838;
double WNaF = S * FtoS * 2.210091;
double WNa2SO4 = S * SO4toS * 1.478635;
double WNa2CO3 = Max(0.0, S - 1000.0 * c);
double WSOL = WNaOH + WNaAl + WTOS + WKOH + WNaCl + WNaF + WNa2SO4 + WNa2CO3;
double WH2O = Max(0.0, 1000.0 - WSOL);
double VH2O = WH2O / RHOH2O;
double VKOH = WKOH * 0.160095;
double VNa2SO4 = WNa2SO4 * 0.142179;
double VNa2CO3 = Max(0.0, WNa2CO3 * (0.3484 * Pow((WNa2CO3 / GTZ(WH2O)),0.5) - 0.0591));
double VNaCl = WNaCl * 0.320909;
//VOrg = 0.71 for low temp plant ; 0.2 for high temp plant; 0.6 for WAPL
double VOrg = 0.6;
double VTOS = WTOS * VOrg;
double VNaF = WNaF * 0.074;
double F1 = WNaAl / GTZ(WH2O);
double F2 = WNaOH / GTZ(WH2O);
double V = 0.75 * WNaAl * F1 + 0.82926 * WNaOH * F2 - 1.4985 * WNaAl * F1 * F1 - 0.81711 * WNaOH * F2 * F2 + 0.7212 * WNaAl * F1 * F1 * F1 + 0.33201 * WNaOH * F2 * F2 * F2;
V = V + 50.0 * Pow((1000 - WH2O) / GTZ(WH2O), 2.0);// for low temp
//V = V+23.9*((1000-WH2O)/GTZ(WH2O));// for high temp plant
double TVOL = V + VH2O + VKOH + VNa2SO4 + VNa2CO3 + VNaCl + VNaF + VTOS;
double RHOT = 1000.0 / GTZ(TVOL);
return (RHOT * 1000.0);
}
// --------------------------------------------------------------------------
double CBayerConcs::LiquorDensEqn3(double T_, double S, double A, double C)
{
const double Rac = A/NZ(C);
const double Rcs = C/NZ(S);
const double Rso4 = 73.4;
const double Rcl = 31.6;
const double Roc = 76.6;
const double R1 = (8383.2 - (464.8 - 4886.4*Rac)*Rcs + 11.8*Rso4 + 9.81*Rcl + 12.85*Roc)*1e-4;
const double R2 = (2.69*Rac*Rac - 3.71)*Rcs*1e-4;
const double RHO = 1548.15 + R1*S + R2*S*S - 1.10913*T_ - 59651.0/T_;
return RHO;
}
// --------------------------------------------------------------------------
double CBayerConcs::LiquorDensEqn4(double T_, double S, double A, double C, double Rso4, double Rcl, double Roc)
{
const double Rac = A/NZ(C);
const double Rcs = C/NZ(S);
const double R1 = (8383.2 - (464.8 - 4886.4*Rac)*Rcs + 11.8*Rso4 + 9.81*Rcl + 12.85*Roc)*1e-4;
const double R2 = (2.69*Rac*Rac - 3.71)*Rcs*1e-4;
const double RHO = 1548.15 + R1*S + R2*S*S - 1.10913*T_ - 59651.0/T_;
return RHO;
}
// --------------------------------------------------------------------------
// Liquid Density Calculations from BRAHMA model
// One version uses TOC, the other TOS
// There are difficulties in matching SysCAD species model with the Brahma model
// Notes
// Original code is density in g/cc, modified to g/l or kg/m^3
// Based on following Pascal Code
/* Function Density_l_in( T : prec; LiqCompL: LiquorCompositionTypeL): prec;
Var
term1, term2, term3, term4, sum : prec;
begin
with LiqCompL do
begin
term1 := 0.5 * (1 - 9.528321E-4*(T-20) - 2.64664e-6*Sqr(T-20) );
term2 := 5e-4* SQRT(1e6 + 4e3*(0.8347*C + (0.74 + C * 4.2e-4) * A
+ 1.048*(S-C) + 0.8007*Cl*106/71 + 1.2517*SO4*106/96 + 1.35*TOS) );
term3 := 1.0018 * Pow( 10, -3.36587 + 0.01136 * (S-C) );
term4 := (C - 130) * 4e-5;
sum := term1 + term2 + term3 + term4;
if sum > 2 then sum := 2;
density_l_in := 0.9982 * sum;
end;
end;
begin
with LiqCompL do
begin
case PDat.Choice_Dens_Term of
1 : begin {Old}
term1 := 0.5 * (1 - 9.528321E-4*(T-20) - 2.64664e-6*Sqr(T-20) );
term2 := 5e-4* SQRT(1e6 + 4e3*(0.8347*C + (0.74 + C * 4.2e-4) * A
+ 1.048*(S-C) + 0.8007*Cl*106/71 + 1.2517*SO4*106/96 + 1.35*TOS) );
term3 := 1.0018 * Pow( 10, -3.36587 + 0.01136 * (S-C) );
term4 := (C - 130) * 4e-5;
sum := term1 + term2 + term3 + term4;
sum := 0.9982 * sum;
end;
2 : begin {New}
term1 := 1.0149 + 7.0127E-4*C + 4.4411E-4*A;
term2 := 7.4899E-4 * (S-C);
term3 := 7.800E-4 * SO4 * 142/96 + 9.576E-4 * CL * 58/35.5;
term4 := 1.6847E-3 * TOC-3.0501E-4 * (T - 25) - 2.877E-6 * SQR(T - 25);
sum := term1 + term2 + term3 + term4;
end;
end; {case}
if sum > 2 then sum := 2;
density_l_in := sum;
end;
end;
*/
// Old Brahma Density Equation...
double CBayerConcs::LiquorDensEqn5(double Tc,
double C, double S, double A,
double Cl, double SO4, double TOS)
{
double term1 = 0.5 * (1 - 9.528321E-4*(Tc-20) - 2.64664e-6*Sqr(Tc-20) );
double term2 = 5e-4* Sqrt(1e6 + 4e3*(0.8347*C + (0.74 + C * 4.2e-4) * A
+ 1.048*(S-C) + 0.8007*Cl*106/71 + 1.2517*SO4*106/96 + 1.35*TOS) );
double term3 = 1.0018 * pow( 10. , -3.36587 + 0.01136 * (S-C) );
double term4 = (C - 130) * 4e-5;
double sum = (term1 + term2 + term3 + term4)*998.2;
if (sum > 2000.) sum = 2000.0;
return sum;
}
// New Brahma Density Equation...
double CBayerConcs::LiquorDensEqn6(double Tc,
double C, double S, double A,
double Cl, double SO4, double TOC)
{
const double term1 = 1.0149 + 7.0127E-4*C + 4.4411E-4*A;
const double term2 = 7.4899E-4 * (S-C);
const double term3 = 7.800E-4 * SO4 * 142/96 + 9.576E-4 * Cl * 58/35.5;
const double term4 = 1.6847E-3 * TOC-3.0501E-4 * (Tc - 25) - 2.877E-6 * Sqr(Tc - 25);
double sum = (term1 + term2 + term3 + term4)*1000;
if (sum > 2000.) sum = 2000.0;
return sum;
}
// --------------------------------------------------------------------------
double CBayerConcs::WaterDensity(double T_)
{
//const double TR = 1.0 - (K2C(T_)+273.15)/647.3;
//kga 15/2/2006: Do not allow TR to be negative (ie assume maximum temperature = 647.3K
const double TR = Max(0.01, 1.0 - (K2C(T_)+273.15)/647.3);
const double TR2 = TR*TR;
const double a = 1497.2*Pow(TR,0.975);
const double b = 1688000.0*Pow(TR,20.0) - 7439.0*Pow(TR,6.0) + 2002.4*TR2 - 1763.3;
const double c = 2.8436 - 0.025096/TR + 0.00008007/TR2;
const double RhoW = 0.001 * ( 576.44 + a + TR2*b - 1.0/TR*c);
return RhoW;
}
// --------------------------------------------------------------------------
double CBayerConcs::LiquorDensity(double T_, MArray & MA)
{
/*Liquor Density with mass fractions*/
double TLiq=MA.Mass(MP_Liq); //Total Liquid kg/s
if (TLiq<1.0e-9)
return 0.0;
double Tc = K2C(T_);
switch (BATCBayerSM::sm_iDensityMethod)
{
case BDM_Original:
{
// Version independent of caustic concentration
// Calculates density in gm/cc
// By J.W.Mulloy
double TNa=LTotalSodium(MA); // Total Sodium Compounds as Na2CO3 kg/s
double Alumina=MA[::Alumina]; // Alumina kg/s
double WTNa=TNa*100.0/TLiq; // Wgt % of TNa
double WAlumina=Alumina*100.0/TLiq; // Wgt % of Alumina
double RHO = LiquorDensEqn1(Tc, WTNa, WAlumina);
return RHO;
}
case BDM_WRS:
{
//Referance: Bayer Process Properties BATC SysCAD Model
/*t = temperature, °C
S = S, g of S per kg liquor
AtoC = A/C
CtoS = C/S
CltoS = kg Cl- ions per kg S
FtoS = kg F- ions per kg S
SO4toS = kg SO4- ions per kg S
TOCtoS = kg TOC per kg S
K2OtoS = kg K- ions per kg S
Function RHOT(t, S, AtoC, CtoS, CltoS, FtoS, SO4toS, TOCtoS, K2OtoS)
' calculate the density of Bayer liquor
' S in g/kg, t in °C
On Error GoTo eh_rhot
C = S * CtoS * 0.001
a = C * AtoC
RHOH2O = RHOW(t) (Note this is a function call for water density – use default SysCAD function in place)
CI = C - S * K2OtoS * 0.001
WNaOH = (321 * CI - 333 * a) * 2.3521
WNaAl = a * 1607.887
TOStoS = TOCtoS * 2
' Fact = 1.376 for low temp 1.26428 for high temp plant combines the MW with gOC/gOrg
Fact = 1.376
WTOS = S * TOStoS * Fact
WKOH = S * K2OtoS * 1.191239
WNaCl = S * CltoS * 1.64838
WNaF = S * FtoS * 2.210091
WNa2SO4 = S * SO4toS * 1.478635
WNa2CO3 = S - 1000 * C
WSOL = WNaOH + WNaAl + WTOS + WKOH + WNaCl + WNaF + WNa2SO4 + WNa2CO3
WH2O = 1000 - WSOL
VH2O = WH2O / RHOH2O
VKOH = WKOH * 0.160095
VNa2SO4 = WNa2SO4 * 0.142179
VNa2CO3 = WNa2CO3 * (0.3484 * (WNa2CO3 / WH2O) ^ 0.5 - 0.0591)
VNaCl = WNaCl * 0.320909
' VOrg = 0.71 for low temp plant ; 0.2 for high temp plant; 0.6 for WAPL
VOrg = 0.6
VTOS = WTOS * VOrg
VNaF = WNaF * 0.074
F1 = WNaAl / WH2O
F2 = WNaOH / WH2O
V = 0.75 * WNaAl * F1 + 0.82926 * WNaOH * F2 - 1.4985 * WNaAl * F1 ^ 2 - 0.81711 * WNaOH * F2 ^ 2 + 0.7212 * WNaAl * F1 ^ 3 + 0.33201 * WNaOH * F2 ^ 3
V = V + 50 * ((1000 - WH2O) / WH2O) ^ 2 ' for low temp
V=V+23.9*((1000-WH2O)/WH2O) for high temp plant
TVOL = V + VH2O + VKOH + VNa2SO4 + VNa2CO3 + VNaCl + VNaF + VTOS
RHOT = 1000 / TVOL
*/
const double S = (MA[SodiumCarbonate] + MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW);
const double A = MA[Alumina];
const double C = MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW;
const double AtoC = A/NZ(C);
const double CtoS = C/NZ(S);
const double Cl = MA[SodiumChloride]/::SodiumChloride.MW*MW_Cl;
const double CltoS = Cl/NZ(S); //kg per kg S
const double F = MA[SodiumFluoride]/::SodiumFluoride.MW*MW_F;
const double FtoS = F/NZ(S); //kg per kg S
const double SO4 = MA[SodiumSulphate]/::SodiumSulphate.MW*MW_SO4;
const double SO4toS = SO4/NZ(S); //kg per kg S
const double StoLiq = S*1000.0/TLiq;//g of S per kg liquor
const double TOC = (/*MA[Organics]*5.0/::Organics.MW + */MA[SodiumOxalate]*2.0/::SodiumOxalate.MW)*MW_C + MA[Organics1]*2.21/::Organics1.MW*MW_C;
const double TOCtoS = TOC/NZ(S); //kg per kg S
double RHO = LiquorDensEqn2(T_, StoLiq, CtoS, AtoC, CltoS, FtoS, SO4toS, TOCtoS);
return RHO;
}
case BDM_BPD1:
{
//Referance: Bayer Process Properties BATC SysCAD Model
//2.2 Liquor Density – Basis of Process Design.
//Note the liquor sulphate, chloride and organic carbon concentrations are fixed.
//Function variables:
//A = Al2O3 concentration (g/L liquor)
//C = NaOH & NaAl(OH)4 concentration, expressed as grams Na2CO3 / L liquor @ 25°C
//S = NaOH, NaAl(OH)4 plus Na2CO3 expressed as grams Na2CO3 / L liquor @ 25°C
//RAC = A/C ratio
//RCS = C/S ratio
//RSO4 = 73.4 g SO4 / kg S (SO4 ions not Na2SO4)
//RCl = 31.6 g Cl / kg S (Cl ions not NaCl)
//ROC = 76.6 g organic carbon / kg S
//RF = 2.7 g F / kg S
double rho = 1000.0;
const double S = (MA[SodiumCarbonate] + MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW)/TLiq*rho;
const double A = MA[Alumina]/TLiq*rho;
const double C = (MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW)/TLiq*rho;
double RHO = LiquorDensEqn3(T_, S, A, C);
return RHO;
}
case BDM_BPD2:
{
//Referance: Bayer Process Properties BATC SysCAD Model
//2.2 Liquor Density – Basis of Process Design.
//Revised as per email from Melissa Rothnie 28 September 2005
//now uses actual concentrations for SO4, Cl and OC ions
//Function variables:
//A = Al2O3 concentration (g/L liquor)
//C = NaOH & NaAl(OH)4 concentration, expressed as grams Na2CO3 / L liquor @ 25°C
//S = NaOH, NaAl(OH)4 plus Na2CO3 expressed as grams Na2CO3 / L liquor @ 25°C
//RAC = A/C ratio
//RCS = C/S ratio
//RSO4 = 73.4 g SO4 / kg S (SO4 ions not Na2SO4)
//RCl = 31.6 g Cl / kg S (Cl ions not NaCl)
//ROC = 76.6 g organic carbon / kg S
//RF = 2.7 g F / kg S
double rho = 1000.0;//guess, then iterate...???
const double S_ = (MA[SodiumCarbonate] + MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW);
const double S = (MA[SodiumCarbonate] + MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW)/TLiq*rho;
const double A = MA[Alumina]/TLiq*rho;
const double C = MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW/TLiq*rho;
const double SO4 = MA[SodiumSulphate]/::SodiumSulphate.MW*MW_SO4;
const double Cl = MA[SodiumChloride]/::SodiumChloride.MW*MW_Cl;
const double TOC = (/*MA[Organics]*5.0/::Organics.MW + */MA[SodiumOxalate]*2.0/::SodiumOxalate.MW)*MW_C + MA[Organics1]*2.21/::Organics1.MW*MW_C;
const double Rso4 = SO4/NZ(S_);
const double Rcl = Cl/NZ(S_);
const double Roc = TOC/NZ(S_);
double RHO = LiquorDensEqn4(T_, S, A, C, Rso4, Rcl, Roc);
return RHO;
}
case BDM_BRAHMA25:
{
double C = Liq[CausticSoda];
double S = C+Liq[SodiumCarbonate];
double A = Liq[Alumina];
double Cl = Liq[SodiumChloride]*35.453*2/SodiumCarbonate.MW;
double SO4 = Liq[SodiumSulphate]*96.07/SodiumCarbonate.MW;
double TOC = Liq[Organics1]*(12.11*2.21/(89.5951)) + Liq[SodiumOxalate]*(2*12.11/134.012);
return LiquorDensEqn6( Tc, C, S, A, Cl, SO4, TOC);
}
case BDM_BRAHMA:
{
double den = 1000.;
double denOld;
do {
denOld = den;
double r = den/TLiq;
double C = MA[CausticSoda]*r*NaFactor[CausticSoda] ;
double S = C+MA[SodiumCarbonate]*r;
double A = MA[Alumina]*r;
double Cl = MA[SodiumChloride]*r /(58.44/35.45);
double SO4 = MA[SodiumSulphate]*r /(142.0431/96.07);
double TOC = (MA[Organics1]*(12.11*2.21/(89.5951)) + MA[SodiumOxalate]*(2*12.11/134.012))*r;
den = LiquorDensEqn6( Tc, C, S, A, Cl, SO4, TOC);
} while (fabs(1.-den/denOld) > 1.0e-5);
return den;
}
case BDM_BRAHMA_OLD:
{
double den = 1000.;
double denOld;
do {
denOld = den;
double r = den/TLiq;
double C = MA[CausticSoda]*r / (2*39.99/105.99);
double S = C+MA[SodiumCarbonate]*r;
double A = MA[Alumina]*r;
double Cl = MA[SodiumChloride]*r /(58.44/35.45);
double SO4 = MA[SodiumSulphate]*r /(142.07/96.07);
double TOS = (MA[Organics1]*(105.99/(2*89.569)) + MA[SodiumOxalate]*105.99/134.012)*r;
den = LiquorDensEqn5( Tc, C, S, A, Cl, SO4, TOS);
// pBayerMdl->p("den = %12.5g", den);
} while (fabs(1.-den/denOld) > 1.0e-5);
return den;
}
}//end switch
return 1000.0;
}
//===========================================================================
//
//
//
//===========================================================================
BATCBayerSM::BATCBayerSM(TaggedObject *pNd) : LiqConcs25(this)
{
MInitialise(); // this must be called to initialise the SMDK library if neccessary
fDoCalc = false;
//feed calculator defaults...
dRqd_AtoC = 0.4;
dRqd_C = 220.0;
dRqd_CtoS = 0.85;
dRqd_Sul = 20.0;
dRqd_Sil = 1.0;
//dRqd_Org = 50.0;
//dRqd_OrgRatio = 0.9;
dRqd_Ox = 45.0;
dRqd_TOC = 12.0;
dRqd_Salt = 15.0;
dRqd_Fl = 5.0;
dRqd_SolFrac = 0.0;
dRqd_SolConc = dNAN;
}
//---------------------------------------------------------------------------
BATCBayerSM::~BATCBayerSM()
{
}
//---------------------------------------------------------------------------
bool BATCBayerSM::get_IsBaseClassOf(LPCTSTR OtherProgID)
{
return false;
//return S_OK;
}
//---------------------------------------------------------------------------
LPCTSTR BATCBayerSM::get_PreferredModelProgID()
{
return NULL;
}
//---------------------------------------------------------------------------
void BATCBayerSM::BuildDataFields()
{
};
//---------------------------------------------------------------------------
bool BATCBayerSM::ExchangeDataFields()
{
return false;
};
//---------------------------------------------------------------------------
bool BATCBayerSM::ValidateDataFields()
{
bool OK=MSpModelBase::ValidateDataFields();
InputCalcs(fDoCalc, Temperature);
return OK;
}
//---------------------------------------------------------------------------
double BATCBayerSM::get_Density(long Phases, double T, double P, MArray *pMA)
{
MArray MA(pMA ? (*pMA) : this);
const double MSol=(Phases & MP_Sol) ? MA.Mass(MP_Sol) : 0.0;
const double MLiq=(Phases & MP_Liq) ? MA.Mass(MP_Liq) : 0.0;
const double MGas=(Phases & MP_Gas) ? MA.Mass(MP_Gas) : 0.0;
const double MTot=GTZ(MSol+MLiq+MGas);
const double MSL = MSol+MLiq;
if (MSL<UsableMass || MSL/MTot<1.0e-6)
return MSpModelBase::get_Density(Phases, T, P, &MA);
const double WaterFrac = (MLiq>1e-6 ? MA[Water]/MLiq : 0.0);
if (WaterFrac>sm_dH2OTestFrac0)
return MSpModelBase::get_Density(Phases, T, P, &MA);
const double FSol=MSol/MTot;
const double FLiq=MLiq/MTot;
double Dl=1.0;
if (FLiq>1.0e-9)
{
LiqConcs25.Converge(MA);
Dl = LiqConcs25.LiquorDensity(T, MA);
if (WaterFrac>sm_dH2OTestFrac1)
{
const double Std_Dl = MSpModelBase::get_Density(MP_Liq, T, P, &MA);
const double Std_Prop = Min(1.0, (WaterFrac-sm_dH2OTestFrac1)/(sm_dH2OTestFrac0-sm_dH2OTestFrac1));
Dl = (Dl*(1.0-Std_Prop)) + (Std_Dl*Std_Prop);
}
}
return DensityMix(FSol, dNAN, FLiq, Dl, (1.0-FSol-FLiq), dNAN, T, P, MA);
}
//---------------------------------------------------------------------------
double BATCBayerSM::LiqCpCalc(MArray & MA, double Tc)
{
double Cpl = 0.0;
LiqConcs25.Converge(MA);
const double MLiq = MA.Mass(MP_Liq); //Total Liquid kg/s
switch (sm_iCPMethod)
{
case CPM_Original:
{
// Heat Capacity of Bayer Liquor Kcal/kg.degC
// A function of the weight fraction of TNa and Al2O3
// From published Russian data
const double TNaAsCO3 = LiqConcs25.LTotalSodium(MA);
const double TNaAsCO3Use = Max(TNaAsCO3, MLiq*0.19); // Only Valid for TNaAsCO3/FLiq > 0.19
const double TNa = 100.0*TNaAsCO3*::OccSoda.MW/::SodiumCarbonate.MW/MLiq; //61.98=MW Na2O, 105.99=MW Na2CO3
const double TAl2O3 = 100.0*MA[Alumina]/MLiq;
Cpl = -0.020113606661083*TNa
+0.001081165172606*TNa*TNa
-0.000022606160779*TNa*TNa*TNa
-0.004597725999883*TAl2O3
-0.000001053264708*TAl2O3*TAl2O3
-0.00000218836287*TAl2O3*TAl2O3*TAl2O3;
// Scale for more dilute Liquors
Cpl = 1.0275057375729+(TNaAsCO3/TNaAsCO3Use*Cpl);
Cpl = KCal_2_kJ(Cpl); // kJ/kg.degC (KCal_2_kJ=4.184)
break;
}
case CPM_WRS:
{
// Heat Capacity of Bayer Liquor Kcal/kg.degC
//Referance: Bayer Process Properties BATC SysCAD Model
const double S = (MA[SodiumCarbonate] + MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW);
const double A = MA[Alumina];
const double C = MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW;
const double AtoC = A/NZ(C);
const double CtoS = C/NZ(S);
const double Cl = MA[SodiumChloride]/::SodiumChloride.MW*MW_Cl;
const double CltoS = Cl/NZ(S)*1000.0; //g per kg S
//const double F = MA[SodiumFluoride]/::SodiumFluoride.MW*MW_F;
//const double FtoS = F/NZ(S)*1000.0; //g per kg S
const double SO4 = MA[SodiumSulphate]/::SodiumSulphate.MW*MW_SO4;
const double SO4toS = SO4/NZ(S)*1000.0; //g per kg S
//const double TOC = (MA[Organics]*5.0/::Organics.MW + MA[SodiumOxalate]*2.0/::SodiumOxalate.MW)*MW_C + MA[Organics1]*2.21/::Organics1.MW*MW_C;
//const double TOCtoS = TOC/NZ(S)*1000.0; //g per kg S
const double StoLiq = S*1000.0/MLiq;//g of S per kg liquor
const double D25 = LiqConcs25.Density25/1000.0;
const double Sgl = StoLiq * D25;
const double R3 = (-2236.1 + (598.99 - 2252.95*AtoC)*CtoS - 3.24526*SO4toS - 7.53787*CltoS)*0.000001;
const double R4 = (1.79983 - (0.76776 - 2.39436*AtoC)*CtoS)*CtoS*0.000001;
const double D = 8.98685*0.000001;
const double E = -1.0*(633.401 + 0.451216*Sgl*CtoS)*0.000001;
const double F = 4.17188 + R3*Sgl + R4*Sgl*Sgl;
Cpl = D*Tc*Tc/3.0 + E*Tc/2.0 + F;
break;
}
}
return Cpl;
}
//---------------------------------------------------------------------------
double BATCBayerSM::get_msEnthalpy(long Phases, double T, double P, MArray *pMA)
{
MArray MA(pMA ? (*pMA) : this);
const double MSol=(Phases & MP_Sol) ? MA.Mass(MP_Sol) : 0.0;
const double MLiq=(Phases & MP_Liq) ? MA.Mass(MP_Liq) : 0.0;
const double MGas=(Phases & MP_Gas) ? MA.Mass(MP_Gas) : 0.0;
const double MTot=GTZ(MSol+MLiq+MGas);
const double MSL = MSol+MLiq;
if (MSL<UsableMass || MSL/MTot<1.0e-6)
return MSpModelBase::get_msEnthalpy(Phases, T, P, &MA);
const double WaterFrac = (MLiq>1e-6 ? MA[Water]/MLiq : 0.0);
if (WaterFrac>sm_dH2OTestFrac0)
return MSpModelBase::get_msEnthalpy(Phases, T, P, &MA);
const double FSol=MSol/MTot;
const double FLiq=MLiq/MTot;
const double Tc=K_2_C(T);
double Hl=0.0;
if (FLiq>1.0e-9)
{
Hl = LiqCpCalc(MA, Tc) * Tc;
if (WaterFrac>sm_dH2OTestFrac1)
{
const double Std_Hl = MSpModelBase::get_msEnthalpy(MP_Liq, T, P, &MA);
const double Std_Prop = Min(1.0, (WaterFrac-sm_dH2OTestFrac1)/(sm_dH2OTestFrac0-sm_dH2OTestFrac1));
Hl = (Hl*(1.0-Std_Prop)) + (Std_Hl*Std_Prop);
}
}
double Hs=(FSol>1.0e-9) ? gs_MVDefn.msHz(MP_Sol, T, P, PropOverides, &MA) : 0.0;
return msEnthalpyMix(FSol, Hs, FLiq, Hl, (1.0-FSol-FLiq), dNAN, T, P, MA);
}
//---------------------------------------------------------------------------
double BATCBayerSM::get_msEntropy(long Phases, double T, double P, MArray *pMA)
{
return MSpModelBase::get_msEntropy(Phases, T, P, pMA);
}
//---------------------------------------------------------------------------
double BATCBayerSM::get_msCp(long Phases, double T, double P, MArray *pMA)
{
MArray MA(pMA ? (*pMA) : this);
const double MSol=(Phases & MP_Sol) ? MA.Mass(MP_Sol) : 0.0;
const double MLiq=(Phases & MP_Liq) ? MA.Mass(MP_Liq) : 0.0;
const double MGas=(Phases & MP_Gas) ? MA.Mass(MP_Gas) : 0.0;
const double MTot=GTZ(MSol+MLiq+MGas);
const double MSL = MSol+MLiq;
if (MSL<UsableMass || MSL/MTot<1.0e-6)
return MSpModelBase::get_msCp(Phases, T, P, &MA);
const double WaterFrac = (MLiq>1e-6 ? MA[Water]/MLiq : 0.0);
if (WaterFrac>sm_dH2OTestFrac0)
return MSpModelBase::get_msCp(Phases, T, P, &MA);
const double FSol=MSol/MTot;
const double FLiq=MLiq/MTot;
double Cpl=0.0;
if (FLiq>1.0e-9)
{
Cpl = LiqCpCalc(MA, K_2_C(T));
if (WaterFrac>sm_dH2OTestFrac1)
{
const double Std_Cpl = MSpModelBase::get_msCp(MP_Liq, T, P, &MA);
const double Std_Prop = Min(1.0, (WaterFrac-sm_dH2OTestFrac1)/(sm_dH2OTestFrac0-sm_dH2OTestFrac1));
Cpl = (Cpl*(1.0-Std_Prop)) + (Std_Cpl*Std_Prop);
}
}
double Cps=(FSol>1.0e-9) ? Max(sm_dMinSolCp, gs_MVDefn.msCp(MP_Sol, T, P, PropOverides, &MA)) : 0.0;
return msCpMix(FSol, Cps, FLiq, Cpl, (1.0-FSol-FLiq), dNAN, T, P, MA);
}
//---------------------------------------------------------------------------
double BATCBayerSM::get_SaturationT(double P, MArray *pMA)
{
MArray MA(pMA ? (*pMA) : this);
if (MA.Mass(MP_SL)/GTZ(MA.Mass())<1.0e-6)
return MSpModelBase::get_SaturationT(P, &MA);
const double MLiq = MA.Mass(MP_Liq);
const double WaterFrac = (MLiq>1e-6 ? MA[Water]/MLiq : 0.0);
if (WaterFrac>sm_dH2OTestFrac0)
return MSpModelBase::get_SaturationT(P, &MA);
const double Std_SatT = MSpModelBase::get_SaturationT(P, &MA);
const double BPE = BoilPtElev(MA, Std_SatT);
double SatT = Std_SatT+BPE;
if (WaterFrac>sm_dH2OTestFrac1)
{
const double Std_Prop = Min(1.0, (WaterFrac-sm_dH2OTestFrac1)/(sm_dH2OTestFrac0-sm_dH2OTestFrac1));
SatT = (SatT*(1.0-Std_Prop)) + (Std_SatT*Std_Prop);
}
return SatT;
}
//---------------------------------------------------------------------------
double BATCBayerSM::get_SaturationP(double T, MArray *pMA)
{
MArray MA(pMA ? (*pMA) : this);
if (MA.Mass(MP_SL)/GTZ(MA.Mass())<1.0e-6)
return MSpModelBase::get_SaturationP(T, &MA);
const double MLiq = MA.Mass(MP_Liq);
const double WaterFrac = (MLiq>1e-6 ? MA[Water]/MLiq : 0.0);
if (WaterFrac>sm_dH2OTestFrac0)
return MSpModelBase::get_SaturationP(T, &MA);
//converge...
const int BPE_MaxIter = 8;
const double BPE_Tol = 1.0e-3;
double BPE = 0.0;
for (int Iter=BPE_MaxIter; Iter; Iter--)
{
double NewBPE = BoilPtElev(MA, T-BPE);
NewBPE = Range(0.0, NewBPE, 20.0);
if (fabs(NewBPE-BPE)<BPE_Tol)
break;
BPE = NewBPE;
}
double SatP = MSpModelBase::get_SaturationP(T-BPE, &MA);
if (WaterFrac>sm_dH2OTestFrac1)
{
const double Std_SatP = MSpModelBase::get_SaturationP(T, &MA);
const double Std_Prop = Min(1.0, (WaterFrac-sm_dH2OTestFrac1)/(sm_dH2OTestFrac0-sm_dH2OTestFrac1));
SatP = (SatP*(1.0-Std_Prop)) + (Std_SatP*Std_Prop);
}
return SatP;
}
//---------------------------------------------------------------------------
double BATCBayerSM::Molality(double &WH20, double &Mtot)
{
MArray MA(this);
double TLiq=MA.Mass(MP_Liq); // Total Liquid kg/s
if (TLiq<1.0e-9)
return 0.0;
const double giAl2O3 = 1000 * MA[Alumina] / TLiq * 2.0 * 81.97 / ::Alumina.MW; // 81.97 = MW of NaAlO2
const double giNaOH = 1000 * MA[CausticSoda] / TLiq
- (1000 * MA[Alumina] / TLiq * 2.0 * ::CausticSoda.MW/::Alumina.MW);
const double giNa2CO3 = 1000 * MA[SodiumCarbonate] / TLiq;
const double giNaCl = 1000 * MA[SodiumChloride] / TLiq;
const double giNa2SO4 = 1000 * MA[SodiumSulphate] / TLiq;
const double giNaF = 1000 * MA[SodiumFluoride] / TLiq;
//const double giNa2C5O7 = 1000 * MA[Organics] / TLiq;
const double giNaOrg = 1000 * MA[Organics1] / TLiq;
const double giNa2C2O4 = 1000 * MA[SodiumOxalate] / TLiq;
const double giSum = giAl2O3 + giNaOH + giNa2CO3 + giNaCl + giNa2SO4 + giNaF + /*giNa2C5O7 + */giNaOrg + giNa2C2O4;
WH20 = 1000.0 - giSum;
//Gram moles per kg liq
const double gmAl2O3 = giAl2O3 / 81.97; // 81.97 = MW of NaAlO2
const double gmNaOH = giNaOH / ::CausticSoda.MW;
const double gmNa2CO3 = giNa2CO3 / ::SodiumCarbonate.MW;
const double gmNaCl = giNaCl / ::SodiumChloride.MW;
const double gmNa2SO4 = giNa2SO4 / ::SodiumSulphate.MW;
const double gmNaF = giNaF / ::SodiumFluoride.MW;
//const double gmNa2C5O7 = giNa2C5O7 / ::Organics.MW;
const double gmNaOrg = giNaOrg / ::Organics1.MW;
const double gmNa2C2O4 = giNa2C2O4 / ::SodiumOxalate.MW;
Mtot = gmAl2O3 + gmNaOH + gmNa2CO3 + gmNaCl + gmNa2SO4 + gmNaF + /*gmNa2C5O7 + */gmNaOrg + gmNa2C2O4;
// Total gmoles/kg H2O = molality
return 1000.0 * Mtot/Max(0.1, WH20);
}
//---------------------------------------------------------------------------
double BATCBayerSM::BoilPtElev(MArray & MA, double T)
{
double TLiq=MA.Mass(MP_Liq); // Total Liquid kg/s
if (TLiq<1.0e-9)
return 0.0;
double BPE = 0.0;
switch (sm_iBPEMethod)
{
case BPM_Dewey:
{
if (MA[Alumina]<1.0e-6 && MA[CausticSoda]<1.0e-6 && MA[SodiumCarbonate]<1.0e-6)
return 0.0;
// Gram ion per kg liq
const double giAl2O3 = 1000 * MA[Alumina] / TLiq * 2.0 * 81.97 / ::Alumina.MW; // 81.97 = MW of NaAlO2
const double giNaOH = 1000 * MA[CausticSoda] / TLiq
- (1000 * MA[Alumina] / TLiq * 2.0 * ::CausticSoda.MW/::Alumina.MW);
const double giNa2CO3 = 1000 * MA[SodiumCarbonate] / TLiq;
const double giNaCl = 1000 * MA[SodiumChloride] / TLiq;
const double giNa2SO4 = 1000 * MA[SodiumSulphate] / TLiq;
const double giNaF = 1000 * MA[SodiumFluoride] / TLiq;
//const double giNa2C5O7 = 1000 * MA[Organics] / TLiq;
const double giNaOrg = 1000 * MA[Organics1] / TLiq;
const double giNa2C2O4 = 1000 * MA[SodiumOxalate] / TLiq;
const double giSum = giAl2O3 + giNaOH + giNa2CO3 + giNaCl + giNa2SO4 + giNaF + /*giNa2C5O7 + */giNaOrg + giNa2C2O4;
const double gH2OperKgLiq = 1000.0 - giSum;
//Gram moles per kg liq
const double gmAl2O3 = giAl2O3 / 81.97; // 81.97 = MW of NaAlO2
const double gmNaOH = giNaOH / ::CausticSoda.MW;
const double gmNa2CO3 = giNa2CO3 / ::SodiumCarbonate.MW;
const double gmNaCl = giNaCl / ::SodiumChloride.MW;
const double gmNa2SO4 = giNa2SO4 / ::SodiumSulphate.MW;
const double gmNaF = giNaF / ::SodiumFluoride.MW;
//const double gmNa2C5O7 = giNa2C5O7 / ::Organics.MW;
const double gmNaOrg = giNaOrg / ::Organics1.MW;
const double gmNa2C2O4 = giNa2C2O4 / ::SodiumOxalate.MW;
const double gmSum = gmAl2O3 + gmNaOH + gmNa2CO3 + gmNaCl + gmNa2SO4 + gmNaF + /*gmNa2C5O7 + */gmNaOrg + gmNa2C2O4;
// Total gmoles/kg H2O = molality
const double gmSumPerH2O = 1000.0 * gmSum/Max(0.1, gH2OperKgLiq);
// Boiling point elevation degC
BPE = 0.00182 + 0.55379*Pow((gmSumPerH2O/10.0),7)
+ 0.0040625*gmSumPerH2O*T
+ (1.0/T) * (-286.66*gmSumPerH2O + 29.919*gmSumPerH2O*gmSumPerH2O
+0.6228*Pow(gmSumPerH2O,3))
- (0.032647*gmSumPerH2O*Pow((gmSumPerH2O*T/1000.0),2))
+ (Pow(T*0.001,5.0) * (5.9705*gmSumPerH2O
-0.57532*gmSumPerH2O*gmSumPerH2O + 0.10417*Pow(gmSumPerH2O,3)));
break;
}
case BPM_BPD1:
{
//Referance: Bayer Process Properties BATC SysCAD Model
//2.8 Boiling Point Elevation – Basis of Process Design
//Note that concentrations for SO4, Cl and OC ions are fixed.
LiqConcs25.Converge(MA);
const double S = (LiqConcs25.Liq[::CausticSoda] + LiqConcs25.Liq[::SodiumCarbonate]);
if (S<1.0e-6)
return 0.0;
const double A = LiqConcs25.Liq[::Alumina];
const double C = LiqConcs25.Liq[::CausticSoda];
//const double RhoT = CBayerConcs::LiquorDensEqn3(T, S, A, C);
const double Rho25 = CBayerConcs::LiquorDensEqn3(C2K(25.0), S, A, C);
const double Rac = A/NZ(C);
const double Rcs = C/NZ(S);
//const double Rso4 = 73.4;
//const double Rcl = 31.6;
//const double Roc = 76.6;
const double S_ = (MA[SodiumCarbonate] + MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW);
const double SO4 = MA[SodiumSulphate]/::SodiumSulphate.MW*MW_SO4;
const double Rso4 = SO4/NZ(S_)*1000.0; //g per kg S
const double Cl = MA[SodiumChloride]/::SodiumChloride.MW*MW_Cl;
const double Rcl = Cl/NZ(S_)*1000.0; //g per kg S
const double TOC = (/*MA[Organics]*5.0/::Organics.MW + */MA[SodiumOxalate]*2.0/::SodiumOxalate.MW)*MW_C + MA[Organics1]*2.21/::Organics1.MW*MW_C;
const double Roc = TOC/NZ(S_)*1000.0; //g per kg S
//const double Rho25 = CBayerConcs::LiquorDensEqn4(T, S, A, C, Rso4, Rcl, Roc);
const double R5 = 1000.0 + 823.53*Rac - 245.28*Rcs;
const double R6 = 1.4792*Rso4 + 1.6479*Rcl + 2.9247*Roc;
const double R7 = 943.4*(1+Rcs) + 1.0417*Rso4 + 2.8169*Rcl + 2.2831*Roc;
//const double Molality = (10*R7*S)/((1000.0*RhoT) - (R5+R6)*S); //Molality (gmole/kg H2O)
const double Molality = (10*R7*S)/((1000.0*Rho25) - (R5+R6)*S); //Molality (gmole/kg H2O)
BPE = (8.356e-4 + 7.1949e-3*Pow(Molality,0.66))*K2C(T) + 0.2649*Pow(Molality,1.6) - 0.1159;
break;
}
case BPM_BPD2:
{
//Referance: Bayer Process Properties BATC SysCAD Model
//2.8 Boiling Point Elevation – Basis of Process Design
//Revised as per email from Melissa Rothnie 28 September 2005
//now uses actual concentrations for SO4, Cl and OC ions; and user selected density correlation.
LiqConcs25.Converge(MA);
const double S = (LiqConcs25.Liq[::CausticSoda] + LiqConcs25.Liq[::SodiumCarbonate]);
if (S<1.0e-6)
return 0.0;
const double A = LiqConcs25.Liq[::Alumina];
const double C = LiqConcs25.Liq[::CausticSoda];
const double Rho25 = LDensity25();
const double Rac = A/NZ(C);
const double Rcs = C/NZ(S);
const double S_ = (MA[SodiumCarbonate] + MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW);
const double SO4 = MA[SodiumSulphate]/::SodiumSulphate.MW*MW_SO4;
const double Rso4 = SO4/NZ(S_)*1000.0; //g per kg S
const double Cl = MA[SodiumChloride]/::SodiumChloride.MW*MW_Cl;
const double Rcl = Cl/NZ(S_)*1000.0; //g per kg S
const double TOC = (/*MA[Organics]*5.0/::Organics.MW + */MA[SodiumOxalate]*2.0/::SodiumOxalate.MW)*MW_C + MA[Organics1]*2.21/::Organics1.MW*MW_C;
const double Roc = TOC/NZ(S_)*1000.0; //g per kg S
const double R5 = 1000.0 + 823.53*Rac - 245.28*Rcs;
const double R6 = 1.4792*Rso4 + 1.6479*Rcl + 2.9247*Roc;
const double R7 = 943.4*(1+Rcs) + 1.0417*Rso4 + 2.8169*Rcl + 2.2831*Roc;
double Molality = (10*R7*S)/((1000.0*Rho25) - (R5+R6)*S); //Molality (gmole/kg H2O)
if (Molality<1.0e-9)
{
Molality = 0.0; //added by KGA 25/8/2006 to fix crash
}
BPE = (8.356e-4 + 7.1949e-3*Pow(Molality,0.66))*K2C(T) + 0.2649*Pow(Molality,1.6) - 0.1159;
break;
}
case BPM_Adamson:
{
LiqConcs25.Converge(MA);
if (LiqConcs25.Liq[::CausticSoda]<1.0e-6 && LiqConcs25.Liq[::SodiumCarbonate]<1.0e-6)
return 0.0;
//Equation: f(x1,x2) = a+b*x1+c*x2+d*x1^2+e*x2^2+f*x1*x2+g*x1^3+h*x2^3+i*x1*x2^2+j*x1^2*x2
//Constants a to f determined by equation data fit to above equation based on defined data
//from published Adamson data, where x1 is Na2O conc g/L @ 25C; and x2 is temp in degC.
const double a = 0.007642857;
const double b = 0.006184282;
const double c = 2.92857E-05;
const double d = 0.00010957;
const double e = -3.80952E-08;
const double f = 0.000208801;
const double g = -8.61985E-10;
const double h = 8.33556E-18;
const double i = 1.7316E-10;
const double j = -2.49763E-07;
const double Sodium = LiqConcs25.Liq[::CausticSoda] + LiqConcs25.Liq[::SodiumCarbonate]
+ LiqConcs25.Liq[::SodiumOxalate] + /*LiqConcs25.Liq[::Organics] + */LiqConcs25.Liq[::Organics1]
+ LiqConcs25.Liq[::SodiumChloride] + LiqConcs25.Liq[::SodiumSulphate] + LiqConcs25.Liq[::SodiumFluoride];
const double x1 = Sodium*::OccSoda.MW/::SodiumCarbonate.MW;
const double x2 = K2C(T);
const double x1_2 = x1*x1;
const double x2_2 = x2*x2;
BPE = a + b*x1 + c*x2 + d*x1_2 + e*x2_2 + f*x1*x2 + g*x1*x1_2 + h*x2*x2_2 + i*x1*x2_2 + j*x1_2*x2;
break;
}
}
return BPE;
}
//---------------------------------------------------------------------------
double BATCBayerSM::get_DynamicViscosity(long Phases, double T, double P, MArray *pMA)
{
return MSpModelBase::get_DynamicViscosity(Phases, T, P, pMA);
/*
//equation valid in range 20C to 80C. Equation does not account for affect of impuraties
MArray MA(pMA ? (*pMA) : this);
const double MSol=(Phases & MP_Sol) ? MA.Mass(MP_Sol) : 0.0;
const double MLiq=(Phases & MP_Liq) ? MA.Mass(MP_Liq) : 0.0;
const double MGas=(Phases & MP_Gas) ? MA.Mass(MP_Gas) : 0.0;
const double MTot=GTZ(MSol+MLiq+MGas);
if (MLiq<UsableMass)
return MSpModelBase::get_DynamicViscosity(Phases, T, P, pMA);
const double MW_Na2CO3 = ::SodiumCarbonate.MW; //105.989
const double MW_Na2O = ::OccSoda.MW; //61.9789360
const double MW_NaOH = ::CausticSoda.MW; //39.9971080
LiqConcs25.Converge(MA);
//const double DensL=get_Density(MP_Liq, T, P, pMA);
const double DensL=LiqConcs25.LiquorDensity(T, MA);
const double A = LiqConcs25.Liq[::Alumina]; //Mass Conc. of Al2O3 per litre. A(as Al2O3)
const double C1 = LiqConcs25.Liq[::CausticSoda]/MW_Na2CO3*MW_Na2O; //Concentration of Na2O @ 25°C. C(as Na2O)
const double C2 = C1*MW_NaOH/MW_Na2O*2.0; //Mass Conc. NaOH per litre. C(as NaOH)
const double Tc = Range(0.0, K2C(T), 80.0); //temperature
const double Tc2 = Tc*Tc;
const double d1 = (0.0857-0.00658*Tc+0.0000023*Tc2) + (A/1000.0)*(3.56-0.0357*Tc+0.000184*Tc) + (C2/1000.0)*(3.23-0.0034*A-0.1246*Tc+0.00204*Tc2-0.00001107*Tc2*Tc);
double ViscL = Pow(10, d1); //Liquid viscosity
//to account for high temperatures: Visc(T) = Visc(80) * WaterVisc(T)/WaterVisc(80).
if (Tc>80.0)
{
double ViscWaterT = MSpModelBase::get_DynamicViscosity(MP_Liq, T, P, pMA); //is there a beter way to call the water properties directly???
double ViscWater80 = MSpModelBase::get_DynamicViscosity(MP_Liq, C2K(80.0), P, pMA); //is there a beter way to call the water properties directly???
ViscL *= (ViscWaterT/GTZ(ViscWater80));
}
double ViscSL = ViscL;
if (MSol>0.0)
{
const double DensS = MSpModelBase::get_Density(MP_Sol, T, P, pMA);
const double Sf = MSol/MTot;
const double Vs = 1.0/(1.0-(1.0-1.0/Sf)*DensS/GTZ(DensL)); //Vol fraction solids
const double Ratio = 1.0 + 2.5*Vs + 14.1*Vs*Vs + 0.00237*exp(16.0*Vs); //Slurry viscosity/liquid viscosity
ViscSL = Ratio * ViscL;
}
return ViscSL;
//return MSpModelBase::get_DynamicViscosity(Phases, T, P, pMA);
*/
}
//---------------------------------------------------------------------------
double BATCBayerSM::get_ThermalConductivity(long Phases, double T, double P, MArray *pMA)
{
return MSpModelBase::get_ThermalConductivity(Phases, T, P, pMA);
}
//===========================================================================
//
//
//
//===========================================================================
// The properties that are defined for visibility in the SysCAD Access properties window
// in adition, these properties are accesable in code by name.
enum {
idDensityMethod ,
idCPMethod ,
idASatMethod ,
idKEq_A1,
idKEq_B1,
idKEq_C1,
idBPEMethod ,
idMinSolCp ,
idH2OTestFrac0 ,
idH2OTestFrac1 ,
idDefineLiquor ,
idRqd_A_to_C ,
idRqd_C_to_S ,
idRqd_C ,
idRqd_Na2SO4 ,
idRqd_NaCl ,
idRqd_NaF ,
idRqd_Oxalate ,
idRqd_TOC ,
idRqd_SiO2 ,
idRqd_SolConc ,
idRqd_SolFrac ,
idAluminaConc25 ,
idAtoC ,
idCtoS ,
idCltoC ,
idTOStoTOC ,
idNa2SO4toC ,
idNa2CO3toS ,
idTOC25 ,
idTOS25 ,
idNaSO4Conc25 ,
idNaClConc25 ,
idNaFConc25 ,
idNa2C2O4Conc25 ,
idFreeCaustic25 ,
idSolidsConc25 ,
idSeparator1 ,
idCausticConc25 ,
idSodaConc25 ,
idCarbonateConc25 ,
idOrganateConc25 ,
idOxalateConc25 ,
idTotalOrganics25 ,
idChlorineConc25 ,
idSulphateConc25 ,
idFluorideConc25 ,
idTotalNa25 ,
idSeparator2 ,
idLVolume25 ,
idSLVolume25 ,
idLDensity25 ,
idSLDensity25 ,
idSeparator3 ,
idAluminaConc ,
idSodiumCarbonateConc,
idTOC ,
idSolidsConc ,
idSeparator4 ,
idCausticConc ,
idSodaConc ,
idSeparator5 ,
#if At25
idAluminaConcSat25 ,
idAtoCSaturation ,
idSSNRatio ,
idAluminaConcSat ,
#else
idAluminaConcSat ,
idAtoCSaturation ,
idSSNRatio ,
#endif
idOxalateEquilibrium ,
idSulphateEquilibrium,
idCarbonateEquilibrium,
idMolality,
idSeparator6 ,
idBoilPtElev ,
idTHAMassFlow ,
idTHADens ,
idMPI_EndOfProps };
//---------------------------------------------------------------------------
long BATCBayerSM::DefinedPropertyCount()
{
return idMPI_EndOfProps + 1 + MSpModelBase::DefinedPropertyCount();
}
//---------------------------------------------------------------------------
/*static MPropertyInfo::MStringValueP SVOrg[]={
//{"Organics and Ratio", DLM_TotOrganics},
{ "TOC and Oxalate", DLM_TOC},
{0}};*/
static MPropertyInfo::MStringValueP SVASat[]={
{ "LiqInfo5", ASM_LiqInfo5 },
{ "LiqInfo6", ASM_LiqInfo6 },
#if IncludeBrahma
{ "BRAHMA", ASM_BRAHMA },
#endif
{0}};
static MPropertyInfo::MStringValueP SVDens[]={
{ "Original", BDM_Original },
{ "Reynolds-WRS", BDM_WRS },
//{ "BPD", BDM_BPD1 },
//{ "BPD_Sept05", BDM_BPD2 },
#if IncludeBrahma
{ "BRAHMA", BDM_BRAHMA},
{ "BRAHMA(old)", BDM_BRAHMA_OLD},
{ "BRAHMA25", BDM_BRAHMA25},
#endif
{0}};
static MPropertyInfo::MStringValueP SVCp[]={
{ "Original", CPM_Original },
{ "Reynolds-WRS", CPM_WRS },
{0}};
static MPropertyInfo::MStringValueP SVBPE[]={
{ "Dewey", BPM_Dewey },
{ "Adamson", BPM_Adamson },
{ "BPD Original Density", BPM_BPD1 },//{ "BPD", BPM_BPD1 },
{ "BPD Global Density", BPM_BPD2 },//{ "BPD_Sept05", BPM_BPD2 },
{0}};
long BATCBayerSM::DefinedPropertyInfo(long Index, MPropertyInfo & Info)
{//define a list of all properties: This sets what is displayed in the access window.
long Inx=Index-MSpModelBase::DefinedPropertyCount();
switch(Inx)
{
case idDensityMethod : Info.SetText("--Global options---------");
Info.SetStructName("Config"); //NB: The "struct name" is used as part of tag!
Info.Set(ePT_Long, "", "DensityMethod", SVDens, MP_GlobalProp|MP_Parameter, "Global Density method"); return Inx;
case idCPMethod : Info.Set(ePT_Long, "", "CPMethod", SVCp, MP_GlobalProp|MP_Parameter, "Global CP method"); return Inx;
case idASatMethod : Info.Set(ePT_Long, "", "ASatMethod", SVASat, MP_GlobalProp|MP_Parameter, "Global ASat Method"); return Inx;
case idKEq_A1: Info.Set(ePT_Double, "", "KEq_A1", MC_, "", 0, 0, MP_GlobalProp|MP_Parameter, "Brahma Equilibrium Constant A1"); return Inx;
case idKEq_B1: Info.Set(ePT_Double, "", "KEq_B1", MC_, "", 0, 0, MP_GlobalProp|MP_Parameter, "Brahma Equilibrium Constant B1"); return Inx;
case idKEq_C1: Info.Set(ePT_Double, "", "KEq_C1", MC_, "", 0, 0, MP_GlobalProp|MP_Parameter, "Brahma Equilibrium Constant C1"); return Inx;
case idBPEMethod : Info.Set(ePT_Long, "", "BPEMethod", SVBPE, MP_GlobalProp|MP_Parameter, "Global BPE method"); return Inx;
case idMinSolCp : Info.Set(ePT_Double, "", "MinSolCp", MC_CpMs, "kJ/kg.C", 0, 0, MP_GlobalProp|MP_Parameter|MP_InitHidden, "Global minimum solids Cp"); return Inx;
case idH2OTestFrac0 : Info.Set(ePT_Double, "", "WaterTestFrac0", MC_Frac, "%", 0, 0, MP_GlobalProp|MP_Parameter|MP_InitHidden, "Global water fraction above which Standard properties are used"); return Inx;
case idH2OTestFrac1 : Info.Set(ePT_Double, "", "WaterTestFrac1", MC_Frac, "%", 0, 0, MP_GlobalProp|MP_Parameter|MP_InitHidden, "Global water fraction above which proportional amounts of two properties models are used"); return Inx;
case idDefineLiquor : Info.SetText("--Calculator-------------");
Info.SetStructName("Calc"); //NB: The "struct name" is used as part of tag!
Info.Set(ePT_Bool, "", "DefineLiquor", MC_, "", 0, 0, MP_ConfigProp|MP_Parameter|MP_CheckBox, ""); return Inx;
case idRqd_A_to_C : Info.Set(ePT_Double, "", "Rqd_A/C", MC_, "", 0, 0, MP_ConfigProp|MP_Parameter, "The required Alumina/Caustic Ratio"); return Inx;
case idRqd_C_to_S : Info.Set(ePT_Double, "", "Rqd_C/S", MC_, "", 0, 0, MP_ConfigProp|MP_Parameter, "The required Caustic/Soda Ratio"); return Inx;
case idRqd_C : Info.Set(ePT_Double, "", "Rqd_C", MC_Conc, "g/L", 0, 0, MP_ConfigProp|MP_Parameter, "The required Caustic Conc expressed as Carbonate @ 25"); return Inx;
case idRqd_Na2SO4 : Info.Set(ePT_Double, "", "Rqd_Na2SO4", MC_Conc, "g/L", 0, 0, MP_ConfigProp|MP_Parameter, "The required Sodium Sulphate Concentration @ 25"); return Inx;
case idRqd_NaCl : Info.Set(ePT_Double, "", "Rqd_NaCl", MC_Conc, "g/L", 0, 0, MP_ConfigProp|MP_Parameter, "The required Sodium Chloride Concentration @ 25"); return Inx;
case idRqd_NaF : Info.Set(ePT_Double, "", "Rqd_NaF", MC_Conc, "g/L", 0, 0, MP_ConfigProp|MP_Parameter, "The required Sodium Fluoride Concentration @ 25"); return Inx;
case idRqd_Oxalate : Info.Set(ePT_Double, "", "Rqd_Oxalate", MC_Conc, "g/L", 0, 0, MP_ConfigProp|MP_Parameter, "The required Oxalate Concentration @ 25"); return Inx;
case idRqd_TOC : Info.Set(ePT_Double, "", "Rqd_TOC", MC_Conc, "g/L", 0, 0, MP_ConfigProp|MP_Parameter, "The required Total Organic Carbon Conc expressed as Carbon @ 25"); return Inx;
case idRqd_SiO2 : Info.Set(ePT_Double, "", "Rqd_SiO2", MC_Conc, "g/L", 0, 0, MP_ConfigProp|MP_Parameter, "The required Silica Concentration @ 25"); return Inx;
case idRqd_SolConc : Info.Set(ePT_Double, "", "Rqd_SolConc", MC_Conc, "g/L", 0, 0, MP_ConfigProp|MP_Parameter|MP_NanOK, "The required Solids Conc (*=unused)"); return Inx;
case idRqd_SolFrac : Info.Set(ePT_Double, "", "Rqd_SolFrac", MC_Frac, "%", 0, 0, MP_ConfigProp|MP_Parameter, "The required Solids Fraction"); return Inx;
case idAluminaConc25 : Info.SetStructName("Props"); //NB: The "struct name" is used as part of tag! Recomend "Props" for compatability with other properties models.
Info.SetText("--Concentration and Ratio @ 25,-----------");
Info.Set(ePT_Double, "", "Alumina@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Alumina Concentration @ 25"); return Inx;
case idAtoC : Info.Set(ePT_Double, "", "A/C", MC_, "", 0, 0, MP_Result|MP_NoFiling, "A to C ratio"); return Inx;
case idCtoS : Info.Set(ePT_Double, "", "C/S", MC_, "", 0, 0, MP_Result|MP_NoFiling, "C to S ratio"); return Inx;
case idCltoC : Info.Set(ePT_Double, "", "Cl/C", MC_, "", 0, 0, MP_Result|MP_NoFiling|MP_InitHidden, "Cl to C ratio"); return Inx;
case idTOStoTOC : Info.Set(ePT_Double, "", "TOS/TOC", MC_, "", 0, 0, MP_Result|MP_NoFiling, "TOS to TOC ratio"); return Inx;
case idNa2SO4toC : Info.Set(ePT_Double, "", "SO4/C", MC_, "", 0, 0, MP_Result|MP_NoFiling|MP_InitHidden, "Na2SO4 to Caustic ratio"); return Inx;
case idNa2CO3toS : Info.Set(ePT_Double, "", "CO3/S", MC_, "", 0, 0, MP_Result|MP_NoFiling|MP_InitHidden, "Na2CO3 to Soda ratio"); return Inx;
case idTOC25 : Info.Set(ePT_Double, "", "TOC@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Total Organic Carbon Concentration @ 25"); return Inx;
case idTOS25 : Info.Set(ePT_Double, "", "TOS@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Total Organic Soda Concentration @ 25"); return Inx;
case idNaSO4Conc25 : Info.Set(ePT_Double, "", "Sulphate*@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "SodiumSulphate Concentration @ 25"); return Inx;
case idNaClConc25 : Info.Set(ePT_Double, "", "Chloride*@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling|MP_InitHidden, "SodiumChloride Concentration @ 25"); return Inx;
case idNaFConc25 : Info.Set(ePT_Double, "", "Fluoride*@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling|MP_InitHidden, "SodiumFluoride Concentration @ 25"); return Inx;
case idNa2C2O4Conc25 : Info.Set(ePT_Double, "", "Oxalate*@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "SodiumOxalate Concentration @ 25"); return Inx;
case idFreeCaustic25 : Info.Set(ePT_Double, "", "FreeCaustic@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling|MP_InitHidden, "Free Caustic Concentration @ 25"); return Inx;
case idSolidsConc25 : Info.Set(ePT_Double, "", "SolidsConc@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Solids Concentration @ 25");return Inx;
case idSeparator1 : Info.SetText("..."); return Inx;
case idCausticConc25 : Info.SetText("--Concentrations @ 25, as Na2CO3 Equiv----");
Info.Set(ePT_Double, "", "Caustic@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Caustic Concentration @ 25"); return Inx;
case idSodaConc25 : Info.Set(ePT_Double, "", "Soda@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Soda Concentration @ 25"); return Inx;
case idCarbonateConc25 : Info.Set(ePT_Double, "", "Carbonate@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "SodiumCarbonate Concentration @ 25"); return Inx;
case idSulphateConc25 : Info.Set(ePT_Double, "", "Sulphate@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "SodiumSulphate Concentration @ 25"); return Inx;
case idChlorineConc25 : Info.Set(ePT_Double, "", "Chloride@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling|MP_InitHidden, "SodiumChloride Concentration @ 25"); return Inx;
case idFluorideConc25 : Info.Set(ePT_Double, "", "Fluoride@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling|MP_InitHidden, "SodiumFluoride Concentration @ 25"); return Inx;
case idOxalateConc25 : Info.Set(ePT_Double, "", "Oxalate@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "SodiumOxalate Concentration @ 25"); return Inx;
case idOrganateConc25 : Info.Set(ePT_Double, "", "Organate@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling|MP_InitHidden, "Organate Concentration @ 25"); return Inx;
case idTotalOrganics25 : Info.Set(ePT_Double, "", "TotalOrganics@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Total Organic Concentration @ 25"); return Inx;
case idTotalNa25 : Info.Set(ePT_Double, "", "TotalNa@25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Total Sodium Concentration @ 25"); return Inx;
case idSeparator2 : Info.SetText("..."); return Inx;
case idLVolume25 : Info.SetText("--Volume and Density @ 25-----------------");
Info.Set(ePT_Double, "", "LVolume@25", MC_Qv, "L/s", 0, 0, MP_Result|MP_NoFiling, "Liquor Volumetric flowrate @ 25"); return Inx;
case idSLVolume25 : Info.Set(ePT_Double, "", "SLVolume@25", MC_Qv, "L/s", 0, 0, MP_Result|MP_NoFiling, "Slurry Volumetric flowrate @ 25"); return Inx;
case idLDensity25 : Info.Set(ePT_Double, "", "LDensity@25", MC_Rho, "g/L", 0, 0, MP_Result|MP_NoFiling, "Liquor Density @ 25"); return Inx;
case idSLDensity25 : Info.Set(ePT_Double, "", "SLDensity@25", MC_Rho, "g/L", 0, 0, MP_Result|MP_NoFiling, "Slurry Density @ 25"); return Inx;
case idSeparator3 : Info.SetText("..."); return Inx;
case idAluminaConc : Info.SetText("--Concentration @ T-----------------------");
Info.Set(ePT_Double, "", "Alumina@T", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Alumina Concentration @ T"); return Inx;
case idSodiumCarbonateConc: Info.Set(ePT_Double, "", "Carbonate@T", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling|MP_InitHidden, "SodiumCarbonate Concentration @ T"); return Inx;
case idTOC : Info.Set(ePT_Double, "", "TOC@T", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Total Organic Carbon Concentration @ T"); return Inx;
case idSolidsConc : Info.Set(ePT_Double, "", "SolidsConc@T", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Solids Concentration @ T"); return Inx;
case idSeparator4 : Info.SetText("..."); return Inx;
case idCausticConc : Info.SetText("--Concentration @ T, as Na2CO3 Equiv -----");
Info.Set(ePT_Double, "", "Caustic@T", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Caustic Concentration @ T"); return Inx;
case idSodaConc : Info.Set(ePT_Double, "", "Soda@T", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Soda Concentration @ T"); return Inx;
case idSeparator5 : Info.SetText("..."); return Inx;
#if At25
case idAluminaConcSat25 : Info.SetText("--Other Bayer Liquor Properties @ 25-------");
Info.Set(ePT_Double, "", "AluminaSatConc25", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Alumina Saturation Concentration @ 25"); return Inx;
case idAtoCSaturation : Info.Set(ePT_Double, "", "ASat_To_C", MC_, "", 0, 0, MP_Result|MP_NoFiling, "Alumina Saturation to Caustic ratio @ 25"); return Inx;
case idSSNRatio : Info.Set(ePT_Double, "", "SSNRatio", MC_, "", 0, 0, MP_Result|MP_NoFiling, "A/C actual to ASat/C ratio @ 25"); return Inx;
case idAluminaConcSat : Info.SetText("--Other Bayer Liquor Properties @ T-------");
Info.Set(ePT_Double, "", "AluminaSatConc", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Alumina Saturation Concentration @ T"); return Inx;
#else
case idAluminaConcSat : Info.SetText("--Other Bayer Liquor Properties @ T-------");
Info.Set(ePT_Double, "", "AluminaSatConc", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Alumina Saturation Concentration @ T"); return Inx;
case idAtoCSaturation : Info.Set(ePT_Double, "", "ASat_To_C", MC_, "", 0, 0, MP_Result|MP_NoFiling, "Alumina Saturation to Caustic ratio @ T"); return Inx;
case idSSNRatio : Info.Set(ePT_Double, "", "SSNRatio", MC_, "", 0, 0, MP_Result|MP_NoFiling, "A/C actual to ASat/C ratio @ T"); return Inx;
#endif
case idOxalateEquilibrium : Info.Set(ePT_Double, "", "OxalateSolubility", MC_Conc, "g/L", 0, 0, MP_Result|MP_NoFiling, "Oxalate Equilibrium Concentration @ T"); return Inx;
case idSulphateEquilibrium : Info.Set(ePT_Double, "", "SulphateSolubility", MC_, "", 0, 0, MP_Result|MP_NoFiling, "Sulphate Equilibrium Concentration @ T (g/kg)"); return Inx;
case idCarbonateEquilibrium : Info.Set(ePT_Double, "", "CarbonateSolubility", MC_, "", 0, 0, MP_Result|MP_NoFiling, "Carbonate Equilibrium Concentration @ T (g/kg)"); return Inx;
case idMolality : Info.Set(ePT_Double, "", "Molality", MC_, "", 0, 0, MP_Result|MP_NoFiling, "Molality for Brahma"); return Inx;
case idSeparator6 : Info.SetText("..."); return Inx;
case idBoilPtElev : Info.SetText("--Other-------");
Info.Set(ePT_Double, "", "BoilPtElev", MC_dT, "C", 0, 0, MP_Result|MP_NoFiling, "Boiling Point Elevation"); return Inx;
case idTHAMassFlow : Info.Set(ePT_Double, "", "THAMassFlow", MC_Qm, "kg/s", 0, 0, MP_Result|MP_NoFiling, "THA flow rate"); return Inx;
case idTHADens : Info.Set(ePT_Double, "", "THADens", MC_Rho, "kg/m^3", 0, 0, MP_Result|MP_NoFiling, "THA Density"); return Inx;
case idMPI_EndOfProps : return MPI_EndOfProps;
default:
{
char Buff[16];
sprintf(Buff, "Unused%d", Inx);
Info.Set(ePT_Double, "", Buff, MC_, "", 0, 0, MP_Null, "");
return Inx;
}
}
return MPI_MoreProps;
}
//---------------------------------------------------------------------------
DWORD BATCBayerSM::GetPropertyVisibility(long Index)
{//determine visibility of list of all properties
switch (Index-MSpModelBase::DefinedPropertyCount())
{
//case idDefnLiqMethod:
case idKEq_A1: return (sm_iASatMethod==ASM_BRAHMA) ? ePVis_All : (ePVis_DynFull|ePVis_DynFlow|ePVis_Probal|ePVis_File);
case idKEq_B1: return (sm_iASatMethod==ASM_BRAHMA) ? ePVis_All : (ePVis_DynFull|ePVis_DynFlow|ePVis_Probal|ePVis_File);
case idKEq_C1: return (sm_iASatMethod==ASM_BRAHMA) ? ePVis_All : (ePVis_DynFull|ePVis_DynFlow|ePVis_Probal|ePVis_File);
case idRqd_A_to_C:
case idRqd_C_to_S:
case idRqd_C:
case idRqd_Oxalate:
case idRqd_TOC:
case idRqd_Na2SO4:
case idRqd_NaCl:
case idRqd_NaF:
case idRqd_SiO2:
case idRqd_SolConc:
case idRqd_SolFrac: return fDoCalc ? ePVis_All : (ePVis_DynFull|ePVis_DynFlow|ePVis_Probal|ePVis_File);
//case idRqd_Organic:
//case idRqd_OrgRatio: return fDoCalc ? ePVis_All : (ePVis_DynFull|ePVis_DynFlow|ePVis_Probal|ePVis_File);
default: return ePVis_All;
}
return ePVis_All;
}
//---------------------------------------------------------------------------
void BATCBayerSM::GetPropertyValue(long Index, ULONG Phase/*=MP_All*/, double T/*=NAN*/, double P/*=NAN*/, MPropertyValue & Value)
{//define method of retrieving values for list of all properties
switch (Index-MSpModelBase::DefinedPropertyCount())
{
case idDensityMethod : Value=sm_iDensityMethod; return;
case idCPMethod : Value=sm_iCPMethod; return;
case idASatMethod : Value=sm_iASatMethod; return;
case idBPEMethod : Value=sm_iBPEMethod; return;
case idMinSolCp : Value=sm_dMinSolCp; return;
case idH2OTestFrac0 : Value=sm_dH2OTestFrac0; return;
case idH2OTestFrac1 : Value=sm_dH2OTestFrac1; return;
case idKEq_A1: Value = KEq_A1; return;
case idKEq_B1: Value = KEq_B1; return;
case idKEq_C1: Value = KEq_C1; return;
case idDefineLiquor : Value=fDoCalc; return;
//case idDefnLiqMethod : Value=sm_iRqdCalcMethod; return;
case idRqd_A_to_C : Value=dRqd_AtoC; return;
case idRqd_C_to_S : Value=dRqd_CtoS; return;
case idRqd_C : Value=dRqd_C; return;
case idRqd_Oxalate : Value=dRqd_Ox; return;
case idRqd_TOC : Value=dRqd_TOC; return;
case idRqd_Na2SO4 : Value=dRqd_Sul; return;
case idRqd_NaCl : Value=dRqd_Salt; return;
case idRqd_NaF : Value=dRqd_Fl; return;
case idRqd_SiO2 : Value=dRqd_Sil; return;
case idRqd_SolConc : Value=dRqd_SolConc; return;
case idRqd_SolFrac : Value=dRqd_SolFrac; return;
case idTHAMassFlow : Value=THAMassFlow(); return;
case idTHADens : Value=THADens(T); return;
case idCausticConc : Value=CausticConc(T); return;
case idAluminaConc : Value=AluminaConc(T); return;
case idSodaConc : Value=SodaConc(T); return;
case idSodiumCarbonateConc : Value=SodiumCarbonateConc(T); return;
case idCausticConc25 : Value=LiqConcs25.Liq[::CausticSoda]; return;
case idAluminaConc25 : Value=LiqConcs25.Liq[::Alumina]; return;
case idSodaConc25 : Value=LiqConcs25.Liq[::CausticSoda]+ LiqConcs25.Liq[::SodiumCarbonate]; return;
case idCarbonateConc25 : Value=LiqConcs25.Liq[::SodiumCarbonate]; return;
case idNaClConc25 : Value=LiqConcs25.Liq[::SodiumChloride]*::SodiumChloride.MW*2/::SodiumCarbonate.MW; return;
case idNaFConc25 : Value=LiqConcs25.Liq[::SodiumFluoride]*::SodiumFluoride.MW*2/::SodiumCarbonate.MW; return;
case idNaSO4Conc25 : Value=LiqConcs25.Liq[::SodiumSulphate]*::SodiumSulphate.MW/::SodiumCarbonate.MW; return;
case idNa2C2O4Conc25 : Value=LiqConcs25.Liq[::SodiumOxalate]*::SodiumOxalate.MW/::SodiumCarbonate.MW; return;
case idSolidsConc : Value=SolidsConc(T); return;
case idSolidsConc25 : Value=SolidsConc25(); return;
case idFreeCaustic25 : Value=FreeCaustic(C_2_K(25.0)); return;
case idTOC : Value=TOC(T); return;
case idTOC25 : Value=TOC25(); return;
case idTOS25 : Value=TOS25(); return;
case idAtoC : Value=AtoC(); return;
case idCtoS : Value=CtoS(); return;
case idCltoC : Value=CltoC(); return;
case idTOStoTOC : Value=TOStoTOC(); return;
case idNa2SO4toC : Value=Na2SO4toC(); return;
case idNa2CO3toS : Value=Na2CO3toS(); return;
case idBoilPtElev : Value=getBoilingPtElevation(P, NULL); return;
case idLVolume25 : Value=LVolume25(); return;
case idSLVolume25 : Value=SLVolume25(); return;
case idOrganateConc25 : Value=OrganateConc25(); return;
case idOxalateConc25 : Value=OxalateConc25(); return;
case idTotalOrganics25 : Value=TotalOrganicsConc25(); return;
case idChlorineConc25 : Value=ChlorineConc25(); return;
case idSulphateConc25 : Value=SulphateConc25(); return;
case idFluorideConc25 : Value=FluorideConc25(); return;
case idTotalNa25 : Value=TotalSodiumConc25(); return;
case idAluminaConcSat25: Value=AluminaConcSat(C_2_K(25.0)); return;
case idAluminaConcSat : Value=AluminaConcSat(T); return;
case idOxalateEquilibrium : Value=OxalateSolubility(T); return;
case idSulphateEquilibrium : Value=SulphateSolubility(T); return;
case idCarbonateEquilibrium : Value=CarbonateSolubility(T); return;
#if At25
case idAtoCSaturation : Value=AtoCSaturation(C_2_K(25.0)); return;
case idSSNRatio : Value=SSNRatio(C_2_K(25.0)); return;
#else
case idAtoCSaturation : Value=AtoCSaturation(T); return;
case idSSNRatio : Value=SSNRatio(T); return;
#endif
case idMolality :
{
double d1,d2;
Value = Molality(d1, d2);
return;
}
case idLDensity25 : Value=LDensity25(); return;
case idSLDensity25 : Value=SLDensity25(); return;
default: Value=0.0; return;
}
}
//---------------------------------------------------------------------------
void BATCBayerSM::PutPropertyValue(long Index, MPropertyValue & Value)
{//define method of setting values for list of all properties
switch (Index-MSpModelBase::DefinedPropertyCount())
{
case idDensityMethod : sm_iDensityMethod=(byte)(long)Value; return;
case idCPMethod : sm_iCPMethod=(byte)(long)Value; return;
case idASatMethod : sm_iASatMethod=(byte)(long)Value; return;
case idBPEMethod : sm_iBPEMethod=(byte)(long)Value; return;
case idMinSolCp : sm_dMinSolCp=Value; return;
case idH2OTestFrac0 : sm_dH2OTestFrac0=Range(0.0, (double)Value, 1.0); return;
case idH2OTestFrac1 : sm_dH2OTestFrac1=Range(0.0, (double)Value, sm_dH2OTestFrac0); return;
case idKEq_A1: KEq_A1 = Value; return;
case idKEq_B1: KEq_B1 = Value; return;
case idKEq_C1: KEq_C1 = Value; return;
case idDefineLiquor : fDoCalc=Value; return;
//case idDefnLiqMethod : sm_iRqdCalcMethod=(byte)(long)Value; return;
case idRqd_A_to_C : dRqd_AtoC=Value; return;
case idRqd_C_to_S : dRqd_CtoS=Value; return;
case idRqd_C : dRqd_C=Value; return;
case idRqd_Oxalate : dRqd_Ox=Value; return;
case idRqd_TOC : dRqd_TOC=Value; return;
case idRqd_Na2SO4 : dRqd_Sul=Value; return;
case idRqd_NaCl : dRqd_Salt=Value; return;
case idRqd_NaF : dRqd_Fl=Value; return;
case idRqd_SiO2 : dRqd_Sil=Value; return;
case idRqd_SolConc : dRqd_SolConc=Value; return;
case idRqd_SolFrac : dRqd_SolFrac=Value; return;
}
}
//---------------------------------------------------------------------------
//A:--------------------------------
//toc = (OrConc*5 + OxConc*2) *12/106
//tor = OrConc + OxConc
//OxConc = tor * OrgRatio
//OrConc = tor - OxConc ==> OrConc = tor - tor*OrgRatio ==> OrConc = tor*(1 - OrgRatio)
//tor=f(toc,OrgRatio):
//==> toc = (tor*5*(1 - OrgRatio) + tor*OrgRatio*2)*12/106
//==> toc = tor*(5*(1 - OrgRatio) + 2*OrgRatio)*12/106
//==> toc = tor*(5 - 3*OrgRatio)*12/106
//==> tor = toc/(5 - 3*OrgRatio)/12*106
//tor=f(toc,OxConc):
//==> tor = toc/(5 - 3*OxConc/tor)/12*106
//==> tor = toc*tor/(5*tor-3*OxConc)/12*106
//==> 5*tor-3*OxConc = toc/12*106
//==> 5*tor = toc/12*106 + 3*OxConc
//==> tor = (toc/12*106 + 3*OxConc)/5
//OrgRatio=f(OxConc,toc)
//==> OrgRatio = OxConc/tor
//==> OrgRatio = (OxConc*5)/(toc/12*106 + 3*OxConc)
//==> OrgRatio = 5/(toc/OxConc/12*106 + 3)
//toc=f(tor,OrgRatio)
//==> tor = toc/(5 - 3*OrgRatio)/12*106
//==> toc = tor/(5 - 3*OrgRatio)*12/106
//B:--------------------------------
//toc = (OrConc*2.21*2 + OxConc*2) *12/106
//tor = OrConc + OxConc
//OxConc = tor * OrgRatio
//OrConc = tor - OxConc ==> OrConc = tor - tor*OrgRatio ==> OrConc = tor*(1 - OrgRatio)
//tor=f(toc,OrgRatio):
//==> toc = (tor*2.21*2*(1 - OrgRatio) + tor*OrgRatio*2)*12/106
//==> toc = tor*(2.21*2*(1 - OrgRatio) + 2*OrgRatio)*12/106
//==> toc = tor*(2.21*2 + (2-2.21*2)*OrgRatio)*12/106
//==> tor = toc/(2.21*2 + (2-2.21*2)*OrgRatio)/12*106
//tor=f(toc,OxConc):
//==> tor = toc/(2.21*2 + (2-2.21*2)*OxConc/tor)/12*106
//==> tor = toc*tor/(2.21*2*tor + (2-2.21*2)*OxConc)/12*106
//==> 2.21*2*tor + (2-2.21*2)*OxConc = toc/12*106
//==> 2.21*2*tor = toc/12*106 - (2-2.21*2)*OxConc
//==> tor = (toc/12*106 - (2-2.21*2)*OxConc)/(2.21*2)
//OrgRatio=f(OxConc,toc)
//==> OrgRatio = OxConc/tor
//==> OrgRatio = (OxConc*2.21*2)/(toc/12*106 - (2-2.21*2)*OxConc)
//==> OrgRatio = 2.21*2/(toc/OxConc/12*106 - (2-2.21*2))
//toc=f(tor,OrgRatio)
//==> tor = toc/(2.21*2 + (2-2.21*2)*OrgRatio)/12*106
//==> toc = tor/(2.21*2 + (2-2.21*2)*OrgRatio)*12/106
void BATCBayerSM::InputCalcs(bool DoIt, double T_)
{
/*switch (View)
{
case SVV_AsRawFrac:
case SVV_AsRawMass:
case SVV_AsRawMassFlow:
fDoCalc=false;
return;
}*/
if (DoIt)
{
//Change inputs if out of range
dRqd_AtoC = Range(0.0, dRqd_AtoC, 0.9);
dRqd_C = Range(0.0, dRqd_C, 9000.0);
dRqd_CtoS = Range(0.1, dRqd_CtoS, 1.0);
dRqd_Sul = Range(0.0, dRqd_Sul, 500.0);
dRqd_Sil = Range(0.0, dRqd_Sil, 500.0);
dRqd_Salt = Range(0.0, dRqd_Salt, 500.0);
dRqd_Fl = Range(0.0, dRqd_Fl, 500.0);
dRqd_Ox = Range(0.0, dRqd_Ox, 500.0);
dRqd_TOC = Range(0.0, dRqd_TOC, 500.0);
dRqd_SolFrac= Range(0.0, dRqd_SolFrac, 0.99);
//if (FindingConc)
// dRqd_SolConc = Range(0.0, dRqd_SolConc, 5000.0);
//calculator to determine Liquor feed fractions based on requirements at 25C...
double DensL = 1100.0;
double DensS = 2420.0;
const bool FindingConc=Valid(dRqd_SolConc);
const bool WantSolids=(FindingConc && dRqd_SolConc>1e-6) || (dRqd_SolFrac>1e-6);
double TotalMass = Mass(MP_SL);
if (WantSolids)
{
if (FindingConc)
dRqd_SolFrac=Range(0.0, (dRqd_SolConc*DensS)/(dRqd_SolConc*DensS + DensL*DensS - DensL*dRqd_SolConc), 0.99); // Initial Guess
if (Mass(MP_Sol)<1.0e-6 && TotalMass>UsableMass)
{//assume THA solids required
Log.Message(MMsg_Note, "Assume solids are THA for Bayer feed calculator");
M[::THA] = TotalMass*dRqd_SolFrac;
double Scl = (TotalMass*(1.0-dRqd_SolFrac))/GTZ(Mass(MP_Liq));
ScaleMass(MP_Liq, Scl);
TotalMass = Mass(MP_SL);
}
}
else
{
dRqd_SolFrac = 0.0;
}
//----------------------------------------------
const double LiqMassCalc = (M[Water] + M[CausticSoda] + M[Alumina] + M[SodiumCarbonate] + M[SodiumChloride] + M[SodiumFluoride] +
M[SodiumSulphate] + M[SilicateLiq] + M[SodiumOxalate] + /*M[Organics] + */M[Organics1]);
const double LiqTtl = Mass(MP_Liq);
const double OtherLiqMass = LiqTtl - LiqMassCalc;
const double VapMass = Mass(MP_Gas);
double LiqMass = TotalMass*(1.0-dRqd_SolFrac);
if (OtherLiqMass>LiqMass && OtherLiqMass>0.0)
{
if (dRqd_SolFrac>0.0)
Log.Message(MMsg_Warning, "Invalid Bayer feed calculator: large solids plus other liquids required");
else
Log.Message(MMsg_Warning, "Invalid Bayer feed calculator: large other liquids required");
}
if (LiqMass-OtherLiqMass > 1e-6) // There are liquids required in the feed.
//if (TotalMass>1e-6 && (FindingConc?(dRqd_SolConc>=0):(dRqd_SolFrac<1-1e-6))) // There are liquids in the feed.
{
bool BadDensity = false;
double WaterUsed = 0.0;
const double P = Pressure;
for (bool Done=false; !Done; )
{
dRqd_SolFrac=Range(0.0, dRqd_SolFrac, 0.99);
LiqMass = TotalMass*(1.0-dRqd_SolFrac);
double Density25;
double Al, Caustic, Carbonate, Salt, NaSulphate, Silicate, NaFluoride;
double water, Derr, Org1, Org2;
double Ox, Og, Other;
const double MW_Na2C2O4 = ::SodiumOxalate.MW; //133.999
//const double MW_Na2C5O7 = ::Organics.MW; //218.030
const double MW_NaOrg = ::Organics1.MW; //89.5915
const double minTOC = dRqd_Ox*2.0/MW_Na2C2O4*MW_C;
double TocUsed = dRqd_TOC;
if (dRqd_TOC<minTOC)
{
//LogWarning(FullObjTag(), 0, "Required TOC too low based on specified Oxalate");
TocUsed = minTOC; //this will give Og of zero
}
Ox = dRqd_Ox;
Og = (TocUsed/MW_C - dRqd_Ox*2.0/MW_Na2C2O4)*MW_NaOrg/2.21;
if (dRqd_C>1.0e-6)
{
const double MW_NaOH = ::CausticSoda.MW; //39.9971080
const double MW_Na2CO3 = ::SodiumCarbonate.MW; //105.989
const double MW_NaCl = ::SodiumChloride.MW; //58.4425
const double MW_Na2SO4 = ::SodiumSulphate.MW; //142.043
const double MW_NaF = ::SodiumFluoride.MW; //
const double MW_Na2O = ::OccSoda.MW; //61.9789360
// Calculate density based on factors.
double Lm = LiqMass;
double Dens1 = DensL/1000.0;//1.100; // First guess at density
double Vol, Tal, Tna, Tcc;
for (int j=0; j<100; j++)
{
Vol = Lm/Dens1;
switch (sm_iDensityMethod)
{
case BDM_Original:
{
Tna = (dRqd_C/dRqd_CtoS + (Ox/MW_Na2C2O4 + Og/(2*MW_NaOrg) + dRqd_Salt/(2*MW_NaCl) + dRqd_Sul/MW_Na2SO4 + dRqd_Fl/(2*MW_NaF)) * MW_Na2CO3)
* Vol/(1000.0*Lm)*100.0; //Wgt % of Total Na
Tcc = dRqd_C/(Dens1*1000.0)*100.0;//Wgt % of Caustic
Tal = dRqd_AtoC * Tcc; //Wgt % of Alumina
Density25 = CBayerConcs::LiquorDensEqn1(25.0, Tna, Tal)/1000.0;
break;
}
case BDM_WRS:
{
const double S = dRqd_C/dRqd_CtoS*Lm/Dens1;
const double AtoC = dRqd_AtoC;
const double CtoS = dRqd_CtoS;
const double CltoS = dRqd_Salt*MW_Cl/MW_NaCl*Lm/Dens1/NZ(S);
const double FtoS = dRqd_Fl*MW_F/MW_NaF*Lm/Dens1/NZ(S);
const double SO4toS = dRqd_Sul*MW_SO4/MW_Na2SO4*Lm/Dens1/NZ(S);
const double OxFlowCarbon = Ox*2.0/MW_Na2C2O4*MW_C;
const double OgFlowCarbon = Og*2.21/MW_NaOrg*MW_C;
const double TOCtoS = (OxFlowCarbon+OgFlowCarbon)*Lm/Dens1/NZ(S);
const double StoLiq = S/Lm;//g of S per kg liquor
Density25 = CBayerConcs::LiquorDensEqn2(C2K(25.0), StoLiq, CtoS, AtoC, CltoS, FtoS, SO4toS, TOCtoS)/1000.0;
if (Density25<0.1)
{//todo: try fix bug for when this goes tiny?
BadDensity = true;
Density25 = 0.1;
}
break;
}
case BDM_BPD2: //NOT implemented, use BDM_BPD1
case BDM_BPD1:
{
if (0)
{
const double S = dRqd_C/dRqd_CtoS*Lm/Dens1;
const double A = dRqd_AtoC*dRqd_C*Lm/Dens1;
const double C = dRqd_C*Lm/Dens1;
Density25 = CBayerConcs::LiquorDensEqn3(C2K(25.0), S, A, C)/1000.0;
}
const double S = dRqd_C/dRqd_CtoS*Lm/Dens1;
const double AtoC = dRqd_AtoC;
const double CtoS = dRqd_CtoS;
const double CltoS = dRqd_Salt*MW_Cl/MW_NaCl*Lm/Dens1/NZ(S);
const double FtoS = dRqd_Fl*MW_F/MW_NaF*Lm/Dens1/NZ(S);
const double SO4toS = dRqd_Sul*MW_SO4/MW_Na2SO4*Lm/Dens1/NZ(S);
const double OxFlowCarbon = Ox*2.0/MW_Na2C2O4*MW_C;
const double OgFlowCarbon = Og*2.21/MW_NaOrg*MW_C;
const double TOCtoS = (OxFlowCarbon+OgFlowCarbon)*Lm/Dens1/NZ(S);
const double StoLiq = S/Lm;//g of S per kg liquor
Density25 = CBayerConcs::LiquorDensEqn2(C2K(25.0), StoLiq, CtoS, AtoC, CltoS, FtoS, SO4toS, TOCtoS)/1000.0;
break;
}
case BDM_BRAHMA25:
case BDM_BRAHMA:
{
const double C = dRqd_C;
const double S = dRqd_C/dRqd_CtoS;
const double A = dRqd_C*dRqd_AtoC;
const double Cl = dRqd_Salt*MW_Cl/MW_NaCl;
const double F = dRqd_Fl*MW_F/MW_NaF;
const double SO4 = dRqd_Sul*MW_SO4/MW_Na2SO4;
const double TOC = dRqd_Ox*2*12.11/134.012 + Og*12.11*2.21/89.5951;
Density25 = CBayerConcs::LiquorDensEqn5(25.0, dRqd_C, S, A, Cl, SO4, TOC)/1000.;
break;
}
case BDM_BRAHMA_OLD:
{
const double C = dRqd_C;
const double S = dRqd_C/dRqd_CtoS;
const double A = dRqd_C*dRqd_AtoC;
const double Cl = dRqd_Salt*MW_Cl/MW_NaCl;
const double F = dRqd_Fl*MW_F/MW_NaF;
const double SO4 = dRqd_Sul*MW_SO4/MW_Na2SO4;
const double TOS = dRqd_Ox;
Density25 = CBayerConcs::LiquorDensEqn4(25.0, dRqd_C, S, A, Cl, SO4, TOS)/1000.;
break;
}
default:
//ERROR NOT IMPLEMENTED!!!
break;
}//end switch
Derr = fabs(Dens1 - Density25);
if ( Derr < 1.0e-10)
j = 100;
else
Dens1 = Density25;
}
//---------------------------------------------------
// Now calculate Species as fractions based on density
Caustic = dRqd_C * 2.0*MW_NaOH/MW_Na2CO3 * Vol; //dRqd_C * 0.75474 * Vol;
Al = dRqd_AtoC * dRqd_C * Vol;
Carbonate = (dRqd_C/dRqd_CtoS - dRqd_C) * Vol;
Salt = dRqd_Salt * Vol; //NaCl
NaFluoride = dRqd_Fl * Vol;
NaSulphate = dRqd_Sul * Vol;
Silicate = dRqd_Sil * Vol;
Org1 = dRqd_Ox * Vol;
Org2 = Og * Vol;
Other = OtherLiqMass/LiqMass*Vol*Dens1*1000.0;
double TmpTot = Org1 + Org2 + NaSulphate + NaFluoride + Silicate + Salt + Carbonate + Al + Caustic;
TmpTot += Other;
double Lmass = Vol * Density25 * 1000.0;
if (TmpTot <= Lmass)
{
water = Lmass - TmpTot;
TmpTot += water;
}
else
{
water = 0.0;
//Do not want Other to be adjusted
TmpTot = (TmpTot-Other)/(LiqMass-OtherLiqMass)*LiqMass;
}
// Normalise the fractions
Caustic /= TmpTot;
Al /= TmpTot;
Carbonate /= TmpTot;
Salt /= TmpTot;
NaFluoride /= TmpTot;
NaSulphate /= TmpTot;
Silicate /= TmpTot;
Org1 /= TmpTot;
Org2 /= TmpTot;
water /= TmpTot;
//-------------------------------------------------------
// Set masses of the liquid species.
M[CausticSoda]=Caustic*LiqMass;
M[Alumina]=Al*LiqMass;
M[SodiumCarbonate]=Carbonate*LiqMass;
M[SodiumChloride]=Salt*LiqMass;
M[SodiumFluoride]=NaFluoride*LiqMass;
M[SodiumSulphate]=NaSulphate*LiqMass;
M[SilicateLiq]=Silicate*LiqMass;
M[SodiumOxalate]=Org1*LiqMass;
//M[Organics]=0.0;
M[Organics1]=Org2*LiqMass;
M[Water]=water*LiqMass;
}
else
{
// Default to water
M[Water]=GEZ(LiqMass-OtherLiqMass);
M[CausticSoda]=0.0;
M[Alumina]=0.0;
M[SodiumCarbonate]=0.0;
M[SodiumChloride]=0.0;
M[SodiumFluoride]=0.0;
M[SodiumSulphate]=0.0;
M[SilicateLiq]=0.0;
M[SodiumOxalate]=0.0;
//M[Organics]=0.0;
M[Organics1]=0.0;
}
WaterUsed=M[Water];
if (FindingConc)
{
double PrevSF=dRqd_SolFrac;
DensL=Density25*1000.0;
DensS=MSpModelBase::get_Density(MP_Sol, C_2_K(25.0), P, NULL);
dRqd_SolFrac=Max(0.0, (dRqd_SolConc*DensS)/(dRqd_SolConc*DensS + DensL*DensS - DensL*dRqd_SolConc));
if (fabs(PrevSF-dRqd_SolFrac)<1e-9)
Done=true;
}
else
Done=true;
}// while
if (BadDensity)
Log.Message(MMsg_Warning, "Bayer feed calculator Bad liquor density!");
if (WaterUsed<1.0e-9)
Log.Message(MMsg_Warning, "Bayer feed calculator water set to zero");
}
//--------------------------------------------
double MSol=Mass(MP_Sol);
if (WantSolids && MSol>1.0e-6)
{
double MOther=Mass(MP_SL)-MSol;
double Scl=dRqd_SolFrac*MOther/(MSol*(1.0-dRqd_SolFrac));
ScaleMass(MP_Sol, Scl);
Log.ClearCondition(4);
}
else
{
// Set solid fractions to zero.
ScaleMass(MP_Sol, 0.0);
Log.SetCondition(WantSolids, 4, MMsg_Warning, "Solids Required");
}
}
else
Log.ClearCondition(4);
}
//---------------------------------------------------------------------------
double BATCBayerSM::CausticConc(double T_)
{
LiqConcs25.Converge(MArray(this));
double DRatio = (T_==C_2_K(25.0) ? 1.0 : LiqConcs25.LiquorDensity(T_, MArray(this))/LiqConcs25.Density25);
return Max(0.0, LiqConcs25.Liq[::CausticSoda] * DRatio);
}
//---------------------------------------------------------------------------
double BATCBayerSM::AluminaConc(double T_)
{
LiqConcs25.Converge(MArray(this));
double DRatio = (T_==C_2_K(25.0) ? 1.0 : LiqConcs25.LiquorDensity(T_, MArray(this))/LiqConcs25.Density25);
return Max(0.0, LiqConcs25.Liq[::Alumina]*DRatio);
}
//---------------------------------------------------------------------------
double BATCBayerSM::SodaConc(double T_)
{
LiqConcs25.Converge(MArray(this));
double DRatio = (T_==C_2_K(25.0) ? 1.0 : LiqConcs25.LiquorDensity(T_, MArray(this))/LiqConcs25.Density25);
double liq25S = LiqConcs25.Liq[::CausticSoda]
//+ LiqConcs25.Liq[::SodiumAluminate]
+ LiqConcs25.Liq[::SodiumCarbonate];
return Max(0.0, liq25S * DRatio);
}
//---------------------------------------------------------------------------
double BATCBayerSM::SodiumCarbonateConc(double T_)
{
LiqConcs25.Converge(MArray(this));
double DRatio = (T_==C_2_K(25.0) ? 1.0 : LiqConcs25.LiquorDensity(T_, MArray(this))/LiqConcs25.Density25);
return Max(0.0, LiqConcs25.Liq[SodiumCarbonate]*DRatio);
}
//---------------------------------------------------------------------------
double BATCBayerSM::SodiumSulphateConc(double T_)
{
LiqConcs25.Converge(MArray(this));
double DRatio = (T_==C_2_K(25.0) ? 1.0 : LiqConcs25.LiquorDensity(T_, MArray(this))/LiqConcs25.Density25);
return Max(0.0, LiqConcs25.Liq[SodiumSulphate]*DRatio);
}
//---------------------------------------------------------------------------
double BATCBayerSM::SodiumOxalateConc(double T_)
{
LiqConcs25.Converge(MArray(this));
double DRatio = (T_==C_2_K(25.0) ? 1.0 : LiqConcs25.LiquorDensity(T_, MArray(this))/LiqConcs25.Density25);
return Max(0.0, LiqConcs25.Liq[SodiumOxalate]*DRatio);
}
//---------------------------------------------------------------------------
double BATCBayerSM::SolidsConc(double T_)
{
const double mt=Mass(MP_Sol);
return (mt>=UsableMass) ? mt/GTZ(Mass(MP_SL))*get_Density(MP_SL, T_, Pressure, NULL) : 0.0;
}
double BATCBayerSM::SolidsConc25()
{
const double mt=Mass(MP_Sol);
return (mt>=UsableMass) ? mt/GTZ(Mass(MP_SL))*get_Density(MP_SL, C_2_K(25.0), Pressure, NULL) : 0.0;
}
//---------------------------------------------------------------------------
/*double BATCBayerSM::TOOC(double T_)
{//TOOC as Na2CO3 equivilent; TOOC = TOC*106/12
LiqConcs25.Converge(MArray(this));
double DRatio = (T_==C_2_K(25.0) ? 1.0 : LiqConcs25.LiquorDensity(T_, MArray(this))/LiqConcs25.Density25);
double Tooc = (LiqConcs25.Liq[::Organics]*5.0 + LiqConcs25.Liq[::Organics1]*2.21 + LiqConcs25.Liq[::SodiumOxalate]*2.0);
return Max(0.0, Tooc*DRatio);
}*/
//---------------------------------------------------------------------------
double BATCBayerSM::TOC(double T_)
{
//TOOC = TOC*106/12
LiqConcs25.Converge(MArray(this));
double DRatio = (T_==C_2_K(25.0) ? 1.0 : LiqConcs25.LiquorDensity(T_, MArray(this))/LiqConcs25.Density25);
double Toc = (/*LiqConcs25.Liq[::Organics]*5.0 + */LiqConcs25.Liq[::SodiumOxalate]*2.0)*MW_C/::SodiumCarbonate.MW
+ LiqConcs25.Liq[::Organics1]*2.21*MW_C/::SodiumCarbonate.MW*2.0;
return Max(0.0, Toc*DRatio);
}
double BATCBayerSM::TOC25()
{
//TOOC = TOC*106/12
LiqConcs25.Converge(MArray(this));
return (/*LiqConcs25.Liq[::Organics]*5.0 + */LiqConcs25.Liq[::SodiumOxalate]*2.0)*MW_C/::SodiumCarbonate.MW
+ LiqConcs25.Liq[::Organics1]*2.21*MW_C/::SodiumCarbonate.MW*2.0;
}
//---------------------------------------------------------------------------
double BATCBayerSM::TOS(double T_)
{
MArray MA(this);
LiqConcs25.Converge(MA);
double DRatio = (T_==C_2_K(25.0) ? 1.0 : LiqConcs25.LiquorDensity(T_, MA)/LiqConcs25.Density25);
const double InorganicSoda = LiqConcs25.Liq[::SodiumSulphate] + LiqConcs25.Liq[::SodiumChloride]
+ LiqConcs25.Liq[::SodiumFluoride] + LiqConcs25.Liq[::SodiumCarbonate] + LiqConcs25.Liq[::CausticSoda];
const double TSodium = InorganicSoda + LiqConcs25.Liq[::SodiumOxalate] + /*LiqConcs25.Liq[::Organics] + */LiqConcs25.Liq[::Organics1];
return (TSodium - InorganicSoda)*DRatio;
}
double BATCBayerSM::TOS25()
{
MArray MA(this);
LiqConcs25.Converge(MA);
const double InorganicSoda = LiqConcs25.Liq[::SodiumSulphate] + LiqConcs25.Liq[::SodiumChloride]
+ LiqConcs25.Liq[::SodiumFluoride] + LiqConcs25.Liq[::SodiumCarbonate] + LiqConcs25.Liq[::CausticSoda];
const double TSodium = InorganicSoda + LiqConcs25.Liq[::SodiumOxalate] + /*LiqConcs25.Liq[::Organics] + */LiqConcs25.Liq[::Organics1];
return TSodium - InorganicSoda;
}
//---------------------------------------------------------------------------
double BATCBayerSM::TOStoTOC()
{
MArray MA(this);
LiqConcs25.Converge(MA);
const double TOC = (/*LiqConcs25.Liq[::Organics]*5.0 + */LiqConcs25.Liq[::SodiumOxalate]*2.0)*MW_C/::SodiumCarbonate.MW
+ LiqConcs25.Liq[::Organics1]*2.21*MW_C/::SodiumCarbonate.MW*2.0;
if (TOC>1.0e-6)
{
const double InorganicSoda = LiqConcs25.Liq[::SodiumSulphate] + LiqConcs25.Liq[::SodiumChloride]
+ LiqConcs25.Liq[::SodiumFluoride] + LiqConcs25.Liq[::SodiumCarbonate] + LiqConcs25.Liq[::CausticSoda];
const double TSodium = InorganicSoda + LiqConcs25.Liq[::SodiumOxalate] + /*LiqConcs25.Liq[::Organics] + */LiqConcs25.Liq[::Organics1];
const double TOS = TSodium - InorganicSoda;
return TOS/TOC;
}
return 0.0;
}
//---------------------------------------------------------------------------
double BATCBayerSM::FreeCaustic(double T_)
{
return CausticConc(T_) * (1.0 - AtoC()*::SodiumCarbonate.MW/::Alumina.MW);
}
//---------------------------------------------------------------------------
double BATCBayerSM::AtoC()
{
LiqConcs25.Converge(MArray(this));
return LiqConcs25.Liq[::Alumina] / GTZ(LiqConcs25.Liq[::CausticSoda]);
}
//---------------------------------------------------------------------------
double BATCBayerSM::CtoS()
{
LiqConcs25.Converge(MArray(this));
return LiqConcs25.Liq[::CausticSoda]
/ GTZ(LiqConcs25.Liq[::CausticSoda] + LiqConcs25.Liq[::SodiumCarbonate]);
}
//---------------------------------------------------------------------------
double BATCBayerSM::CltoC()
{
LiqConcs25.Converge(MArray(this));
return (LiqConcs25.Liq[SodiumChloride])/GTZ(LiqConcs25.Liq[::CausticSoda]);
}
//---------------------------------------------------------------------------
double BATCBayerSM::Na2SO4toC()
{
LiqConcs25.Converge(MArray(this));
return (LiqConcs25.Liq[SodiumSulphate])/GTZ(LiqConcs25.Liq[::CausticSoda]);
}
//---------------------------------------------------------------------------
double BATCBayerSM::THAMassFlow()
{
MArray M(this);
return M[::THA];
}
//---------------------------------------------------------------------------
double BATCBayerSM::THADens(double T_)
{
return gs_MVDefn[::THA].Density(T_, StdP, NULL);
}
//---------------------------------------------------------------------------
double BATCBayerSM::IonicStrength()
{
const double MW_Na2CO3 = ::SodiumCarbonate.MW; //105.989..
const double MW_Na2O = ::OccSoda.MW; //61.9789..
const double MW_NaCl = ::SodiumChloride.MW; //58.4425..
const double MW_Na2SO4 = ::SodiumSulphate.MW; //142.043..
LiqConcs25.Converge(MArray(this));
double I;
switch (sm_iASatMethod)
{
case ASM_LiqInfo5:
{
/* Saturated Alumina concentration (ie Alumina concentration at Equilibrium)
calculated using the formula found in:
Fourth International Alumina Quality Workshop June 1996 Proceedings
Rosenberg S.P, Healy S.J 'A Thermodynamic Model for Gibbsite Solubility
in Bayer Liquors'.*/
const double k1 = 0.9346;
const double k2 = 2.0526;
const double k3 = 2.1714;
const double k4 = 1.6734;
const double cTOC = TOC(C_2_K(25.0));
const double cNaCl = LiqConcs25.Liq[::SodiumChloride] /LiqConcs25.NaFactor[::SodiumChloride];
const double cNa2CO3 = LiqConcs25.Liq[::SodiumCarbonate]/LiqConcs25.NaFactor[::SodiumCarbonate];
const double cNa2SO4 = LiqConcs25.Liq[::SodiumSulphate] /LiqConcs25.NaFactor[::SodiumSulphate];
const double cNaOH = LiqConcs25.Liq[::CausticSoda];
I = 0.01887*cNaOH + k1*cNaCl/MW_NaCl + k2*cNa2CO3/MW_Na2CO3 + k3*cNa2SO4/MW_Na2SO4 + k4*0.01887*cTOC;
return I;
}
case ASM_BRAHMA: //use LiqInfo6...
case ASM_LiqInfo6:
{
const double k1 = 0.9041;
const double k2 = 1.0826;
const double k3 = 1.1589;
const double k4 = 1.1659;
const double cTOC = TOC(C_2_K(25.0));
const double cNaCl = LiqConcs25.Liq[::SodiumChloride] /LiqConcs25.NaFactor[::SodiumChloride];
const double cNa2CO3 = LiqConcs25.Liq[::SodiumCarbonate]/LiqConcs25.NaFactor[::SodiumCarbonate];
const double cNa2SO4 = LiqConcs25.Liq[::SodiumSulphate] /LiqConcs25.NaFactor[::SodiumSulphate];
const double cNaOH = LiqConcs25.Liq[::CausticSoda];
I = 0.01887*cNaOH + k1*cNaCl/MW_NaCl + k2*cNa2CO3/MW_Na2CO3 + k3*cNa2SO4/MW_Na2SO4 + k4*0.01887*cTOC;
return I;
}
}
return 0.0;
}
//---------------------------------------------------------------------------
double BATCBayerSM::AluminaConcSat(double T_)
{
T_ = Max(1.0, T_);
switch (sm_iASatMethod)
{
case ASM_LiqInfo5:
{
const double I = IonicStrength();
const double I2 = Sqrt(I);
const double cNaOH = LiqConcs25.Liq[::CausticSoda];
// Saturated Alumina concentration (ie Alumina concentration at Equilibrium)
//calculated using the formula found in:
//Fourth International Alumina Quality Workshop June 1996 Proceedings
//Rosenberg S.P, Healy S.J 'A Thermodynamic Model for Gibbsite Solubility
//in Bayer Liquors'.
const double a0 = -9.2082;
const double a3 = -0.8743;
const double a4 = 0.2149;
const double dG = -30960.0; //Gibbs energy of dissolution
const double R = R_c;//8.3145; //Universal Gas Constant 8.314472
const double X = a0*I2/(1.0+I2) - a3*I - a4*Pow(I, 3.0/2.0);
const double Keq = Exps(dG/(R*T_)); //Equilibrium Constant
const double ASat = 0.96197*cNaOH/(1.0+(Pow(10.0, X)/Keq));
return ASat;
}
case ASM_LiqInfo6:
{
const double I = IonicStrength();
const double I2 = Sqrt(I);
const double cNaOH = LiqConcs25.Liq[::CausticSoda];
const double a0 = -8.5733;
const double a3 = -0.7370;
const double a4 = 0.1918;
const double dG = -30639.0; //Gibbs energy of dissolution
const double R = R_c;//8.3145; //Universal Gas Constant 8.314472
const double X = a0*I2/(1.0+I2) - a3*I - a4*Pow(I, 3.0/2.0);
const double Keq = Exps(dG/(R*T_)); //Equilibrium Constant
const double ASat = 0.96197*cNaOH/(1.0+(Pow(10.0, X)/Keq));
return ASat;
}
case ASM_BRAHMA:
{
/************************************
Implemented from the BRAHMA model Pascal CODE
Function ACequilf( Density : prec;
Temp : prec;
LiqCompK: LiquorCompositionTypeK;
Var CEquil : prec): prec;
const
T0 = 273.15;
Var
WH2O, Mtot, Molality, MolalityOld, BPR, H2OAct, LnKeq : prec;
Keq, ACin, ACuit, DeltaAk, WeightH2ONew : prec;
C_Na, Factor : prec;
LoopCounter : integer;
begin
With LiqCompK do ACin := Ak / Ck;
WH2O := WeightH2O( Mtot, LiqCompK );
Molality := 1000*Mtot/WH2O;
LoopCounter:=0;
repeat
MolalityOld := Molality;
BPR := 0.00182 + 0.55379 * PowI(molality/10,7)
+ 0.0040625 * Molality * (Temp+T0)
+ (1/(temp+T0)) * (-286.66*Molality + 29.919 * PowI(Molality,2)
+ 0.6228 * PowI(Molality,3))
- 0.032647 * Molality * PowI(Molality*(temp+T0)/1000,2)
+ PowI((temp+T0)/1000,5) * ( 5.90705* Molality - 0.57532 *
PowI(Molality,2) + 0.10417 * PowI(Molality,3));
H2OAct := Exp( 10519/1.986 * ( 1/(T0+100+BPR) - 1/(100+T0) ) );
LnKeq := -(1/8.31051) * ( PDat.KEq_A1 / (temp+T0)
+ PDat.KEq_B1 * ( (temp-25)/(temp+T0) - Ln((temp+T0)/298.15))
+ PDat.KEq_C1 * (1 + 0.00536 * Molality ));
Keq := SQRT( Exp( LnKeq ) );
ACuit := 1 / ( 1 + Keq * PowI(H2OAct,2) ) * 102/106;
DeltaAk := LiqCompK.Ck * ( ACin - ACuit );
WeightH2Onew := WH2O - ( DeltaAk/102 * 72 );
Molality := 1000 * Mtot / WeightH2ONew;
inc(LoopCounter);
until (Abs( 1 - Molality/MolalityOld ) < 1e-5) or (LoopCounter>100);
ACEquilf := ACuit;
end;
*/
const double C = CausticConc(T_);
if (C<1.0e-12)
return 0.0;
double ACin = AtoC();
int i;
//MArray MA(this);
double WH20, Mtot;
double molality = Molality(WH20, Mtot);
if (Mtot<1.0e-12)
return 0.0;
/*
const double KEq_A1 = -64149;
const double KEq_B1 = 69.92;
const double KEq_C1 = 166.465; */
/*const double KEq_A1 = -55292;
const double KEq_B1 = 0;
const double KEq_C1 = 139.5;*/
double ACUit, BPR;
for (i=0; i<100; i++)
{
double molalityOld = molality;
//const double Std_SatT = MSpModelBase::get_SaturationT(P, &MA);
//const double BPE = BoilPtElev(MA, Std_SatT);
//double BPR = BoilPtElev(MA, T_); //should this be used???
const double molality2 = molality*molality;
BPR = 0.00182 + 0.55379*Pow(molality/10.0,7.0) + 0.0040625*molality*T_
+ (1.0/T_) * (-286.66*molality + 29.919*molality2 + 0.6228*molality2*molality)
- 0.032647*molality*Pow(molality*T_/1000,2.0)
+ Pow(T_/1000,5.0)*(5.90705*molality - 0.57532*molality2 + 0.10417*molality*molality2);
double H2OAct = exp( 10519.0/1.986 * ( 1/C2K(100+BPR) - 1/C2K(100) ) );
double LnKeq = -(1/8.31051) * ( KEq_A1 / T_
+ KEq_B1 * ( (K2C(T_)-25)/T_ - Ln(T_/298.15))
+ KEq_C1 * (1 + 0.00536 * molality ));
double Keq = exp(LnKeq/2.);
ACUit = 1.0 / (1.0 + Keq*H2OAct*H2OAct) * 102/106;
double DeltaAk = /*C**/(ACin - ACUit);
double WeightH2ONew = WH20 - ( DeltaAk/102 * 72 );
molality = 1000 * Mtot / WeightH2ONew;
if (fabs(1.0 - molality/molalityOld)<1.0e-7)
break;
}
//Log.Message(MMsg_Note,"BPR:%g molality:%g", BPR, molality);
//Log.Message(MMsg_Note,"AC:%g molality:%g, bpr:%g iters%d", ACUit, molality, BPR, i);
const double ASat = ACUit * C;
return ASat;
}
}
return 0.0;
}
//---------------------------------------------------------------------------
double BATCBayerSM::OxalateSolubility(double T_)
{
if (0)
{
// Function calculates the equilibrium concentration (g/l) of oxalate, based on stream properties.
// (British Aluminium - Burnt Island)
const double C = CausticConc(C_2_K(25.0)); // g/l
const double Na2CO3Qm = M[SodiumCarbonate]; // kg/s
const double LiqQv = LVolume25(); // m^3/s
const double OxEquil = 7.62*Exps(0.012*K2C(T_) - (::OccSoda.MW/::SodiumCarbonate.MW)*(0.016*C + 0.011*Na2CO3Qm/GTZ(LiqQv)));
return OxEquil; //(OxEquil+Approach);
}
else
{
/*
Function variables:
t = temperature of stream, °C
a = A g/L
C = C g/L
S = S g/L
Na2SO4 = Na2SO4 g/L
NaCl = NaCl g/L
TOC = TOC g/L
Oxal () = equilibrium oxalate concentration g/L Na2C2O4
Function Oxal(t, a, C, S, Na2SO4, NaCl, TOC)
' Process Chemistry Oxalate equilibrium relationship based on plant data for LPP filtrate
Delta = 0.5 ' gpl
' "Delta" gpl added to fit seed poisoning/residence time effects away from equilibrium.
On Error GoTo eh_oxalate
Oxal = Delta + 190 * Exp(-1166.4 / (t + 273) + 0.511 * Log(t + 273) + 0.00007 * t ^ 2 - 1.7252 * Log(-0.0171 * a + 0.0482 * C + 0.0248 * (S - C) + 0.0214 * Na2SO4 + 0.054 * NaCl + 0.08 * TOC))
Exit Function
eh_oxalate:
Oxal = 0
Exit Function
End Function
*/
//Referance: Bayer Process Properties BATC SysCAD Model
//Process Chemistry Oxalate Equilibrium relationship based on plant data for LPP filtrate
LiqConcs25.Converge(MArray(this));
const double Delta = 0.5; //gpl
//"Delta" gpl added to fit seed poioning/residence time effects away from equilibrium
const double A = LiqConcs25.Liq[::Alumina];
const double S = LiqConcs25.Liq[::CausticSoda]+LiqConcs25.Liq[::SodiumCarbonate];
if (A>1e-5 && S>1e-5)
{
const double C = LiqConcs25.Liq[::CausticSoda];
const double Na2SO4 = LiqConcs25.Liq[::SodiumSulphate]*::SodiumSulphate.MW/::SodiumCarbonate.MW;
const double NaCl = LiqConcs25.Liq[SodiumChloride]*::SodiumChloride.MW*2/::SodiumCarbonate.MW;
const double TOC = TOC25();
const double d1 = -0.0171*A + 0.0482*C + 0.0248*(S-C) + 0.0214*Na2SO4 + 0.054*NaCl + 0.08*TOC;
if (d1>0.0)
{
const double Tc = K2C(T_);
const double d2 = -1166.4/(Tc+273.0) + 0.511*log(Tc+273.0) + 0.00007*Tc*Tc - 1.7252*log(d1);
const double OxEquil = Delta + 190.0*exp(d2);
return OxEquil;
}
}
}
return 0.0;
}
//---------------------------------------------------------------------------
/*
TODO: Check this...
Solubilty equations return crazy numbers for dilute liquor. Eg:
Seed_W.Content.Calc.Rqd_A/C 0.748
Seed_W.Content.Calc.Rqd_C/S 0.280
Seed_W.Content.Calc.Rqd_C (g/L) 5.256
Seed_W.Content.Calc.Rqd_Na2SO4 (g/L) 2.815
Seed_W.Content.Calc.Rqd_NaCl (g/L) 0.719
Seed_W.Content.Calc.Rqd_NaF (g/L) 0
Seed_W.Content.Calc.Rqd_Oxalate (g/L) 0.836
Seed_W.Content.Calc.Rqd_TOC (g/L) 1.183
Seed_W.Content.Calc.Rqd_SiO2 (g/L) 0
Seed_W.Content.Calc.Rqd_SolConc (g/L) *
Seed_W.Content.Calc.Rqd_SolFrac (%) 0
*/
double BATCBayerSM::SulphateSolubility(double T_)
{
//Referance: Bayer Process Properties BATC SysCAD Model
//The sulphate solubility correlation format is based on the paper published in Light Metals 1983 by Eddie Schiller.
//Constants have been refitted to Worsley liquor by Iwan Hiralal, Billiton.
MArray MA(this);
double TLiq=MA.Mass(MP_Liq); // Total Liquid kg/s
if (TLiq<1.0e-6 || MA[SodiumCarbonate]<1.0e-6 || MA[CausticSoda]<1.0e-6 || MA[SodiumSulphate]<1.0e-6)
return 0.0;
const double S = (MA[SodiumCarbonate] + MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW);
const double A = MA[Alumina];
const double C = MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW;
const double AtoC = A/NZ(C);
const double CtoS = C/NZ(S);
const double Cl = MA[SodiumChloride]/::SodiumChloride.MW*MW_Cl;
const double CltoS = Cl/NZ(S); //kg per kg S
const double F = MA[SodiumFluoride]/::SodiumFluoride.MW*MW_F;
const double FtoS = F/NZ(S); //kg per kg S
const double SO4 = MA[SodiumSulphate]/::SodiumSulphate.MW*MW_SO4;
double SO4toS = SO4/NZ(S); //kg per kg S
const double StoLiq = S*1000.0/TLiq;//g of S per kg liquor
const double TOC = (/*MA[Organics]*5.0/::Organics.MW + */MA[SodiumOxalate]*2.0/::SodiumOxalate.MW)*MW_C + MA[Organics1]*2.21/::Organics1.MW*MW_C;
const double TOCtoS = TOC/NZ(S); //kg per kg S
const double K2OtoS = 0.0;
//A /= 1000.0;
//C /= 1000.0;
double tol = 1.0;
double Sulptemp = 0.0;
double Sulptemp2 = 1.0;
int Iter=100;
while (tol>0.001 && Iter--)
{
// S in g/kg; Sulph as g/kg liq Na2SO4
// LOG returns natural to base e
// Sub function calculates molality
// FreeS calculates univalent diionisation of divalent molecules
double C_ = StoLiq*CtoS*0.001;
double A_ = C_*AtoC;
double wOH = 321.0*C_ - 333.0*A_;
double wAlO2 = 1157.0*A_;
double wCl = StoLiq*CltoS;
double wF = StoLiq*FtoS;
double wCO3 = 0.566*(StoLiq - 1000.0*C_);
double wSO4 = StoLiq*SO4toS;
double TOStoS = TOCtoS*2.0;
//Fact=0.830 for low temp plant, 0.942 for high temp plant
double Fact = 0.83;//should be 2.28 for WAPL = 2*(89.9-23)/(1.2*106)* TOS/TOC
double wOrg = StoLiq * TOCtoS * Fact;
double tsoda = StoLiq + StoLiq*(TOStoS + CltoS*1.495 + FtoS*2.789 + SO4toS*1.104 - K2OtoS*1.125);
double FreeS = (tsoda/106.0*2.0 - wCO3/60.0 - wSO4/96.0)/2.0*106.0;
double wNa = 0.434*tsoda;
double wK = 0.83*StoLiq*K2OtoS;
double OH = wOH/17.0;
double AlO2 = wAlO2/59.0;
double Cl = wCl/35.5;
double F = wF/19.0;
double CO3 = wCO3/60.0;
double SO4 = wSO4/96.0;
double Org = wOrg/88.0;
double Na = wNa/23.0;
double K = wK/39.1;
double wsum = wOH + wAlO2 + wCl + wF + wCO3 + wSO4 + wOrg + wNa + wK;
double msum = OH + AlO2 + Cl + F + CO3 + SO4 + Org;
double W = 1000.0 - wsum;
double molality1 = msum*1000.0/W;
// Sub function calculates Na2SO4 at equilibrium in moles/kg H2O
// base from LM 1983 Eddie Schiller, Reynold's Metals Company
// Constants refitted to Wapl liquor by I.Hiralal BNL
const double C1 = 1.2291;
const double D1 = 1.2993;
//C1 = 2.6069 ' original
//D1 = 4.2731 ' original
//C1 = 1.309449951 ' DJAntrobus Dec 02
//D1 = 1.567839051 ' DJAntrobus Dec 02
double d = FreeS/106.0*2.0/(W/1000.0);
double molSO4 = exp(-C1*log(GTZ(d)) + D1); //weight of Na2SO4 (g / kg H2O)
double EwSO4 = molSO4 * 142.04;
Sulptemp = EwSO4*W/1000.0;
tol = fabs(Sulptemp - Sulptemp2);
Sulptemp2 = Sulptemp;
SO4toS = EwSO4/StoLiq;
}
if (Iter<=0 && tol>0.01)
return 0.0; //PROBLEM!!! (todo check/trap for this...)
return Sulptemp;
/*Function Sulph(S, AtoC, CtoS, CltoS, FtoS, SO4toS, TOCtoS, K2OtoS)
// calculates empirical fit of Na2SO4 solubility in Worsley leach liquors
' S in g/kg; Sulph as g/kg liq Na2SO4
' LOG returns natural to base e
' Sub function calculates molality
' FreeS calculates univalent diionisation of divalent molecules
On Error GoTo eh_Sulph
tol = 1
Sulptemp = 0
Sulptemp2 = 1
Do Until tol < 0.001
C = S * CtoS * 0.001
a = C * AtoC
wOH = 321 * C - 333 * a
wAlO2 = 1157 * a
wCl = S * CltoS
wF = S * FtoS
wCO3 = 0.566 * (S - 1000 * C)
wSO4 = S * SO4toS
TOStoS = TOCtoS * 2
' Fact=0.830 for low temp plant, 0.942 for high temp plant
Fact = 0.83 ' should be 2.28 for WAPL = 2*(89.9-23)/(1.2*106)* TOS/TOC
wOrg = S * TOCtoS * Fact
tsoda = S + S * (TOStoS + CltoS * 1.495 + FtoS * 2.789 + SO4toS * 1.104 - K2OtoS * 1.125)
FreeS = (tsoda / 106 * 2 - wCO3 / 60 - wSO4 / 96) / 2 * 106
wNa = 0.434 * tsoda
wK = 0.83 * S * K2OtoS
OH = wOH / 17
AlO2 = wAlO2 / 59
Cl = wCl / 35.5
F = wF / 19
CO3 = wCO3 / 60
SO4 = wSO4 / 96
Org = wOrg / 88
Na = wNa / 23
K = wK / 39.1
wsum = wOH + wAlO2 + wCl + wF + wCO3 + wSO4 + wOrg + wNa + wK
msum = OH + AlO2 + Cl + F + CO3 + SO4 + Org
W = 1000 - wsum
molality1 = msum * 1000 / W
' Sub function calculates Na2SO4 at equilibrium in moles/kg H2O
' base from LM 1983 Eddie Schiller, Reynold's Metals Company
' Constants refitted to Wapl liquor by I.Hiralal BNL
C1 = 1.2291
D1 = 1.2993
' C1 = 2.6069 ' original
' D1 = 4.2731 ' original
' C1 = 1.309449951 ' DJAntrobus Dec 02
' D1 = 1.567839051 ' DJAntrobus Dec 02
molSO4 = Exp(-C1 * Log(FreeS / 106 * 2 / (W / 1000)) + D1)
' weight of Na2SO4 (g / kg H2O)
EwSO4 = molSO4 * 142.04
Sulptemp = EwSO4 * W / 1000
tol = Abs(Sulptemp - Sulptemp2)
Sulptemp2 = Sulptemp
SO4toS = EwSO4 / S
Loop
Sulph = Sulptemp
Exit Function
eh_Sulph:
Sulph = 0
End Function*/
}
//---------------------------------------------------------------------------
double BATCBayerSM::CarbonateSolubility(double T_)
{
//Referance: Bayer Process Properties BATC SysCAD Model
// calculates empirical fit of Na2CO3 solubility in Worsley leach liquors
// S in g/kg; Carb as g/kg liq Na2CO3
// LOG returns natural to base e
// Sub function calculates molality
// FreeS calculates univalent ionisation of molecules
MArray MA(this);
double TLiq=MA.Mass(MP_Liq); // Total Liquid kg/s
if (TLiq<1.0e-6 || MA[SodiumCarbonate]<1.0e-6 || MA[CausticSoda]<1.0e-6)
return 0.0;
const double S = (MA[SodiumCarbonate] + MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW);
const double A = MA[Alumina];
const double C = MA[CausticSoda]/(2.0*::CausticSoda.MW)*::SodiumCarbonate.MW;
const double AtoC = A/NZ(C);
double CtoS = C/NZ(S);
const double Cl = MA[SodiumChloride]/::SodiumChloride.MW*MW_Cl;
const double CltoS = Cl/NZ(S); //kg per kg S
const double F = MA[SodiumFluoride]/::SodiumFluoride.MW*MW_F;
const double FtoS = F/NZ(S); //kg per kg S
const double SO4 = MA[SodiumSulphate]/::SodiumSulphate.MW*MW_SO4;
const double SO4toS = SO4/NZ(S); //kg per kg S
double StoLiq = S*1000.0/TLiq;//g of S per kg liquor
const double TOC = (/*MA[Organics]*5.0/::Organics.MW + */MA[SodiumOxalate]*2.0/::SodiumOxalate.MW)*MW_C + MA[Organics1]*2.21/::Organics1.MW*MW_C;
const double TOCtoS = TOC/NZ(S); //kg per kg S
const double K2OtoS = 0.0;
double tol = 1.0;
double Carbtemp = 0.0;
double Carbtemp2 = 1.0;
int Iter=100;
while (tol>0.001 && Iter--)
{
double C_ = StoLiq*CtoS*0.001;
double A_ = C_*AtoC;
double wOH = 321.0*C_ - 333.0*A_;
double wAlO2 = 1157.0*A_;
double wCl = StoLiq*CltoS;
double wF = StoLiq*FtoS;
double wCO3 = 0.566*(StoLiq - 1000.0*C_);
double wSO4 = StoLiq*SO4toS;
double TOStoS = TOCtoS*2.0;
//Fact=0.830 for low temp plant, 0.942 for high temp plant
double Fact = 0.83;//should be 2.28 for WAPL = 2*(89.9-23)/(1.2*106)* TOS/TOC
double wOrg = StoLiq * TOCtoS * Fact;
double tsoda = StoLiq + StoLiq*(TOStoS + CltoS*1.495 + FtoS*2.789 + SO4toS*1.104 - K2OtoS*1.125);
double FreeS = (tsoda/106.0*2.0 - wCO3/60.0 - wSO4/96.0)/2.0*106.0;
double wNa = 0.434*tsoda;
double wK = 0.83*StoLiq*K2OtoS;
double OH = wOH/17.0;
double AlO2 = wAlO2/59.0;
double Cl = wCl/35.5;
double F = wF/19.0;
double CO3 = wCO3/60.0;
double SO4 = wSO4/96.0;
double Org = wOrg/88.0;
double Na = wNa/23.0;
double K = wK/39.1;
double wsum = wOH + wAlO2 + wCl + wF + wCO3 + wSO4 + wOrg + wNa + wK;
double msum = OH + AlO2 + Cl + F + CO3 + SO4 + Org;
double W = 1000.0 - wsum;
double molality1 = msum*1000.0/W;
// Sub function calculates Na2CO3 at equilibrium in moles/kg H2O
// base from LM 1983 Eddie Schiller, Reynold's Metals Company
//A1 = 2.6642 ' original
//B1 = 5.3677 ' original
const double A1 = 1.1061; // fitted
const double B1 = 1.7608; // fitted
double d = FreeS/106.0*2.0/(W/1000.0);
double molCO3 = exp(-A1*log(GTZ(d)) + B1); //weight of Na2CO3 (g / kg H2O)
double EwCO3 = molCO3*105.99;
Carbtemp = EwCO3*W/1000.0;
tol = fabs(Carbtemp - Carbtemp2);
Carbtemp2 = Carbtemp;
CtoS = C_*1000.0/(C_*1000.0 + EwCO3);
StoLiq = (C_*1000.0 + EwCO3);
}
if (Iter<=0 && tol>0.01)
return 0.0; //PROBLEM!!! (todo check/trap for this...)
return Carbtemp;
/*
The carbonate solubility correlation is based on the paper published in Light Metals 1983 by Eddie Schiller. Constants have also been refitted to Worsley liquor.
Function Carb(S, AtoC, CtoS, CltoS, FtoS, SO4toS, TOCtoS, K2OtoS)
' calculates empirical fit of Na2CO3 solubility in Worsley leach liquors
' S in g/kg; Carb as g/kg liq Na2CO3
' LOG returns natural to base e
' Sub function calculates molality
' FreeS calculates univalent ionisation of molecules
On Error GoTo eh_Carb
tol = 1
Carbtemp = 0
Carbtemp2 = 1
Do Until tol < 0.001
C = S * CtoS * 0.001
a = C * AtoC
wOH = 321 * C - 333 * a
wAlO2 = 1157 * a
wCl = S * CltoS
wF = S * FtoS
wCO3 = 0.566 * (S - 1000 * C)
wSO4 = S * SO4toS
TOStoS = TOCtoS * 2
' Fact=0.830 for low temp plant, 0.942 for high temp plant
Fact = 0.83 ' should be 2.28 for WAPL = 2*(89.9-23)/(1.2*106) * TOS/TOC
wOrg = S * TOCtoS * Fact
tsoda = S + S * (TOStoS + CltoS * 1.495 + FtoS * 2.789 + SO4toS * 1.104 - K2OtoS * 1.125)
FreeS = (tsoda / 106 * 2 - wCO3 / 60 - wSO4 / 96) / 2 * 106
wNa = 0.434 * tsoda
wK = 0.83 * S * K2OtoS
OH = wOH / 17
AlO2 = wAlO2 / 59
Cl = wCl / 35.5
F = wF / 19
CO3 = wCO3 / 60
SO4 = wSO4 / 96
Org = wOrg / 88
Na = wNa / 23
K = wK / 39.1
wsum = wOH + wAlO2 + wCl + wF + wCO3 + wSO4 + wOrg + wNa + wK
msum = OH + AlO2 + Cl + F + CO3 + SO4 + Org
W = 1000 - wsum
molality1 = msum * 1000 / W
' Sub function calculates Na2CO3 at equilibrium in moles/kg H2O
' base from LM 1983 Eddie Schiller, Reynold's Metals Company
' A1 = 2.6642 ' original
' B1 = 5.3677 ' original
A1 = 1.1061 ' fitted
B1 = 1.7608 ' fitted
molCO3 = Exp(-A1 * Log(FreeS / 106 * 2 / (W / 1000)) + B1)
' weight of Na2CO3 (g / kg H2O)
EwCO3 = molCO3 * 105.99
Carbtemp = EwCO3 * W / 1000
tol = Abs(Carbtemp - Carbtemp2)
Carbtemp2 = Carbtemp
CtoS = C * 1000 / (C * 1000 + EwCO3)
S = (C * 1000 + EwCO3)
Loop
Carb = Carbtemp
' Carb = Log(FreeS / 106 * 2 / (W / 1000))
Exit Function
eh_Carb:
Carb = 0
End Function
*/
return 0.0;
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
double BATCBayerSM::LVolume25()
{
const double mt=Mass(MP_Liq);
return ((mt>=UsableMass) ? (mt / get_Density(MP_Liq, C_2_K(25.0), Pressure, NULL)) : 0.0);
}
double BATCBayerSM::SLVolume25()
{
const double mt=Mass(MP_SL);
return ((mt>=UsableMass) ? (mt / get_Density(MP_SL, C_2_K(25.0), Pressure, NULL)) : 0.0);
}
//---------------------------------------------------------------------------
double BATCBayerSM::LDensity25()
{
return (get_Density(MP_Liq, C_2_K(25.0), Pressure, NULL));
}
double BATCBayerSM::SLDensity25()
{
return (get_Density(MP_SL, C_2_K(25.0), Pressure, NULL));
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
double BATCBayerSM::AtoCSaturation(double T_)
{
double C = CausticConc(T_);
if (C<1.0e-12)
return 0.0;
const double ACsat = AluminaConcSat(T_) / GTZ(C);
return ACsat;
}
//---------------------------------------------------------------------------
double BATCBayerSM::SSNRatio(double T_)
{// AtoC actual / AtoC saturation ==> A/ASat
const double C = CausticConc(T_);
if (C<1.0e-12)
return 0.0;
const double ACsat = AtoCSaturation(T_);
return AtoC() / GTZ(ACsat);
/*The calculated equilibrium alumina (A*) per these methods is for liquor at temperature, but is corrected to 25°C.
Hence the calcs for SSN and A/C* should use the A and C at 25°C, and not at T.
Eg. For the following liquor at 145°C (using LiqInfo6):
C = 260
A/C = 0.750 (A = 195.0)
C/S = 0.900
Na2SO4 = 5
NaCl = 5
NaOx = 2
TOC = 12
The calculated A* is 201.0 g/L, and so the SSN ratio should be 195.0/201.0 = 0.970 and the A/C* should be 0.773.
The current calculated values for SSN ratio and A/C* are based on the A@T of 181.2 and C@T of 241.6, and hence
are reported incorrectly as 0.902 and 0.832 respectively.
Could you please update these and upload?
We probably should also change where we report the A* number on the access page, or change its description so that it's
clear that it is corrected to 25°C even though it appears under the heading for "Other properties at T". Perhaps call it
"ASatConc25C" or something similar. Your thoughts?
Would it be possible for you also to upload the standard (generic) alumina properties .dll?
*/
}
//---------------------------------------------------------------------------
double BATCBayerSM::TotalSodiumConc25()
{//TotalNa Conc @ 25 expressed as Na2CO3
LiqConcs25.Converge(MArray(this));
double Sodium = LiqConcs25.Liq[::CausticSoda] // NaOH
+ LiqConcs25.Liq[::SodiumCarbonate] // Na2CO3
+ LiqConcs25.Liq[SodiumOxalate] // Na2C2O4
//+ LiqConcs25.Liq[Organics] // Na2C5O7
+ LiqConcs25.Liq[Organics1] // NaC2.21O2.275H3.63
+ LiqConcs25.Liq[SodiumChloride] // NaCl
+ LiqConcs25.Liq[SodiumSulphate] // Na2SO4
+ LiqConcs25.Liq[SodiumFluoride]; // NaF
return Sodium;
}
//---------------------------------------------------------------------------
/*double BATCBayerSM::TotalSodium()
{//TotalNa Conc
MArray MA(this);
LiqConcs25.Converge(MA);
double TSodium = LiqConcs25.LTotalSodium(MA); // The sodium components in liq.
return TSodium;
}*/
//---------------------------------------------------------------------------
double BATCBayerSM::Na2CO3toS()
{
LiqConcs25.Converge(MArray(this));
return LiqConcs25.Liq[::SodiumCarbonate]
/ GTZ(LiqConcs25.Liq[::CausticSoda] + LiqConcs25.Liq[::SodiumCarbonate]);
}
//---------------------------------------------------------------------------
double BATCBayerSM::OrganateConc25()
{//Organic Na2C5O7 + NaOrg Conc @ 25
LiqConcs25.Converge(MArray(this));
double Organate = /*LiqConcs25.Liq[::Organics] + */LiqConcs25.Liq[::Organics1];
return Organate;
}
//---------------------------------------------------------------------------
double BATCBayerSM::OxalateConc25()
{
LiqConcs25.Converge(MArray(this));
double Oxalate = LiqConcs25.Liq[::SodiumOxalate];
return Oxalate;
}
//---------------------------------------------------------------------------
double BATCBayerSM::TotalOrganicsConc25()
{
LiqConcs25.Converge(MArray(this));
double Organics = /*LiqConcs25.Liq[::Organics] + */LiqConcs25.Liq[::Organics1] + LiqConcs25.Liq[::SodiumOxalate];
return Organics;
}
//---------------------------------------------------------------------------
double BATCBayerSM::ChlorineConc25()
{
LiqConcs25.Converge(MArray(this));
double Chlorine = LiqConcs25.Liq[::SodiumChloride];
return Chlorine;
}
//---------------------------------------------------------------------------
double BATCBayerSM::SulphateConc25()
{
LiqConcs25.Converge(MArray(this));
double Sulphate = LiqConcs25.Liq[::SodiumSulphate];
return Sulphate;
}
//---------------------------------------------------------------------------
double BATCBayerSM::FluorideConc25()
{
LiqConcs25.Converge(MArray(this));
double Fluoride = LiqConcs25.Liq[::SodiumFluoride];
return Fluoride;
}
//---------------------------------------------------------------------------
| [
"[email protected]",
"[email protected]",
"[email protected]"
]
| [
[
[
1,
10
],
[
15,
28
],
[
35,
37
],
[
40,
55
],
[
57,
57
],
[
59,
63
],
[
72,
72
],
[
75,
85
],
[
87,
137
],
[
140,
144
],
[
150,
151
],
[
153,
153
],
[
155,
278
],
[
371,
372
],
[
376,
376
],
[
381,
528
],
[
577,
629
],
[
644,
644
],
[
646,
895
],
[
936,
1052
],
[
1058,
1164
],
[
1169,
1236
],
[
1243,
1245
],
[
1247,
1249
],
[
1257,
1275
],
[
1279,
1284
],
[
1290,
1307
],
[
1309,
1311
],
[
1316,
1321
],
[
1323,
1336
],
[
1338,
1392
],
[
1417,
1436
],
[
1441,
1471
],
[
1476,
1520
],
[
1524,
1531
],
[
1533,
1536
],
[
1541,
1541
],
[
1551,
1570
],
[
1576,
1780
],
[
1782,
1803
],
[
1833,
2177
],
[
2179,
2205
],
[
2209,
2225
],
[
2229,
2238
],
[
2348,
2795
],
[
2821,
2916
]
],
[
[
11,
12
],
[
29,
34
],
[
38,
39
],
[
56,
56
],
[
58,
58
],
[
73,
74
],
[
86,
86
],
[
138,
139
],
[
147,
149
],
[
154,
154
],
[
368,
370
],
[
373,
375
],
[
377,
380
],
[
529,
574
],
[
576,
576
],
[
630,
643
],
[
645,
645
],
[
933,
935
],
[
1276,
1278
],
[
1285,
1289
],
[
1308,
1308
],
[
1322,
1322
],
[
1337,
1337
],
[
1781,
1781
],
[
1804,
1827
],
[
1829,
1832
],
[
2178,
2178
],
[
2206,
2208
],
[
2226,
2228
],
[
2239,
2240
],
[
2347,
2347
]
],
[
[
13,
14
],
[
64,
71
],
[
145,
146
],
[
152,
152
],
[
279,
367
],
[
575,
575
],
[
896,
932
],
[
1053,
1057
],
[
1165,
1168
],
[
1237,
1242
],
[
1246,
1246
],
[
1250,
1256
],
[
1312,
1315
],
[
1393,
1416
],
[
1437,
1440
],
[
1472,
1475
],
[
1521,
1523
],
[
1532,
1532
],
[
1537,
1540
],
[
1542,
1550
],
[
1571,
1575
],
[
1828,
1828
],
[
2241,
2346
],
[
2796,
2820
]
]
]
|
5686a8c03aa9cfc0c96c036fe32b2f9c5c95c84f | c82d009662b7b3da2707a577a3143066d128093a | /numeric/units/miles.h | 93ab521586e3124363a66af0e7b30e44a9ff75e9 | []
| no_license | canilao/cpp_framework | 01a2c0787440d9fca64dbb0fb10c1175a4f7d198 | da5c612e8f15f6987be0c925f46e854b2e703d73 | refs/heads/master | 2021-01-10T13:26:39.376268 | 2011-02-04T16:26:26 | 2011-02-04T16:26:26 | 49,291,836 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,231 | h | /*******************************************************************************
\file miles.h
\brief Class declaration for a mile of length.
\note C Anilao 10/05/2006 Created.
*******************************************************************************/
#ifndef MILES_H
#define MILES_H
// General Dependancies.
#include "length.h"
// Exactly how many inches are in a mile.
#define INCHES_IN_A_MILE 63360ULL
namespace numeric
{
/*******************************************************************************
\class Class for a declaration for a mile.
\brief Concrete class for measurable length units.
*******************************************************************************/
class miles : public length
{
public:
// Constructor.
miles();
// Copy Constructor.
miles(const miles & origMiles);
// Decimal number constructor.
miles(const double & decimalNumber);
// Base length number constructor.
miles(const length & origBaseLength);
// Destructor.
virtual ~miles();
// The child class must define this for conversions.
virtual double GetCoreUnitConversion() const;
};
/*******************************************************************************
\brief Constructor
\note C Anilao 10/05/2006 Created.
*******************************************************************************/
inline miles::miles()
{}
/*******************************************************************************
\brief Constructor
\note C Anilao 10/05/2006 Created.
*******************************************************************************/
inline miles::miles(const miles & origMiles) : length(origMiles)
{}
/*******************************************************************************
\brief Decimal constructor.
\note C Anilao 10/05/2006 Created.
*******************************************************************************/
inline miles::miles(const double & decimalNumber)
{
// Use our assignment operator to assign ourself.
SetData(decimalNumber * GetCoreUnitConversion());
}
/*******************************************************************************
\brief Base length constructor.
\note C Anilao 10/05/2006 Created.
*******************************************************************************/
inline miles::miles(const length & origBaseLength) : length(origBaseLength)
{}
/*******************************************************************************
\brief Destructor
\note C Anilao 10/05/2006 Created.
*******************************************************************************/
inline miles::~miles()
{}
/*******************************************************************************
\brief The child class must define this for conversions.
\note C Anilao 10/25/2006 Created.
*******************************************************************************/
inline double miles::GetCoreUnitConversion() const
{
// Return our conversion.
return (INCHES_IN_A_MILE * CORE_UNITS_TO_ONE_INCH);
}
}
#endif
| [
"Chris@55e5c601-11dd-bd4b-a960-93a593583956"
]
| [
[
[
1,
119
]
]
]
|
4c8473c44cab5ac748a8dc4d4e28490a99fc15d0 | c70941413b8f7bf90173533115c148411c868bad | /core/src/vtxMatrix.cpp | 2581b914ab194a9946a096021caf729029ded11c | []
| no_license | cnsuhao/vektrix | ac6e028dca066aad4f942b8d9eb73665853fbbbe | 9b8c5fa7119ff7f3dc80fb05b7cdba335cf02c1a | refs/heads/master | 2021-06-23T11:28:34.907098 | 2011-03-27T17:39:37 | 2011-03-27T17:39:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,129 | cpp | /*
-----------------------------------------------------------------------------
This source file is part of "vektrix"
(the rich media and vector graphics rendering library)
For the latest info, see http://www.fuse-software.com/
Copyright (c) 2009-2010 Fuse-Software (tm)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#include "vtxMatrix.h"
#include "vtxVector2.h"
#include "vtxLogManager.h"
#include "vtxStringHelper.h"
namespace vtx
{
//-----------------------------------------------------------------------
/*
* [sx, cx, tx]
* [cy, sy, ty]
* [0, 0, 1]
*/
//-----------------------------------------------------------------------
Matrix::Matrix(
float sx, float cx, float tx,
float cy, float sy, float ty)
{
// first row
m[0][0] = sx;
m[0][1] = cx;
m[0][2] = tx;
// second row
m[1][0] = cy;
m[1][1] = sy;
m[1][2] = ty;
}
//-----------------------------------------------------------------------
Vector2 Matrix::getTransformation() const
{
return Vector2(m[0][2], m[1][2]);
}
//-----------------------------------------------------------------------
Matrix Matrix::getTransformationMatrix() const
{
const Vector2& transform = getTransformation();
return Matrix(
1, 0, transform.x,
0, 1, transform.y);
}
//-----------------------------------------------------------------------
Vector2 Matrix::getScale() const
{
return Vector2(
sqrt(m[0][0] * m[0][0] + m[0][1] * m[0][1]),
sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1]));
}
//-----------------------------------------------------------------------
Matrix Matrix::getScaleMatrix() const
{
const Vector2& scale = getScale();
return Matrix(
scale.x, 0, 0,
0, scale.y, 0);
}
//-----------------------------------------------------------------------
float Matrix::getRotation() const
{
// -atan2(cx * scale.y, sx)
return -atan2(
m[0][1] * sqrt(m[1][0] * m[1][0] + m[1][1] * m[1][1]),
m[0][0]) * 180.0f / (float)M_PI;
}
//-----------------------------------------------------------------------
Matrix Matrix::getRotationMatrix() const
{
const Vector2& scale = getScale();
return Matrix(
m[0][0] / scale.x, m[0][1] / scale.x, 0,
m[1][0] / scale.y, m[1][1] / scale.y, 0);
}
//-----------------------------------------------------------------------
Matrix Matrix::operator*(const Matrix& matrix) const
{
Matrix product;
for (size_t iRow = 0; iRow < 2; iRow++)
{
for (size_t iCol = 0; iCol < 3; iCol++)
{
product.m[iRow][iCol] =
m[iRow][0]*matrix.m[0][iCol] +
m[iRow][1]*matrix.m[1][iCol];
}
}
product.m[0][2] += m[0][2];
product.m[1][2] += m[1][2];
return product;
}
//-----------------------------------------------------------------------
Matrix Matrix::operator*(const float& scalar) const
{
Matrix product;
// first row
product.m[0][0] = m[0][0] * scalar;
product.m[0][1] = m[0][1] * scalar;
product.m[0][2] = m[0][2] * scalar;
// second row
product.m[1][0] = m[1][0] * scalar;
product.m[1][1] = m[1][1] * scalar;
product.m[1][2] = m[1][2] * scalar;
return product;
}
//-----------------------------------------------------------------------
Vector2 Matrix::transformAffine(const Vector2& v) const
{
return Vector2(
m[0][0] * v.x + m[0][1] * v.y + m[0][2],
m[1][0] * v.x + m[1][1] * v.y + m[1][2]);
}
//-----------------------------------------------------------------------
Matrix Matrix::transpose() const
{
return Matrix(
m[0][0], m[1][0], 0,
m[0][1], m[1][1], 0);
}
//-----------------------------------------------------------------------
Matrix Matrix::inverseTransformation() const
{
Matrix result;
Matrix invTrans;
invTrans.m[0][2] = -m[0][2];
invTrans.m[1][2] = -m[1][2];
Matrix invRot = getRotationMatrix().transpose();
Matrix invScale = getScaleMatrix();
invScale.m[0][0] = 1.0f / invScale.m[0][0];
invScale.m[1][1] = 1.0f / invScale.m[1][1];
invTrans = invScale * invTrans;
result = invRot * invTrans;
// [a, c, tx]
// [b, d, ty]
// [0, 0, 1]
//// first row
//result.m[0][0] = m[1][1] / (m[0][0] * m[1][1] - m[1][0] * m[0][1]);
//result.m[0][1] = -m[0][1] / (m[0][0] * m[1][1] - m[1][0] * m[0][1]);
//result.m[0][2] = (m[0][1] * m[1][2] - m[1][1] * m[0][2]) / (m[0][0] * m[1][1] - m[1][0] * m[0][1]);
//// second row
//result.m[1][0] = -m[1][0] / (m[0][0] * m[1][1] - m[1][0] * m[0][1]);
//result.m[1][1] = m[0][0] / (m[0][0] * m[1][1] - m[1][0] * m[0][1]);
//result.m[1][2] = (m[0][0] * m[1][2] - m[1][0] * m[0][2]) / (m[0][0] * m[1][1] - m[1][0] * m[0][1]);
return result;
}
//-----------------------------------------------------------------------
Vector2 Matrix::transformInverse(const Vector2& v) const
{
return inverseTransformation().transformAffine(v);
}
//-----------------------------------------------------------------------
}
| [
"stonecold_@9773a11d-1121-4470-82d2-da89bd4a628a"
]
| [
[
[
1,
194
]
]
]
|
8d8515c04448c967fe25b5c6746e50fb24d8d827 | a84b013cd995870071589cefe0ab060ff3105f35 | /webdriver/branches/jsapi/third_party/gecko-1.9.0.11/win32/include/nsIDOMDocumentType.h | 7d924b36a71bd1ee384989490c18bb801703eb0d | [
"Apache-2.0"
]
| permissive | vdt/selenium | 137bcad58b7184690b8785859d77da0cd9f745a0 | 30e5e122b068aadf31bcd010d00a58afd8075217 | refs/heads/master | 2020-12-27T21:35:06.461381 | 2009-08-18T15:56:32 | 2009-08-18T15:56:32 | 13,650,409 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,104 | h | /*
* DO NOT EDIT. THIS FILE IS GENERATED FROM e:/xr19rel/WINNT_5.2_Depend/mozilla/dom/public/idl/core/nsIDOMDocumentType.idl
*/
#ifndef __gen_nsIDOMDocumentType_h__
#define __gen_nsIDOMDocumentType_h__
#ifndef __gen_nsIDOMNode_h__
#include "nsIDOMNode.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMDocumentType */
#define NS_IDOMDOCUMENTTYPE_IID_STR "a6cf9077-15b3-11d2-932e-00805f8add32"
#define NS_IDOMDOCUMENTTYPE_IID \
{0xa6cf9077, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
class NS_NO_VTABLE NS_SCRIPTABLE nsIDOMDocumentType : public nsIDOMNode {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMDOCUMENTTYPE_IID)
/**
* Each Document has a doctype attribute whose value is either null
* or a DocumentType object.
* The nsIDOMDocumentType interface in the DOM Core provides an
* interface to the list of entities that are defined for the document.
*
* For more information on this interface please see
* http://www.w3.org/TR/DOM-Level-2-Core/
*
* @status FROZEN
*/
/* readonly attribute DOMString name; */
NS_SCRIPTABLE NS_IMETHOD GetName(nsAString & aName) = 0;
/* readonly attribute nsIDOMNamedNodeMap entities; */
NS_SCRIPTABLE NS_IMETHOD GetEntities(nsIDOMNamedNodeMap * *aEntities) = 0;
/* readonly attribute nsIDOMNamedNodeMap notations; */
NS_SCRIPTABLE NS_IMETHOD GetNotations(nsIDOMNamedNodeMap * *aNotations) = 0;
/* readonly attribute DOMString publicId; */
NS_SCRIPTABLE NS_IMETHOD GetPublicId(nsAString & aPublicId) = 0;
/* readonly attribute DOMString systemId; */
NS_SCRIPTABLE NS_IMETHOD GetSystemId(nsAString & aSystemId) = 0;
/* readonly attribute DOMString internalSubset; */
NS_SCRIPTABLE NS_IMETHOD GetInternalSubset(nsAString & aInternalSubset) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMDocumentType, NS_IDOMDOCUMENTTYPE_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMDOCUMENTTYPE \
NS_SCRIPTABLE NS_IMETHOD GetName(nsAString & aName); \
NS_SCRIPTABLE NS_IMETHOD GetEntities(nsIDOMNamedNodeMap * *aEntities); \
NS_SCRIPTABLE NS_IMETHOD GetNotations(nsIDOMNamedNodeMap * *aNotations); \
NS_SCRIPTABLE NS_IMETHOD GetPublicId(nsAString & aPublicId); \
NS_SCRIPTABLE NS_IMETHOD GetSystemId(nsAString & aSystemId); \
NS_SCRIPTABLE NS_IMETHOD GetInternalSubset(nsAString & aInternalSubset);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMDOCUMENTTYPE(_to) \
NS_SCRIPTABLE NS_IMETHOD GetName(nsAString & aName) { return _to GetName(aName); } \
NS_SCRIPTABLE NS_IMETHOD GetEntities(nsIDOMNamedNodeMap * *aEntities) { return _to GetEntities(aEntities); } \
NS_SCRIPTABLE NS_IMETHOD GetNotations(nsIDOMNamedNodeMap * *aNotations) { return _to GetNotations(aNotations); } \
NS_SCRIPTABLE NS_IMETHOD GetPublicId(nsAString & aPublicId) { return _to GetPublicId(aPublicId); } \
NS_SCRIPTABLE NS_IMETHOD GetSystemId(nsAString & aSystemId) { return _to GetSystemId(aSystemId); } \
NS_SCRIPTABLE NS_IMETHOD GetInternalSubset(nsAString & aInternalSubset) { return _to GetInternalSubset(aInternalSubset); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMDOCUMENTTYPE(_to) \
NS_SCRIPTABLE NS_IMETHOD GetName(nsAString & aName) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetName(aName); } \
NS_SCRIPTABLE NS_IMETHOD GetEntities(nsIDOMNamedNodeMap * *aEntities) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetEntities(aEntities); } \
NS_SCRIPTABLE NS_IMETHOD GetNotations(nsIDOMNamedNodeMap * *aNotations) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetNotations(aNotations); } \
NS_SCRIPTABLE NS_IMETHOD GetPublicId(nsAString & aPublicId) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPublicId(aPublicId); } \
NS_SCRIPTABLE NS_IMETHOD GetSystemId(nsAString & aSystemId) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSystemId(aSystemId); } \
NS_SCRIPTABLE NS_IMETHOD GetInternalSubset(nsAString & aInternalSubset) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetInternalSubset(aInternalSubset); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMDocumentType : public nsIDOMDocumentType
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMDOCUMENTTYPE
nsDOMDocumentType();
private:
~nsDOMDocumentType();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMDocumentType, nsIDOMDocumentType)
nsDOMDocumentType::nsDOMDocumentType()
{
/* member initializers and constructor code */
}
nsDOMDocumentType::~nsDOMDocumentType()
{
/* destructor code */
}
/* readonly attribute DOMString name; */
NS_IMETHODIMP nsDOMDocumentType::GetName(nsAString & aName)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMNamedNodeMap entities; */
NS_IMETHODIMP nsDOMDocumentType::GetEntities(nsIDOMNamedNodeMap * *aEntities)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute nsIDOMNamedNodeMap notations; */
NS_IMETHODIMP nsDOMDocumentType::GetNotations(nsIDOMNamedNodeMap * *aNotations)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute DOMString publicId; */
NS_IMETHODIMP nsDOMDocumentType::GetPublicId(nsAString & aPublicId)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute DOMString systemId; */
NS_IMETHODIMP nsDOMDocumentType::GetSystemId(nsAString & aSystemId)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute DOMString internalSubset; */
NS_IMETHODIMP nsDOMDocumentType::GetInternalSubset(nsAString & aInternalSubset)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMDocumentType_h__ */
| [
"simon.m.stewart@07704840-8298-11de-bf8c-fd130f914ac9"
]
| [
[
[
1,
162
]
]
]
|
f7ec7e64173be3d4b51146845e52d11cd40473ae | 927e18c69355c4bf87b59dffefe59c2974e86354 | /super-go-proj/SgBoardColor.h | 75ec941141f02b073fc697bd1465daaf0d833221 | []
| no_license | lqhl/iao-gim-ca | 6fc40adc91a615fa13b72e5b4016a8b154196b8f | f177268804d1ba6edfd407fa44a113a44203ec30 | refs/heads/master | 2020-05-18T17:07:17.972573 | 2011-06-17T03:54:51 | 2011-06-17T03:54:51 | 32,191,309 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,800 | h | //----------------------------------------------------------------------------
/** @file SgBoardColor.h
State of a point on the board for games with Black, White, Empty states. */
//----------------------------------------------------------------------------
#ifndef SG_BOARDCOLOR_H
#define SG_BOARDCOLOR_H
#include <climits>
#include "SgBlackWhite.h"
#include <Poco/Debugger.h>
//----------------------------------------------------------------------------
/** Empty point. */
const int SG_EMPTY = 2;
/** Border point (outside of playing area) */
const int SG_BORDER = 3;
//----------------------------------------------------------------------------
// SgEBWIterator and maybe other code relies on that
poco_static_assert(SG_BLACK == 0);
poco_static_assert(SG_WHITE == 1);
poco_static_assert(SG_EMPTY == 2);
//----------------------------------------------------------------------------
/** SG_BLACK, SG_WHITE, or SG_EMPTY */
typedef int SgEmptyBlackWhite;
/** SG_BLACK, SG_WHITE, SG_EMPTY, or SG_BORDER */
typedef int SgBoardColor;
#define SG_ASSERT_EBW(c) \
poco_assert(c == SG_BLACK || c == SG_WHITE || c == SG_EMPTY)
#define SG_ASSERT_COLOR(c) \
poco_assert(c == SG_BLACK || c == SG_WHITE || c == SG_EMPTY || c == SG_BORDER)
inline bool SgIsEmptyBlackWhite(SgBoardColor c)
{
return c == SG_BLACK || c == SG_WHITE || c == SG_EMPTY;
}
inline SgBoardColor SgOpp(SgBoardColor c)
{
SG_ASSERT_COLOR(c);
return c <= SG_WHITE ? SgOppBW(c) : c;
}
inline char SgEBW(SgEmptyBlackWhite color)
{
SG_ASSERT_EBW(color);
return color == SG_EMPTY ? 'E' : color == SG_BLACK ? 'B' : 'W';
}
//----------------------------------------------------------------------------
/** Iterator over three colors, Empty, Black and White.
Works analogously to SgBWIterator. */
class SgEBWIterator
{
public:
SgEBWIterator()
: m_color(SG_BLACK)
{ }
/** Advance the state of the iteration to the next element.
Relies on current coding: incrementing SG_WHITE will yield value
outside of {SG_EMPTY, SG_BLACK, SG_WHITE} */
void operator++()
{
++m_color;
}
/** Return the value of the current element. */
SgEmptyBlackWhite operator*() const
{
return m_color;
}
/** Return true if iteration is valid, otherwise false. */
operator bool() const
{
return m_color <= SG_EMPTY;
}
private:
SgEmptyBlackWhite m_color;
/** Not implemented */
SgEBWIterator(const SgEBWIterator&);
/** Not implemented */
SgEBWIterator& operator=(const SgEBWIterator&);
};
//----------------------------------------------------------------------------
#endif // SG_SGBOARDCOLOR_H
| [
"[email protected]"
]
| [
[
[
1,
102
]
]
]
|
45f7514443406221add327a841628a752b469f3e | 6426b0ba09cf324c4caad8b86b74f33ef489710e | /src/goVideoPreview.h | 5d08aa6248678b8e7eb5500193a89e8d83df1b6c | []
| no_license | gameoverhack/iMediate | e619a1148ecc3f76f011e2c1a7fa9cdb32c8a290 | 9c43edf26954cbc15fb0145632fa4dbf2634fc29 | refs/heads/master | 2020-04-05T23:05:37.392441 | 2010-10-23T20:10:03 | 2010-10-23T20:10:03 | 1,373,120 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,679 | h | #ifndef __GOVIDEOPREVIEW_H
#define __GOVIDEOPREVIEW_H
#include "ofxMSAInteractiveObject.h"
#include "goThreadedImage.h"
#define IDLE_COLOR 0xFFFFFF
#define OVER_COLOR 0x00FF00
#define DOWN_COLOR 0xFF0000
class goVideoPreview : public ofxMSAInteractiveObject
{
public:
goVideoPreview();
virtual ~goVideoPreview();
goThreadedImage videoIcon;
int index;
ofEvent<int> previewClicked;
void setup()
{
//printf("MyTestObject::setup() - hello!\n");
enableMouseEvents();
//enableKeyEvents();
}
void exit()
{
//printf("MyTestObject::exit() - goodbye!\n");
}
void update()
{
// x = ofGetWidth()/2 + cos(ofGetElapsedTimef() * 0.2) * ofGetWidth()/4;
// y = ofGetHeight()/2 + sin(ofGetElapsedTimef() * 0.2) * ofGetHeight()/4;
}
void draw()
{
//cout << "draw" << endl;
if(isMouseDown()) ofSetColor(DOWN_COLOR);
else if(isMouseOver()) ofSetColor(OVER_COLOR);
else ofSetColor(IDLE_COLOR);
//ofRect(x, y, width, height);
videoIcon.draw(x, y, width, height);
}
virtual void onRollOver(int x, int y)
{
//printf("MyTestObject::onRollOver(x: %i, y: %i)\n", x, y);
}
virtual void onRollOut()
{
//printf("MyTestObject::onRollOut()\n");
}
virtual void onMouseMove(int x, int y)
{
//printf("MyTestObject::onMouseMove(x: %i, y: %i)\n", x, y);
}
virtual void onDragOver(int x, int y, int button)
{
//printf("MyTestObject::onDragOver(x: %i, y: %i, button: %i)\n", x, y, button);
}
virtual void onDragOutside(int x, int y, int button)
{
//printf("MyTestObject::onDragOutside(x: %i, y: %i, button: %i)\n", x, y, button);
}
virtual void onPress(int x, int y, int button)
{
ofNotifyEvent(previewClicked, index);
//GROUPS[myID].playVideoInGroup(index);
}
virtual void onRelease(int x, int y, int button)
{
//printf("MyTestObject::onRelease(x: %i, y: %i, button: %i)\n", x, y, button);
}
virtual void onReleaseOutside(int x, int y, int button)
{
//printf("MyTestObject::onReleaseOutside(x: %i, y: %i, button: %i)\n", x, y, button);
}
virtual void keyPressed(int key)
{
//printf("MyTestObject::keyPressed(key: %i)\n", key);
}
virtual void keyReleased(int key)
{
//printf("MyTestObject::keyReleased(key: %i)\n", key);
}
protected:
private:
};
#endif // __GOVIDEOPREVIEW_H
| [
"gameover@4bdaed08-0356-49c7-8fa1-902f09de843b"
]
| [
[
[
1,
106
]
]
]
|
7b6aaf11d64e2b9426f69b28e58f67d029cf62b0 | e587b7fd4e2762dddf7161019bbd6a84b848f8c1 | /2007/game/client/multiplayer/basenetworkedplayer_cl.cpp | d2d5e6472983ad574c713053769e42992e58c415 | [
"Apache-2.0"
]
| permissive | code-google-com/sourcesdk-skeleton | 6bf0791c7fb2c7c17125b11f8172dc1ea03b35d0 | 016933bfc10331e293dd752750108d7ae76fabb3 | refs/heads/master | 2021-01-20T08:43:50.735666 | 2011-08-27T18:14:25 | 2011-08-27T18:14:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,767 | cpp | #include "cbase.h"
#include "basenetworkedplayer_cl.h"
#include "prediction.h"
#undef CBaseNetworkedPlayer
// ***************** C_TEPlayerAnimEvent **********************
IMPLEMENT_CLIENTCLASS_EVENT( C_TEPlayerAnimEvent, DT_TEPlayerAnimEvent, CTEPlayerAnimEvent );
BEGIN_RECV_TABLE_NOBASE( C_TEPlayerAnimEvent, DT_TEPlayerAnimEvent )
RecvPropEHandle( RECVINFO( m_hPlayer ) ),
RecvPropInt( RECVINFO( m_iEvent ) ),
RecvPropInt( RECVINFO( m_nData ) )
END_RECV_TABLE()
void C_TEPlayerAnimEvent::PostDataUpdate( DataUpdateType_t updateType )
{
C_BaseNetworkedPlayer *pPlayer = (C_BaseNetworkedPlayer*)m_hPlayer.Get();
if ( pPlayer && !pPlayer->IsDormant() )
pPlayer->DoAnimationEvent( (PlayerAnimEvent_t)m_iEvent.Get(), m_nData );
}
// ***************** C_BaseNetworkedPlayer **********************
BEGIN_RECV_TABLE_NOBASE( C_BaseNetworkedPlayer, DT_BaseNetworkedPlayerExclusive )
RecvPropVector( RECVINFO_NAME( m_vecNetworkOrigin, m_vecOrigin ) ), // RECVINFO_NAME copies the networked value over to the 'real' one
RecvPropFloat( RECVINFO( m_angEyeAngles[0] ) ),
END_RECV_TABLE()
BEGIN_RECV_TABLE_NOBASE( C_BaseNetworkedPlayer, DT_BaseNetworkedPlayerNonLocalExclusive )
RecvPropVector( RECVINFO_NAME( m_vecNetworkOrigin, m_vecOrigin ) ), // RECVINFO_NAME again
RecvPropFloat( RECVINFO( m_angEyeAngles[0] ) ),
RecvPropFloat( RECVINFO( m_angEyeAngles[1] ) ),
END_RECV_TABLE()
IMPLEMENT_CLIENTCLASS_DT(C_BaseNetworkedPlayer, DT_BaseNetworkedPlayer, CBaseNetworkedPlayer )
RecvPropBool( RECVINFO( m_bSpawnInterpCounter ) ),
RecvPropEHandle( RECVINFO( m_hRagdoll ) ),
RecvPropDataTable( "netplayer_localdata", 0, 0, &REFERENCE_RECV_TABLE(DT_BaseNetworkedPlayerExclusive) ),
RecvPropDataTable( "netplayer_nonlocaldata", 0, 0, &REFERENCE_RECV_TABLE(DT_BaseNetworkedPlayerNonLocalExclusive) ),
END_NETWORK_TABLE()
BEGIN_PREDICTION_DATA( C_BaseNetworkedPlayer )
DEFINE_PRED_FIELD( m_flCycle, FIELD_FLOAT, FTYPEDESC_OVERRIDE | FTYPEDESC_PRIVATE | FTYPEDESC_NOERRORCHECK ),
DEFINE_PRED_FIELD( m_nSequence, FIELD_INTEGER, FTYPEDESC_OVERRIDE | FTYPEDESC_PRIVATE | FTYPEDESC_NOERRORCHECK ),
DEFINE_PRED_FIELD( m_flPlaybackRate, FIELD_FLOAT, FTYPEDESC_OVERRIDE | FTYPEDESC_PRIVATE | FTYPEDESC_NOERRORCHECK ),
DEFINE_PRED_ARRAY_TOL( m_flEncodedController, FIELD_FLOAT, MAXSTUDIOBONECTRLS, FTYPEDESC_OVERRIDE | FTYPEDESC_PRIVATE, 0.02f ),
DEFINE_PRED_FIELD( m_nNewSequenceParity, FIELD_INTEGER, FTYPEDESC_OVERRIDE | FTYPEDESC_PRIVATE | FTYPEDESC_NOERRORCHECK ),
END_PREDICTION_DATA()
C_BaseNetworkedPlayer::C_BaseNetworkedPlayer() : m_iv_angEyeAngles( "C_BaseNetworkedPlayer::m_iv_angEyeAngles" )
{
m_angEyeAngles.Init();
AddVar( &m_angEyeAngles, &m_iv_angEyeAngles, LATCH_SIMULATION_VAR );
m_bSpawnInterpCounterCache,m_bSpawnInterpCounter = false;
SetPredictionEligible(true);
};
const QAngle& C_BaseNetworkedPlayer::EyeAngles()
{
if( IsLocalPlayer() )
return BaseClass::EyeAngles();
else
return m_angEyeAngles;
}
const QAngle& C_BaseNetworkedPlayer::GetRenderAngles()
{
if ( IsRagdoll() )
return vec3_angle;
else
return m_PlayerAnimState->GetRenderAngles();
}
void C_BaseNetworkedPlayer::DoAnimationEvent( PlayerAnimEvent_t event, int nData )
{
if ( IsLocalPlayer() && prediction->InPrediction() && !prediction->IsFirstTimePredicted() )
return;
MDLCACHE_CRITICAL_SECTION();
m_PlayerAnimState->DoAnimationEvent( event, nData );
}
void C_BaseNetworkedPlayer::UpdateClientSideAnimation()
{
// Keep the model upright; pose params will handle pitch aiming.
QAngle angles = GetLocalAngles();
angles[PITCH] = 0;
SetLocalAngles( angles );
m_PlayerAnimState->Update( EyeAngles()[YAW], EyeAngles()[PITCH] );
BaseClass::UpdateClientSideAnimation();
}
void C_BaseNetworkedPlayer::PostDataUpdate( DataUpdateType_t updateType )
{
// C_BaseEntity assumes we're networking the entity's angles, so pretend that it
// networked the same value we already have.
SetNetworkAngles( GetLocalAngles() );
// respawn test (can't use a recvproxy with a bool value?!?)
if ( m_bSpawnInterpCounter != m_bSpawnInterpCounterCache )
Respawn();
BaseClass::PostDataUpdate( updateType );
}
#include "view_scene.h" // for tone mapping reset
void C_BaseNetworkedPlayer::Respawn()
{
// fix up interp
MoveToLastReceivedPosition( true );
ResetLatched();
m_bSpawnInterpCounterCache = m_bSpawnInterpCounter;
// reset HDR
if ( IsLocalPlayer() )
ResetToneMapping(1.0);
}
IRagdoll* C_BaseNetworkedPlayer::GetRepresentativeRagdoll() const
{
if ( m_hRagdoll.Get() )
{
C_BaseNetworkedRagdoll *pRagdoll = (C_BaseNetworkedRagdoll*)m_hRagdoll.Get();
return pRagdoll->GetIRagdoll();
}
else
return NULL;
} | [
"[email protected]@6febd7a2-65a9-c2d8-fb53-b51429dd0aeb"
]
| [
[
[
1,
134
]
]
]
|
99665a90f19d8cccdce22e0461cd94cdcbe7b19b | 58ef4939342d5253f6fcb372c56513055d589eb8 | /CloverDemo/source/control/inc/ListBoxHighLightControl.h | d8b68e4d47b265388f49923c54f7dd6cf4064f69 | []
| no_license | flaithbheartaigh/lemonplayer | 2d77869e4cf787acb0aef51341dc784b3cf626ba | ea22bc8679d4431460f714cd3476a32927c7080e | refs/heads/master | 2021-01-10T11:29:49.953139 | 2011-04-25T03:15:18 | 2011-04-25T03:15:18 | 50,263,327 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,393 | h | /*
============================================================================
Name : ListBoxHighLightControl.h
Author : zengcity
Version : 1.0
Copyright : Your copyright notice
Description : CListBoxHighLightControl declaration
============================================================================
*/
#ifndef LISTBOXHIGHLIGHTCONTROL_H
#define LISTBOXHIGHLIGHTCONTROL_H
// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include "BaseControl.h"
#include "ListBoxPainter.h"
// CLASS DECLARATION
/**
* CListBoxHighLightControl
*
*/
class CListBoxHighLightControl : public CBaseControl
{
public:
// Constructors and destructor
/**
* Destructor.
*/
~CListBoxHighLightControl();
/**
* Two-phased constructor.
*/
static CListBoxHighLightControl* NewL();
/**
* Two-phased constructor.
*/
static CListBoxHighLightControl* NewLC();
private:
/**
* Constructor for performing 1st stage construction
*/
CListBoxHighLightControl();
/**
* EPOC default constructor for performing 2nd stage construction
*/
void ConstructL();
public:
//from base
virtual void Draw(CBitmapContext& gc) const;
//new func
void SetPainter(CListBoxPainter* aPainter) {iPainter = aPainter;};
private:
CListBoxPainter* iPainter; //not own
};
#endif // LISTBOXHIGHLIGHTCONTROL_H
| [
"zengcity@415e30b0-1e86-11de-9c9a-2d325a3e6494"
]
| [
[
[
1,
69
]
]
]
|
170103f2d16524724283d8e9c8da6f2c763a95b8 | 208475bcab65438eed5d8380f26eacd25eb58f70 | /Monitor/Dog.h | 783890d8f0ca6f9b1be19a4bfa20fd934fc4b7f2 | []
| no_license | awzhang/MyWork | 83b3f0b9df5ff37330c0e976310d75593f806ec4 | 075ad5d0726c793a0c08f9158080a144e0bb5ea5 | refs/heads/master | 2021-01-18T07:57:03.219372 | 2011-07-05T02:41:55 | 2011-07-05T02:46:30 | 15,523,223 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 625 | h | #ifndef _DOG_H_
#define _DOG_H_
union semun {
int val; /* Value for SETVAL */
struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */
unsigned short *array; /* Array for GETALL, SETALL */
struct seminfo *__buf; /* Buffer for IPC_INFO (Linux specific) */
};
extern DWORD DOG_RSTVAL;
class CDog
{
public:
CDog();
virtual ~CDog();
public:
//void DogClr( DWORD v_dwSymb );
DWORD DogQuery();
void DogInit();
private:
int _SemCreate();
int _SemV();
int _SemP();
int _ShmCreate();
private:
int m_iSemID;
int m_iShmID;
char* m_pShareMem;
};
#endif
| [
"[email protected]"
]
| [
[
[
1,
36
]
]
]
|
c3f0c7bcb69e4343339dd6e967da9bd35bf67b98 | 2b32433353652d705e5558e7c2d5de8b9fbf8fc3 | /Dm_new_idz/Mlita/GraphCtrl/GraphCtrlPpg.cpp | 9d62d9c63401b069637e9e06a9f3ffa8fa5332c8 | []
| no_license | smarthaert/d-edit | 70865143db2946dd29a4ff52cb36e85d18965be3 | 41d069236748c6e77a5a457280846a300d38e080 | refs/heads/master | 2020-04-23T12:21:51.180517 | 2011-01-30T00:37:18 | 2011-01-30T00:37:18 | 35,532,200 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,450 | cpp | // GraphCtrlPpg.cpp : Implementation of the CGraphCtrlPropPage property page class.
#include "stdafx.h"
#include "GraphCtrl.h"
#include "GraphCtrlPpg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNCREATE(CGraphCtrlPropPage, COlePropertyPage)
/////////////////////////////////////////////////////////////////////////////
// Message map
BEGIN_MESSAGE_MAP(CGraphCtrlPropPage, COlePropertyPage)
//{{AFX_MSG_MAP(CGraphCtrlPropPage)
// NOTE - ClassWizard will add and remove message map entries
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// Initialize class factory and guid
IMPLEMENT_OLECREATE_EX(CGraphCtrlPropPage, "GRAPHCTRL.GraphCtrlPropPage.1",
0xa7d216c7, 0x4f58, 0x4609, 0xac, 0xfd, 0xa7, 0x7e, 0x5, 0xe4, 0x52, 0xc5)
/////////////////////////////////////////////////////////////////////////////
// CGraphCtrlPropPage::CGraphCtrlPropPageFactory::UpdateRegistry -
// Adds or removes system registry entries for CGraphCtrlPropPage
BOOL CGraphCtrlPropPage::CGraphCtrlPropPageFactory::UpdateRegistry(BOOL bRegister)
{
if (bRegister)
return AfxOleRegisterPropertyPageClass(AfxGetInstanceHandle(),
m_clsid, IDS_GRAPHCTRL_PPG);
else
return AfxOleUnregisterClass(m_clsid, NULL);
}
/////////////////////////////////////////////////////////////////////////////
// CGraphCtrlPropPage::CGraphCtrlPropPage - Constructor
CGraphCtrlPropPage::CGraphCtrlPropPage() :
COlePropertyPage(IDD, IDS_GRAPHCTRL_PPG_CAPTION)
{
//{{AFX_DATA_INIT(CGraphCtrlPropPage)
// NOTE: ClassWizard will add member initialization here
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_DATA_INIT
}
/////////////////////////////////////////////////////////////////////////////
// CGraphCtrlPropPage::DoDataExchange - Moves data between page and properties
void CGraphCtrlPropPage::DoDataExchange(CDataExchange* pDX)
{
//{{AFX_DATA_MAP(CGraphCtrlPropPage)
// NOTE: ClassWizard will add DDP, DDX, and DDV calls here
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_DATA_MAP
DDP_PostProcessing(pDX);
}
/////////////////////////////////////////////////////////////////////////////
// CGraphCtrlPropPage message handlers
| [
"[email protected]"
]
| [
[
[
1,
76
]
]
]
|
fa72726193418511867b7c7afcd3272df4cd1ce9 | 741b36f4ddf392c4459d777930bc55b966c2111a | /incubator/deeppurple/lwplugins/lwwrapper/Panel/ControlMultiListBox.cpp | 583a6477ef75eaaac62e5bd4599981d3b99c34af | []
| no_license | BackupTheBerlios/lwpp-svn | d2e905641f60a7c9ca296d29169c70762f5a9281 | fd6f80cbba14209d4ca639f291b1a28a0ed5404d | refs/heads/master | 2021-01-17T17:01:31.802187 | 2005-10-16T22:12:52 | 2005-10-16T22:12:52 | 40,805,554 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,691 | cpp | // ControlMultiListBox.cpp: implementation of the ControlMultiListBox class.
//
//////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "ControlMultiListBox.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ControlMultiListBox::ControlMultiListBox() :
NumRows(5),
Width(200)
{
}
ControlMultiListBox::~ControlMultiListBox()
{
}
bool ControlMultiListBox::RegisterWithPanel(LWPanelID pan)
{
LWPanControlDesc desc;
desc.type=LWT_MLIST;
desc.multiList.width=Width;
desc.multiList.nameFn=Name_Callback;
desc.multiList.countFn=Count_Callback;
desc.multiList.colWidth=Colwidth_Callback;
desc.multiList.visItems=NumRows;
ThisControl=Lightwave3D::panf->addControl (pan, "MultiListBoxControl", &desc, const_cast<char *>(Name.c_str()));
LWValue LocVal= { LWT_INTEGER };
LocVal.ptr.ptr=this;
ThisControl->set(ThisControl,CTL_USERDATA,&LocVal);
return true;
}
void ControlMultiListBox::Initialize(const char *name, Panel *SetOwner, int width, int numrows)
{
Width=width;
NumRows=numrows;
Control::Initialize(name,SetOwner);
}
int ControlMultiListBox::SetCount()
{
return 2;
}
char *debugStr3[]={"one","two"};
const char *ControlMultiListBox::SetName( int index, int column )
{
if (index==-1)
return debugStr3[0];
if (index==0)
return debugStr3[0];
if (index==1)
return debugStr3[1];
return NULL;
}
int ControlMultiListBox::SetColwidth( int index )
{
if (index<2)
return Width/2;
else
return 0;
}
////////////////////////////////////////////////////////////
// Callbacks
int ControlMultiListBox::Count_Callback( void *userdata )
{
if (userdata==NULL)
return 0;
else
{
ControlMultiListBox *theControl=static_cast<ControlMultiListBox *>(userdata);
return theControl->SetCount();
}
return 0;
}
const char *ControlMultiListBox::Name_Callback( void *userdata, int index, int column)
{
if (userdata==NULL)
return 0;
else
{
ControlMultiListBox *theControl=static_cast<ControlMultiListBox *>(userdata);
return theControl->SetName(index, column);
}
return 0;
}
int ControlMultiListBox::Colwidth_Callback( void *userdata, int index )
{
if (userdata==NULL)
return 0;
else
{
ControlMultiListBox *theControl=static_cast<ControlMultiListBox *>(userdata);
return theControl->SetColwidth(index);
}
return 20;
} | [
"deeppurple@dac1304f-7ce9-0310-a59f-f2d444f72a61"
]
| [
[
[
1,
118
]
]
]
|
7dd608022165e6ddbae36c9170717c35566a30ce | 0f8559dad8e89d112362f9770a4551149d4e738f | /Wall_Destruction/Havok/Source/Physics/Collide/Agent/hkpCollisionAgent.inl | 4060511e0e9eeaed36428bdfb4fe58f22e6c9967 | []
| no_license | TheProjecter/olafurabertaymsc | 9360ad4c988d921e55b8cef9b8dcf1959e92d814 | 456d4d87699342c5459534a7992f04669e75d2e1 | refs/heads/master | 2021-01-10T15:15:49.289873 | 2010-09-20T12:58:48 | 2010-09-20T12:58:48 | 45,933,002 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,629 | inl | /*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#define HK_MISSING_CONTACT_MANAGER_ERROR_TEXT "No contact manager defined: You probably called processCollision on an Agent which is created without a valid hkpContactMgr (e.g. like hkpShapePhantom)"
inline hkpCollisionAgent::~hkpCollisionAgent()
{
}
inline hkpCollisionAgent::hkpCollisionAgent( hkpContactMgr* contactMgr )
{
m_contactMgr = contactMgr;
}
inline hkpContactMgr* hkpCollisionAgent::getContactMgr()
{
return m_contactMgr;
}
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20091222)
*
* Confidential Information of Havok. (C) Copyright 1999-2009
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at www.havok.com/tryhavok.
*
*/
| [
"[email protected]"
]
| [
[
[
1,
38
]
]
]
|
91c8478dac7e0bb996ac6984763aed76ea1a21ef | 0b10bd863f21af585581f46b97fde3ef8489fa56 | /RippleLibrary/ConfigData.h | 1cc3adddf9a931d1754edf725282d97d4b4a2277 | [
"Apache-2.0"
]
| permissive | hemant19cse/Ripple-Framework | 47d78c3de2dd30dae806842d9d6edc9775cba659 | c3126aa0669068f5ee102b65231fdaebdcdfa9ff | refs/heads/master | 2020-12-25T09:37:43.539293 | 2011-12-19T20:49:41 | 2011-12-19T20:49:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,107 | h | /*
* Copyright 2010-2011 Research In Motion Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <QSettings>
class ConfigData
{
public:
static ConfigData* getInstance();
~ConfigData(void);
void writeSettings();
QString toolingContent();
void toolingContent(QString content);
QSize windowSize();
void windowSize(QSize size);
QPoint windowPosition();
void windowPosition(QPoint position);
unsigned int windowState();
void windowState(unsigned int state);
QString localStoragePath();
void localStoragePath(QString path);
QString buildServiceCommand();
void buildServiceCommmand(QString cmd);
unsigned short buildServicePort();
void buildServicePort(unsigned short port);
unsigned int hardwareAccelerationEnabled();
void hardwareAccelerationEnabled(unsigned int hwEnabled);
unsigned int webGLEnabled();
void webGLEnabled(unsigned int glEnabled);
private:
ConfigData(void);
void readSettings();
static const QString CONFIGURATION_FILE_NAME;
static const QString APPLICATION_NAME_IN_SETTINGS;
static const QString TOOLING_CONTENT_NAME_IN_SETTINGS;
static const QString TOOLING_CONTENT_DEFAULT;
static const QString MAIN_WINDOW_SIZE_NAME_IN_SETTINGS;
static const QString LOCAL_STORAGE_PATH_IN_SETTINGS;
static const QSize MAIN_WINDOW_SIZE_DEFAULT;
static const QString MAIN_WINDOW_POSITION_NAME_IN_SETTINGS;
static const QString MAIN_WINDOW_STATE_NAME_IN_SETTINGS;
static const QPoint MAIN_WINDOW_POSITION_DEFAULT;
static const unsigned int MAIN_WINDOW_STATE_DEFAULT;
static const QString LOCAL_STORAGE_PATH_DEFAULT;
static const QString BUILD_SERVICE_COMMAND_IN_SETTINGS;
static const QString BUILD_SERVICE_COMMAND_DEFAULT;
static const QString BUILD_SERVICE_PORT_IN_SETTINGS;
static const QString BUILD_SERVICE_PORT_DEFAULT;
static const QString HARDWARE_ACCELERATION_IN_SETTINGS;
static const unsigned int HARDWARE_ACCELERATION_DEFAULT;
static const QString WEBGL_ENABLED_IN_SETTINGS;
static const unsigned int WEBGL_ENABLED_DEFAULT;
static ConfigData* _instance;
static bool _instanceFlag;
QSettings *_settings;
QString _toolingContent;
QSize _mainWindowSize;
QPoint _mainWindowPosition;
unsigned int _mainWindowState;
QString _localStoragePath;
QString _applicationStoragePath;
QString _buildServiceCommand;
QString _buildServicePort;
unsigned int _hardwareAccelerationEnabled;
unsigned int _webGLEnabled;
};
| [
"[email protected]",
"[email protected]",
"[email protected]"
]
| [
[
[
1,
38
],
[
42,
44
],
[
57,
58
],
[
60,
61
],
[
63,
69
],
[
71,
71
],
[
73,
73
],
[
82,
84
],
[
87,
88
],
[
91,
91
],
[
97,
97
]
],
[
[
39,
41
],
[
45,
56
],
[
59,
59
],
[
70,
70
],
[
72,
72
],
[
74,
81
],
[
89,
90
],
[
92,
96
]
],
[
[
62,
62
],
[
85,
86
]
]
]
|
89bd53ad64ffb0e4c4f6ef84894803cf4924f7e9 | 8a3fce9fb893696b8e408703b62fa452feec65c5 | /业余时间学习笔记/MemPool/MemPool/Pool/List.h | f73a39b934f87a6423fad2b955fa25fd66f7712c | []
| no_license | win18216001/tpgame | bb4e8b1a2f19b92ecce14a7477ce30a470faecda | d877dd51a924f1d628959c5ab638c34a671b39b2 | refs/heads/master | 2021-04-12T04:51:47.882699 | 2011-03-08T10:04:55 | 2011-03-08T10:04:55 | 42,728,291 | 0 | 2 | null | null | null | null | GB18030 | C++ | false | false | 2,855 | h | /**
* file list.h
* brief 封装一个双向链表
* author Expter
*
* date 2010/01/1
*/
#pragma once
template < class T>
class TlinkedList
{
public:
/// Constructor
TlinkedList(){ m_Head = m_Tail = NULL ; m_Size = 0; };
/// Destructor
~TlinkedList(){};
/// the operation of linked list
public:
T* GetHead() { return m_Head; }
T* GetTail() { return m_Tail; }
T* GetNext(T* Node) { return Node->next;}
T* GetPrev(T* Node) { return Node->prev;}
long GetSize() { return m_Size; }
/// about list add,insert,remove function
/// AddListToTail
void PushNode(T* Node)
{
Node->next = Node->prev = NULL;
if ( this->m_Head == NULL )
{
this->m_Head = Node;
this->m_Tail = Node;
this->m_Size = 1;
}
else
{
this->m_Tail->next = Node;
Node->prev = this->m_Tail;
this->m_Tail= Node;
this->m_Size ++;
}
}
/// Add Node to list Head
void PushNodeToHead(T* Node)
{
Node->next = Node->prev = NULL;
if ( this->m_Head == NULL )
{
this->m_Head = Node;
this->m_Tail = Node;
this->m_Size = 1;
}
else
{
this->m_Head->prev = Node;
Node->next = this->m_Head;
this->m_Head = Node;
this->m_Size++;
}
}
/// insert Insert_Node in Find_Node end
void InsertNode(T* Find_Node,T* Insert_Node)
{
Insert_Node->next = Insert_Node->prev = NULL;
if(Find_Node->next != NULL)
{
T temp;
temp.next = Find_Node->next;
Find_Node->next = Insert_Node;
Insert_Node->next = temp.next;
Insert_Node->prev = Find_Node;
temp.next->prev = Insert_Node;
}
else
{
Insert_Node->prev = Find_Node;
Find_Node->next = Insert_Node;
this->m_Tail = Insert_Node;
}
this->m_Size++;
}
void RemoveNode( T* DelNode)
{
if ( DelNode->prev == NULL )
{
if ( DelNode->next != NULL )
{
this->m_Head = DelNode->next;
this->m_Head->prev = NULL;
this->m_Size -- ;
}
else
{
this->m_Head = this->m_Tail = NULL;
this->m_Size = 0;
}
}
else
{
if ( DelNode->next != NULL )
{
DelNode->prev->next = DelNode->next;
DelNode->next->prev = DelNode->prev;
this->m_Size -- ;
}
else
{
m_Tail = DelNode->prev;
m_Tail->next = NULL;
this->m_Size -- ;
}
}
DelNode->prev = DelNode->next = NULL;
}
void ReleaseList()
{
if ( this->m_Head )
{
T* temp1 = this->m_Head;
T* temp2 = NULL;
while ( temp1 != NULL )
{
temp2 = temp1->next;
RemoveNode( temp1 );
temp1 = temp2;
}
}
}
T* PopNode()
{
T* head = GetHead();
if( head != NULL )
{
RemoveNode(head);
}
return head;
}
private:
long m_Size;
T* m_Head;
T* m_Tail;
};
| [
"[email protected]"
]
| [
[
[
1,
170
]
]
]
|
b6e356378a4eccaf2f0c87c01b1b0d4b055e00f3 | d425cf21f2066a0cce2d6e804bf3efbf6dd00c00 | /Utils/_RussianText.cpp | cf207579b2fc7453ee3e77dbaf47f51ff06b36da | []
| no_license | infernuslord/ja2 | d5ac783931044e9b9311fc61629eb671f376d064 | 91f88d470e48e60ebfdb584c23cc9814f620ccee | refs/heads/master | 2021-01-02T23:07:58.941216 | 2011-10-18T09:22:53 | 2011-10-18T09:22:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 316,280 | cpp | // WANNE: Yes, this should be disabled, otherwise we get weird behavior when running the game with a VS 2005 build!
//#pragma setlocale("RUSSIAN")
#ifdef PRECOMPILEDHEADERS
#include "Utils All.h"
#else
#include "Language Defines.h"
#if defined( RUSSIAN )
#include "text.h"
#include "Fileman.h"
#include "Scheduling.h"
#include "EditorMercs.h"
#include "Item Statistics.h"
#include "Encyclopedia.h"
#endif
#endif
//suppress : warning LNK4221: no public symbols found; archive member will be inaccessible
void this_is_the_RussianText_public_symbol(void){;}
#ifdef RUSSIAN
/*
******************************************************************************************************
** IMPORTANT TRANSLATION NOTES **
******************************************************************************************************
GENERAL INSTRUCTIONS
- Always be aware that foreign strings should be of equal or shorter length than the English equivalent.
I know that this is difficult to do on many occasions due to the nature of foreign languages when
compared to English. By doing so, this will greatly reduce the amount of work on both sides. In
most cases (but not all), JA2 interfaces were designed with just enough space to fit the English word.
The general rule is if the string is very short (less than 10 characters), then it's short because of
interface limitations. On the other hand, full sentences commonly have little limitations for length.
Strings in between are a little dicey.
- Never translate a string to appear on multiple lines. All strings L"This is a really long string...",
must fit on a single line no matter how long the string is. All strings start with L" and end with ",
- Never remove any extra spaces in strings. In addition, all strings containing multiple sentences only
have one space after a period, which is different than standard typing convention. Never modify sections
of strings contain combinations of % characters. These are special format characters and are always
used in conjunction with other characters. For example, %s means string, and is commonly used for names,
locations, items, etc. %d is used for numbers. %c%d is a character and a number (such as A9).
%% is how a single % character is built. There are countless types, but strings containing these
special characters are usually commented to explain what they mean. If it isn't commented, then
if you can't figure out the context, then feel free to ask SirTech.
- Comments are always started with // Anything following these two characters on the same line are
considered to be comments. Do not translate comments. Comments are always applied to the following
string(s) on the next line(s), unless the comment is on the same line as a string.
- All new comments made by SirTech will use "//@@@ comment" (without the quotes) notation. By searching
for @@@ everytime you recieve a new version, it will simplify your task and identify special instructions.
Commonly, these types of comments will be used to ask you to abbreviate a string. Please leave the
comments intact, and SirTech will remove them once the translation for that particular area is resolved.
- If you have a problem or question with translating certain strings, please use "//!!! comment"
(without the quotes). The syntax is important, and should be identical to the comments used with @@@
symbols. SirTech will search for !!! to look for your problems and questions. This is a more
efficient method than detailing questions in email, so try to do this whenever possible.
FAST HELP TEXT -- Explains how the syntax of fast help text works.
**************
1) BOLDED LETTERS
The popup help text system supports special characters to specify the hot key(s) for a button.
Anytime you see a '|' symbol within the help text string, that means the following key is assigned
to activate the action which is usually a button.
EX: L"|Map Screen"
This means the 'M' is the hotkey. In the game, when somebody hits the 'M' key, it activates that
button. When translating the text to another language, it is best to attempt to choose a word that
uses 'M'. If you can't always find a match, then the best thing to do is append the 'M' at the end
of the string in this format:
EX: L"Ecran De Carte (|M)" (this is the French translation)
Other examples are used multiple times, like the Esc key or "|E|s|c" or Space -> (|S|p|a|c|e)
2) NEWLINE
Any place you see a \n within the string, you are looking at another string that is part of the fast help
text system. \n notation doesn't need to be precisely placed within that string, but whereever you wish
to start a new line.
EX: L"Clears all the mercs' positions,\nand allows you to re-enter them manually."
Would appear as:
Clears all the mercs' positions,
and allows you to re-enter them manually.
NOTE: It is important that you don't pad the characters adjacent to the \n with spaces. If we did this
in the above example, we would see
WRONG WAY -- spaces before and after the \n
EX: L"Clears all the mercs' positions, \n and allows you to re-enter them manually."
Would appear as: (the second line is moved in a character)
Clears all the mercs' positions,
and allows you to re-enter them manually.
@@@ NOTATION
************
Throughout the text files, you'll find an assortment of comments. Comments are used to describe the
text to make translation easier, but comments don't need to be translated. A good thing is to search for
"@@@" after receiving new version of the text file, and address the special notes in this manner.
!!! NOTATION
************
As described above, the "!!!" notation should be used by you to ask questions and address problems as
SirTech uses the "@@@" notation.
*/
CHAR16 XMLTacticalMessages[1000][MAX_MESSAGE_NAMES_CHARS] =
{
L"",
};
//Encyclopedia
STR16 pMenuStrings[] =
{
//Encyclopedia
L"Locations", // 0
L"Characters",
L"Items",
L"Quests",
L"Menu 5",
L"Menu 6", //5
L"Menu 7",
L"Menu 8",
L"Menu 9",
L"Menu 10",
L"Menu 11", //10
L"Menu 12",
L"Menu 13",
L"Menu 14",
L"Menu 15",
L"Menu 15", // 15
//Briefing Room
L"Exit",
};
STR16 pOtherButtonsText[] =
{
L"Briefing",
L"Accept",
};
STR16 pOtherButtonsHelpText[] =
{
L"Briefing",
L"Accept missions",
};
STR16 pLocationPageText[] =
{
L"Prev page",
L"Photo",
L"Next page",
};
STR16 pSectorPageText[] =
{
L"<<",
L"Main page",
L">>",
L"Type: ",
L"Empty data",
L"Missing of defined missions. Add missions to the file TableData\\BriefingRoom\\BriefingRoom.xml. First mission has to be visible. Put value Hidden = 0.",
};
STR16 pEncyclopediaTypeText[] =
{
L"Unknown",// 0 - unknown
L"City", //1 - cities
L"SAM Site", //2 - SAM Site
L"Other location", //3 - other location
L"Mines", //4 - mines
L"Military complex", //5 - military complex
L"Laboratory complex", //6 - laboratory complex
L"Factory complex", //7 - factory complex
L"Hospital", //8 - hospital
L"Prison", //9 - prison
L"Airport", //10 - air port
};
STR16 pEncyclopediaHelpCharacterText[] =
{
L"Show all",
L"Show AIM",
L"Show MERC",
L"Show RPC",
L"Show NPC",
L"Show Pojazd",
L"Show IMP",
L"Show EPC",
L"Filter",
};
STR16 pEncyclopediaShortCharacterText[] =
{
L"All",
L"AIM",
L"MERC",
L"RPC",
L"NPC",
L"Veh.",
L"IMP",
L"EPC",
L"Filter",
};
STR16 pEncyclopediaHelpText[] =
{
L"Show all",
L"Show cities",
L"Show SAM Sites",
L"Show other location",
L"Show mines",
L"Show military complex",
L"Show laboratory complex",
L"Show Factory complex",
L"Show hospital",
L"Show prison",
L"Show air port",
};
STR16 pEncyclopediaSkrotyText[] =
{
L"All",
L"City",
L"SAM",
L"Other",
L"Mine",
L"Mil.",
L"Lab.",
L"Fact.",
L"Hosp.",
L"Prison",
L"Air.",
};
STR16 pEncyclopediaShortInventoryText[] =
{
L"All", //0
L"Gun",
L"Ammo",
L"LBE",
L"Misc",
L"All", //5
L"Gun",
L"Ammo",
L"LBE Gear",
L"Misc",
};
STR16 BoxFilter[] =
{
// Guns
L"Heavy",
L"Pistol",
L"M. Pist.",
L"SMG",
L"Rifle",
L"S. Rifle",
L"A. Rifle",
L"MG",
L"Shotgun",
// Ammo
L"Pistol",
L"M. Pist.", //10
L"SMG",
L"Rifle",
L"S. Rifle",
L"A. Rifle",
L"MG",
L"Shotgun",
// Used
L"Guns",
L"Armor",
L"LBE Gear",
L"Misc", //20
// Armour
L"Helmets",
L"Vests",
L"Leggings",
L"Plates",
// Misc
L"Blades",
L"Th. Knife",
L"Melee",
L"Grenades",
L"Bombs",
L"Med.", //30
L"Kits",
L"Face",
L"LBE",
L"Misc.", //34
};
//-----------
// Editor
//Editor Taskbar Creation.cpp
STR16 iEditorItemStatsButtonsText[] =
{
L"Delete",
};
STR16 FaceDirs[8] =
{
L"north",
L"northeast",
L"east",
L"southeast",
L"south",
L"southwest",
L"west",
L"northwest"
};
STR16 iEditorMercsToolbarText[] =
{
L"Toggle viewing of players", //0
L"Toggle viewing of enemies",
L"Toggle viewing of creatures",
L"Toggle viewing of rebels",
L"Toggle viewing of civilians",
L"Player",
L"Enemy",
L"Creature",
L"Rebels",
L"Civilian",
L"DETAILED PLACEMENT", //10
L"General information mode",
L"Physical appearance mode",
L"Attributes mode",
L"Inventory mode",
L"Profile ID mode",
L"Schedule mode",
L"Schedule mode",
L"DELETE",
L"Delete currently selected merc (DEL).",
L"NEXT", //20
L"Find next merc (SPACE).",
L"Toggle priority existance",
L"Toggle whether or not placement has/naccess to all doors.",
//Orders
L"STATIONARY",
L"ON GUARD",
L"ON CALL",
L"SEEK ENEMY",
L"CLOSE PATROL",
L"FAR PATROL",
L"POINT PATROL", //30
L"RND PT PATROL",
//Attitudes
L"DEFENSIVE",
L"BRAVE SOLO",
L"BRAVE AID",
L"AGGRESSIVE",
L"CUNNING SOLO",
L"CUNNING AID",
L"Set merc to face %s",
L"Find",
L"BAD", //40
L"POOR",
L"AVERAGE",
L"GOOD",
L"GREAT",
L"BAD",
L"POOR",
L"AVERAGE",
L"GOOD",
L"GREAT",
L"Previous color set", //50
L"Next color set",
L"Previous body type",
L"Next body type",
L"Toggle time variance (+ or - 15 minutes)",
L"Toggle time variance (+ or - 15 minutes)",
L"Toggle time variance (+ or - 15 minutes)",
L"Toggle time variance (+ or - 15 minutes)",
L"No action",
L"No action",
L"No action", //60
L"No action",
L"Clear Schedule",
L"Find selected merc",
};
STR16 iEditorBuildingsToolbarText[] =
{
L"ROOFS", //0
L"WALLS",
L"ROOM INFO",
L"Place walls using selection method",
L"Place doors using selection method",
L"Place roofs using selection method",
L"Place windows using selection method",
L"Place damaged walls using selection method.",
L"Place furniture using selection method",
L"Place wall decals using selection method",
L"Place floors using selection method", //10
L"Place generic furniture using selection method",
L"Place walls using smart method",
L"Place doors using smart method",
L"Place windows using smart method",
L"Place damaged walls using smart method",
L"Lock or trap existing doors",
L"Add a new room",
L"Edit cave walls.",
L"Remove an area from existing building.",
L"Remove a building", //20
L"Add/replace building's roof with new flat roof.",
L"Copy a building",
L"Move a building",
L"Draw room number",
L"Erase room numbers",
L"Toggle erase mode",
L"Undo last change",
L"Cycle brush size",
};
STR16 iEditorItemsToolbarText[] =
{
L"Weapons", //0
L"Ammo",
L"Armour",
L"LBE",
L"Exp",
L"E1",
L"E2",
L"E3",
L"Triggers",
L"Keys",
};
STR16 iEditorMapInfoToolbarText[] =
{
L"Add ambient light source", //0
L"Toggle fake ambient lights.",
L"Add exit grids (r-clk to query existing).",
L"Cycle brush size",
L"Undo last change",
L"Toggle erase mode",
L"Specify north point for validation purposes.",
L"Specify west point for validation purposes.",
L"Specify east point for validation purposes.",
L"Specify south point for validation purposes.",
L"Specify center point for validation purposes.", //10
L"Specify isolated point for validation purposes.",
};
STR16 iEditorOptionsToolbarText[]=
{
L"New map", //0
L"New basement",
L"New cave level",
L"Save map",
L"Load map",
L"Select tileset",
L"Leave Editor mode",
L"Exit game.",
L"Create radar map",
L"When checked, the map will be saved in original JA2 map format.\nThis option is only valid on 'normal' size maps that do not reference grid numbers (e.g: exit grids) > 25600.",
L"When checked and you load a map, the map will be enlarged automatically depending on the selected Rows and Cols.",
};
STR16 iEditorTerrainToolbarText[] =
{
L"Draw ground textures", //0
L"Set map ground textures",
L"Place banks and cliffs",
L"Draw roads",
L"Draw debris",
L"Place trees & bushes",
L"Place rocks",
L"Place barrels & other junk",
L"Fill area",
L"Undo last change",
L"Toggle erase mode", //10
L"Cycle brush size",
L"Raise brush density",
L"Lower brush density",
};
STR16 iEditorTaskbarInternalText[]=
{
L"Terrain", //0
L"Buildings",
L"Items",
L"Mercs",
L"Map Info",
L"Options",
};
//Editor Taskbar Utils.cpp
STR16 iRenderMapEntryPointsAndLightsText[] =
{
L"North Entry Point", //0
L"West Entry Point",
L"East Entry Point",
L"South Entry Point",
L"Center Entry Point",
L"Isolated Entry Point",
L"Prime",
L"Night",
L"24Hour",
};
STR16 iBuildTriggerNameText[] =
{
L"Panic Trigger1", //0
L"Panic Trigger2",
L"Panic Trigger3",
L"Trigger%d",
L"Pressure Action",
L"Panic Action1",
L"Panic Action2",
L"Panic Action3",
L"Action%d",
};
STR16 iRenderDoorLockInfoText[]=
{
L"No Lock ID", //0
L"Explosion Trap",
L"Electric Trap",
L"Siren Trap",
L"Silent Alarm",
L"Super Electric Trap", //5
L"Brothel Siren Trap",
L"Trap Level %d",
};
STR16 iRenderEditorInfoText[]=
{
L"Save map in vanilla JA2 (v1.12) map format (Version: 5.00 / 25)", //0
L"No map currently loaded.",
L"File: %S, Current Tileset: %s",
L"Enlarge map on loading",
};
//EditorBuildings.cpp
STR16 iUpdateBuildingsInfoText[] =
{
L"TOGGLE", //0
L"VIEWS",
L"SELECTION METHOD",
L"SMART METHOD",
L"BUILDING METHOD",
L"Room#", //5
};
STR16 iRenderDoorEditingWindowText[] =
{
L"Editing lock attributes at map index %d.",
L"Lock ID",
L"Trap Type",
L"Trap Level",
L"Locked",
};
//EditorItems.cpp
STR16 pInitEditorItemsInfoText[] =
{
L"Pressure Action", //0
L"Panic Action1",
L"Panic Action2",
L"Panic Action3",
L"Action%d",
L"Panic Trigger1", //5
L"Panic Trigger2",
L"Panic Trigger3",
L"Trigger%d",
};
STR16 pDisplayItemStatisticsTex[] =
{
L"Status Info Line 1",
L"Status Info Line 2",
L"Status Info Line 3",
L"Status Info Line 4",
L"Status Info Line 5",
};
//EditorMapInfo.cpp
STR16 pUpdateMapInfoText[] =
{
L"R", //0
L"G",
L"B",
L"Prime",
L"Night",
L"24Hrs", //5
L"Radius",
L"Underground",
L"Light Level",
L"Outdoors",
L"Basement", //10
L"Caves",
L"Restricted",
L"Scroll ID",
L"Destination",
L"Sector", //15
L"Destination",
L"Bsmt. Level",
L"Dest.",
L"GridNo",
};
//EditorMercs.cpp
CHAR16 gszScheduleActions[ 11 ][20] =
{
L"No action",
L"Lock door",
L"Unlock door",
L"Open door",
L"Close door",
L"Move to gridno",
L"Leave sector",
L"Enter sector",
L"Stay in sector",
L"Sleep",
L"Ignore this!"
};
STR16 zDiffNames[5] =
{
L"Wimp",
L"Easy",
L"Average",
L"Tough",
L"Steroid Users Only"
};
STR16 EditMercStat[12] =
{
L"Max Health",
L"Cur Health",
L"Strength",
L"Agility",
L"Dexterity",
L"Charisma",
L"Wisdom",
L"Marksmanship",
L"Explosives",
L"Medical",
L"Scientific",
L"Exp Level",
};
STR16 EditMercOrders[8] =
{
L"Stationary",
L"On Guard",
L"Close Patrol",
L"Far Patrol",
L"Point Patrol",
L"On Call",
L"Seek Enemy",
L"Random Point Patrol",
};
STR16 EditMercAttitudes[6] =
{
L"Defensive",
L"Brave Loner",
L"Brave Buddy",
L"Cunning Loner",
L"Cunning Buddy",
L"Aggressive",
};
STR16 pDisplayEditMercWindowText[] =
{
L"Merc Name:", //0
L"Orders:",
L"Combat Attitude:",
};
STR16 pCreateEditMercWindowText[] =
{
L"Merc Colors", //0
L"Done",
L"Previous merc standing orders",
L"Next merc standing orders",
L"Previous merc combat attitude",
L"Next merc combat attitude", //5
L"Decrease merc stat",
L"Increase merc stat",
};
STR16 pDisplayBodyTypeInfoText[] =
{
L"Random", //0
L"Reg Male",
L"Big Male",
L"Stocky Male",
L"Reg Female",
L"NE Tank", //5
L"NW Tank",
L"Fat Civilian",
L"M Civilian",
L"Miniskirt",
L"F Civilian", //10
L"Kid w/ Hat",
L"Humvee",
L"Eldorado",
L"Icecream Truck",
L"Jeep", //15
L"Kid Civilian",
L"Domestic Cow",
L"Cripple",
L"Unarmed Robot",
L"Larvae", //20
L"Infant",
L"Yng F Monster",
L"Yng M Monster",
L"Adt F Monster",
L"Adt M Monster", //25
L"Queen Monster",
L"Bloodcat",
};
STR16 pUpdateMercsInfoText[] =
{
L" --=ORDERS=-- ", //0
L"--=ATTITUDE=--",
L"RELATIVE",
L"ATTRIBUTES",
L"RELATIVE",
L"EQUIPMENT",
L"RELATIVE",
L"ATTRIBUTES",
L"Army",
L"Admin",
L"Elite", //10
L"Exp. Level",
L"Life",
L"LifeMax",
L"Marksmanship",
L"Strength",
L"Agility",
L"Dexterity",
L"Wisdom",
L"Leadership",
L"Explosives", //20
L"Medical",
L"Mechanical",
L"Morale",
L"Hair color:",
L"Skin color:",
L"Vest color:",
L"Pant color:",
L"RANDOM",
L"RANDOM",
L"RANDOM", //30
L"RANDOM",
L"By specifying a profile index, all of the information will be extracted from the profile ",
L"and override any values that you have edited. It will also disable the editing features ",
L"though, you will still be able to view stats, etc. Pressing ENTER will automatically ",
L"extract the number you have typed. A blank field will clear the profile. The current ",
L"number of profiles range from 0 to ",
L"Current Profile: n/a ",
L"Current Profile: %s",
L"STATIONARY",
L"ON CALL", //40
L"ON GUARD",
L"SEEK ENEMY",
L"CLOSE PATROL",
L"FAR PATROL",
L"POINT PATROL",
L"RND PT PATROL",
L"Action",
L"Time",
L"V",
L"GridNo 1", //50
L"GridNo 2",
L"1)",
L"2)",
L"3)",
L"4)",
L"lock",
L"unlock",
L"open",
L"close",
L"Click on the gridno adjacent to the door that you wish to %s.", //60
L"Click on the gridno where you wish to move after you %s the door.",
L"Click on the gridno where you wish to move to.",
L"Click on the gridno where you wish to sleep at. Person will automatically return to original position after waking up.",
L" Hit ESC to abort entering this line in the schedule.",
};
CHAR16 pRenderMercStringsText[][100] =
{
L"Slot #%d",
L"Patrol orders with no waypoints",
L"Waypoints with no patrol orders",
};
STR16 pClearCurrentScheduleText[] =
{
L"No action",
};
STR16 pCopyMercPlacementText[] =
{
L"Placement not copied because no placement selected.",
L"Placement copied.",
};
STR16 pPasteMercPlacementText[] =
{
L"Placement not pasted as no placement is saved in buffer.",
L"Placement pasted.",
L"Placement not pasted as the maximum number of placements for this team is already used.",
};
//editscreen.cpp
STR16 pEditModeShutdownText[] =
{
L"Exit editor?",
};
STR16 pHandleKeyboardShortcutsText[] =
{
L"Are you sure you wish to remove all lights?", //0
L"Are you sure you wish to reverse the schedules?",
L"Are you sure you wish to clear all of the schedules?",
L"Clicked Placement Enabled",
L"Clicked Placement Disabled",
L"Draw High Ground Enabled", //5
L"Draw High Ground Disabled",
L"Number of edge points: N=%d E=%d S=%d W=%d",
L"Random Placement Enabled",
L"Random Placement Disabled",
L"Removing Treetops", //10
L"Showing Treetops",
L"World Raise Reset",
L"World Raise Set Old",
L"World Raise Set",
};
STR16 pPerformSelectedActionText[] =
{
L"Creating radar map for %S", //0
L"Delete current map and start a new basement level?",
L"Delete current map and start a new cave level?",
L"Delete current map and start a new outdoor level?",
L" Wipe out ground textures? ",
};
STR16 pWaitForHelpScreenResponseText[] =
{
L"HOME", //0
L"Toggle fake editor lighting ON/OFF",
L"INSERT",
L"Toggle fill mode ON/OFF",
L"BKSPC",
L"Undo last change",
L"DEL",
L"Quick erase object under mouse cursor",
L"ESC",
L"Exit editor",
L"PGUP/PGDN", //10
L"Change object to be pasted",
L"F1",
L"This help screen",
L"F10",
L"Save current map",
L"F11",
L"Load map as current",
L"+/-",
L"Change shadow darkness by .01",
L"SHFT +/-", //20
L"Change shadow darkness by .05",
L"0 - 9",
L"Change map/tileset filename",
L"b",
L"Change brush size",
L"d",
L"Draw debris",
L"o",
L"Draw obstacle",
L"r", //30
L"Draw rocks",
L"t",
L"Toggle trees display ON/OFF",
L"g",
L"Draw ground textures",
L"w",
L"Draw building walls",
L"e",
L"Toggle erase mode ON/OFF",
L"h", //40
L"Toggle roofs ON/OFF",
};
STR16 pAutoLoadMapText[] =
{
L"Map data has just been corrupted. Don't save, don't quit, get Kris! If he's not here, save the map using a temp filename and document everything you just did, especially your last action!",
L"Schedule data has just been corrupted. Don't save, don't quit, get Kris! If he's not here, save the map using a temp filename and document everything you just did, especially your last action!",
};
STR16 pShowHighGroundText[] =
{
L"Showing High Ground Markers",
L"Hiding High Ground Markers",
};
//Item Statistics.cpp
/*CHAR16 gszActionItemDesc[ 34 ][ 30 ] = // NUM_ACTIONITEMS = 34
{
L"Klaxon Mine",
L"Flare Mine",
L"Teargas Explosion",
L"Stun Explosion",
L"Smoke Explosion",
L"Mustard Gas",
L"Land Mine",
L"Open Door",
L"Close Door",
L"3x3 Hidden Pit",
L"5x5 Hidden Pit",
L"Small Explosion",
L"Medium Explosion",
L"Large Explosion",
L"Toggle Door",
L"Toggle Action1s",
L"Toggle Action2s",
L"Toggle Action3s",
L"Toggle Action4s",
L"Enter Brothel",
L"Exit Brothel",
L"Kingpin Alarm",
L"Sex with Prostitute",
L"Reveal Room",
L"Local Alarm",
L"Global Alarm",
L"Klaxon Sound",
L"Unlock door",
L"Toggle lock",
L"Untrap door",
L"Tog pressure items",
L"Museum alarm",
L"Bloodcat alarm",
L"Big teargas",
};
*/
STR16 pUpdateItemStatsPanelText[] =
{
L"Toggle hide flag", //0
L"No item selected.",
L"Slot available for",
L"random generation.",
L"Keys not editable.",
L"ProfileID of owner",
L"Item class not implemented.",
L"Slot locked as empty.",
L"Status",
L"Rounds",
L"Trap Level", //10
L"Quantity",
L"Trap Level",
L"Status",
L"Trap Level",
L"Status",
L"Quantity",
L"Trap Level",
L"Dollars",
L"Status",
L"Trap Level", //20
L"Trap Level",
L"Tolerance",
L"Alarm Trigger",
L"Exist Chance",
L"B",
L"R",
L"S",
};
STR16 pSetupGameTypeFlagsText[] =
{
L"Item appears in both Sci-Fi and Realistic modes. (|B)", //0
L"Item appears in |Realistic mode only.",
L"Item appears in |Sci-Fi mode only.",
};
STR16 pSetupGunGUIText[] =
{
L"SILENCER", //0
L"SNIPERSCOPE",
L"LASERSCOPE",
L"BIPOD",
L"DUCKBILL",
L"G-LAUNCHER", //5
};
STR16 pSetupArmourGUIText[] =
{
L"CERAMIC PLATES", //0
};
STR16 pSetupExplosivesGUIText[] =
{
L"DETONATOR",
};
STR16 pSetupTriggersGUIText[] =
{
L"If the panic trigger is an alarm trigger,\nenemies won't attempt to use it if they\nare already aware of your presence.",
};
//Sector Summary.cpp
STR16 pCreateSummaryWindowText[]=
{
L"Okay", //0
L"A",
L"G",
L"B1",
L"B2",
L"B3", //5
L"LOAD",
L"SAVE",
L"Update",
};
STR16 pRenderSectorInformationText[] =
{
L"Tileset: %s", //0
L"Version Info: Summary: 1.%02d, Map: %1.2f / %02d",
L"Number of items: %d",
L"Number of lights: %d",
L"Number of entry points: %d",
L"N",
L"E",
L"S",
L"W",
L"C",
L"I", //10
L"Number of rooms: %d",
L"Total map population: %d",
L"Enemies: %d",
L"Admins: %d",
L"(%d detailed, %d profile -- %d have priority existance)",
L"Troops: %d",
L"(%d detailed, %d profile -- %d have priority existance)",
L"Elites: %d",
L"(%d detailed, %d profile -- %d have priority existance)",
L"Civilians: %d", //20
L"(%d detailed, %d profile -- %d have priority existance)",
L"Humans: %d",
L"Cows: %d",
L"Bloodcats: %d",
L"Creatures: %d",
L"Monsters: %d",
L"Bloodcats: %d",
L"Number of locked and/or trapped doors: %d",
L"Locked: %d",
L"Trapped: %d", //30
L"Locked & Trapped: %d",
L"Civilians with schedules: %d",
L"Too many exit grid destinations (more than 4)...",
L"ExitGrids: %d (%d with a long distance destination)",
L"ExitGrids: none",
L"ExitGrids: 1 destination using %d exitgrids",
L"ExitGrids: 2 -- 1) Qty: %d, 2) Qty: %d",
L"ExitGrids: 3 -- 1) Qty: %d, 2) Qty: %d, 3) Qty: %d",
L"ExitGrids: 3 -- 1) Qty: %d, 2) Qty: %d, 3) Qty: %d, 4) Qty: %d",
L"Enemy Relative Attributes: %d bad, %d poor, %d norm, %d good, %d great (%+d Overall)", //40
L"Enemy Relative Equipment: %d bad, %d poor, %d norm, %d good, %d great (%+d Overall)",
L"%d placements have patrol orders without any waypoints defined.",
L"%d placements have waypoints, but without any patrol orders.",
L"%d gridnos have questionable room numbers. Please validate.",
};
STR16 pRenderItemDetailsText[] =
{
L"R", //0
L"S",
L"Enemy",
L"TOO MANY ITEMS TO DISPLAY!",
L"Panic1",
L"Panic2",
L"Panic3",
L"Norm1",
L"Norm2",
L"Norm3",
L"Norm4", //10
L"Pressure Actions",
L"TOO MANY ITEMS TO DISPLAY!",
L"PRIORITY ENEMY DROPPED ITEMS",
L"None",
L"TOO MANY ITEMS TO DISPLAY!",
L"NORMAL ENEMY DROPPED ITEMS",
L"TOO MANY ITEMS TO DISPLAY!",
L"None",
L"TOO MANY ITEMS TO DISPLAY!",
L"ERROR: Can't load the items for this map. Reason unknown.", //20
};
STR16 pRenderSummaryWindowText[] =
{
L"CAMPAIGN EDITOR -- %s Version 1.%02d", //0
L"(NO MAP LOADED).",
L"You currently have %d outdated maps.",
L"The more maps that need to be updated, the longer it takes. It'll take ",
L"approximately 4 minutes on a P200MMX to analyse 100 maps, so",
L"depending on your computer, it may vary.",
L"Do you wish to regenerate info for ALL these maps at this time (y/n)?",
L"There is no sector currently selected.",
L"Entering a temp file name that doesn't follow campaign editor conventions...",
L"You need to either load an existing map or create a new map before being",
L"able to enter the editor, or you can quit (ESC or Alt+x).", //10
L", ground level",
L", underground level 1",
L", underground level 2",
L", underground level 3",
L", alternate G level",
L", alternate B1 level",
L", alternate B2 level",
L", alternate B3 level",
L"ITEM DETAILS -- sector %s",
L"Summary Information for sector %s:", //20
L"Summary Information for sector %s",
L"does not exist.",
L"Summary Information for sector %s",
L"does not exist.",
L"No information exists for sector %s.",
L"No information exists for sector %s.",
L"FILE: %s",
L"FILE: %s",
L"Override READONLY",
L"Overwrite File", //30
L"You currently have no summary data. By creating one, you will be able to keep track",
L"of information pertaining to all of the sectors you edit and save. The creation process",
L"will analyse all maps in your \\MAPS directory, and generate a new one. This could",
L"take a few minutes depending on how many valid maps you have. Valid maps are",
L"maps following the proper naming convention from a1.dat - p16.dat. Underground maps",
L"are signified by appending _b1 to _b3 before the .dat (ex: a9_b1.dat). ",
L"Do you wish to do this now (y/n)?",
L"No summary info. Creation denied.",
L"Grid",
L"Progress", //40
L"Use Alternate Maps",
L"Summary",
L"Items",
};
STR16 pUpdateSectorSummaryText[] =
{
L"Analyzing map: %s...",
};
STR16 pSummaryLoadMapCallbackText[] =
{
L"Loading map: %s",
};
STR16 pReportErrorText[] =
{
L"Skipping update for %s. Probably due to tileset conflicts...",
};
STR16 pRegenerateSummaryInfoForAllOutdatedMapsText[] =
{
L"Generating map information",
};
STR16 pSummaryUpdateCallbackText[] =
{
L"Generating map summary",
};
STR16 pApologizeOverrideAndForceUpdateEverythingText[] =
{
L"MAJOR VERSION UPDATE",
L"There are %d maps requiring a major version update.",
L"Updating all outdated maps",
};
//selectwin.cpp
STR16 pDisplaySelectionWindowGraphicalInformationText[] =
{
L"%S[%d] is from default tileset %s (%S)",
L"File: %S, subindex: %d (%S)",
L"Current Tileset: %s",
};
//Cursor Modes.cpp
STR16 wszSelType[6] = {
L"Small",
L"Medium",
L"Large",
L"XLarge",
L"Width: xx",
L"Area"
};
//---
CHAR16 gszAimPages[ 6 ][ 20 ] =
{
L"Cтp. 1/2", //0
L"Cтp. 2/2",
L"Cтp. 1/3",
L"Cтp. 2/3",
L"Cтp. 3/3",
L"Cтp. 1/1", //5
};
// by Jazz
CHAR16 zGrod[][500] =
{
L"Робот", //0 // Robot
};
STR16 pCreditsJA2113[] =
{
L"@T,{;Разработчики JA2 v1.13",
L"@T,C144,R134,{;Программирование",
L"@T,C144,R134,{;Графика и звук",
L"@};(Многое взято из других модов)",
L"@T,C144,R134,{;Предметы",
L"@T,C144,R134,{;Также помогали",
L"@};(И многие другие, предложившие хорошие идеи и высказавшие важные замечания!)",
};
CHAR16 ItemNames[MAXITEMS][80] =
{
L"",
};
CHAR16 ShortItemNames[MAXITEMS][80] =
{
L"",
};
// Different weapon calibres
// CAWS is Close Assault Weapon System and should probably be left as it is
// NATO is the North Atlantic Treaty Organization
// WP is Warsaw Pact
// cal is an abbreviation for calibre
CHAR16 AmmoCaliber[MAXITEMS][20];// =
//{
// L"0",
// L",38 кал",
// L"9мм",
// L",45 кал",
// L",357 кал",
// L"12 кал",
// L"ОББ",
// L"5,45мм",
// L"5,56мм",
// L"7,62мм НАТО",
// L"7,62мм ВД",
// L"4,7мм",
// L"5,7мм",
// L"Монстр",
// L"Ракета",
// L"", // дротик
// L"", // пламя
//// L".50 cal", // barrett
//// L"9mm Hvy", // Val silent
//};
// This BobbyRayAmmoCaliber is virtually the same as AmmoCaliber however the bobby version doesnt have as much room for the words.
//
// Different weapon calibres
// CAWS is Close Assault Weapon System and should probably be left as it is
// NATO is the North Atlantic Treaty Organization
// WP is Warsaw Pact
// cal is an abbreviation for calibre
CHAR16 BobbyRayAmmoCaliber[MAXITEMS][20] ;//=
//{
// L"0",
// L",38 кал",
// L"9мм",
// L",45 кал",
// L",357 кал",
// L"12 кал",
// L"ОББ",
// L"5,45мм",
// L"5,56мм",
// L"7,62мм Н.",
// L"7,62мм ВД",
// L"4,7мм",
// L"5.7мм",
// L"Монстр",
// L"Ракета",
// L"", // дротик
//// L"", // flamethrower
//// L".50 cal", // barrett
//// L"9mm Hvy", // Val silent
//};
CHAR16 WeaponType[MAXITEMS][30] =
{
L"", //Other
L"Пистолет", //Pistol
L"Авт.пистолет", //MP 'Автоматический пистолет'
L"ПП", //SMG 'Пистолет-пулемет'
L"Винтовка", //Rifle
L"Сн.винтовка", //Sniper rifle 'Снайперская винтовка'
L"Шт.винтовка", //Assault rifle 'Штурмовая винтовка'
L"Ручной пулемет", //LMG 'Ручной пулемет'
L"Ружье", //Shotgun 'Гладкоствольное ружье'
};
CHAR16 TeamTurnString[][STRING_LENGTH] =
{
L"Ход Игрока", // player's turn
L"Ход Противника",
L"Ход Тварей",
L"Ход Ополчения",
L"Ход Гражданских",
L"Player_Plan",// planning turn
L"Client №1",//hayden
L"Client №2",//hayden
L"Client №3",//hayden
L"Client №4",//hayden
};
CHAR16 Message[][STRING_LENGTH] =
{
L"",
// In the following 8 strings, the %s is the merc's name, and the %d (if any) is a number.
L"%s получает ранение в голову и теряет в интеллекте!",
L"%s получает ранение в плечо и теряет в ловкости!",
L"%s получает ранение в грудь и теряет в силе!",
L"%s получает ранение в ногу и теряет в проворности!",
L"%s получает ранение в голову и теряет %d единиц интеллекта!",
L"%s получает ранение в плечо и теряет %d единиц ловкости!",
L"%s получает ранение в грудь и теряет %d единиц силы!",
L"%s получает ранение в ногу и теряет %d единиц проворности!",
L"Перехват!",
// The first %s is a merc's name, the second is a string from pNoiseVolStr,
// the third is a string from pNoiseTypeStr, and the last is a string from pDirectionStr
L"", //OBSOLETE
L"К вам на помощь прибыло подкрепление!",
// In the following four lines, all %s's are merc names
L"%s перезаряжает оружие.",
L"%s недостаточно очков действия!",
L"%s оказывает первую помощь (любая клавиша - отмена).",
L"%s и %s оказывают первую помощь (любая клавиша - отмена).",
// the following 17 strings are used to create lists of gun advantages and disadvantages
// (separated by commas)
L"надёжно",
L"ненадёжно",
L"простой ремонт",
L"сложный ремонт",
L"большой урон",
L"малый урон",
L"скорострельное",
L"нескорострельное",
L"дальний бой",
L"ближний бой",
L"лёгкое",
L"тяжёлое",
L"компактное",
L"очередями", //fast burst fire
L"нет отсечки очереди",
L"бол.магазин",
L"мал.магазин",
// In the following two lines, all %s's are merc names
L"%s: камуфляжная краска стёрлась.",
L"%s: камуфляжная краска смылась.",
// The first %s is a merc name and the second %s is an item name
L"Второе оружие: закончились патроны!",
L"%s крадёт %s.",
// The %s is a merc name
L"%s: оружие не стреляет очередями.",
L"Уже установлено!",
L"Объединить?",
// Both %s's are item names
L"Нельзя присоединить %s к %s.",
L"Ничего",
L"Разрядить",
L"Навеска",
//You cannot use "item(s)" and your "other item" at the same time.
//Ex: You cannot use sun goggles and you gas mask at the same time.
L"Нельзя использовать %s и %s одновременно.",
L"Этот предмет можно присоединить к другим предметам, поместив его в одно из четырех мест для приспособлений.",
L"Этот предмет можно присоединить к другим предметам, поместив его в одно из четырех мест для приспособлений. (Однако эти предметы несовместимы)",
L"В секторе еще остались враги!",
L"%s требует полную оплату, нужно заплатить еще %s",
L"%s: попадание в голову!",
L"Покинуть битву?",
L"Это несъемное приспособление. Установить его?",
L"%s чувствует прилив энергии!",
L"%s поскальзывается на стеклянных шариках!",
L"%s не удалось отобрать %s у врага!",
L"%s чинит %s",
L"Перехватили ход: ",
L"Сдаться?",
L"Человек отверг вашу помощь.",
L"Вам это надо?",
L"Чтобы воспользоваться вертолётом Небесного Всадника - выберите 'Машина/Вертолёт'.",
L"%s успевает зарядить только одно оружие.", //%s only had enough time to reload ONE gun
L"Ход Кошек-Убийц", //Bloodcats' turn
L"автоматический", //full auto
L"неавтоматический", //no full auto
L"точный", //accurate
L"неточный", //inaccurate
L"нет одиночных", //no semi auto
L"Враг обобран до нитки!",
L"У врага в руках ничего нет!",
L"%s: песчаный камуфляж нанесён.",
L"%s: песчаный камуфляж смыт.",
L"%s: растительный камуфляж нанесён.",
L"%s: растительный камуфляж смыт.",
L"%s: городской камуфляж нанесён.",
L"%s: городской камуфляж смыт.",
L"%s: арктический камуфляж нанесён.",
L"%s: арктический камуфляж смыт.",
L"Нельзя установить навеску %s на это место.",
L"The %s will not fit in any open slots.",
};
// the names of the towns in the game
CHAR16 pTownNames[MAX_TOWNS][MAX_TOWN_NAME_LENGHT] =
{
L"",
L"Омерта",
L"Драссен",
L"Альма",
L"Грам",
L"Тикса",
L"Камбрия",
L"Сан-Мона",
L"Эстони",
L"Орта",
L"Балайм",
L"Медуна",
L"Читзена",
};
// the types of time compression. For example: is the timer paused? at normal speed, 5 minutes per second, etc.
// min is an abbreviation for minutes
STR16 sTimeStrings[] =
{
L"Пауза",
L"Норма",
L"5 мин",
L"30 мин",
L"60 мин",
L"6 часов",
};
// Assignment Strings: what assignment does the merc have right now? For example, are they on a squad, training,
// administering medical aid (doctor) or training a town. All are abbreviated. 8 letters is the longest it can be.
STR16 pAssignmentStrings[] =
{
L"Отряд 1",
L"Отряд 2",
L"Отряд 3",
L"Отряд 4",
L"Отряд 5",
L"Отряд 6",
L"Отряд 7",
L"Отряд 8",
L"Отряд 9",
L"Отряд 10",
L"Отряд 11",
L"Отряд 12",
L"Отряд 13",
L"Отряд 14",
L"Отряд 15",
L"Отряд 16",
L"Отряд 17",
L"Отряд 18",
L"Отряд 19",
L"Отряд 20",
L"На службе", // on active duty
L"Медик", // administering medical aid
L"Пациент", // getting medical aid
L"Транспорт", // in a vehicle
L"В пути", // in transit - abbreviated form
L"Ремонт", // repairing
L"Практика", // training themselves
L"Ополчение", // training a town to revolt
L"Мобил.гр.", //training moving militia units //M.Militia
L"Тренер", // training a teammate
L"Ученик", // being trained by someone else
L"Штат", // operating a strategic facility //Staff
L"Отдых", // Resting at a facility //Rest
L"Мертв", // dead
L"Недеесп.", // abbreviation for incapacitated
L"В плену", // Prisoner of war - captured
L"Госпиталь", // patient in a hospital
L"Пуст", // Vehicle is empty
};
STR16 pMilitiaString[] =
{
L"Ополчение", // the title of the militia box
L"Запас", //the number of unassigned militia troops
L"Нельзя перераспределять ополчение, когда враг находится в этом районе!",
L"Здесь присутствуют ополченцы из других секторов. Распустить их по своим прежним позициям?", //Some militia were not assigned to a sector. Would you like to disband them?
};
STR16 pMilitiaButtonString[] =
{
L"Авто", // auto place the militia troops for the player
L"Готово", // done placing militia troops
L"Распустить", // HEADROCK HAM 3.6: Disband militia //Disband
};
STR16 pConditionStrings[] =
{
L"Отличное", //the state of a soldier .. excellent health
L"Хорошее", //good health
L"Сносное", //fair health
L"Ранен", //wounded health
L"Устал", //tired
L"Кровотечение", //bleeding to death
L"Без сознания", //knocked out
L"Умирает", //near death
L"Мертв", //dead
};
STR16 pEpcMenuStrings[] =
{
L"Сражаться", // set merc on active duty
L"Пациент", // set as a patient to receive medical aid
L"Транспорт", // tell merc to enter vehicle
L"Без эскорта", // let the escorted character go off on their own
L"Отмена", // close this menu
};
// look at pAssignmentString above for comments
STR16 pPersonnelAssignmentStrings[] =
{
L"Отряд 1",
L"Отряд 2",
L"Отряд 3",
L"Отряд 4",
L"Отряд 5",
L"Отряд 6",
L"Отряд 7",
L"Отряд 8",
L"Отряд 9",
L"Отряд 10",
L"Отряд 11",
L"Отряд 12",
L"Отряд 13",
L"Отряд 14",
L"Отряд 15",
L"Отряд 16",
L"Отряд 17",
L"Отряд 18",
L"Отряд 19",
L"Отряд 20",
L"На службе",
L"Медик",
L"Пациент",
L"Транспорт",
L"В пути",
L"Ремонт",
L"Практика",
L"Ополчение",
L"Тренирует мобильную группу", //Training Mobile Militia
L"Тренер",
L"Ученик",
L"Работает с населением", //Facility Staff
L"Отдыхает", //Resting at Facility
L"Мертв",
L"Недеесп.",
L"В плену",
L"Госпиталь",
L"Пуст", // Vehicle is empty
};
// refer to above for comments
STR16 pLongAssignmentStrings[] =
{
L"Отряд 1",
L"Отряд 2",
L"Отряд 3",
L"Отряд 4",
L"Отряд 5",
L"Отряд 6",
L"Отряд 7",
L"Отряд 8",
L"Отряд 9",
L"Отряд 10",
L"Отряд 11",
L"Отряд 12",
L"Отряд 13",
L"Отряд 14",
L"Отряд 15",
L"Отряд 16",
L"Отряд 17",
L"Отряд 18",
L"Отряд 19",
L"Отряд 20",
L"На службе",
L"Медик",
L"Пациент",
L"В транспорте",
L"В пути",
L"Ремонтирует",
L"Практикуется",
L"Тренирует ополчение",
L"Тренирует мобильную группу", //Train Mobiles
L"Тренирует",
L"Обучается",
L"Работает с населением", //Staff Facility
L"Отдыхает в заведении", //Resting at Facility
L"Мертв",
L"Недееспособен",
L"В плену",
L"В госпитале", // patient in a hospital
L"Без пассажиров", // Vehicle is empty
};
// the contract options
STR16 pContractStrings[] =
{
L"Изменение контракта:",
L"", // a blank line, required
L"Продлить на 1 день", // offer merc a one day contract extension
L"Продлить на 7 дней", // 1 week
L"Продлить на 14 дней", // 2 week
L"Уволить", // end merc's contract
L"Отмена", // stop showing this menu
};
STR16 pPOWStrings[] =
{
L"В плену", //an acronym for Prisoner of War
L"??",
};
STR16 pLongAttributeStrings[] =
{
L"СИЛА",
L"ЛОВКОСТЬ",
L"ПРОВОРНОСТЬ",
L"ИНТЕЛЛЕКТ",
L"МЕТКОСТЬ",
L"МЕДИЦИНА",
L"МЕХАНИКА",
L"ЛИДЕРСТВО",
L"ВЗРЫВЧАТКА",
L"УРОВЕНЬ",
};
STR16 pInvPanelTitleStrings[] =
{
L"Броня", // the armor rating of the merc
L"Вес", // the weight the merc is carrying
L"Камуф.", // the merc's camouflage rating
L"Камуфляж:",
L"Броня:",
};
STR16 pShortAttributeStrings[] =
{
L"Прв", // the abbreviated version of : agility
L"Лов", // dexterity
L"Сил", // strength
L"Лид", // leadership
L"Инт", // wisdom
L"Опт", // experience level
L"Мет", // marksmanship skill
L"Взр", // explosive skill
L"Мех", // mechanical skill
L"Мед", // medical skill
};
STR16 pUpperLeftMapScreenStrings[] =
{
L"Назначение", // the mercs current assignment
L"Контракт", // the contract info about the merc
L"Здоровье", // the health level of the current merc
L"Боев.дух", // the morale of the current merc
L"Сост.", // the condition of the current vehicle
L"Бензин", // the fuel level of the current vehicle
};
STR16 pTrainingStrings[] =
{
L"Тренинг", // tell merc to train self
L"Ополчение", // tell merc to train town
L"Тренер", // tell merc to act as trainer
L"Ученик", // tell merc to be train by other
};
STR16 pGuardMenuStrings[] =
{
L"Ведение огня:", // the allowable rate of fire for a merc who is guarding
L" Агрессивная атака", // the merc can be aggressive in their choice of fire rates
L" Беречь патроны", // conserve ammo
L" Воздержаться от стрельбы", // fire only when the merc needs to
L"Другие параметры:", // other options available to merc
L" Может отступить", // merc can retreat
L" Может искать укрытие", // merc is allowed to seek cover
L" Может помочь команде", // merc can assist teammates
L"Готово", // done with this menu
L"Отмена", // cancel this menu
};
// This string has the same comments as above, however the * denotes the option has been selected by the player
STR16 pOtherGuardMenuStrings[] =
{
L"Ведение огня:",
L" *Агрессивная атака*",
L" *Беречь патроны*",
L" *Воздержаться от стрельбы*",
L"Другие параметры:",
L" *Может отступить*",
L" *Может искать укрытие*",
L" *Может помочь команде*",
L"Готово",
L"Отмена",
};
STR16 pAssignMenuStrings[] =
{
L"На службе", // merc is on active duty
L"Медик", // the merc is acting as a doctor
L"Пациент", // the merc is receiving medical attention
L"Машина", // the merc is in a vehicle
L"Ремонт", // the merc is repairing items
L"Обучение", // the merc is training
L"Удобства", // the merc is using/staffing a facility //Facility
L"Отмена", // cancel this menu
};
//lal
STR16 pMilitiaControlMenuStrings[] =
{
L"В атаку", // set militia to aggresive
L"Держать оборону", // set militia to stationary
L"Отступать", // retreat militia
L"За мной", // retreat militia
L"Ложись", // retreat militia
L"В укрытие",
L"Все в атаку",
L"Всем держать оборону",
L"Всем отступать",
L"Все за мной",
L"Всем рассеяться",
L"Всем залечь",
L"Всем в укрытие",
//L"Всем искать предметы",
L"Отмена", // cancel this menu
};
//STR16 pTalkToAllMenuStrings[] =
//{
// L"В атаку", // set militia to aggresive
// L"Держать оборону", // set militia to stationary
// L"Отступать", // retreat militia
// L"За мной", // retreat militia
// L"Ложись", // retreat militia
// L"Отмена", // cancel this menu
//};
STR16 pRemoveMercStrings[] =
{
L"Убрать бойца", // remove dead merc from current team
L"Отмена",
};
STR16 pAttributeMenuStrings[] =
{
L"Сила",
L"Ловкость",
L"Проворность",
L"Здоровье",
L"Меткость",
L"Медицина",
L"Механика",
L"Лидерство",
L"Взрывчатка",
L"Отмена",
};
STR16 pTrainingMenuStrings[] =
{
L"Практика", // train yourself
L"Ополчение", // train the town
L"Мобил. группа", //Mobile Militia
L"Тренер", // train your teammates
L"Ученик", // be trained by an instructor
L"Отмена", // cancel this menu
};
STR16 pSquadMenuStrings[] =
{
L"Отряд 1",
L"Отряд 2",
L"Отряд 3",
L"Отряд 4",
L"Отряд 5",
L"Отряд 6",
L"Отряд 7",
L"Отряд 8",
L"Отряд 9",
L"Отряд 10",
L"Отряд 11",
L"Отряд 12",
L"Отряд 13",
L"Отряд 14",
L"Отряд 15",
L"Отряд 16",
L"Отряд 17",
L"Отряд 18",
L"Отряд 19",
L"Отряд 20",
L"Отмена",
};
STR16 pPersonnelTitle[] =
{
L"Команда", // the title for the personnel screen/program application
};
STR16 pPersonnelScreenStrings[] =
{
L"Здоровье:", // health of merc
L"Проворность:",
L"Ловкость:",
L"Сила:",
L"Лидерство:",
L"Интеллект:",
L"Опыт:", // experience level
L"Меткость:",
L"Механика:",
L"Взрывчатка:",
L"Медицина:",
L"Мед. депозит:", // amount of medical deposit put down on the merc
L"До конца контракта:", // cost of current contract
L"Убил врагов:", // number of kills by merc
L"Помог убить:", // number of assists on kills by merc
L"Гонорар за день:", // daily cost of merc
L"Общая цена услуг:", // total cost of merc
L"Контракт:", // cost of current contract
L"У вас на службе:", // total service rendered by merc
L"Задолж. жалования:", // amount left on MERC merc to be paid
L"Процент попаданий:", // percentage of shots that hit target
L"Боёв:", // number of battles fought
L"Ранений:", // number of times merc has been wounded
L"Навыки:",
L"Нет навыков",
L"Достижения:", //Achievements
};
// SANDRO - helptexts for merc records
STR16 pPersonnelRecordsHelpTexts[] =
{
L"Элиты: %d\n",
L"Солдат: %d\n",
L"Полиции: %d\n",
L"Враждебных граждан: %d\n",
L"Животных: %d\n",
L"Танков: %d\n",
L"Других объектов: %d\n",
L"Своим: %d\n",
L"Ополчению: %d\n",
L"Другим: %d\n",
L"Выпущено пуль: %d\n",
L"Выпущено ракет: %d\n",
L"Брошено гранат: %d\n",
L"Брошено ножей: %d\n",
L"Ударов ножом: %d\n",
L"Ударов кулаками: %d\n",
L"Удачных попаданий: %d\n",
L"Замков взломано: %d\n",
L"Замков сорвано: %d\n",
L"Ловушек обезврежено: %d\n",
L"Взрывчатки взорвано: %d\n",
L"Предметов отремонтированно: %d\n",
L"Предметов собрано: %d\n",
L"Вещей украдено: %d\n",
L"Ополченцев натренировано: %d\n",
L"Бойцов перевязано: %d\n",
L"Заданий: %d\n",
L"Встречено информаторов: %d\n",
L"Секторов разведано: %d\n",
L"Выйдено из окружения: %d\n", //Ambushes Prevented
L"Заданий жителей выполнено: %d\n",
L"Тактических сражений: %d\n",
L"Автобитв: %d\n",
L"Количество отступлений: %d\n",
L"Попаданий в засады: %d\n",
L"Крупнейшая битва: %d врагов\n",
L"Стреляных ран: %d\n",
L"Ножевых ран: %d\n",
L"Пропущенных ударов: %d\n",
L"Подорвался: %d\n",
L"Ухудшений параметров: %d\n",
L"Перенёс мед. вмешательств: %d\n", //Surgeries undergone
L"Травм на производстве: %d\n", //Facility Accidents
L"Характер:",
L"Недостаток:",
L"По жизни:", //Attitudes For old traits display instead of "Character:"!
};
//These string correspond to enums used in by the SkillTrait enums in SoldierProfileType.h
STR16 gzMercSkillText[] =
{
L"Нет навыка",
L"Взлом замков",
L"Рукопашный бой",
L"Электроника",
L"Ночные операции",
L"Метание",
L"Инструктор",
L"Тяжелое оружие",
L"Автоматическое оружие",
L"Скрытность",
L"Ловкач",
L"Воровство",
L"Боевые искусства",
L"Холодное оружие",
L"Снайпер",
L"Камуфляж",
L"(Эксперт)",
};
//////////////////////////////////////////////////////////
// SANDRO - added this
STR16 gzMercSkillTextNew[] =
{
// Major traits
L"Нет навыка", //No Skill
L"Автоматчик", //Auto Weapons
L"Гренадёр", //Heavy Weapons
L"Стрелок", //Marksman
L"Охотник", //Hunter
L"Ковбой", //Gunslinger
L"Боксёр", //Hand to Hand
L"Старшина", //Deputy
L"Механик-электронщик", //Technician
L"Санитар", //Paramedic
// Minor traits
L"Ловкач", //Ambidextrous
L"Мастер клинка", //Melee
L"Мастер по метанию", //Throwing
L"Ночник", //Night Ops
L"Бесшумный убийца", //Stealthy
L"Спортсмен", //Athletics
L"Культурист", //Bodybuilding
L"Подрывник", //Demolitions
L"Инструктор", //Teaching
L"Разведчик", //Scouting
// second names for major skills
L"Пулемётчик", //Machinegunner
L"Артиллерист", //Bombardier
L"Снайпер", //Sniper
L"Рейнджер", //Ranger
L"Пистолетчик", //Gunfighter
L"Боевые искусства", //Martial Arts
L"Командир", //Squadleader
L"Инженер", //Engineer
L"Доктор", //Doctor
L"Ещё...",
};
//////////////////////////////////////////////////////////
// This is pop up help text for the options that are available to the merc
STR16 pTacticalPopupButtonStrings[] =
{
L"Встать/Идти (|S)",
L"Присесть/Гусиный шаг (|C)",
L"Стоять/Бежать (|R)",
L"Лечь/Ползти (|P)",
L"Поворот (|L)",
L"Действие",
L"Поговорить",
L"Осмотреть (|C|t|r|l)",
// Pop up door menu
L"Открыть",
L"Искать ловушки",
L"Вскрыть отмычками",
L"Открыть cилой",
L"Обезвредить",
L"Запереть",
L"Отпереть",
L"Использовать заряд взрывчатки",
L"Взломать ломом",
L"Отмена (|E|s|c)",
L"Закрыть",
};
// Door Traps. When we examine a door, it could have a particular trap on it. These are the traps.
STR16 pDoorTrapStrings[] =
{
L"нет ловушки",
L"бомба-ловушка",
L"электроловушка",
L"сирена",
L"сигнализация",
};
// Contract Extension. These are used for the contract extension with AIM mercenaries.
STR16 pContractExtendStrings[] =
{
L"1 день",
L"7 дней",
L"14 дней",
};
// On the map screen, there are four columns. This text is popup help text that identifies the individual columns.
STR16 pMapScreenMouseRegionHelpText[] =
{
L"Выбрать наемника",
L"Отдать приказ",
L"Проложить путь движения",
L"Контракт наемника (|C)",
L"Местонахождение бойца",
L"Спать",
};
// volumes of noises
STR16 pNoiseVolStr[] =
{
L"ТИХИЙ",
L"ЧЕТКИЙ",
L"ГРОМКИЙ",
L"ОЧЕНЬ ГРОМКИЙ",
};
// types of noises
STR16 pNoiseTypeStr[] = // OBSOLETE
{
L"НЕЗНАКОМЫЙ",
L"ЗВУК ШАГОВ",
L"СКРИП",
L"ВСПЛЕСК",
L"УДАР",
L"ВЫСТРЕЛ",
L"ВЗРЫВ",
L"КРИК",
L"УДАР",
L"УДАР",
L"ЗВОН",
L"ГРОХОТ",
};
// Directions that are used to report noises
STR16 pDirectionStr[] =
{
L"c СЕВЕРО-ВОСТОКА",
L"c ВОСТОКА",
L"c ЮГО-ВОСТОКА",
L"c ЮГА",
L"c ЮГО-ЗАПАДА",
L"c ЗАПАДА",
L"c СЕВЕРО-ЗАПАДА",
L"c СЕВЕРА",
};
// These are the different terrain types.
STR16 pLandTypeStrings[] =
{
L"Город",
L"Дорога",
L"Равнина",
L"Пустыня",
L"Прерия",
L"Лес",
L"Болото",
L"Вода",
L"Холмы",
L"Непроходимо",
L"Река", //river from north to south
L"Река", //river from east to west
L"Чужая страна",
//NONE of the following are used for directional travel, just for the sector description.
L"Тропики",
L"Ферма",
L"Поля, дорога",
L"Леса, дорога",
L"Ферма, дорога",
L"Тропики, дорога",
L"Леса, дорога",
L"Побережье",
L"Горы, дорога",
L"Берег, дорога",
L"Пустыня, дорога",
L"Болота, дорога",
L"Прерия, ПВО",
L"Пустыня, ПВО",
L"Тропики, ПВО",
L"Медуна, ПВО",
//These are descriptions for special sectors
L"Госпиталь Камбрии",
L"Аэропорт Драссена",
L"Аэропорт Медуны",
L"База ПВО",
L"Убежище повстанцев", //The rebel base underground in sector A10
L"Подвалы Тиксы", //The basement of the Tixa Prison (J9)
L"Логово тварей", //Any mine sector with creatures in it
L"Подвалы Орты", //The basement of Orta (K4)
L"Туннель", //The tunnel access from the maze garden in Meduna
//leading to the secret shelter underneath the palace
L"Убежище", //The shelter underneath the queen's palace
L"", //Unused
};
STR16 gpStrategicString[] =
{
L"", //Unused
L"%s замечен в секторе %c%d, и другой отряд уже на подходе.", //STR_DETECTED_SINGULAR
L"%s замечен в секторе %c%d, и остальные отряды уже на подходе.", //STR_DETECTED_PLURAL
L"Желаете дождаться прибытия остальных?", //STR_COORDINATE
//Dialog strings for enemies.
L"Враг предлагает вам сдаться.", //STR_ENEMY_SURRENDER_OFFER
L"Оставшиеся без сознания бойцы попали в плен.", //STR_ENEMY_CAPTURED
//The text that goes on the autoresolve buttons
L"Отступить", //The retreat button //STR_AR_RETREAT_BUTTON
L"OK", //The done button //STR_AR_DONE_BUTTON
//The headers are for the autoresolve type (MUST BE UPPERCASE)
L"ОБОРОНА", //STR_AR_DEFEND_HEADER
L"АТАКА", //STR_AR_ATTACK_HEADER
L"ВСТРЕЧА", //STR_AR_ENCOUNTER_HEADER
L"Сектор", //The Sector A9 part of the header //STR_AR_SECTOR_HEADER
//The battle ending conditions
L"ПОБЕДА!", //STR_AR_OVER_VICTORY
L"ПОРАЖЕНИЕ!", //STR_AR_OVER_DEFEAT
L"СДАЛСЯ!", //STR_AR_OVER_SURRENDERED
L"ПЛЕНЕН!", //STR_AR_OVER_CAPTURED
L"ОТСТУПИЛ!", //STR_AR_OVER_RETREATED
//These are the labels for the different types of enemies we fight in autoresolve.
L"Ополченец", //STR_AR_MILITIA_NAME,
L"Элита", //STR_AR_ELITE_NAME,
L"Солдат", //STR_AR_TROOP_NAME,
L"Полиция", //STR_AR_ADMINISTRATOR_NAME,
L"Рептион", //STR_AR_CREATURE_NAME,
//Label for the length of time the battle took
L"Прошло времени", //STR_AR_TIME_ELAPSED,
//Labels for status of merc if retreating. (UPPERCASE)
L"ОТСТУПИЛ", //STR_AR_MERC_RETREATED,
L"ОТСТУПАЕТ", //STR_AR_MERC_RETREATING,
L"ОТСТУПИТЬ", //STR_AR_MERC_RETREAT,
//PRE BATTLE INTERFACE STRINGS
//Goes on the three buttons in the prebattle interface. The Auto resolve button represents
//a system that automatically resolves the combat for the player without having to do anything.
//These strings must be short (two lines -- 6-8 chars per line)
L"Авто битва", //STR_PB_AUTORESOLVE_BTN,
L"Перейти в сектор", //STR_PB_GOTOSECTOR_BTN,
L"Уйти из сектора", //STR_PB_RETREATMERCS_BTN,
//The different headers(titles) for the prebattle interface.
L"ВСТРЕЧА С ВРАГОМ", //STR_PB_ENEMYENCOUNTER_HEADER,
L"НАСТУПЛЕНИЕ ВРАГА", //STR_PB_ENEMYINVASION_HEADER, // 30
L"ВРАЖЕСКАЯ ЗАСАДА", //STR_PB_ENEMYAMBUSH_HEADER
L"ВРАЖЕСКИЙ СЕКТОР", //STR_PB_ENTERINGENEMYSECTOR_HEADER
L"АТАКА ТВАРЕЙ", //STR_PB_CREATUREATTACK_HEADER
L"ЗАСАДА КОШЕК-УБИЙЦ", //STR_PB_BLOODCATAMBUSH_HEADER
L"ВХОД В ЛОГОВИЩЕ КОШЕК-УБИЙЦ", //STR_PB_ENTERINGBLOODCATLAIR_HEADER
//Various single words for direct translation. The Civilians represent the civilian
//militia occupying the sector being attacked. Limited to 9-10 chars
L"Локация",
L"Враг",
L"Наемники",
L"Ополчение",
L"Рептионы",
L"Кошки-убийцы",
L"Сектор",
L"Нет", //If there are no uninvolved mercs in this fight.
L"Н/Д", //Acronym of Not Applicable
L"д", //One letter abbreviation of day
L"ч", //One letter abbreviation of hour
//TACTICAL PLACEMENT USER INTERFACE STRINGS
//The four buttons
L"Отмена",
L"Случайно",
L"Группой",
L"B aтaку!",
//The help text for the four buttons. Use \n to denote new line (just like enter).
L"Убирает все позиции бойцов \nи позволяет заново расставить их. (|C)",
L"При каждом нажатии распределяет \nбойцов случайным образом. (|S)",
L"Позволяет выбрать место, \nгде сгруппировать ваших бойцов. (|G)",
L"Нажмите эту кнопку, когда завершите \nвыбор позиций для бойцов. (|В|в|о|д)",
L"Вы должны разместить всех своих бойцов \nдо того, как начать бой.",
//Various strings (translate word for word)
L"Сектор",
L"Выбор точек входа",
//Strings used for various popup message boxes. Can be as long as desired.
L"Препятствие. Место недоступно. Попробуйте пройти другим путем.",
L"Поместите бойцов в незатененную часть карты.",
//This message is for mercs arriving in sectors. Ex: Red has arrived in sector A9.
//Don't uppercase first character, or add spaces on either end.
L"прибыл(а) в сектор",
//These entries are for button popup help text for the prebattle interface. All popup help
//text supports the use of \n to denote new line. Do not use spaces before or after the \n.
L"Автоматически просчитывает бой\nбез загрузки карты. (|A)",
L"Нельзя включить автобой\nво время нападения.",
L"Войти в сектор, чтобы атаковать врага. (|E)",
L"Отступить отрядом в предыдущий сектор. (|R)", //singular version
L"Всем отрядам отступить в предыдущий сектор. (|R)", //multiple groups with same previous sector
//various popup messages for battle conditions.
//%c%d is the sector -- ex: A9
L"Враги атаковали ваших ополченцев в секторе %c%d.",
//%c%d сектор -- напр: A9
L"Твари атаковали ваших ополченцев в секторе %c%d.",
//1st %d refers to the number of civilians eaten by monsters, %c%d is the sector -- ex: A9
//Note: the minimum number of civilians eaten will be two.
L"Твари убили %d гражданских во время атаки сектора %s.",
//%s is the sector location -- ex: A9: Omerta
L"Враги атаковали ваших наемников в секторе %s. Ни один из ваших бойцов не в состоянии сражаться!",
//%s is the sector location -- ex: A9: Omerta
L"Твари атаковали ваших наемников в секторе %s. Ни один из ваших бойцов не в состоянии сражаться!",
};
STR16 gpGameClockString[] =
{
//This is the day represented in the game clock. Must be very short, 4 characters max.
L"День",
};
//When the merc finds a key, they can get a description of it which
//tells them where and when they found it.
STR16 sKeyDescriptionStrings[2] =
{
L"Найдено в секторе:",
L"Найдено за день:",
};
//The headers used to describe various weapon statistics.
CHAR16 gWeaponStatsDesc[][ 17 ] =
{
// HEADROCK: Changed this for Extended Description project
L"Состояние:",
L"Вес:",
L"Нужно ОД",
L"Дист:", // Range
L"Урон:", // Damage
L"Всего:", // Number of bullets left in a magazine
L"ОД:", // abbreviation for Action Points
L"=",
L"=",
//Lal: additional strings for tooltips
L"Точность:", //9
L"Дист:", //10
L"Урон:", //11
L"Вес:", //12
L"Оглушение:",//13
// HEADROCK: Added new strings for extended description ** REDUNDANT **
L"Навеска:", //14 //Attachments
L"AUTO/5:", //15
L"Осталось патрон:", //16 //Remaining ammo
L"Предустановка:", //17 //WarmSteel - So we can also display default attachments
};
// HEADROCK: Several arrays of tooltip text for new Extended Description Box
// Please note, several of these are artificially inflated to 19 entries to help fix a complication with
// changing item type while watching its description box
STR16 gzWeaponStatsFasthelp[ 32 ] =
{
L"Точность", //Accuracy
L"Урон", //Damage
L"Дальнобойность", //Range
L"Уровни прицеливания", //Aiming Levels
L"Модификатор прицельной стрельбы", //Aiming Modifier
L"Радиус наилучшей видимости\nточки прицеливания", //Average Best Laser Range
L"Пламегаситель", //Flash Suppression
L"Шумность (чем меньше, тем лучше)", //Loudness (Lower is better)
L"Надёжность", //Reliability
L"Простота ремонта", //Repair Ease
L"Минимальная эффективная дальность", //Min. Range for Aiming Bonus
L"Модификатор точности", //To-Hit Modifier
L"", //12
L"ОД на вскидку", //APs to ready
L"ОД на 1 выстрел", //APs to fire Single
L"ОД на огонь с отсечкой", //APs to fire Burst
L"ОД на огонь очередью", //APs to fire Auto
L"ОД на замену магазина", //APs to Reload
L"ОД на досылку патрона", //APs to Reload Manually
L"", //19
L"Бонус от сошек\n(при стрельбе лёжа)", //Bipod Modifier
L"Выстрелов в автоматическом\nрежиме за 5 ОД", //Autofire shots per 5 AP
L"Штраф за отдачу при\nстрельбе очередью\n(c отсечкой/без) (чем меньше, тем лучше)", //Burst/Auto Penalty //22
L"ОД на бросок", //APs to Throw
L"ОД на выстрел", //APs to Launch
L"ОД на удар ножом", //APs to Stab
L"Не стреляет одиночными!", //No Single Shot!
L"Нет отсечки патрона!", //No Burst Mode!
L"Нет автоматического режима!", //No Auto Mode!
L"ОД на удар", //APs to Bash
L"Штраф за отдачу при \nстрельбе очередью \n(чем меньше, тем лучше)", //Autofire Penalty (Lower is better)
L"Штраф за отдачу при\nстрельбе очередью c отсечкой\n(чем меньше, тем лучше)", //Burst Penalty (Lower is better)
};
STR16 gzWeaponStatsFasthelpTactical[ 32 ] =
{
L"Точность", //Accuracy
L"Урон", //Damage
L"Дальнобойность", //Range
L"Уровни прицеливания",
L"Модификатор прицельной стрельбы", //Aiming Modifier
L"Радиус наилучшей видимости\nточки прицеливания", //Average Best Laser Range
L"Пламегаситель", //Flash Suppression
L"Шумность (чем меньше, тем лучше)", //Loudness (Lower is better)
L"Надёжность", //Reliability
L"Простота ремонта", //Repair Ease
L"Минимальная эффективная дальность", //Min. Range for Aiming Bonus
L"Модификатор точности", //To-Hit Modifier
L"", //12
L"ОД на вскидку", //APs to ready
L"ОД на 1 выстрел", //APs to fire Single
L"ОД на огонь с отсечкой", //APs to fire Burst
L"ОД на огонь очередью", //APs to fire Auto
L"ОД на замену магазина", //APs to Reload
L"ОД на досылку патрона", //APs to Reload Manually
L"Штраф за отдачу при\nстрельбе очередью c отсечкой\n(чем меньше, тем лучше)", //19 //Burst Penalty (Lower is better)
L"Бонус от сошек\n(при стрельбе лёжа)", //Bipod Modifier
L"Выстрелов в автоматическом\nрежиме за 5 ОД", //Autofire shots per 5 AP
L"Штраф за отдачу при \nстрельбе очередью \n(чем меньше, тем лучше)", //Autofire Penalty (Lower is better)
L"Штраф за отдачу при\nстрельбе очередью\n(c отсечкой/без) (чем меньше, тем лучше)", //Burst/Auto Penalty //23
L"ОД на бросок", //APs to Throw
L"ОД на выстрел", //APs to Launch
L"ОД на удар ножом", //APs to Stab
L"Не стреляет одиночными!", //No Single Shot!
L"Нет отсечки патрона!", //No Burst Mode!
L"Нет автоматического режима!", //No Auto Mode!
L"ОД на удар", //APs to Bash
L"",
};
STR16 gzMiscItemStatsFasthelp[ 34 ] =
{
L"Модификатор размера предмета\n(чем меньше, тем лучше)", //Item Size Modifier (Lower is better)
L"Модификатор надёжности", //Reliability Modifier
L"Модификатор шумности\n(чем меньше, тем лучше)", //Loudness Modifier (Lower is better)
L"Скрывает вспышку", //Hides Muzzle Flash
L"Модификатор сошек", //Bipod Modifier
L"Модификатор дальнобойности", //Range Modifier
L"Модификатор точности", //To-Hit Modifier
L"Радиус наилучшей видимости\nточки прицеливания", //Best Laser Range
L"Модификатор бонусов оптики", //Aiming Bonus Modifier
L"Модификатор очереди с отсечкой", //Burst Size Modifier
L"Модификатор штрафа за отдачу\nпри стрельбе c отсечкой\n(чем больше, тем лучше)", //Burst Penalty Modifier (Higher is better)
L"Модификатор штрафа за отдачу\nпри стрельбе очередью\n(чем больше, тем лучше)", //Auto-Fire Penalty Modifier (Higher is better)
L"Модификатор ОД", //AP Modifier
L"Модификатор ОД\nна очередь с отсечкой\n(чем меньше, тем лучше)", //AP to Burst Modifier (Lower is better)
L"Модификатор ОД\nна очередь без отсечки\n(чем меньше, тем лучше)", //AP to Auto-Fire Modifier (Lower is better)
L"Модификатор ОД на вскидку\n(чем меньше, тем лучше)", //AP to Ready Modifier (Lower is better)
L"Модификатор ОД\nна замену магазина\n(чем меньше, тем лучше)", //AP to Reload Modifier (Lower is better)
L"Модификатор объёма магазина", //Magazine Size Modifier
L"Модификатор ОД на выстрел\n(чем меньше, тем лучше)", //AP to Attack Modifier (Lower is better)
L"Модификатор урона", //Damage Modifier
L"Модификатор урона\nв ближнем бою", //Melee Damage Modifier
L"Камуфляж 'Лес'",
L"Камуфляж 'Город'",
L"Камуфляж 'Пустыня'",
L"Камуфляж 'Снег'",
L"Модификатор скрытности", // 25
L"Модификатор диапазона\nслышимости",
L"Модификатор диапазона\nвидимости",
L"Модификатор диапазона\nвидимости днём",
L"Модификатор диапазона\nвидимости ночью",
L"Модификатор диапазона\nвидимости при ярком освещении", //30
L"Модификатор диапазона\nвидимости в пещере",
L"Сужение сектора обзора\n(чем меньше, тем лучше)", //Tunnel Vision Percentage (Lower is better)
L"Минимальная эффективная\nдальность оптики", //Minimum Range for Aiming Bonus
};
// HEADROCK: End new tooltip text
// HEADROCK HAM 4: New condition-based text similar to JA1.
STR16 gConditionDesc[] =
{
L"В ", //In
L"ИДЕАЛЬНОМ",
L"ОТЛИЧНОМ",
L"ХОРОШЕМ", //GOOD
L"НОРМАЛЬНОМ", //FAIR
L"ПЛОХОМ", //POOR
L"УЖАСНОМ", //BAD
L"НЕРАБОЧЕМ",
L" состоянии."
};
//The headers used for the merc's money.
CHAR16 gMoneyStatsDesc[][ 13 ] =
{
L"Кол-во",
L"Осталось:", //this is the overall balance
L"Кол-во",
L"Отделить:", //the amount he wants to separate from the overall balance to get two piles of money
L"Текущий",
L"Баланс",
L"Снимаемая",
L"Сумма",
};
//The health of various creatures, enemies, characters in the game. The numbers following each are for comment
//only, but represent the precentage of points remaining.
CHAR16 zHealthStr[][13] =
{
L"УМИРАЕТ", // >= 0
L"КРИТИЧЕН", // >= 15
L"ПЛОХ", // >= 30
L"РАНЕН", // >= 45
L"ЗДОРОВ", // >= 60
L"СИЛЕН", // >= 75
L"ОТЛИЧНО", // >= 90
};
STR16 gzMoneyAmounts[6] =
{
L"1000$",
L"100$",
L"10$",
L"Снять",
L"Разделить",
L"Взять",
};
// short words meaning "Advantages" for "Pros" and "Disadvantages" for "Cons."
CHAR16 gzProsLabel[10] =
{
L"+",
};
CHAR16 gzConsLabel[10] =
{
L"-",
};
//Conversation options a player has when encountering an NPC
CHAR16 zTalkMenuStrings[6][ SMALL_STRING_LENGTH ] =
{
L"Повторить", //meaning "Repeat yourself"
L"Дружественно", //approach in a friendly
L"Напрямую", //approach directly - let's get down to business
L"Угрожать", //approach threateningly - talk now, or I'll blow your face off
L"Дать",
L"Нанять",
};
//Some NPCs buy, sell or repair items. These different options are available for those NPCs as well.
CHAR16 zDealerStrings[4][ SMALL_STRING_LENGTH ]=
{
L"Купить/Продать",
L"Купить",
L"Продать",
L"Ремонтировать",
};
CHAR16 zDialogActions[1][ SMALL_STRING_LENGTH ] =
{
L"До встречи",
};
//These are vehicles in the game.
STR16 pVehicleStrings[] =
{
L"Эльдорадо",
L"Хаммер", // a hummer jeep/truck -- military vehicle
L"Фургон",
L"Джип",
L"Танк",
L"Вертолет",
};
STR16 pShortVehicleStrings[] =
{
L"Эльдор",
L"Хаммер", // the HMVV
L"Фургон",
L"Джип",
L"Танк",
L"Верт.", // the helicopter
};
STR16 zVehicleName[] =
{
L"Эльдорадо",
L"Хаммер", //a military jeep. This is a brand name.
L"Фургон", // Ice cream truck
L"Джип",
L"Танк",
L"Вертолет", //an abbreviation for Helicopter
};
//These are messages Used in the Tactical Screen
CHAR16 TacticalStr[][ MED_STRING_LENGTH ] =
{
L"Воздушный Рейд",
L"Оказать первую помощь?",
// CAMFIELD NUKE THIS and add quote #66.
L"%s замечает, что некоторые вещи отсутствуют в посылке.",
// The %s is a string from pDoorTrapStrings
L"Замок (%s).",
L"Тут нет замка.",
L"Успех!",
L"Провал.",
L"Успех!",
L"Провал",
L"На замке нет ловушки.",
L"Успех!",
// The %s is a merc name
L"У %s нет подходящего ключа",
L"Ловушка обезврежена",
L"На замке не найдено ловушки.",
L"Заперто",
L"ДВЕРЬ",
L"С ЛОВУШКОЙ",
L"ЗАПЕРТАЯ",
L"НЕЗАПЕРТАЯ",
L"СЛОМАНАЯ",
L"Тут есть кнопка. Нажать?",
L"Разрядить ловушку?",
L"Пред...",
L"След...",
L"Еще...",
// In the next 2 strings, %s is an item name
L"%s помещен(а) на землю.",
L"%s отдан(а) %s.",
// In the next 2 strings, %s is a name
L"%s: Оплачено сполна.",
L"%s: Еще должен %d.",
L"Установить частоту радиодетонатора:", //in this case, frequency refers to a radio signal
L"Количество ходов до взрыва:", //how much time, in turns, until the bomb blows
L"Выберите частоту радиодетонатора на пульте:", //in this case, frequency refers to a radio signal
L"Обезвредить ловушку?",
L"Убрать синий флаг?",
L"Поставить здесь синий флаг?",
L"Завершающий ход",
// In the next string, %s is a name. Stance refers to way they are standing.
L"Вы действительно хотите атаковать %s?",
L"Увы, в машине боец не может изменить положение.",
L"Робот не может менять положение.",
// In the next 3 strings, %s is a name
L"%s не может поменять положение здесь.",
L"%s не может получить первую помощь.",
L"%s не нуждается в медицинской помощи.",
L"Туда идти нельзя.",
L"У вас уже полная команда, мест нет.", //there's no room for a recruit on the player's team
// In the next string, %s is a name
L"%s нанят(а).",
// Here %s is a name and %d is a number
L"%s должен получить $%d.",
// In the next string, %s is a name
L"Сопроводить %s?",
// In the next string, the first %s is a name and the second %s is an amount of money (including $ sign)
L"Нанять %s за %s в день?",
// This line is used repeatedly to ask player if they wish to participate in a boxing match.
L"Хотите участвовать в поединке?",
// In the next string, the first %s is an item name and the
// second %s is an amount of money (including $ sign)
L"Купить %s за %s?",
// In the next string, %s is a name
L"%s сопровождается отрядом %d.",
// These messages are displayed during play to alert the player to a particular situation
L"ОТКАЗ", //weapon is jammed.
L"Роботу нужны патроны %s калибра.", //Robot is out of ammo
L"Бросить туда не получится.", //Merc can't throw to the destination he selected
// These are different buttons that the player can turn on and off.
L"Режим скрытности (|Z)",
L"Карта (|M)",
L"Завершить ход (|D)",
L"Говорить",
L"Молчать",
L"Подняться (|P|g|U|p)",
L"Смена уровня (|T|a|b)",
L"Забраться/Спрыгнуть (|J)",
L"Присесть/Лечь (|P|g|D|n)",
L"Осмотреть (|C|t|r|l)",
L"Предыдущий боец",
L"Следующий боец (|П|p|o|б|e|л)",
L"Настройки (|O)",
L"Режим очереди (|B)",
L"Смотреть/Повернуться (|L)",
L"Здоровье: %d/%d\nЭнергия: %d/%d\nБоевой дух: %s",
L"Ну и?", //this means "what?"
L"Продолж.", // an abbrieviation for "Continued"
L"%s будет говорить.",
L"%s будет молчать.",
L"Состояние: %d/%d\nТопливо: %d/%d",
L"Выйти из машины",
L"Сменить отряд (|S|h|i|f|t |П|p|о|б|e|л)",
L"Ехать",
L"Н/Д", //this is an acronym for "Not Applicable."
L"Рукопашный бой",
L"Применить оружие",
L"Воспользоваться ножом",
L"Использовать взрывчатку",
L"Воспользоваться аптечкой",
L"(Ловит)",
L"(Перезарядка)",
L"(Дать)",
L"Сработала %s.", // The %s here is a string from pDoorTrapStrings ASSUME all traps are female gender
L"%s прибыл(а).",
L"%s: истратил(а) все очки действия.",
L"%s сейчас не может действовать.",
L"%s перевязан(а).",
L"%s: закончились бинты.",
L"Враг в секторе!",
L"Врагов в поле зрения нет.",
L"Недостаточно очков действия.",
L"Оденьте на голову одного из наемников пульт управления роботом.",
L"Последняя очередь опустошила магазин!",
L"СОЛДАТ",
L"РЕПТИОН",
L"ОПОЛЧЕНЕЦ",
L"ЖИТЕЛЬ",
L"Выход из сектора",
L"ДА",
L"ОТМЕНА",
L"Выбранный боец",
L"Все бойцы отряда",
L"Идти в сектор",
L"Идти на карту",
L"Этот сектор отсюда покинуть нельзя.",
L"%s слишком далеко.",
L"Скрыть кроны деревьев",
L"Показать кроны деревьев",
L"ВОРОНА", //Crow, as in the large black bird
L"ШЕЯ",
L"ГОЛОВА",
L"ТОРС",
L"НОГИ",
L"Рассказать Королеве то, что она хочет знать?",
L"Регистрация отпечатков пальцев пройдена.",
L"Неопознанные отпечатки пальцев. Оружие заблокировано.",
L"Цель захвачена",
L"Путь заблокирован",
L"Положить/Снять деньги", // Help text over the $ button on the Single Merc Panel
L"Никто не нуждается в медицинской помощи.",
L"отказ", // Short form of JAMMED, for small inv slots
L"Туда вскарабкаться невозможно.", // used ( now ) for when we click on a cliff
L"Путь блокирован. Хотите поменяться местами с этим человеком?",
L"Человек отказывается двигаться.",
// In the following message, '%s' would be replaced with a quantity of money (e.g. $200)
L"Вы согласны заплатить %s?",
L"Принять бесплатное лечение?",
L"Согласиться выйти замуж за Дэррела?",
L"Связка ключей",
L"С эскортируемыми этого сделать нельзя.",
L"Пощадить сержанта?",
L"За пределами прицельной дальности.",
L"Шахтер",
L"Машина может ездить только между секторами.",
L"Ни у кого из наемников нет аптечки",
L"Путь для %s заблокирован",
L"Ваши бойцы, захваченные армией Дейдраны, томятся здесь в плену!",
L"Замок поврежден.",
L"Замок разрушен.",
L"Кто-то с другой стороны пытается открыть эту дверь.",
L"Состояние: %d/%d\nТопливо: %d/%d",
L"%s не видит %s.", // Cannot see person trying to talk to
L"Навеска снята",
L"Вы не можете содержать еще одну машину, довольствуйтесь уже имеющимися двумя.",
};
//Varying helptext explains (for the "Go to Sector/Map" checkbox) what will happen given different circumstances in the "exiting sector" interface.
STR16 pExitingSectorHelpText[] =
{
//Helptext for the "Go to Sector" checkbox button, that explains what will happen when the box is checked.
L"Если выбрано, то карта соседнего сектора будет сразу же загружена.",
L"Если выбрано, то вы автоматически попадете на экран карты,\nтак как путешествие займет некоторое время.",
//If you attempt to leave a sector when you have multiple squads in a hostile sector.
L"Этот сектор оккупирован врагом, и вы не можете выйти отсюда.\nВы должны разобраться с этим, прежде чем перейти в любой другой сектор.",
//Because you only have one squad in the sector, and the "move all" option is checked, the "go to sector" option is locked to on.
//The helptext explains why it is locked.
L"Как только оставшиеся наемники покинут этот сектор,\nсразу будет загружен соседний сектор.",
L"Выведя оставшихся наемников из этого сектора,\nвы автоматически попадете на экран карты,\nтак как на путешествие потребуется некоторое время.",
//If an EPC is the selected merc, it won't allow the merc to leave alone as the merc is being escorted. The "single" button is disabled.
L"%s нуждается в сопровождении ваших наемников и не может в одиночку покинуть сектор.",
//If only one conscious merc is left and is selected, and there are EPCs in the squad, the merc will be prohibited from leaving alone.
//There are several strings depending on the gender of the merc and how many EPCs are in the squad.
//DO NOT USE THE NEWLINE HERE AS IT IS USED FOR BOTH HELPTEXT AND SCREEN MESSAGES!
L"%s не может покинуть сектор один, так как он сопровождает %s.", //male singular
L"%s не может покинуть сектор одна, так как она сопровождает %s.", //female singular
L"%s не может покинуть сектор один, так как он сопровождает группу из нескольких человек.", //male plural
L"%s не может покинуть сектор одна, так как она сопровождает группу из нескольких человек.", //female plural
//If one or more of your mercs in the selected squad aren't in range of the traversal area, then the "move all" option is disabled,
//and this helptext explains why.
L"Все ваши наемники должны быть в машине,\nчтобы отряд смог отправиться в место назначения.",
L"", //UNUSED
//Standard helptext for single movement. Explains what will happen (splitting the squad)
L"Если выбрать, то %s отправится в одиночку\nи автоматически будет переведен в отдельный отряд.",
//Standard helptext for all movement. Explains what will happen (moving the squad)
L"Если выбрать, данный отряд отправится\nв место назначения, покинув этот сектор.",
//This strings is used BEFORE the "exiting sector" interface is created. If you have an EPC selected and you attempt to tactically
//traverse the EPC while the escorting mercs aren't near enough (or dead, dying, or unconscious), this message will appear and the
//"exiting sector" interface will not appear. This is just like the situation where
//This string is special, as it is not used as helptext. Do not use the special newline character (\n) for this string.
L"%s сопровождается вашими наемниками и не может покинуть этот сектор в одиночку. Остальные наемники должны быть рядом, прежде чем вы сможете покинуть сектор.",
};
STR16 pRepairStrings[] =
{
L"Предметы", // tell merc to repair items in inventory
L"База ПВО", // tell merc to repair SAM site - SAM is an acronym for Surface to Air Missile
L"Отмена", // cancel this menu
L"Робот", // repair the robot
};
// NOTE: combine prestatbuildstring with statgain to get a line like the example below.
// "John has gained 3 points of marksmanship skill."
STR16 sPreStatBuildString[] =
{
L"теряет", // the merc has lost a statistic
L"получает", // the merc has gained a statistic
L"единицу", // singular
L"единиц", // plural
L"уровень", // singular
L"уровня", // plural
};
STR16 sStatGainStrings[] =
{
L"здоровья.",
L"проворности.",
L"ловкости.",
L"интеллекта.",
L"медицины.",
L"взрывного дела.",
L"механики.",
L"меткости.",
L"опыта.",
L"силы.",
L"лидерства.",
};
STR16 pHelicopterEtaStrings[] =
{
L"Общая дистанция:", // total distance for helicopter to travel
L"Безопасно: ", // distance to travel to destination
L"Опасно:", // distance to return from destination to airport
L"Итого:", // total cost of trip by helicopter
L"ОВП:", // ETA is an acronym for "estimated time of arrival"
L"У вертолета закончилось топливо. Придется совершить посадку на вражеской территории!", // warning that the sector the helicopter is going to use for refueling is under enemy control ->
L"Пассажиры:",
L"Выбрать вертолет или точку высадки?",
L"Вертолет",
L"Высадка",
};
STR16 sMapLevelString[] =
{
L"Подуровень:", // what level below the ground is the player viewing in mapscreen
};
STR16 gsLoyalString[] =
{
L"Лояльность", // the loyalty rating of a town ie : Loyal 53%
};
// error message for when player is trying to give a merc a travel order while he's underground.
STR16 gsUndergroundString[] =
{
L"не может выйти на марш в подземельях.",
};
STR16 gsTimeStrings[] =
{
L"ч", // hours abbreviation
L"м", // minutes abbreviation
L"с", // seconds abbreviation
L"д", // days abbreviation
};
// text for the various facilities in the sector
STR16 sFacilitiesStrings[] =
{
L"Нет", //важные объекты сектора
L"Госпиталь",
L"Завод", //Factory
L"Тюрьма",
L"Военная база",
L"Аэропорт",
L"Стрельбище", // a field for soldiers to practise their shooting skills
};
// text for inventory pop up button
STR16 pMapPopUpInventoryText[] =
{
L"Инвентарь",
L"Выйти",
};
// town strings
STR16 pwTownInfoStrings[] =
{
L"Размер", // 0 // size of the town in sectors
L"", // blank line, required
L"Контроль", // how much of town is controlled
L"Нет", // none of this town
L"Шахта города", // mine associated with this town
L"Лояльность", // 5 // the loyalty level of this town
L"Готовы", // the forces in the town trained by the player
L"",
L"Важные объекты", // main facilities in this town
L"Уровень", // the training level of civilians in this town
L"Тренировка ополчения", // 10 // state of civilian training in town
L"Ополчение", // the state of the trained civilians in the town
L"Тренинг мобильных групп", // HEADROCK HAM 3.6: The stat of Mobile militia training in town //Mobile Training
};
// Mine strings
STR16 pwMineStrings[] =
{
L"Шахта", // 0
L"Серебро",
L"Золото",
L"Дневная выработка",
L"Производственные возможности",
L"Заброшена", // 5
L"Закрыта",
L"Истощается",
L"Идет добыча",
L"Статус",
L"Уровень добычи",
L"Тип руды", // 10
L"Принадлежность",
L"Лояльность",
// L"Работ.шахтеры",
};
// blank sector strings
STR16 pwMiscSectorStrings[] =
{
L"Вражеские силы",
L"Сектор",
L"Количество предметов",
L"Неизвестно",
L"Под контролем",
L"Да",
L"Нет",
};
// error strings for inventory
STR16 pMapInventoryErrorString[] =
{
L"%s слишком далеко.", //Merc is in sector with item but not close enough
L"Нельзя выбрать этого бойца.", //MARK CARTER
L"%s вне этого сектора, и не может подобрать предмет.",
L"Во время боя вам придется подбирать вещи с земли.",
L"Во время боя вам придется выкладывать вещи на землю на тактической карте.",
L"%s вне этого сектора, и не может оставить предмет.",
L"Во время битвы вы не можете заряжать оружие патронами из короба.",
};
STR16 pMapInventoryStrings[] =
{
L"Локация", // sector these items are in
L"Всего предметов", // total number of items in sector
};
// help text for the user
STR16 pMapScreenFastHelpTextList[] =
{
L"Чтобы перевести наемника в другой отряд, назначить его врачом или отдать приказ ремонтировать вещи, щелкните по колонке 'ЗАНЯТИЕ'.",
L"Чтобы приказать наемнику перейти в другой сектор, щелкните в колонке 'КУДА'.",
L"Как только наемник получит приказ на передвижение, включится сжатие времени.",
L"Нажатием левой кнопки мыши выбирается сектор. Еще одно нажатие нужно, чтобы отдать наемникам приказы на передвижение. Нажатие правой кнопки мыши на секторе откроет экран дополнительной информации.",
L"Чтобы вызвать экран помощи - в любой момент времени нажмите 'h'.",
L"Тестовый текст",
L"Тестовый текст",
L"Тестовый текст",
L"Тестовый текст",
L"Вы практически ничего не сможете сделать на этом экране, пока не прибудете в Арулько. Когда познакомитесь со своей командой, включите сжатие времени (кнопки в правом нижнем углу). Это ускорит течение времени, пока ваша команда не прибудет в Арулько.",
};
// movement menu text
STR16 pMovementMenuStrings[] =
{
L"Отправить наемников в сектор", // title for movement box
L"Путь", // done with movement menu, start plotting movement
L"Отмена", // cancel this menu
L"Другое", // title for group of mercs not on squads nor in vehicles
};
STR16 pUpdateMercStrings[] =
{
L"Ой!:", // an error has occured
L"Срок контракта истек:", // this pop up came up due to a merc contract ending
L"Задание выполнили:", // this pop up....due to more than one merc finishing assignments
L"Бойцы вернулись к своим обязанностям:", // this pop up ....due to more than one merc waking up and returing to work
L"Бойцы ложатся спать:", // this pop up ....due to more than one merc being tired and going to sleep
L"Скоро закончатся контракты у:", // this pop up came up due to a merc contract ending
};
// map screen map border buttons help text
STR16 pMapScreenBorderButtonHelpText[] =
{
L"Населенные пункты (|W)",
L"Шахты (|M)",
L"Отряды и враги (|T)",
L"Карта воздушного пространства (|A)",
L"Вещи (|I)",
L"Ополчение и враги (|Z)",
L"Мобильные группы ополченцев (|R)", //HAM 4: Show Mobile Militia Restrictions
};
STR16 pMapScreenInvenButtonHelpText[] =
{
L"Next (|.)", // next page // TODO.Translate
L"Previous (|,)", // previous page // TODO.Translate
L"Exit Sector Inventory (|E|s|c)", // exit sector inventory // TODO.Translate
};
STR16 pMapScreenBottomFastHelp[] =
{
L"Лэптоп (|L)",
L"Тактический экран (|E|s|c)",
L"Настройки (|O)",
L"Сжатие времени (|+)", // time compress more
L"Сжатие времени (|-)", // time compress less
L"Предыдущее сообщение (|С|т|р|е|л|к|а |в|в|е|р|х)\nПредыдущая страница (|P|g|U|p)", // previous message in scrollable list
L"Следующее сообщение (|С|т|р|е|л|к|а |в|н|и|з)\nСледующая страница (|P|g|D|n)", // next message in the scrollable list
L"Включить / выключить\nсжатие времени (|П|р|о|б|е|л)", // start/stop time compression
};
STR16 pMapScreenBottomText[] =
{
L"Текущий баланс", // current balance in player bank account
};
STR16 pMercDeadString[] =
{
L"%s мертв(а)",
};
STR16 pDayStrings[] =
{
L"День",
};
// the list of email sender names
CHAR16 pSenderNameList[500][128] =
{
L"",
};
/*
{
L"Энрико",
L"Psych Pro Inc.",
L"Помощь",
L"Psych Pro Inc.",
L"Спек",
L"R.I.S.", //5
L"Барри",
L"Блад",
L"Рысь",
L"Гризли",
L"Вики", //10
L"Тревор",
L"Грунти (Хряп)",
L"Иван",
L"Анаболик",
L"Игорь", //15
L"Тень",
L"Рыжий",
L"Жнец (Потрошитель)",
L"Фидель",
L"Лиска", //20
L"Сидней",
L"Гас",
L"Сдоба",
L"Айс",
L"Паук", //25
L"Скала (Клифф)",
L"Бык",
L"Стрелок",
L"Тоска",
L"Рейдер", //30
L"Сова",
L"Статик",
L"Лен",
L"Дэнни",
L"Маг",
L"Стефан",
L"Лысый",
L"Злобный",
L"Доктор Кью",
L"Гвоздь",
L"Тор",
L"Стрелка",
L"Волк",
L"ЭмДи",
L"Лава",
//----------
L"M.I.S. Страховка",
L"Бобби Рэй",
L"Босс",
L"Джон Кульба",
L"А.I.М.",
};
*/
// next/prev strings
STR16 pTraverseStrings[] =
{
L"<<",
L">>",
};
// new mail notify string
STR16 pNewMailStrings[] =
{
L"Получена новая почта...",
};
// confirm player's intent to delete messages
STR16 pDeleteMailStrings[] =
{
L"Удалить письмо?",
L"Удалить, НЕ ПРОЧИТАВ?",
};
// the sort header strings
STR16 pEmailHeaders[] =
{
L"От:",
L"Тема:",
L"День:",
};
// email titlebar text
STR16 pEmailTitleText[] =
{
L"Почтовый ящик",
};
// the financial screen strings
STR16 pFinanceTitle[] =
{
L"Финансовый отчет", //the name we made up for the financial program in the game
};
STR16 pFinanceSummary[] =
{
L"Доход:", // credit (subtract from) to player's account
L"Расход:", // debit (add to) to player's account
L"Вчерашний чистый доход:",
L"Вчерашние другие поступления:",
L"Вчерашний расход:",
L"Баланс на конец дня:",
L"Чистый доход сегодня:",
L"Другие поступления за сегодня:",
L"Расход за сегодня:",
L"Текущий баланс:",
L"Ожидаемый доход:",
L"Ожидаемый баланс:", // projected balance for player for tommorow
};
// headers to each list in financial screen
STR16 pFinanceHeaders[] =
{
L"День", // the day column
L"Доход", // the credits column
L"Расход", // the debits column
L"Операции", // transaction type - see TransactionText below
L"Баланс", // balance at this point in time
L"Стр.", // page number
L"Дней", // the day(s) of transactions this page displays
};
STR16 pTransactionText[] =
{
L"Начисленный процент", // interest the player has accumulated so far
L"Анонимный взнос",
L"Перевод средств",
L"Нанят", // Merc was hired
L"Покупки у Бобби Рэя", // Bobby Ray is the name of an arms dealer
L"Оплата счета M.E.R.C.",
L"%s: страховка.", // medical deposit for merc
L"I.M.P.: Анализ профиля", // IMP is the acronym for International Mercenary Profiling
L"%s: куплена страховка.",
L"%s: Страховка уменьшена",
L"%s: Продление страховки", // johnny contract extended
L"для %s: Страховка аннулирована",
L"%s: Требуется страховка", // insurance claim for merc
L"1 день", // merc's contract extended for a day
L"7 дней", // merc's contract extended for a week
L"14 дней", // ... for 2 weeks
L"Доход шахты",
L"", //String nuked
L"Куплены цветы",
L"%s: Возврат мед. депозита",
L"%s: Остаток мед. депозита",
L"%s: Мед. депозит удержан",
L"%s: оплата услуг.", // %s is the name of the npc being paid
L"%s берет наличные.", // transfer funds to a merc
L"%s: переводит деньги.", // transfer funds from a merc
L"%s: оружие ополчению.", // initial cost to equip a town's militia
L"%s продал вам вещи.", //is used for the Shop keeper interface. The dealers name will be appended to the end of the string.
L"%s кладет наличные на счет.",
L"Снаряжение продано населению",
L"Оснащение персонала", // HEADROCK HAM 3.6 //Facility Use
L"Содержание ополчения", // HEADROCK HAM 3.6 //Militia upkeep
};
STR16 pTransactionAlternateText[] =
{
L"Страховка для", // insurance for a merc
L"%s: контракт продлен на 1 день.", // entend mercs contract by a day
L"%s: контракт продлен на 7 дней.",
L"%s: контракт продлен на 14 дней.",
};
// helicopter pilot payment
STR16 pSkyriderText[] =
{
L"Небесному Всаднику заплачено $%d", // skyrider was paid an amount of money
L"Вы все еще должны Небесному Всаднику $%d.", // skyrider is still owed an amount of money
L"Небесный Всадник завершил заправку.", // skyrider has finished refueling
L"",//unused
L"",//unused
L"Небесный Всадник готов к полету.", // Skyrider was grounded but has been freed
L"У Небесного Всадника нет пассажиров. Если вы хотите переправить бойцов в этот сектор, посадите их в вертолет (приказ 'Машина/Вертолет')."
};
// strings for different levels of merc morale
STR16 pMoralStrings[] =
{
L"Отлично",
L"Хорошо",
L"Норма",
L"Низкая",
L"Паника",
L"Ужас",
};
// Mercs equipment has now arrived and is now available in Omerta or Drassen.
STR16 pLeftEquipmentString[] =
{
L"%s оставляет свою экипировку в Омерте (A9).", //%s может взять заказанную экипировку в Омерте (A9).
L"%s оставляет свою экипировку в Драссене (B13).", //%s может взять заказанную экипировку в Драссене (B13).
};
// Status that appears on the Map Screen
STR16 pMapScreenStatusStrings[] =
{
L"Здоровье",
L"Энергия",
L"Боевой дух",
L"Состояние", // the condition of the current vehicle (its "health")
L"Бензин", // the fuel level of the current vehicle (its "energy")
};
STR16 pMapScreenPrevNextCharButtonHelpText[] =
{
L"Предыдущий боец\n(|С|т|р|е|л|к|а |В|л|е|в|о)", // previous merc in the list
L"Следующий боец\n(|С|т|р|е|л|к|а |В|п|р|а|в|о)", // next merc in the list
};
STR16 pEtaString[] =
{
L"РВП:", // eta is an acronym for Estimated Time of Arrival
};
STR16 pTrashItemText[] =
{
L"Вы больше никогда не увидите этот предмет. Уверены?", // do you want to continue and lose the item forever
L"Этот предмет кажется ОЧЕНЬ важным. Вы ДЕЙСТВИТЕЛЬНО хотите выбросить его?", // does the user REALLY want to trash this item
};
STR16 pMapErrorString[] =
{
L"Отряд не может выйти на марш, когда один из наемников спит.",
//1-5
L"Сначала выведите отряд на поверхность.",
L"Выйти на марш? Да тут же враги повсюду!",
L"Чтобы выйти на марш, наемники должны быть назначены в отряд или посажены в машину.",
L"У вас еще нет ни одного бойца.", // you have no members, can't do anything
L"Наемник не может выполнить.", // merc can't comply with your order
//6-10
L"нуждается в сопровождении чтобы идти. Назначьте его с кем-нибудь в отряд.", // merc can't move unescorted .. for a male
L"нуждается в сопровождении чтобы идти. Назначьте ее с кем-нибудь в отряд.", // for a female
#ifdef JA2UB
L"Наёмник ещё не прибыл в Tracona!",
#else
L"Наёмник ещё не прибыл в Арулько!",
#endif
L"Кажется, сначала надо уладить проблемы с контрактом.",
L"Бежать от самолета? Только после вас!", // Cannot give a movement order. Air raid is going on.
//11-15
L"Выступить на марш? Да у нас тут бой идет!",
L"Вы попали в засаду кошек-убийц в секторе %s!",
L"Вы только что вошли в сектор %s... И наткнулись на логово кошек-убийц!",
L"",
L"База ПВО в %s была захвачена.",
//16-20
L"Шахта в %s была захвачена врагом. Ваш дневной доход сократился до %s в день.",
L"Враг занял без сопротивления сектор %s.",
L"Как минимум один из ваших бойцов не может выполнить этот приказ.",
L"%s не может присоединиться к %s - нет места.",
L"%s не может присоединиться к %s - слишком большое расстояние.",
//21-25
L"Шахта в %s была захвачена войсками Дейдраны!",
L"Войска Дейдраны только что вторглись на базу ПВО в %s.",
L"Войска Дейдраны только что вторглись в %s.",
L"Войска Дейдраны были замечены в %s.",
L"Войска Дейдраны только что захватили %s.",
//26-30
L"Как минимум один из ваших бойцов не хочет спать.",
L"Как минимум один из ваших бойцов не может проснуться.",
L"Ополченцы не появятся, пока не завершат тренировку.",
L"%s сейчас не в состоянии принять приказ о перемещении.",
L"Ополченцы вне границ города не могут перейти в другой сектор.",
//31-35
L"Вы не можете держать ополченцев в %s.",
L"Пустая машина не может двигаться!",
L"%s из-за тяжелых ранений не может идти!",
L"Сначала вам нужно покинуть музей!",
L"%s мертв(а)!",
//36-40
L"%s не может переключиться на %s, так как находится в движении.",
L"%s не может сесть в машину с этой стороны.",
L"%s не может вступить в %s",
L"Вы не можете включить сжатие времени, пока не наймете новых бойцов!",
L"Эта машина может двигаться только по дорогам!",
//41-45
L"Вы не можете переназначить наемников на марше.",
L"У машины закончился бензин!",
L"%s еле волочит ноги и идти не может.",
L"Ни один из пассажиров не в состоянии вести машину.",
L"Один или несколько наемников из этого отряда не могут сейчас двигаться.",
//46-50
L"Один или несколько наемников не могут сейчас двигаться.",
L"Машина сильно повреждена!",
L"Внимание! Тренировать ополченцев в одном секторе могут не более двух наемников.",
L"Роботом обязательно нужно управлять. Назначьте наемника с пультом и робота в один отряд.",
};
// help text used during strategic route plotting
STR16 pMapPlotStrings[] =
{
L"Еще раз щелкните по точке назначения, чтобы подтвердить путь или щелкните по другому сектору, чтобы установить больше путевых точек.",
L"Путь движения подтвержден.",
L"Точка назначения не изменена.",
L"Путь движения отменен.",
L"Путь сокращен.",
};
// help text used when moving the merc arrival sector
STR16 pBullseyeStrings[] =
{
L"Выберите сектор, в который прибудут наемники.",
L"Вновь прибывшие наемники высадятся в %s.",
L"Высадить здесь наемников нельзя. Воздушное пространство не безопасно!",
L"Отменено. Сектор прибытия не изменился.",
L"Небо над %s более не безопасно! Место высадки было перемещено в %s.",
};
// help text for mouse regions
STR16 pMiscMapScreenMouseRegionHelpText[] =
{
L"Показать снаряжение (|В|в|о|д)",
L"Выкинуть предмет",
L"Скрыть снаряжение (|В|в|о|д)",
};
// male version of where equipment is left
STR16 pMercHeLeaveString[] =
{
L"Должен ли %s оставить свою амуницию здесь (в %s) или позже в Драссене (B13) перед отлетом?",
L"Должен ли %s оставить свою амуницию здесь (в %s) или позже в Омерте (A9) перед отлетом?",
L"скоро уходит и оставит свою амуницию в Омерте (А9).",
L"скоро уходит и оставит свою амуницию в Драссене (B13).",
L"%s скоро уходит и оставит свою амуницию в %s.",
};
// female version
STR16 pMercSheLeaveString[] =
{
L"Должна ли %s оставить свою амуницию здесь (в %s) или позже в Драссене (B13) перед отлетом?",
L"Должна ли %s оставить свою амуницию здесь (в %s) или позже в Омерте (A9) перед отлетом?",
L"скоро уходит и оставит свою амуницию в Омерте (А9).",
L"скоро уходит и оставит свою амуницию в Драссене (B13).",
L"%s скоро уходит и оставит свою амуницию в %s.",
};
STR16 pMercContractOverStrings[] =
{
L"отправляется домой, так как его контракт завершен.", // merc's contract is over and has departed
L"отправляется домой, так как ее контракт завершен.", // merc's contract is over and has departed
L"уходит, так как его контракт был прерван.", // merc's contract has been terminated
L"уходит, так как ее контракт был прерван.", // merc's contract has been terminated
L"Вы должны M.E.R.C. слишком много денег, так что %s уходит.", // Your M.E.R.C. account is invalid so merc left
};
// Text used on IMP Web Pages
STR16 pImpPopUpStrings[] =
{
L"Неверный код доступа.",
L"Это приведет к потере уже полученных результатов тестирования. Вы уверены?",
L"Введите правильное имя и укажите пол.",
L"Предварительный анализ вашего счета показывает, что вы не можете позволить себе пройти тестирование.",
L"Сейчас вы не можете выбрать этот пункт.",
L"Чтобы закончить анализ, нужно иметь место еще хотя бы для одного члена команды.",
L"Профиль уже создан.",
L"Не могу загрузить I.M.P.-персонаж с диска.",
L"Вы достигли максимального количества I.M.P.-персонажей.",
L"У вас в команде уже есть три I.M.P.-персонажа того же пола.",
L"Вы не можете позволить себе такой I.M.P.-персонаж.",
L"Новый I.M.P.-персонаж присоединился к команде.",
};
// button labels used on the IMP site
STR16 pImpButtonText[] =
{
L"Информация о нас", // about the IMP site
L"НАЧАТЬ", // begin profiling
L"Способности", //Skills
L"Характеристики", // personal stats/attributes section
L"Внешность", // Appearance
L"Голос: %d", // the voice selection
L"Готово", // done profiling
L"Начать сначала", // start over profiling
L"Да, я выбираю отмеченный ответ.",
L"Да",
L"Нет",
L"Готово", // finished answering questions
L"Назад", // previous question..abbreviated form
L"Дальше", // next question
L"ДА.", // yes, I am certain
L"НЕТ, Я ХОЧУ НАЧАТЬ СНОВА.", // no, I want to start over the profiling process
L"ДА",
L"НЕТ",
L"Назад", // back one page
L"Отменить", // cancel selection
L"Да, все верно.",
L"Нет, еще раз взгляну.",
L"Регистрация", // the IMP site registry..when name and gender is selected
L"Анализ данных", // analyzing your profile results
L"Готово",
L"Личные качества", // Character
};
STR16 pExtraIMPStrings[] =
{
// These texts have been also slightly changed
L"Теперь, когда формирование внешности и личных качеств завершён, укажите ваши способности.", //With your character traits chosen, it is time to select your skills.
L"Для завершения, выберите свои характеристики.", //To complete the process, select your attributes.
L"Для начала, подберите наиболее подходящее вам лицо, голос, телосложение и соответствующую расцветку.", //To commence actual profiling, select portrait, voice and colors.
L"Теперь, когда вы завершили формирование своей внешности, перейдём к анализу ваших личных качеств.", //Now that you have completed your appearence choice, procced to character analysis.
};
STR16 pFilesTitle[] =
{
L"Просмотр данных",
};
STR16 pFilesSenderList[] =
{
L"Отчет разведки", // the recon report sent to the player. Recon is an abbreviation for reconissance
L"В розыске №1", // first intercept file .. Intercept is the title of the organization sending the file...similar in function to INTERPOL/CIA/KGB..refer to fist record in files.txt for the translated title
L"В розыске №2", // second intercept file
L"В розыске №3", // third intercept file
L"В розыске №4", // fourth intercept file
L"В розыске №5", // fifth intercept file
L"В розыске №6", // sixth intercept file
};
// Text having to do with the History Log
STR16 pHistoryTitle[] =
{
L"Журнал событий",
};
STR16 pHistoryHeaders[] =
{
L"День", // the day the history event occurred
L"Стр.", // the current page in the history report we are in
L"День", // the days the history report occurs over
L"Локация", // location (in sector) the event occurred
L"Событие", // the event label
};
// various history events
// THESE STRINGS ARE "HISTORY LOG" STRINGS AND THEIR LENGTH IS VERY LIMITED.
// PLEASE BE MINDFUL OF THE LENGTH OF THESE STRINGS. ONE WAY TO "TEST" THIS
// IS TO TURN "CHEAT MODE" ON AND USE CONTROL-R IN THE TACTICAL SCREEN, THEN
// GO INTO THE LAPTOP/HISTORY LOG AND CHECK OUT THE STRINGS. CONTROL-R INSERTS
// MANY (NOT ALL) OF THE STRINGS IN THE FOLLOWING LIST INTO THE GAME.
STR16 pHistoryStrings[] =
{
L"", // leave this line blank
//1-5
L"Нанят(а) %s из A.I.M.", // merc was hired from the aim site
L"Нанят(а) %s из M.E.R.C.", // merc was hired from the aim site
L"%s мертв(а).", // merc was killed
L"Оплачены услуги M.E.R.C.", // paid outstanding bills at MERC
L"Принято задание от Энрико Чивалдори",
//6-10
L"Воспользовались услугами I.M.P.",
L"Оформлена страховка для %s.", // insurance contract purchased
L"%s: cтраховой контракт аннулирован.", // insurance contract canceled
L"Выплата страховки %s.", // insurance claim payout for merc
L"%s: контракт продлен на 1 день.", // Extented "mercs name"'s for a day
//11-15
L"%s: контракт продлен на 7 дней.", // Extented "mercs name"'s for a week
L"%s: контракт продлен на 14 дней.", // Extented "mercs name"'s 2 weeks
L"Вы уволили %s.", // "merc's name" was dismissed.
L"%s уходит от вас.", // "merc's name" quit.
L"получено задание.", // a particular quest started
//16-20
L"задание выполнено.",
L"Поговорили со старшим горняком города %s", // talked to head miner of town
L"%s освобожден(а).",
L"Включен режим чит-кодов",
L"Провизия будет доставлена в Омерту завтра.",
//21-25
L"%s ушла, чтобы выйти замуж за Дерила Хика.",
L"Истек контракт у %s.",
L"Нанят(а) %s.",
L"Энрико сетует на отсутствие успехов в кампании.",
L"Победа в сражении!",
//26-30
L"В шахте %s иссякает запас руды.",
L"Шахта %s истощилась.",
L"Шахта %s закрыта.",
L"Шахта %s снова работает.",
L"Получена информация о тюрьме Тикса.",
//31-35
L"Узнали об Орте - секретном военном заводе.",
L"Ученый из Орты подарил вам ракетные винтовки.",
L"Королева Дейдрана нашла применение трупам.",
L"Фрэнк говорил что-то о боях в Сан-Моне.",
L"Пациенту кажется, что он что-то видел в шахтах.",
//36-40
L"Встретили Дэвина - торговца взрывчаткой.",
L"Пересеклись с бывшим наемником A.I.M., Майком!",
L"Встретили Тони, торговца оружием.",
L"Получена ракетная винтовка от сержанта Кротта.",
L"Документы на магазин Энджела переданы Кайлу.",
//41-45
L"Шиз предлагает построить робота.", //может, собрать робота?
L"Болтун может сделать варево, обманывающее жуков.",
L"Кит отошел от дел.",
L"Говард поставлял цианиды Дейдране.",
L"Встретили торговца Кита из Камбрии.",
//46-50
L"Встретили Говарда, фармацевта из Балайма.",
L"Встретили Перко. Он держит небольшую мастерскую.",
L"Встретили Сэма из Балайма. Он торгует железками.",
L"Франц разбирается в электронике и других вещах.",
L"Арнольд держит мастерскую в Граме.",
//51-55
L"Фредо из Грама чинит электронику.",
L"Один богатей из Балайма дал вам денег.",
L"Встретили старьевщика Джейка.",
L"Один бродяга дал нам электронную карточку.",
L"Вальтер подкуплен, он откроет дверь в подвал.",
//56-60
L"Дэйв заправит машину бесплатно, если будет бензин.",
L"Дали взятку Пабло.",
L"Босс держит деньги в шахте Сан-Моны.",
L"%s: победа в бое без правил.",
L"%s: проигрыш в бое без правил.",
//61-65
L"%s: дисквалификация в бое без правил.", //дисквалификация из боя?
L"В заброшенной шахте найдена куча денег.",
L"Встречен убийца, посланный Боссом.",
L"Потерян контроль над сектором", //ENEMY_INVASION_CODE
L"Отбита атака врага",
//66-70
L"Сражение проиграно", //ENEMY_ENCOUNTER_CODE
L"Смертельная засада", //ENEMY_AMBUSH_CODE
L"Вырвались из засады",
L"Атака провалилась!", //ENTERING_ENEMY_SECTOR_CODE
L"Успешная атака!",
//71-75
L"Атака тварей", //CREATURE_ATTACK_CODE
L"Кошки-убийцы уничтожили ваш отряд.", //BLOODCAT_AMBUSH_CODE
L"Все кошки-убийцы убиты",
L"%s был убит(а).",
L"Отдали Кармену голову террориста.",
L"Убийца ушёл.",
L"%s убит(а) вашим отрядом.",
};
STR16 pHistoryLocations[] =
{
L"Н/Д", // N/A is an acronym for Not Applicable
};
// icon text strings that appear on the laptop
STR16 pLaptopIcons[] =
{
L"Почта",
L"Сайты",
L"Финансы",
L"Команда",
L"Журнал",
L"Данные",
L"Выключить",
L"sir-FER 4.0", // our play on the company name (Sirtech) and web surFER
};
// bookmarks for different websites
// IMPORTANT make sure you move down the Cancel string as bookmarks are being added
STR16 pBookMarkStrings[] =
{
L"A.I.M.",
L"Бобби Рэй",
L"I.M.P.",
L"M.E.R.C.",
L"Похороны",
L"Цветы",
L"Страховка",
L"Oтмeнa",
L"Encyclopedia",
L"Briefing Room",
};
STR16 pBookmarkTitle[] =
{
L"Закладки",
L"Позже это меню можно вызвать правым щелчком мыши.",
};
// When loading or download a web page
STR16 pDownloadString[] =
{
L"Загрузка",
L"Обновление",
};
//This is the text used on the bank machines, here called ATMs for Automatic Teller Machine
STR16 gsAtmSideButtonText[] =
{
L"OK",
L"Взять", // take money from merc
L"Дать", // give money to merc
L"Отмена", // cancel transaction
L"Очист.", // clear amount being displayed on the screen
};
STR16 gsAtmStartButtonText[] =
{
L"Перевести $", // transfer money to merc -- short form
L"Параметры", // view stats of the merc
L"Снаряжение", // view the inventory of the merc
L"Контракт",
};
STR16 sATMText[ ]=
{
L"Перевести средства?", // transfer funds to merc?
L"Уверены?", // are we certain?
L"Ввести сумму", // enter the amount you want to transfer to merc
L"Выбрать тип", // select the type of transfer to merc
L"Не хватает денег", // not enough money to transfer to merc
L"Сумма должна быть кратна $10", // transfer amount must be a multiple of $10
};
// Web error messages. Please use foreign language equivilant for these messages.
// DNS is the acronym for Domain Name Server
// URL is the acronym for Uniform Resource Locator
STR16 pErrorStrings[] =
{
L"Ошибка",
L"Сервер не имеет записи DNS.",
L"Проверьте адрес и попробуйте ещё раз.",
L"OK", //Превышено время ожидания ответа сервера.
L"Обрыв соединения с сервером.",
};
STR16 pPersonnelString[] =
{
L"Бойцов:", // mercs we have
};
STR16 pWebTitle[ ]=
{
L"sir-FER 4.0", // our name for the version of the browser, play on company name
};
// The titles for the web program title bar, for each page loaded
STR16 pWebPagesTitles[] =
{
L"А.I.M.",
L"A.I.M. Состав",
L"A.I.M. Портреты", // a mug shot is another name for a portrait
L"A.I.M. Сортировка",
L"A.I.M.",
L"A.I.M. Галерея",
L"A.I.M. Правила",
L"A.I.M. История",
L"A.I.M. Ссылки",
L"M.E.R.C.",
L"M.E.R.C. Счета",
L"M.E.R.C. Регистрация",
L"M.E.R.C. Оглавление",
L"Бобби Рэй",
L"Бобби Рэй - оружие",
L"Бобби Рэй - боеприпасы",
L"Бобби Рэй - броня",
L"Бобби Рэй - разное", //misc is an abbreviation for miscellaneous
L"Бобби Рэй - вещи б/у.",
L"Бобби Рэй - почтовый заказ",
L"I.M.P.",
L"I.M.P.",
L"\"Цветы по всему миру\"",
L"\"Цветы по всему миру\" - галерея",
L"\"Цветы по всему миру\" - бланк заказа",
L"\"Цветы по всему миру\" - открытки",
L"Страховые агенты: Малеус, Инкус и Стэйпс",
L"Информация",
L"Контракт",
L"Комментарии",
L"Похоронная служба Макгилликатти",
L"",
L"Адрес не найден.",
L"Бобби Рэй - последние поступления",
L"Encyclopedia",
L"Encyclopedia - Data",
L"Briefing Room",
L"Briefing Room - Data",
};
STR16 pShowBookmarkString[] =
{
L"Подсказка",
L"Щелкните еще раз по кнопке \"Сайты\" для отображения меню сайтов.",
};
STR16 pLaptopTitles[] =
{
L"Почтовый ящик",
L"Просмотр данных",
L"Персонал",
L"Финансовый отчет",
L"Журнал",
};
STR16 pPersonnelDepartedStateStrings[] =
{
//reasons why a merc has left.
L"Погиб в бою",
L"Уволен",
L"Другое",
L"Вышла замуж",
L"Контракт истек",
L"Выход",
};
// personnel strings appearing in the Personnel Manager on the laptop
STR16 pPersonelTeamStrings[] =
{
L"В команде",
L"Выбывшие",
L"Гонорар за день:",
L"Высший гонорар:",
L"Низший гонорар:",
L"Погибло в боях:",
L"Уволено:",
L"Другое:",
};
STR16 pPersonnelCurrentTeamStatsStrings[] =
{
L"Худший",
L"Среднее",
L"Лучший",
};
STR16 pPersonnelTeamStatsStrings[] =
{
L"ЗДР",
L"ПРВ",
L"ЛОВ",
L"СИЛ",
L"ЛИД",
L"ИНТ",
L"ОПТ",
L"МЕТ",
L"МЕХ",
L"ВЗР",
L"МЕД",
};
// horizontal and vertical indices on the map screen
STR16 pMapVertIndex[] =
{
L"X",
L"A",
L"B",
L"C",
L"D",
L"E",
L"F",
L"G",
L"H",
L"I",
L"J",
L"K",
L"L",
L"M",
L"N",
L"O",
L"P",
};
STR16 pMapHortIndex[] =
{
L"X",
L"1",
L"2",
L"3",
L"4",
L"5",
L"6",
L"7",
L"8",
L"9",
L"10",
L"11",
L"12",
L"13",
L"14",
L"15",
L"16",
};
STR16 pMapDepthIndex[] =
{
L"",
L"-1",
L"-2",
L"-3",
};
// text that appears on the contract button
STR16 pContractButtonString[] =
{
L"Контракт",
};
// text that appears on the update panel buttons
STR16 pUpdatePanelButtons[] =
{
L"Далее",
L"Стоп",
};
// Text which appears when everyone on your team is incapacitated and incapable of battle
CHAR16 LargeTacticalStr[][ LARGE_STRING_LENGTH ] =
{
L"Вы потерпели поражение в этом секторе!",
L"Рептионы, не испытывая угрызений совести, пожрут всех до единого!",
L"Ваши бойцы захвачены в плен (некоторые без сознания)!",
L"Ваши бойцы захвачены в плен.",
};
//Insurance Contract.c
//The text on the buttons at the bottom of the screen.
STR16 InsContractText[] =
{
L"Назад",
L"Дальше",
L"Да",
L"Очистить",
};
//Insurance Info
// Text on the buttons on the bottom of the screen
STR16 InsInfoText[] =
{
L"Назад",
L"Дальше",
};
//For use at the M.E.R.C. web site. Text relating to the player's account with MERC
STR16 MercAccountText[] =
{
// Text on the buttons on the bottom of the screen
L"Внести сумму",
L"В начало",
L"Номер счета:",
L"Наемник",
L"Дней",
L"Ставка",
L"Стоимость",
L"Всего:",
L"Вы подтверждаете платеж в размере %s?", //the %s is a string that contains the dollar amount ( ex. "$150" )
};
// Merc Account Page buttons
STR16 MercAccountPageText[] =
{
// Text on the buttons on the bottom of the screen
L"Назад",
L"Дальше",
};
//For use at the M.E.R.C. web site. Text relating a MERC mercenary
STR16 MercInfo[] =
{
L"Здоровье",
L"Проворность",
L"Ловкость",
L"Сила",
L"Лидерство",
L"Интеллект",
L"Уровень опыта",
L"Меткость",
L"Механика",
L"Взрывчатка",
L"Медицина",
L"Назад",
L"Нанять",
L"Дальше",
L"Дополнительная информация",
L"В начало",
L"Нанят",
L"Oплaтa",
L"в день",
L"Погиб",
L"Похоже, вы пытаетесь нанять более 18 наемников, а это недопустимо.",
L"Недоступно",
};
// For use at the M.E.R.C. web site. Text relating to opening an account with MERC
STR16 MercNoAccountText[] =
{
//Text on the buttons at the bottom of the screen
L"Открыть счет",
L"Отмена",
L"Вы еще не зарегистрировались. Желаете открыть счет?",
};
// For use at the M.E.R.C. web site. MERC Homepage
STR16 MercHomePageText[] =
{
//Description of various parts on the MERC page
L"Спек Т. Кляйн, основатель и хозяин",
L"Открыть счет",
L"Просмотр счета",
L"Просмотр файлов",
// The version number on the video conferencing system that pops up when Speck is talking
L"Speck Com v3.2",
L"Денежный перевод не состоялся. Недостаточно средств на счету.", // TODO.Translate
};
// For use at MiGillicutty's Web Page.
STR16 sFuneralString[] =
{
L"Похоронное агентство Макгилликатти: скорбим вместе с семьями усопших с 1983.",
L"Директор по похоронам и бывший наемник А.I.М. - Мюррэй Макгилликатти \"Папаша\", специалист по части похорон.",
L"Всю жизнь Папашу сопровождали смерть и утраты, поэтому он, как никто, познал их тяжесть.",
L"Похоронное агентство Макгилликатти предлагает широкий спектр ритуальных услуг - от жилетки, в которую можно поплакать, до восстановления сильно поврежденных останков.",
L"Похоронное агентство Макгилликатти поможет вам и вашим родственникам покоиться с миром.",
// Text for the various links available at the bottom of the page
L"ДОСТАВКА ЦВЕТОВ",
L"КОЛЛЕКЦИЯ УРН И ГРОБОВ",
L"УСЛУГИ ПО КРЕМАЦИИ",
L"ПОМОЩЬ В ПРОВЕДЕНИИ ПОХОРОН",
L"ПОХОРОННЫЕ РИТУАЛЫ",
// The text that comes up when you click on any of the links ( except for send flowers ).
L"К сожалению, наш сайт не закончен, в связи с утратой в семье. Мы постараемся продолжить работу после прочтения завещания и выплат долгов умершего. Сайт вскоре откроется.",
L"Мы искренне сочувствуем вам в это трудное время. Заходите еще.",
};
// Text for the florist Home page
STR16 sFloristText[] =
{
//Text on the button on the bottom of the page
L"Галерея",
//Address of United Florist
L"\"Мы сбросим ваш букет где угодно!\"",
L"1-555-SCENT-ME",
L"333 NoseGay Dr,Seedy City, CA USA 90210",
L"http://www.scent-me.com",
// detail of the florist page
L"Мы работаем быстро и эффективно!",
L"Гарантируем доставку на следующий день практически в любой уголок мира. Есть некоторые ограничения.",
L"Гарантируем самые низкие цены в мире!",
L"Покажите нам рекламу более дешевого сервиса и получите 10 бесплатных роз.",
L"\"Крылатая Флора\", занимаемся фауной и цветами с 1981 г.",
L"Наши летчики, бывшие пилоты бомбардировщиков, сбросят ваш букет в радиусе 10 миль от заданного района. Когда угодно и сколько угодно!",
L"Позвольте нам удовлетворить ваши цветочные фантазии.",
L"Пусть Брюс, известный во всем мире садовник, сам соберет вам отличный букет в нашем саду.",
L"И запомните, если у нас нет таких цветов, мы быстро вырастим то, что вам надо!",
};
//Florist OrderForm
STR16 sOrderFormText[] =
{
//Text on the buttons
L"Назад",
L"Послать",
L"Отмена",
L"Галерея",
L"Название букета:",
L"Цена:",
L"Номер заказа:",
L"Доставить",
L"Завтра",
L"Как будете в тех краях",
L"Место доставки",
L"Дополнительно",
L"Сломать цветы ($10)",
L"Черные розы ($20)",
L"Увядший букет ($10)",
L"Фруктовый пирог (если есть) ($10)",
L"Текст поздравления:",
L"Ввиду небольшого размера открытки, постарайтесь уложиться в 75 символов.",
L"...или выберите одну из",
L"СТАНДАРТНЫХ ОТКРЫТОК",
L"Информация о счете",
//The text that goes beside the area where the user can enter their name
L"Название:",
};
//Florist Gallery.c
STR16 sFloristGalleryText[] =
{
//text on the buttons
L"Назад", //abbreviation for previous
L"Дальше", //abbreviation for next
L"Выберите букет, которые хотите послать.",
L"Примечание: Если Вам нужно послать увядший или сломанный букет - заплатите еще $10.",
//text on the button
L"В начало",
};
//Florist Cards
STR16 sFloristCards[] =
{
L"Выберите текст, который будет напечатан на открытке.",
L"Назад",
};
// Text for Bobby Ray's Mail Order Site
STR16 BobbyROrderFormText[] =
{
L"Бланк заказа", //Title of the page
L"Штк", // The number of items ordered
L"Вес (%s)", // The weight of the item
L"Название", // The name of the item
L"цена 1 вещи", // the item's weight
L"Итого", // The total price of all of items of the same type
L"Стоимость", // The sub total of all the item totals added
L"ДиУ (см. Место Доставки)", // S&H is an acronym for Shipping and Handling
L"Всего", // The grand total of all item totals + the shipping and handling
L"Место доставки",
L"Скорость доставки", // See below
L"Цена (за %s.)", // The cost to ship the items
L"Экспресс-доставка", // Gets deliverd the next day
L"2 рабочих дня", // Gets delivered in 2 days
L"Обычная доставка", // Gets delivered in 3 days
L"ОЧИСТИТЬ",//15 // Clears the order page
L"ЗАКАЗАТЬ", // Accept the order
L"Назад", // text on the button that returns to the previous page
L"В начало", // Text on the button that returns to the home page
L"* - вещи, бывшие в употреблении", // Disclaimer stating that the item is used
L"Вы не можете это оплатить.", //20 // A popup message that to warn of not enough money
L"<НЕ ВЫБРАНО>", // Gets displayed when there is no valid city selected
L"Вы действительно хотите отправить груз в %s?", // A popup that asks if the city selected is the correct one
L"Вес груза**", // Displays the weight of the package
L"** Мин. вес", // Disclaimer states that there is a minimum weight for the package
L"Заказы",
};
STR16 BobbyRFilter[] =
{
// Guns
L"Пистолеты",
L"Авт.пистол.",
L"ПП",
L"Винтовки",
L"Сн.винтовки",
L"Шт.винтовки",
L"Пулеметы",
L"Ружья",
L"Тяжелое",
// Ammo
L"Пистолеты",
L"Авт.пистол.",
L"ПП",
L"Винтовки",
L"Сн.винтовки",
L"Шт.винтовки",
L"Пулеметы",
L"Ружья",
// Used
L"Оружие",
L"Броня",
L"Разгр.с-мы",
L"Разное",
// Armour
L"Каски",
L"Жилеты",
L"Брюки",
L"Пластины",
// Misc
L"Режущие",
L"Метательн.",
L"Дробящие",
L"Гранаты",
L"Бомбы",
L"Аптечки",
L"Наборы",
L"Головные",
L"Разгр.с-мы",
L"Разное",
};
// This text is used when on the various Bobby Ray Web site pages that sell items
STR16 BobbyRText[] =
{
L"Заказать", // Title
// instructions on how to order
L"Нажмите на товар. Левая кнопка - добавить, правая кнопка - уменьшить. После того как выберете товар, оформите заказ.",
//Text on the buttons to go the various links
L"Назад",
L"Оружие",
L"Патроны",
L"Броня",
L"Разное", //misc is an abbreviation for miscellaneous
L"Б/У",
L"Далее",
L"БЛАНК ЗАКАЗА",
L"В начало",
//The following 2 lines are used on the Ammunition page.
//They are used for help text to display how many items the player's merc has
//that can use this type of ammo
L"У вашей команды есть",
L"оружее, использующее этот тип боеприпасов",
//The following lines provide information on the items
L"Вес:", // Weight of all the items of the same type
L"Кал.:", // the caliber of the gun
L"Маг:", // number of rounds of ammo the Magazine can hold
L"Дист:", // The range of the gun
L"Урон:", // Damage of the weapon
L"Скор:", // Weapon's Rate Of Fire, acronym ROF
L"Цена:", // Cost of the item
L"Склад:", // The number of items still in the store's inventory
L"Штук в заказе:", // The number of items on order
L"Урон:", // If the item is damaged
L"Вес:", // the Weight of the item
L"Итого:", // The total cost of all items on order
L"* %% до износа", // if the item is damaged, displays the percent function of the item
//Popup that tells the player that they can only order 10 items at a time
L"Чёрт! В эту форму можно внести не более 10 позиций для одного заказа. Если вы хотите заказать больше (а мы надеемся, вы хотите), то заполните еще один заказ и примите наши извинения за неудобства.",
// A popup that tells the user that they are trying to order more items then the store has in stock
L"Извините, но данного товара нет на складе. Попробуйте заглянуть позже.",
//A popup that tells the user that the store is temporarily sold out
L"Извините, но данного товара пока нет на складе.",
};
// Text for Bobby Ray's Home Page
STR16 BobbyRaysFrontText[] =
{
//Details on the web site
L"Здесь вы найдете лучшие и новейшие образцы оружия",
L"Мы снабдим вас всем, что нужно для победы над противником",
L"ВЕЩИ Б/У",
//Text for the various links to the sub pages
L"РАЗНОЕ",
L"ОРУЖИЕ",
L"БОЕПРИПАСЫ",
L"БРОНЯ",
//Details on the web site
L"Если у нас чего-то нет, то этого нет нигде!",
L"В разработке",
};
// Text for the AIM page.
// This is the text used when the user selects the way to sort the aim mercanaries on the AIM mug shot page
STR16 AimSortText[] =
{
L"А.I.M. Состав", // Title
// Title for the way to sort
L"Сортировка:",
// sort by...
L"Цена",
L"Опыт",
L"Меткость",
L"Медицина",
L"Взрывчатка",
L"Механика",
//Text of the links to other AIM pages
L"Показать фотографии наемников",
L"Просмотреть информацию о наемниках",
L"Просмотреть архивную галерею A.I.M.",
// text to display how the entries will be sorted
L"По возрастанию",
L"По убыванию",
};
//Aim Policies.c
//The page in which the AIM policies and regulations are displayed
STR16 AimPolicyText[] =
{
// The text on the buttons at the bottom of the page
L"Назад",
L"В начало",
L"Оглавление",
L"Дальше",
L"Не согласен",
L"Согласен",
};
//Aim Member.c
//The page in which the players hires AIM mercenaries
// Instructions to the user to either start video conferencing with the merc, or to go the mug shot index
STR16 AimMemberText[] =
{
L"Левый щелчок",
L"связаться с бойцом.",
L"Правый щелчок - ",
L"экран с фотографиями.",
};
//Aim Member.c
//The page in which the players hires AIM mercenaries
STR16 CharacterInfo[] =
{
// The various attributes of the merc
L"Здоровье",
L"Проворность",
L"Ловкость",
L"Сила",
L"Лидерство",
L"Интеллект",
L"Уровень опыта",
L"Меткость",
L"Механика",
L"Взрывчатка",
L"Медицина",
// the contract expenses' area
L"Гонорар",
L"Срок",
L"1 день",
L"7 дней",
L"14 дней",
// text for the buttons that either go to the previous merc,
// start talking to the merc, or go to the next merc
L"<<",
L"Связаться",
L">>",
L"Дополнительная информация", // Title for the additional info for the merc's bio
L"Действующий состав", // Title of the page
L"Снаряжение:", // Displays the optional gear cost
L"Снаряж.", //"gear", //tais: Displays the optional gear cost in nsgi, this moved and can have only a small room, so just make it "gear" without extra's
L"Стоимость Мед. депозита", // If the merc required a medical deposit, this is displayed
L"Набор 1", // Text on Starting Gear Selection Button 1
L"Набор 2", // Text on Starting Gear Selection Button 2
L"Набор 3", // Text on Starting Gear Selection Button 3
L"Набор 4", // Text on Starting Gear Selection Button 4
L"Набор 5", // Text on Starting Gear Selection Button 5
};
//Aim Member.c
//The page in which the player's hires AIM mercenaries
//The following text is used with the video conference popup
STR16 VideoConfercingText[] =
{
L"Сумма контракта:", //Title beside the cost of hiring the merc
//Text on the buttons to select the length of time the merc can be hired
L"1 день",
L"7 дней",
L"14 дней",
//Text on the buttons to determine if you want the merc to come with the equipment
L"Без снаряжения",
L"Со снаряжением",
// Text on the Buttons
L"ОПЛАТИТЬ", // to actually hire the merc
L"ОТМЕНА", // go back to the previous menu
L"НАНЯТЬ", // go to menu in which you can hire the merc
L"ОТБОЙ", // stops talking with the merc
L"ЗАКРЫТЬ",
L"СООБЩЕНИЕ", // if the merc is not there, you can leave a message
//Text on the top of the video conference popup
L"Видеоконференция с",
L"Подключение. . .",
L"+ страховка" // Displays if you are hiring the merc with the medical deposit
};
//Aim Member.c
//The page in which the player hires AIM mercenaries
// The text that pops up when you select the TRANSFER FUNDS button
STR16 AimPopUpText[] =
{
L"ПРОИЗВЕДЕН ЭЛЕКТРОННЫЙ ПЛАТЕЖ", // You hired the merc
L"НЕЛЬЗЯ ПЕРЕВЕСТИ СРЕДСТВА", // Player doesn't have enough money, message 1
L"НЕ ХВАТАЕТ СРЕДСТВ", // Player doesn't have enough money, message 2
// if the merc is not available, one of the following is displayed over the merc's face
L"На задании",
L"Пожалуйста, оставьте сообщение",
L"Скончался",
//If you try to hire more mercs than game can support
L"У вас уже полная команда из наемников.",
L"Автоответчик",
L"Сообщение оставлено на автоответчике",
};
//AIM Link.c
STR16 AimLinkText[] =
{
L"A.I.M. Ссылки", //The title of the AIM links page
};
//Aim History
// This page displays the history of AIM
STR16 AimHistoryText[] =
{
L"A.I.M. История", //Title
// Text on the buttons at the bottom of the page
L"Назад",
L"В начало",
L"A.I.M. Галерея",
L"Дальше",
};
//Aim Mug Shot Index
//The page in which all the AIM members' portraits are displayed in the order selected by the AIM sort page.
STR16 AimFiText[] =
{
// displays the way in which the mercs were sorted
L"Цена",
L"Опыт",
L"Меткость",
L"Медицина",
L"Взрывчатка",
L"Механика",
// The title of the page, the above text gets added at the end of this text
L"Состав A.I.M. По возрастанию, критерий - %s",
L"Состав A.I.M. По убыванию, критерий - %s",
// Instructions to the players on what to do
L"Левый щелчок",
L"Выбрать наемника",
L"Правый щелчок",
L"Критерий сортировки",
// Gets displayed on top of the merc's portrait if they are...
L"Выбыл",
L"Скончался",
L"На задании",
};
//AimArchives.
// The page that displays information about the older AIM alumni merc... mercs who are no longer with AIM
STR16 AimAlumniText[] =
{
// Text of the buttons
L"СТР. 1",
L"СТР. 2",
L"СТР. 3",
L"A.I.M. Галерея", // Title of the page
L"ОК" // Stops displaying information on selected merc
};
//AIM Home Page
STR16 AimScreenText[] =
{
// AIM disclaimers
L"A.I.M. и логотип A.I.M. - зарегистрированные во многих странах торговые марки.",
L"Так что и не думай подражать нам.",
L"(с) 1998-1999 A.I.M., Ltd. Все права защищены.",
//Text for an advertisement that gets displayed on the AIM page
L"\"Цветы по всему миру\"",
L"\"Мы сбросим ваш букет где угодно!\"",
L"Сделай как надо",
L"...в первый раз",
L"Если у нас нет такого ствола, то он вам и не нужен.",
};
//Aim Home Page
STR16 AimBottomMenuText[] =
{
//Text for the links at the bottom of all AIM pages
L"В начало",
L"Наемники",
L"Архив",
L"Правила",
L"Информация",
L"Ссылки",
};
//ShopKeeper Interface
// The shopkeeper interface is displayed when the merc wants to interact with
// the various store clerks scattered through out the game.
STR16 SKI_Text[ ] =
{
L"ИМЕЮЩИЕСЯ ТОВАРЫ", //Header for the merchandise available
L"СТР.", //The current store inventory page being displayed
L"ОБЩАЯ ЦЕНА", //The total cost of the the items in the Dealer inventory area
L"ОБЩАЯ ЦЕННОСТЬ", //The total value of items player wishes to sell
L"ОЦЕНКА", //Button text for dealer to evaluate items the player wants to sell
L"ПЕРЕВОД", //Button text which completes the deal. Makes the transaction.
L"УЙТИ", //Text for the button which will leave the shopkeeper interface.
L"ЦЕНА РЕМОНТА", //The amount the dealer will charge to repair the merc's goods
L"1 ЧАС", // SINGULAR! The text underneath the inventory slot when an item is given to the dealer to be repaired
L"%d ЧАСОВ", // PLURAL! The text underneath the inventory slot when an item is given to the dealer to be repaired
L"ИСПРАВНО", // Text appearing over an item that has just been repaired by a NPC repairman dealer
L"Вам уже некуда класть вещи.", //Message box that tells the user there is no more room to put there stuff
L"%d МИНУТ", // The text underneath the inventory slot when an item is given to the dealer to be repaired
L"Выбросить предмет на землю.",
};
//ShopKeeper Interface
//for the bank machine panels. Referenced here is the acronym ATM, which means Automatic Teller Machine
STR16 SkiAtmText[] =
{
//Text on buttons on the banking machine, displayed at the bottom of the page
L"0",
L"1",
L"2",
L"3",
L"4",
L"5",
L"6",
L"7",
L"8",
L"9",
L"OK", //Transfer the money
L"Взять", //Take money from the player
L"Дать", //Give money to the player
L"Отмена", //Cancel the transfer
L"Очистить", //Clear the money display
};
//Shopkeeper Interface
STR16 gzSkiAtmText[] =
{
// Text on the bank machine panel that....
L"Выберите тип", //tells the user to select either to give or take from the merc
L"Введите сумму", //Enter the amount to transfer
L"Перевести деньги бойцу", //Giving money to the merc
L"Забрать деньги у бойца", //Taking money from the merc
L"Недостаточно средств", //Not enough money to transfer
L"Баланс", //Display the amount of money the player currently has
};
STR16 SkiMessageBoxText[] =
{
L"Желаете снять со счета %s, чтобы покрыть разницу?",
L"Недостаточно средств. Не хватает %s",
L"Желаете снять со счета %s, чтобы оплатить полную стоимость?",
L"Попросить торговца сделать перевод",
L"Попросить торговца починить выбранные предметы",
L"Закончить беседу",
L"Текущий баланс",
};
//OptionScreen.c
STR16 zOptionsText[] =
{
//button Text
L"Сохранить",
L"Загрузить",
L"Выход",
L">>",
L"<<",
L"Готово",
//Text above the slider bars
L"Звуки",
L"Речь",
L"Музыка",
//Confirmation pop when the user selects..
L"Выйти из игры и вернуться в главное меню?",
L"Необходимо выбрать или \"Речь\", или \"Субтитры\"",
};
//SaveLoadScreen
STR16 zSaveLoadText[] =
{
L"Сохранить",
L"Загрузить",
L"Отмена",
L"Сохранение выбрано",
L"Загрузка выбрана",
L"Игра успешно сохранена",
L"ОШИБКА сохранения игры!",
L"Игра успешно загружена",
L"ОШИБКА загрузки игры!",
L"Это сохранение было сделано иной версией игры. Скорее всего, загрузить его не удастся. Все равно продолжить?",
L"Возможно файлы сохранений повреждены. Желаете их удалить?",
//Translators, the next two strings are for the same thing. The first one is for beta version releases and the second one
//is used for the final version. Please don't modify the "#ifdef JA2BETAVERSION" or the "#else" or the "#endif" as they are
//used by the compiler and will cause program errors if modified/removed. It's okay to translate the strings though.
#ifdef JA2BETAVERSION
L"Версия сохранений игры была изменена. Просим сообщить если это изменение привело к какой-либо ошибке. Пытаемся загрузить?",
#else
L"Попытка загрузить сохранение игры устаревшей версии. Автоматически обновить его и загрузить?",
#endif
//Translators, the next two strings are for the same thing. The first one is for beta version releases and the second one
//is used for the final version. Please don't modify the "#ifdef JA2BETAVERSION" or the "#else" or the "#endif" as they are
//used by the compiler and will cause program errors if modified/removed. It's okay to translate the strings though.
#ifdef JA2BETAVERSION
L"Версия игры и файлов сохранений была изменена. Просим сообщить если это изменение привело к какой-либо ошибке. Пытаемся загрузить?",
#else
L"Попытка загрузить сохранение игры устаревшей версии. Автоматически обновить его и загрузить?",
#endif
L"Вы решили записать игру на существующее сохранение #%d?",
L"Хотите загрузить игру из сохранения #",
//The first %d is a number that contains the amount of free space on the users hard drive,
//the second is the recommended amount of free space.
L"У вас заканчивается свободное место на жестком диске. Сейчас свободно %d Мб, а требуется %d Мб свободного места для JA.",
L"Сохраняю", //When saving a game, a message box with this string appears on the screen
L"Нормальный",
L"Огромный",
L"нет",
L"да",
L"Элементы фантастики",
L"Платиновая серия",
L"Ассортимент Бобби Рэя",
L"Нормальный",
L"Большой",
L"Огромный",
L"Всё и сразу",
L"Сохраненная игра была начата в режиме \"Нового Инвентаря\", этот режим не работат при разрешении экрана 640х480. Измените разрешение и загрузите игру снова.",
L"Загрузка игры, начатой в режиме \"Нового Инвентаря\", невозможна. Установите в Ja2.ini игровую папку 'Data-1.13' и повторите попытку.",
};
//MapScreen
STR16 zMarksMapScreenText[] =
{
L"Уровень карты",
L"У вас нет ополченцев. Чтобы они появились, вам нужно склонить на свою сторону горожан.",
L"Доход в сутки",
L"Наемник застрахован",
L"%s не нуждается в отдыхе.",
L"%s на марше и не может лечь спать.",
L"%s валится с ног от усталости, погоди немного.",
L"%s ведет машину.",
L"Отряд не может двигаться, когда один из наемников спит.",
// stuff for contracts
L"Хотя у вас и есть деньги на подписание контракта, но их не хватит, чтобы оплатить страховку наемника.",
L"%s: продление страховки составит %s за %d дополнительных дней. Желаете заплатить?",
L"Предметы в секторе",
L"Жизнь наемника застрахована.",
// other items
L"Медики", // people acting a field medics and bandaging wounded mercs
L"Раненые", // people who are being bandaged by a medic
L"Готово", // Continue on with the game after autobandage is complete
L"Стоп", // Stop autobandaging of patients by medics now
L"Извините, этот пункт недоступен в демонстрационной версии.", // informs player this option/button has been disabled in the demo
L"%s: нет инструментов.",
L"%s: нет аптечки.",
L"Здесь недостаточно добровольцев для тренировки.",
L"В %s максимальное количество ополченцев.",
L"У наемника ограниченный контракт.",
L"Контракт наемника не застрахован",
L"Стратегическая Карта",
//TODO.Translate HEADROCK HAM 4: Prompt messages when turning on Mobile Militia Restrictions view.
L"Сейчас у вас нет мобильных групп ополчения. Включите этот режим в следующий раз, когда наберёте их.",
L"This view shows where your Mobile Militia can and cannot go. GREY = Mobile Militia refuse to go here. RED = Mobile Militia can go here, but you've told them not to. YELLOW = Mobile Militia can enter this sector, but not leave. GREEN = Mobile Militia can go here freely. Right click a Green/Yellow sector to cycle its behavior.",
};
STR16 pLandMarkInSectorString[] =
{
L"Отряд %d заметил кого-то в секторе %s.",
};
// confirm the player wants to pay X dollars to build a militia force in town
STR16 pMilitiaConfirmStrings[] =
{
L"Тренировка отряда ополченцев будет стоить $", // telling player how much it will cost
L"Подтвердить платеж?", // asking player if they wish to pay the amount requested
L"Вы не можете себе этого позволить.", // telling the player they can't afford to train this town
L"Продолжить тренировку в %s (%s %d)?", // continue training this town?
L"Цена $", // the cost in dollars to train militia
L"( Д/Н )", // abbreviated yes/no
L"", // unused
L"Тренировка ополчения в секторе %d будет стоить $%d. %s", // cost to train sveral sectors at once
L"У вас нет $%d, чтобы приступить к тренировке ополчения.",
L"%s: Требуется не менее %d процентов лояльности, чтобы продолжить тренировку ополчения.",
L"Больше вы не можете тренировать ополчение в %s.",
L"У вас нет $%d чтобы тренировать здесь мобильное подразделение.",
L"Продолжить тренировку мобильного подразделения в %s (%s %d)?",
L"Тренировка мобильного подразделения в секторе %d обойдётся в $ %d. %s",
L"Тренировка мобильного подразделения ополченцев обойдётся в $",
};
//Strings used in the popup box when withdrawing, or depositing money from the $ sign at the bottom of the single merc panel
STR16 gzMoneyWithdrawMessageText[] =
{
L"За один раз вы можете снять со счета не более $20 000.",
L"Вы решили положить %s на свой счет?",
};
STR16 gzCopyrightText[] =
{
L"Авторские права (C) 1999 Sir-Tech Canada Ltd. Все права защищены.",
};
//option Text
STR16 zOptionsToggleText[] =
{
L"Речь",
L"Молчаливые герои",
L"Субтитры",
L"Пауза в диалогах",
L"Анимированный дым",
L"Кровь и жестокость",
L"Не трогать мышь!",
L"Старый метод выбора",
L"Показать путь движения",
L"Показать промахи",
L"Игра в реальном времени",
L"Подтверждение сна/подъема",
L"Метрическая система",
L"Движущаяся подсветка бойца",
L"Курсор на бойцов",
L"Курсор на дверь",
L"Мерцание вещей",
L"Показать кроны деревьев",
L"Показать каркасы",
L"Трехмерный курсор",
L"Показать шанс попадания",
L"Курсор очереди для гранат",
L"Злорадные враги", //Allow Enemy Taunts
L"Стрельба гранатой навесом",
L"Красться в реальном времени",
L"Выбор пробелом след. отряда",
L"Тени предметов в инвентаре",
L"Дальность оружия в тайлах",
L"Одиночный трассер",
L"Шум дождя",
L"Вороны",
L"Подсказки над солдатами", //Show Soldier Tooltips
L"Автосохранение каждый ход",
L"Молчаливый пилот вертолёта",
//L"Низкая загрузка процессора",
L"Подробное описание предметов", //Enhanced Description Box
L"Только пошаговый режим", // add forced turn mode
L"Подсветить навык к повышению", //Stat Progress Bars // Show progress towards stat increase
L"Новая расцветка стратег. карты", //Alternate Strategy-Map Colors //Change color scheme of Strategic Map
L"Заметная летящая пуля", // Show alternate bullet graphics (tracers)
L"Новая система прицеливания", // use NCTH
L"Показать снаряжение на голове", //Show Face gear graphics
L"Показать иконки снаряжения",
L"Disable Cursor Swap", // Disable Cursor Swap // TODO.Translate
L"--Читерские настройки--", // TOPTION_CHEAT_MODE_OPTIONS_HEADER,
L"Ускорить доставку Бобби Рэя", // force all pending Bobby Ray shipments
L"-----------------", // TOPTION_CHEAT_MODE_OPTIONS_END
L"--Настройки отладочной версии--", // an example options screen options header (pure text)
L"Сообщать координаты промахов", //Report Miss Offsets // Screen messages showing amount and direction of shot deviation.
L"Сброс всех игровых настроек", // failsafe show/hide option to reset all options
L"В самом деле хотите этого?", // a do once and reset self option (button like effect)
L"Отладочные настройки везде", //Debug Options in other builds // allow debugging in release or mapeditor
L"Показать Отладочные настройки", //DEBUG Render Option group // an example option that will show/hide other options
L"Отображать Mouse Regions", //Render Mouse Regions // an example of a DEBUG build option
L"-----------------", // an example options screen options divider (pure text)
// this is THE LAST option that exists (debug the options screen, doesnt do anything, except exist)
L"Последняя_Строка_Настроек", //THE_LAST_OPTION
};
//This is the help text associated with the above toggles.
STR16 zOptionsScreenHelpText[] =
{
// HEADROCK HAM 4: Added more tooltip text to some toggles, in order to explain them better.
//speech
L"Включить или выключить\nголос во время диалогов.",
//Mute Confirmation
L"Включить или выключить речевое\nподтверждение выполнения приказов.",
//Subtitles
L"Включить или выключить отображение\nсубтитров во время диалогов.",
//Key to advance speech
L"Если субтитры включены, выберите этот пункт,\nчтобы успеть прочитать диалоги персонажей.",
//Toggle smoke animation
L"Отключите анимацию дыма,\nесли он замедляет игру.",
//Blood n Gore
L"Отключите этот пункт, если боитесь крови.",
//Never move my mouse
L"Если выключено, то курсор автоматически перемещается\nна кнопку всплывающего окна диалога.",
//Old selection method
L"Если включено, то будет использоваться старый метод выбора наемников\n(для тех, кто привык к управлению предыдущих частей Jagged Alliance).",
//Show movement path
L"Если включено, то в режиме реального времени будет отображаться путь передвижения\n(если выключено, нажмите |S|H|I|F|T, чтобы увидеть путь).",
//show misses
L"Если включено, то камера будет отслеживать\nтраекторию пуль, прошедших мимо цели.",
//Real Time Confirmation
L"Если включено, то для приказа на передвижение будет требоваться\nдополнительный, подтверждающий щелчок мыши на месте назначения.",
//Display the enemy indicator
L"Если включено, то вы получите предупреждение,\nкогда наемники лягут спать или проснутся.",
//Use the metric system
L"Если включено, то используется метрическая система мер,\nиначе будет британская.",
//Merc Lighted movement
L"При ходьбе карта подсвечивается вокруг бойца (|G).\nОтключите эту настройку для повышения производительности системы.",
//Smart cursor
L"Если включено, то перемещение курсора возле наемника\nавтоматически выбирает его.",
//snap cursor to the door
L"Если включено, то перемещение курсора возле двери\nавтоматически помещает его на дверь.",
//glow items
L"Если включено, то все предметы подсвечиваются. (|I)",
//toggle tree tops
L"Если включено, то отображаются кроны деревьев. (|T)",
//toggle wireframe
L"Если включено, то у препятствий\nдополнительно показывается каркас. (|W)",
L"Если включено, то курсор передвижения\nотображается в 3D. (|Home )",
// Options for 1.13
L"Если включено, шанс попадания\nпоказывается над курсором.",
L"Если включено, очередь из гранатомета\nиспользует курсор стрельбы очередями.",
L"Если включено, враг иногда будет комментировать свои действия.",
L"Если включено, гранатомёты выстреливают \nзаряд под большим углом к горизонту (|Q).",
L"Если включено, игра не переходит в пошаговый режим \nпри обнаружении противника (если враг вас не видит). \nРучной вход в пошаговый режим - |C|t|r+|X.",
L"Если включено, |П|р|о|б|е|л выделяет следующий отряд.",
L"Если включено, показываются тени предметов в инвентаре.",
L"Если включено, дальность оружия \nпоказывается в игровых квадратах.",
L"Если включено, трассирующий эффект \nсоздаётся и одиночным выстрелом.",
L"Если включено, будет шум дождя во время непогоды.",
L"Если включено, вороны присутствуют в игре.",
L"Если включено, при нажатии кнопки |A|l|t \nи наведении курсора мыши на вражеского солдата \nбудет показана дополнительная информация.",
L"Если включено, игра будет автоматически \nсохраняться после каждого хода игрока.",
L"Если включено, Небесный Всадник\nне будет вас раздражать болтливостью.",
//L"Если включено, игра будет использовать\nменьше процессорного времени.",
L"Если включено, будет задействовано\nподробное описание предметов.",
L"Если включено и в секторе присутствует враг, \nпошаговый режим будет задействован \nдо полной зачистки сектора (|C|T|R|L+|S|H|I|F|T+|A|L|T+|T).",
L"Если включено, навык, \nкоторый вскоре повысится будет подсвечен.",
L"Если включено, необследованные сектрора \nна стратегической карте будут чёрно-белыми.",
L"Если включено, летящая пуля будет более заметной.",
L"Если включено, будет задействована новая система прицеливания \nи новый курсор прицеливания.",
L"Если включено, на портрете наёмника будет отображено одетое головное снаряжение.",
L"Если включено, в правом нижнем углу \nна портрете наёмника будут отображены иконки \nодетого головного снаряжения.",
L"When ON, the cursor will not toggle between exchange position and other actions. Press |x to initiate quick exchange.", // TODO.Translate
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_HEADER",
L"Выберите этот пункт чтобы груз Бобби Рэя прибыл немедленно.",
L"(text not rendered)TOPTION_CHEAT_MODE_OPTIONS_END",
L"(text not rendered)TOPTION_DEBUG_MODE_OPTIONS_HEADER", // an example options screen options header (pure text)
L"|H|A|M |4 |D|e|b|u|g: When ON, will report the distance each bullet deviates from the\ncenter of the target, taking all NCTH factors into account.",
L"Если включить, \nповреждённые игровые настройки будут восстановлены.", // failsafe show/hide option to reset all options
L"Отметьте строку для подтверждения сброса игровых настроек.", // a do once and reset self option (button like effect)
L"Если включено, \nотладочные настройки будут доступны как в игре, \nтак и в редакторе карт.", // Allows debug options in release or mapeditor builds
L"Если включено, отладочные настройки \nбудут показаны в общем списке.", //Toggle to display debugging render options
L"Attempts to display slash-rects around mouse regions", // an example of a DEBUG build option
L"(text not rendered)TOPTION_DEBUG_MODE_OPTIONS_END", // an example options screen options divider (pure text)
// this is THE LAST option that exists (debug the options screen, doesnt do anything, except exist)
L"Последняя строка в списке настроек.",
};
STR16 gzGIOScreenText[] =
{
L"УСТАНОВКИ НАЧАЛА ИГРЫ",
#ifdef JA2UB
L"Random Manuel texts ",
L"Off",
L"On",
#else
L"Элементы фантастики",
L"нет",
L"есть",
#endif
L"Платиновая серия",
L"Ассортимент оружия в игре",
L"всё доступное",
L"чуть поменьше",
L"Уровень сложности",
L"лёгкий", //новичок
L"средний", //опытный
L"трудный", //эксперт
L"БЕЗУМНЫЙ", //помешанный
L"Начать игру",
L"Главное меню",
L"Возможность сохранения",
L"в любое время",
L"лишь в мирное",
L"Отключено в демо-версии",
L"Ассортимент Бобби Рэя",
L"хороший",
L"большой",
L"огромный",
L"всё и сразу",
L"Инвентарь / Навеска", //Inventory / Attachments
L"NOT USED",
L"NOT USED",
L"Загрузить",
L"УСТАНОВКИ ИГРЫ (актуальны только настроки игры сервера)",
// Added by SANDRO
L"Умения IMP персонажа", //Skill Traits
L"старые",
L"новые",
L"Количество IMP персонажей", //Max IMP Characters
L"1",
L"2",
L"3",
L"4",
L"5",
L"6",
L"Враг оставляет всё снаряжение",
L"нет",
L"да",
#ifdef JA2UB
L"Tex and John",
L"Random",
L"All",
#else
L"Число террористов",
L"случайное",
L"все сразу",
#endif
L"Спрятанное оружие секторов", //Secret Weapon Caches
L"выборочно",
L"всё возможное",
L"Скорость обновления вооружения", //Progress Speed of Item Choices
L"очень медленно",
L"медленно",
L"умеренно",
L"быстро",
L"очень быстро",
L"старый / старая",
L"новый / старая",
L"новый / новая",
};
STR16 gzMPJScreenText[] =
{
L"СЕТЕВАЯ ИГРА", //MULTIPLAYER
L"Присоединиться", //Join
L"Создать игру", //Host
L"Отмена", //Cancel
L"Обновить", //Refresh
L"Имя игрока", //Player Name
L"IP сервера", //Server IP
L"Порт", //Port
L"Имя сервера", //Server Name
L"# Plrs",
L"Версия", //Version
L"Тип игры", //Game Type
L"Ping",
L"Впишите имя игрока.",
L"Впишите корректный IP адрес. (пример 84.114.195.239).",
L"Впишите корректный порт сервера (используйте диапазон от 1 до 65535).",
};
STR16 gzMPJHelpText[] =
{
L"Новых игроков можно найти здесь: http://webchat.quakenet.org/?channels=ja2-multiplayer",
L"СОЗДАТЬ ИГРУ",
L"Введите '127.0.0.1' в поле IP и выберите номер порта начиная с 60000.", //Enter '127.0.0.1' for the IP and the Port number should be greater than 60000.
L"Убедитесь что выбранный порт (UDP, TCP) не блокируется роутером. Подробнее читайте здесь: http://portforward.com",
L"Так же сообщите по IRC или ICQ другим игрокам ваш внешний IP адрес и порт (http://www.whatismyip.com).",
L"Жмите на кнопку 'Создать игру' для запуска сервера сетевой игры.",
L"ПРИСОЕДИНИТЬСЯ К ИГРЕ",
L"Создавший игру должен был вам сообщить (по IRC, ICQ и т.д.) свой внешний IP адрес и порт.",
L"Впишите эти данные в поле IP адреса и номер порта.",
L"Жмите 'Присоединиться' чтобы подключиться к уже созданной сетевой игре.",
};
// TODO.Translate
STR16 gzMPHScreenText[] =
{
L"СТАРТОВЫЕ УСТАНОВКИ СЕРВЕРА", //HOST GAME
L"Начать игру", //Start
L"Главное меню", //Cancel
L"Имя сервера", //Server Name
L"Тип игры", //Game Type
L"Deathmatch",
L"Team-Deathmatch",
L"Co-Operative",
L"Количество игроков", //Max Players
L"Солдат в отряде", //Maximum Mercs
L"Merc Selection",
L"Найм бойцов",
L"Нанят игроком", //Hired by Player
L"Деньги при старте", //Starting Cash
L"Можно нанимать тех же бойцов", //Allow Hiring Same Merc
L"Сообщения о нанятых бойцах", //Report Hired Mercs
L"Бобби Рэй", //Bobby Rays
L"Место высадки", //Sector Starting Edge
L"Впишите имя сервера", //You must enter a server name
L"",
L"",
L"Время суток", //Starting Time
L"",
L"",
L"Убойность оружия", //Weapon Damage
L"",
L"Время хода", //Timed Turns
L"",
L"Гражданские в CO-OP", //Enable Civilians in CO-OP
L"",
L"Максимум врагов в CO-OP", //Maximum Enemies in CO-OP
L"Синхронизация игровых файлов", //Synchronize Game Directory
L"MP Sync. Directory",
L"Укажите директорию для синхронизации передаваемых файлов.",
L"(Для разделения директорий используйте '/' вместо '\\'.)",
L"Указанная директория для синхронизации не существует.",
L"1",
L"2",
L"3",
L"4",
L"5",
L"6",
// Max. Enemies / Report Hired Merc / Enable Civs in CO-OP
L"да",
L"нет",
// Starting Time
L"утро",
L"день",
L"ночь",
// Starting Cash
L"мало",
L"средне",
L"много",
L"неограничено",
// Time Turns
L"не ограничено", //Never
L"медленно", //Slow
L"умеренно", //Medium
L"быстро", //Fast
// Weapon Damage
L"очень малая", //Very low
L"небольшая", //Low
L"хорошая", //Normal
// Merc Hire
L"случайно",
L"самостоятельно", //Normal
// Sector Edge
L"случайно",
L"выборочно",
// Bobby Ray / Hire same merc
L"нет",
L"есть",
};
STR16 pDeliveryLocationStrings[] =
{
L"Остин", //Austin, Texas, USA
L"Багдад", //Baghdad, Iraq (Suddam Hussein's home)
L"Драссен", //The main place in JA2 that you can receive items. The other towns are dummy names...
L"Гонконг", //Hong Kong, Hong Kong
L"Бейрут", //Beirut, Lebanon (Middle East)
L"Лондон", //London, England
L"Лос-Анджелес",//Los Angeles, California, USA (SW corner of USA)
L"Медуна", //Meduna -- the other airport in JA2 that you can receive items.
L"Метавира", //The island of Metavira was the fictional location used by JA1
L"Майами", //Miami, Florida, USA (SE corner of USA)
L"Москва", //Moscow, USSR
L"Нью-Йорк", //New York, New York, USA
L"Оттава", //Ottawa, Ontario, Canada -- where JA2 was made!
L"Париж", //Paris, France
L"Триполи", //Tripoli, Libya (eastern Mediterranean)
L"Токио", //Tokyo, Japan
L"Ванкувер", //Vancouver, British Columbia, Canada (west coast near US border)
};
STR16 pSkillAtZeroWarning[] =
{ //This string is used in the IMP character generation. It is possible to select 0 ability
//in a skill meaning you can't use it. This text is confirmation to the player.
L"Вы уверены? Значение 0 означает отсутствие этого навыка вообще.",
};
STR16 pIMPBeginScreenStrings[] =
{
L"( до 8 символов )",
};
STR16 pIMPFinishButtonText[ 1 ]=
{
L"Анализ",
};
STR16 pIMPFinishStrings[ ]=
{
L"Спасибо, %s", //%s is the name of the merc
};
// the strings for imp voices screen
STR16 pIMPVoicesStrings[] =
{
L"Голос",
};
STR16 pDepartedMercPortraitStrings[ ]=
{
L"Погиб в бою",
L"Уволен",
L"Другое",
};
// title for program
STR16 pPersTitleText[] =
{
L"Досье",
};
// paused game strings
STR16 pPausedGameText[] =
{
L"Пауза в игре",
L"Продолжить (|P|a|u|s|e)",
L"Пауза (|P|a|u|s|e)",
};
STR16 pMessageStrings[] =
{
L"Выйти из игры?",
L"Да",
L"ДА",
L"НЕТ",
L"ОТМЕНА",
L"НАНЯТЬ",
L"СОЛГАТЬ",
L"Нет описания.", //Save slots that don't have a description.
L"Игра сохранена.",
L"Игра сохранена.",
L"QuickSave", //The name of the quicksave file (filename, text reference)
L"SaveGame", //The name of the normal savegame file, such as SaveGame01, SaveGame02, etc.
L"sav", //The 3 character dos extension (represents sav)
L"..\\SavedGames", //The name of the directory where games are saved.
L"День",
L"Наёмн",
L"Свободное место", //An empty save game slot
L"Демо", //Demo of JA2
L"Ловля Багов", //State of development of a project (JA2) that is a debug build
L"Релиз", //Release build for JA2
L"пвм", //Abbreviation for Rounds per minute -- the potential # of bullets fired in a minute.
L"мин", //Abbreviation for minute.
L"м", //One character abbreviation for meter (metric distance measurement unit).
L"пуль", //Abbreviation for rounds (# of bullets)
L"кг", //Abbreviation for kilogram (metric weight measurement unit)
L"фунт", //Abbreviation for pounds (Imperial weight measurement unit)
L"В начало", //Home as in homepage on the internet.
L"USD", //Abbreviation to US dollars
L"н/д", //Lowercase acronym for not applicable.
L"Посмотрим что происходит тем временем в другом месте", //Meanwhile
L"%s: прибыл в сектор %s%s",//30 Name/Squad has arrived in sector A9. Order must not change without notifying
//SirTech
L"Версия",
L"Пустая ячейка быстрого сохр",
L"Эта ячейка зарезервирована для Быстрого Сохранения, которое можно провести с тактической карты или с глобальной карты, нажав клавиши ALT+S.",
L"Открытая",
L"Закрытая",
L"У вас заканчивается свободное дисковое пространство. На диске есть всего %sMб свободного места, а для Jagged Alliance 2 требуется %s Mб.",
L"Из A.I.M. нанят боец %s.",
L"%s ловит %s.", //'Merc name' has caught 'item' -- let SirTech know if name comes after item.
L"%s принимает препарат.", //'Merc name' has taken the drug
L"%s: отсутствуют навыки в медицине.",//40 'Merc name' has no medical skill.
//CDRom errors (such as ejecting CD while attempting to read the CD)
L"Нарушена целостность программы.",
L"ОШИБКА: CD-ROM открыт.",
//When firing heavier weapons in close quarters, you may not have enough room to do so.
L"Нет места, чтобы вести отсюда огонь.",
//Can't change stance due to objects in the way...
L"Сейчас нельзя изменить положение тела.",
//Simple text indications that appear in the game, when the merc can do one of these things.
L"Выкинуть",
L"Бросить",
L"Передать",
L"%s передан %s.", //"Item" passed to "merc". Please try to keep the item %s before the merc %s, otherwise, must notify SirTech.
L"Не хватает места, чтобы передать %s %s.", //pass "item" to "merc". Same instructions as above.
//A list of attachments appear after the items. Ex: Kevlar vest ( Ceramic Plate 'Attached )'
L" присоединён]", // 50
//Cheat modes
L"Ну и зачем тебе это надо?",
L"Активирован режим кодов.",
//Toggling various stealth modes
L"Отряд идет тихим шагом.",
L"Отряд идет обычным шагом.",
L"%s идет тихим шагом.",
L"%s идет обычным шагом.",
//Wireframes are shown through buildings to reveal doors and windows that can't otherwise be seen in
//an isometric engine. You can toggle this mode freely in the game.
L"Каркас зданий ВКЛ.",
L"Каркас зданий ВЫКЛ.",
//These are used in the cheat modes for changing levels in the game. Going from a basement level to
//an upper level, etc.
L"Нельзя подняться с этого уровня...",
L"Нет нижних этажей...",
L"Входим в подвал. Уровень %d...",
L"Покидаем подвал...",
L".", // used in the shop keeper inteface to mark the ownership of the item eg Red's gun
L"Режим следования ВЫКЛ.",
L"Режим следования ВКЛ.",
L"3D курсор ВЫКЛ.",
L"3D курсор ВКЛ.",
L"Выбран %d-й отряд.",
L"Не хватает денег, чтобы заплатить %s ежедневный гонорар %s", //first %s is the mercs name, the seconds is a string containing the salary
L"Нет", //Skip
L"%s не может уйти в одиночку.",
L"Файл сохранения был записан под названием SaveGame249.sav. Если необходимо, переименуйте его в SaveGame01 - SaveGame10 и тогда, он станет доступен в списке сохранений.",
L"%s: выпил(а) немного %s.",
L"Посылка прибыла в Драссен.",
L"%s прибудет в точку назначения (сектор %s) в %dй день, примерно в %s.", //first %s is mercs name, next is the sector location and name where they will be arriving in, lastely is the day an the time of arrival
L"В журнал добавлена запись!",
L"Очереди из гранат используют курсор стрельбы очередями (стрельба по площадям возможна)",
L"Очереди из гранат используют курсор метания (стрельба по площадям не возможна)",
L"Включены подписи к солдатам", // Changed from Drop All On (Enabled Soldier Tooltips)
L"Отключены подписи к солдатам", // Changed from Drop All Off (Disabled Soldier Tooltips)
L"Гранатометы стреляют под обычным углом",
L"Гранатометы стреляют навесом",
// forced turn mode strings
L"Только пошаговый режим",
L"Режим реального времени", //Normal turn mode
L"Выход из пошагового режима", //Exit combat mode
L"Включен только пошаговый режим. Вступаем в бой!", //Forced Turn Mode Active, Entering Combat
L"Игра сохранена в поле авто-сохранения.",
L"..\\SavedGames\\MP_SavedGames", //The name of the directory where games are saved.
L"Клиент", //Client
L"Нельзя одновременно установить \"Старый\" инвентарь и \"Новую Систему Навески\".", //You cannot use the Old Inventory and the New Attachment System at the same time.
// TODO.Translate
L"Auto Save #", //91 // Text des Auto Saves im Load Screen mit ID
L"This Slot is reserved for Auto Saves, which can be enabled/disabled (AUTO_SAVE_EVERY_N_HOURS) in the ja2_options.ini.", //92 // The text, when the user clicks on the save screen on an auto save
L"Empty Auto Save Slot #", //93 // The text, when the auto save slot (1 - 5) is empty (not saved yet)
L"AutoSaveGame", // 94 // The filename of the auto save, such as AutoSaveGame01 - AutoSaveGame05
L"End-Turn Save #", // 95 // The text for the tactical end turn auto save
L"Saving Auto Save #", // 96 // The message box, when doing auto save
L"Saving", // 97 // The message box, when doing end turn auto save
L"Empty End-Turn Save Slot #", // 98 // The message box, when doing auto save
L"This Slot is reserved for Tactical End-Turn Saves, which can be enabled/disabled in the Option Screen.", //99 // The text, when the user clicks on the save screen on an auto save
// Mouse tooltips
L"QuickSave.sav", // 100
L"AutoSaveGame%02d.sav", // 101
L"Auto%02d.sav", // 102
L"SaveGame%02d.sav", //103
};
CHAR16 ItemPickupHelpPopup[][40] =
{
L"Взять",
L"Вверх",
L"Выбрать все",
L"Вниз",
L"Отмена",
};
STR16 pDoctorWarningString[] =
{
L"%s слишком далеко, чтобы подлечиться.",
L"Ваши медики не могут оказать первую помощь всем раненым.",
};
STR16 pMilitiaButtonsHelpText[] =
{
L"Уменьшить (правя кнопка)\nУвеличить (левая кнопка)\nчисло новобранцев", // button help text informing player they can pick up or drop militia with this button
L"Уменьшить (правая кнопка)\nУвеличить (левая кнопка)\nчисло рядовых",
L"Уменьшить (правая кнопка)\nУвеличить (левая кнопка)\nчисло элитных солдат",
L"Равномерно распределить\nополченцев по всем секторам.",
};
STR16 pMapScreenJustStartedHelpText[] =
{
L"Отправляйтесь в A.I.M. и наймите бойцов (*Подсказка* - это в лэптопе).", // to inform the player to hired some mercs to get things going
#ifdef JA2UB
L"Когда будете готовы отправиться в Tracona, включите сжатие времени в правом нижнем углу экрана.", // to inform the player to hit time compression to get the game underway
#else
L"Когда будете готовы отправиться в Арулько, включите сжатие времени в правом нижнем углу экрана.", // to inform the player to hit time compression to get the game underway
#endif
};
STR16 pAntiHackerString[] =
{
L"Ошибка. Пропущен или испорчен файл(ы). Игра прекращает работу.",
};
STR16 gzLaptopHelpText[] =
{
//Buttons:
L"Просмотреть почту",
L"Посетить Интернет сайты",
L"Просмотреть полученные данные",
L"Просмотреть журнал последних событий",
L"Показать информацию о команде",
L"Просмотреть финансовые отчеты",
L"Закрыть лэптоп",
//Bottom task bar icons (if they exist):
L"Получена новая почта",
L"Получены новые данные",
//Bookmarks:
L"Международная Ассоциация Наемников A.I.M.",
L"Бобби Рэй - заказ оружия через Интернет",
L"Институт Изучения Личности Наемника I.M.P.",
L"Центр рекрутов M.E.R.C.",
L"Похоронная служба Макгилликатти",
L"'Цветы по всему миру'",
L"Страховые агенты по контрактам A.I.M.",
//New Bookmarks
L"",
L"Encyclopedia",
L"Briefing Room",
};
STR16 gzHelpScreenText[] =
{
L"Закрыть окно помощи",
};
STR16 gzNonPersistantPBIText[] =
{
L"Идет бой. Вы можете отступить только через тактический экран.",
L"Войти в сектор, чтобы продолжить бой. (|E)",
L"Провести бой автоматически (|A).",
L"Во время атаки врага автоматическую битву включить нельзя.",
L"После того как вы попали в засаду, автоматическую битву включить нельзя.",
L"Рядом рептионы - автоматическую битву включить нельзя.",
L"Рядом враждебные гражданские - автоматическую битву включить нельзя.",
L"Рядом кошки-убийцы - автоматическую битву включить нельзя.",
L"ИДЕТ БОЙ",
L"Сейчас вы не можете отступить.",
};
STR16 gzMiscString[] =
{
L"Ваши ополченцы продолжают бой без помощи наемников...",
L"Сейчас машине топливо не требуется.",
L"Топливный бак полон на %d%%.",
L"%s полностью под контролем Дейдраны.",
L"Вы потеряли заправочную станцию.",
};
STR16 gzIntroScreen[] =
{
L"Не удается найти вступительный видеоролик",
};
// These strings are combined with a merc name, a volume string (from pNoiseVolStr),
// and a direction (either "above", "below", or a string from pDirectionStr) to
// report a noise.
// e.g. "Sidney hears a loud sound of MOVEMENT coming from the SOUTH."
STR16 pNewNoiseStr[] =
{
L"%s слышит %s звук %s.",
L"%s слышит %s звук движения %s.",
L"%s слышит %s скрип, идущий %s.",
L"%s слышит %s звук всплеска %s.",
L"%s слышит %s звук удара %s.",
L"%s слышит %s звук взрыва %s.",
L"%s слышит %s крик %s.",
L"%s слышит %s звук удара %s.",
L"%s слышит %s звук удара %s.",
L"%s слышит %s звон %s.",
L"%s слышит %s грохот %s.",
};
STR16 wMapScreenSortButtonHelpText[] =
{
L"Сортировка по имени (|F|1)",
L"Сортировка по роду деятельности (|F|2)",
L"Сортировка по состоянию сна (|F|3)",
L"Сортировка по месту пребывания (|F|4)",
L"Сортировка по месту назначения (|F|5)",
L"Сортировка по времени контракта (|F|6)",
};
STR16 BrokenLinkText[] =
{
L"Ошибка 404",
L"Сайт не найден.",
};
STR16 gzBobbyRShipmentText[] =
{
L"Последние поступления",
L"Заказ №",
L"Количество",
L"Заказано",
};
STR16 gzCreditNames[]=
{
L"Chris Camfield",
L"Shaun Lyng",
L"Kris Mдrnes",
L"Ian Currie",
L"Linda Currie",
L"Eric \"WTF\" Cheng",
L"Lynn Holowka",
L"Norman \"NRG\" Olsen",
L"George Brooks",
L"Andrew Stacey",
L"Scot Loving",
L"Andrew \"Big Cheese\" Emmons",
L"Dave \"The Feral\" French",
L"Alex Meduna",
L"Joey \"Joeker\" Whelan",
};
STR16 gzCreditNameTitle[]=
{
L"Ведущий программист игры", // Chris Camfield
L"Дизайнер/Сценарист", // Shaun Lyng
L"Программист стратегической части и редактора", //Kris \"The Cow Rape Man\" Marnes
L"Продюсер/Дизайнер", // Ian Currie
L"Дизайнер/Дизайн карт", // Linda Currie
L"Художник", // Eric \"WTF\" Cheng
L"Тестирование, поддержка", // Lynn Holowka
L"Главный художник", // Norman \"NRG\" Olsen
L"Мастер по звуку", // George Brooks
L"Дизайнер экранов/художник", // Andrew Stacey
L"Ведущий художник/аниматор", // Scot Loving
L"Ведущий программист", // Andrew \"Big Cheese Doddle\" Emmons
L"Программист", // Dave French
L"Программист стратегии и баланса игры", // Alex Meduna
L"Художник-портретист", // Joey \"Joeker\" Whelan",
};
STR16 gzCreditNameFunny[]=
{
L"", // Chris Camfield
L"(Всё ещё зубрит правила пунктуации)", // Shaun Lyng
L"(\"Готово! Осталось только баги исправить.\")", //Kris \"The Cow Rape Man\" Marnes
L"(Уже слишком стар для всего этого)", // Ian Currie
L"(Также работает над Wizardry 8)", // Linda Currie
L"(Заставили тестировать под дулом пистолета)", // Eric \"WTF\" Cheng
L"(Ушла от нас в CFSA - скатертью дорожка...)", // Lynn Holowka
L"", // Norman \"NRG\" Olsen
L"", // George Brooks
L"(Поклонник джаза и группы Dead Head)", // Andrew Stacey
L"(Его настоящее имя Роберт)", // Scot Loving
L"(Единственный ответственный человек)", // Andrew \"Big Cheese Doddle\" Emmons
L"(Может опять заняться мотогонками)", // Dave French
L"(Украден с работы над Wizardry 8)", // Alex Meduna
L"(Делал предметы и загрузочные экраны!)", // Joey \"Joeker\" Whelan",
};
STR16 sRepairsDoneString[] =
{
L"%s: завершён ремонт личных вещей.",
L"%s: завершён ремонт всего оружия и брони.",
L"%s: завершён ремонт всей экипировки отряда.",
L"%s: завершён ремонт всех крупных вещей отряда.", //%s finished repairing everyone's large carried items
L"%s: завершён ремонт всех малых вещей отряда.", //%s finished repairing everyone's medium carried items
L"%s: завершён ремонт всех мелких вещей отряда.", //%s finished repairing everyone's small carried items
L"%s: завершён ремонт разгрузочных систем отряда.", //%s finished repairing everyone's LBE gear
};
STR16 zGioDifConfirmText[]=
{
L"Вы выбрали ЛЁГКИЙ уровень сложности. Этот режим предназначен для первичного ознакомления с Jagged Alliance. Ваш выбор определит ход всей игры, так что будьте осторожны. Вы действительно хотите начать игру в этом режиме?",
L"Вы выбрали СРЕДНИЙ уровень сложности. Этот режим предназначен для тех, кто знаком с Jagged Alliance и подобными играми. Ваш выбор определит ход всей игры, так что будьте осторожны. Вы действительно хотите начать игру в этом режиме?",
L"Вы выбрали ТЯЖЁЛЫЙ уровень сложности. В этом режиме вам потребуется немалый опыт игры в Jagged Alliance. Ваш выбор определит ход всей игры, так что будьте осторожны. Вы действительно хотите начать игру в этом режиме?",
L"Вы выбрали БЕЗУМНЫЙ уровень сложности. Имейте в виду - в этом режиме возможности Дейдраны воистину за пределами разумного! Но если с головой вы не в ладах, то вам даже понравится. Рискнете?",
};
STR16 gzLateLocalizedString[] =
{
L"%S файл для загрузки экрана не найден...",
//1-5
L"Робот не сможет покинуть этот сектор, пока кто-нибудь не возьмет пульт управления.",
//This message comes up if you have pending bombs waiting to explode in tactical.
L"Сейчас нельзя включить сжатие времени. Дождитесь взрыва!",
//'Name' refuses to move.
L"%s отказывается подвинуться.",
//%s a merc name
L"%s: недостаточно очков действия для изменения положения.",
//A message that pops up when a vehicle runs out of gas.
L"%s: закончилось топливо. Машина осталась в %c%d.",
//6-10
// the following two strings are combined with the pNewNoise[] strings above to report noises
// heard above or below the merc
L"сверху",
L"снизу",
//The following strings are used in autoresolve for autobandaging related feedback.
L"Никто из ваших наемников не имеет медицинских навыков.",
L"Нечем бинтовать. Ни у кого из наемников нет аптечки.",
L"Чтобы перевязать всех наемников, не хватило бинтов.",
L"Никто из ваших наемников не нуждается в перевязке.",
L"Автоматически перевязывать бойцов.",
L"Все ваши наемники перевязаны.",
//14
#ifdef JA2UB
L"Tracona",
#else
L"Арулько",
#endif
L"(на крыше)",
L"Здоровье: %d/%d",
//In autoresolve if there were 5 mercs fighting 8 enemies the text would be "5 vs. 8"
//"vs." is the abbreviation of versus.
L"%d против %d",
L"%s полон!", //(ex "The ice cream truck is full")
L"%s нуждается не в первой помощи или перевязке, а в серьезном лечении и/или отдыхе.",
//20
//Happens when you get shot in the legs, and you fall down.
L"Из-за ранения в ногу %s падает на землю!",
//Name can't speak right now.
L"%s сейчас не может говорить",
//22-24 plural versions @@@2 elite to veteran
L"%d новобранца из ополчения произведены в элитных солдат.",
L"%d новобранца из ополчения произведены в рядовые.",
L"%d рядовых ополченца произведены в элитных солдат.",
//25
L"Кнопка",
//26
//Name has gone psycho -- when the game forces the player into burstmode (certain unstable characters)
L"У %s приступ безумия!",
//27-28
//Messages why a player can't time compress.
L"Сейчас небезопасно включать сжатие времени - у вас есть наемники в секторе %s.",
L"Сейчас небезопасно включать сжатие времени - у вас есть наемники в пещерах с жуками.",
//29-31 singular versions @@@2 elite to veteran
L"1 новобранец из ополчения стал элитным солдатом.",
L"1 новобранец из ополчения стал рядовым ополченцем.",
L"1 рядовой ополченец стал элитным солдатом.",
//32-34
L"%s ничего не говорит.",
L"Выбраться на поверхность?",
L"(%dй отряд)",
//35
//Ex: "Red has repaired Scope's MP5K". Careful to maintain the proper order (Red before Scope, Scope before MP5K)
L"%s отремонтировал(а) у %s %s",
//36
L"ГЕПАРД",
//37-38 "Name trips and falls"
L"%s спотыкается и падает.",
L"Этот предмет отсюда взять невозможно.",
//39
L"Оставшиеся бойцы не могут сражаться. Сражение с тварями продолжит ополчение.",
//40-43
//%s is the name of merc.
L"%s: закончились медикаменты!",
L"%s: недостаточно навыков для лечения.",
L"%s: закончился ремонтный набор!",
L"%s: недостаточно навыков для ремонта.",
//44-45
L"Время ремонта",
L"%s не видит этого человека.",
//46-48
L"%s: отвалилась ствольная насадка!",
L"В этом секторе ополченцев могут тренировать не более %d человек.", //No more than %d militia trainers are permitted in this sector.
L"Вы уверены?",
//49-50
L"Сжатие времени.",
L"Бак машины полон.",
//51-52 Fast help text in mapscreen.
L"Возобновить сжатие времени (|П|р|о|б|е|л)",
L"Прекратить сжатие времени (|E|s|c)",
//53-54 "Magic has unjammed the Glock 18" or "Magic has unjammed Raven's H&K G11"
L"%s починил(а) %s",
L"%s починил(а) %s (%s)",
//55
L"Нельзя включить сжатие времени при просмотре предметов в секторе.",
L"CD Агония Власти не найден. Программа выходит в ОС.",
L"Предметы успешно совмещены.",
//58
//Displayed with the version information when cheats are enabled.
L"Прогресс игры текущий/максимально достигнутый: %d%%/%d%%",
//59
L"Сопроводить Джона и Мэри?",
//60
L"Кнопка нажата.",
L"%s чувствует что в бронежилете что-то треснуло!",
L"%s выпустил на %d больше пуль!",
L"%s выпустил на одну пулю больше!",
};
STR16 gzCWStrings[] =
{
L"Вызвать подкрепление из соседних секторов для %s?",
};
// WANNE: Tooltips
STR16 gzTooltipStrings[] =
{
// Debug info
L"%s|Место: %d\n",
L"%s|Яркость: %d / %d\n",
L"%s|Дистанция до |Цели: %d\n",
L"%s|I|D: %d\n",
L"%s|Приказы: %d\n",
L"%s|Настрой: %d\n",
L"%s|Текущие |A|Ps: %d\n",
L"%s|Текущее |Здоровье: %d\n",
// Full info
L"%s|Каска: %s\n",
L"%s|Жилет: %s\n",
L"%s|Брюки: %s\n",
// Limited, Basic
L"|Броня: ",
L"Каска ",
L"Жилет ",
L"Брюки",
L"Одет",
L"нет брони",
L"%s|П|Н|В: %s\n",
L"нет ПНВ",
L"%s|Противогаз: %s\n",
L"нет противогаза",
L"%s|Голова,|Слот |1: %s\n",
L"%s|Голова,|Слот |2: %s\n",
L"\n(в рюкзаке) ",
L"%s|Оружие: %s ",
L"без оружия",
L"Пистолет",
L"Пистолет-пулемет",
L"Винтовка",
L"Ручной пулемет",
L"Ружье",
L"Нож",
L"Тяжелое оружие",
L"без каски",
L"без бронежилета",
L"без поножей",
L"|Броня: %s\n",
// Added - SANDRO
L"%s|Навык 1: %s\n", //%s|Skill 1: %s\n
L"%s|Навык 2: %s\n",
L"%s|Навык 3: %s\n",
};
STR16 New113Message[] =
{
L"Началась буря.",
L"Буря закончилась.",
L"Начался дождь.",
L"Дождь закончился.",
L"Опасайтесь снайперов...",
L"Огонь на подавление!", //suppression fire!
L"*", //BRST - стабильна по количеству выпущенных пуль
L"***", //AUTO - регулируемая очередь
L"ГР",
L"ГР *",
L"ГР ***",
L"Снайпер!",
L"Невозможно разделить деньги из-за предмета на курсоре.",
L"Точка высадки новых наемников перенесена в %s, так как предыдущая точка высадки %s захвачена противником.",
L"Выброшена вещь.",
L"Выброшены все вещи выбранной группы.",
L"Вещь продана голодающему населению Арулько.",
L"Проданы все вещи выбранной группы.",
L"Проверь что солдату мешает лучше видеть.", //You should check your goggles
// Real Time Mode messages
L"Уже в бою.", //In combat already
L"В приделах видимости нет врагов.", //No enemies in sight
L"Красться в режиме реального времени ОТКЛ.", //Real-time sneaking OFF
L"Красться в режиме реального времени ВКЛ.", //Real-time sneaking ON
L"Обнаружен враг!", // this should be enough - SANDRO
L"%s отлично справился с кражей!", //%s was successful at stealing!
L"У %s нет достаточного количества очков действия, чтобы украсть все выбранные вещи.", //%s did not have enough action points to steal all selected items.
L"Хотите провести хирургическую операцию %s перед перевязкой? (Вы сможете восстановить около %i здоровья).", //Do you want to perform surgery on %s before bandaging? (You can heal about %i Health.)
L"Хотите провести хирургическую операцию %s? (Вы сможете восстановить около %i здоровья).", //Do you want to perform surgery on %s? (You can heal about %i Health.)
L"Хотите сначала провести необходимую хирургическую операцию? (пациент(ы) - %i).", //Do you wish to perform necessary surgeries first? (%i patient(s))
L"Хотите провести операцию сначала этому пациенту?", //Do you wish to perform the surgery on this patient first?
L"Оказывать первую помощь с хирургическим вмешательством или без него?", //Apply first aid automatically with necessary surgeries or without them?
L"%s успешно прооперирован(а).", //Surgery on %s finished.
L"%s пропустил(а) удар в грудную клетку и теряет единицу максимального значения здоровья!", //%s is hit in the chest and loses a point of maximum health!
L"%s пропустил(а) удар в грудную клетку и теряет %d максимального значения здоровья!", //%s is hit in the chest and loses %d points of maximum health!
L"%s восстановил(а) одну единицу потерянного %s.", //%s has regained one point of lost %s
L"%s восстановил(а) %d единиц потерянного %s.", //%s has regained %d points of lost %s
L"Ваши навыки разведчика сорвали засаду противника.",
L"Благодаря вашим навыкам разведчика вы успешно избежали встречи с кошками-убицами!",
L"%s получает удар в пах и падает на землю в адской боли!",
/////
L"Внимание: враг обнаружил труп!!!",
L"%s [%d патр.]\n%s %1.1f %s",
};
STR16 New113HAMMessage[] =
{
// 0 - 5
L"%s в страхе пытается укрыться!", //%s cowers in fear! %s съёжился от испуга!
L"%s прижат(а) к земле вражеским огнём!", //%s is pinned down!
L"%s дал более длинную очередь!", //%s fires more rounds than intended!
L"Вы не можете тренировать ополчение в этом секторе.", //You cannot train militia in this sector.
L"Ополченец подобрал %s.", //Militia picks up %s.
L"Невозможно тренировать ополчение когда в секторе враг!", //Cannot train militia with enemies present!
// 6 - 10
L"%s имеет низкий навык Лидерства, чтобы тренировать ополченцев.", //%s lacks sufficient Leadership score to train militia.
L"В этом секторе не может быть тренеров мобильных групп больше %d.", //No more than %d Mobile Militia trainers are permitted in this sector.
L"Нет свободных мест в %s или вокруг него для новой мобильной группы!", //No room in %s or around it for new Mobile Militia!
L"Нужно иметь по %d ополченцев в каждом освобождённом секторе города %s, прежде чем можно будет тренировать мобильные группы.", //You need to have %d Town Militia in each of %s's liberated sectors before you can train Mobile Militia here.
L"Невозможно работать в городском учереждении пока враг в секторе!", //Can't staff a facility while enemies are present!
// 11 - 15
L"%s имеет мало Мудрости, чтобы работать в городском учереждении.", //%s lacks sufficient Wisdom to staff this facility.
L"Учереждение %s полностью укомплектованно персоналом.", //The %s is already fully-staffed.
L"Один час услуг этого заведения обойдётся вам в $%d. Согласны оплачивать?", //It will cost $%d per hour to staff this facility. Do you wish to continue?
L"У вас недостаточно денег чтобы оплатить работу в учреждениии за сегодня. $%d выплачено, ещё нужно $%d. Местным это не понравилось.", //You have insufficient funds to pay for all Facility work today. $%d have been paid, but you still owe $%d. The locals are not pleased.",
L"У вас недостаточно денег чтобы выплатить заработную плату всем рабочим. Теперь долг составил $%d. Местным это не понравилось.",
// 16 - 20
L"Непогашенный долг составляет $%d для работы учереждения, и нет денег чтобы его погасить!", //You have an outstanding debt of $%d for Facility Operation, and no money to pay it off!
L"Непогашенный долг составляет $%d для работы учереждения. Вы не можете назначить бойца на работу в учереждении пока не погасите задолженность.", //You have an outstanding debt of $%d for Facility Operation. You can't assign this merc to facility duty until you have enough money to pay off the entire debt.
L"Непогашенный долг составляет $%d для работы учереждения. Выплатить деньги по задолженности?", //You have an outstanding debt of $%d for Facility Operation. Would you like to pay it all back?
L"Н/Д в этом секторе", //N/A in this sector
L"Дневной расход",
// 21 - 25
L"Недостаточно денег чтобы заплатить всему нанятому ополчению. %d ополченцев было распущенно и распущено домой.", //Insufficient funds to pay all enlisted militia! %d militia have disbanded and returned home.
};
// WANNE: This are the email texts, when one of the 4 new 1.13 MERC mercs have levelled up, that Speck sends
// INFO: Do not replace the ± characters. They indicate the <B2> (-> Newline) from the edt files
STR16 New113MERCMercMailTexts[] =
{
// Gaston: Text from Line 39 in Email.edt
L"Пожалуйста, примите к сведению, что с настоящего момента гонорар Гастона увеличивается вследствие повышения его профессионального уровня. ± ± Спек Т. Кляйн ± ",
// Stogie: Text from Line 43 in Email.edt
L"Пожалуйста, примите к сведению, что повышение боевых навыков лейтенанта Хорга 'Сигары' влечет за собой повышение его гонорара. ± ± Спек Т. Кляйн ± ",
// Tex: Text from Line 45 in Email.edt
L"Прошу принять к сведению, что заслуги Текса позволяют ему требовать более достойной оплаты. Поэтому его гонорар был увеличен, чтобы соответствовать его умениям. ± ± Спек Т. Кляйн ± ",
// Biggens: Text from Line 49 in Email.edt
L"Ставим в известность, что отличная работа полковника Фредерика Биггенса заслуживает поощрения в виде повышения гонорара. Постановление считать действительным с текущего момента. ± ± Спек Т. Кляйн ± ",
};
// TODO.Translate
// WANNE: This is email text (each 2 line), when we left a message on AIM and now the merc is back
STR16 New113AIMMercMailTexts[] =
{
// Monk
L"FW с сервера A.I.M.: Письмо от Виктора Колесникова",
L"Привет. Это Монк. Получил твое сообщение. Я вернулся, так что можешь со мной связаться. ± ± Жду звонка. ±",
// Brain
L"FW с сервера A.I.M.: Письмо от Янно Аллика",
L"Я готов обсудить задания. Для всего есть свое время и место. ± ± Янно Аллик ±",
// Scream
L"FW с сервера A.I.M.: Письмо от Леннарта Вильде",
L"Леннарт Вильде вернулся!",
// Henning
L"FW с сервера A.I.M.: Письмо от Хеннинга фон Браница",
L"Получил твое сообщение, спасибо. Если хочешь обсудить работу, свяжись со мной на сайте A.I.M. До встречи! ± ± Хеннинг фон Браниц ±",
// Luc
L"FW с сервера A.I.M.: Письмо от Люка Фабра",
L"Послание получил, мерси! С удовольствием рассмотрю ваши предложения. Вы знаете, где меня найти. ± ± Жду с нетерпением ±",
// Laura
L"FW с сервера A.I.M.: Письмо от Лоры Колин",
L"Привет! Спасибо, что оставили сообщение. Звучит интересно. ± ± Зайдите снова в A.I.M. Хотелось бы услышать больше. ± ± С уважением! ± ± Др. Лора Колин ± ± P.S. Надеюсь, Monk уже в вашей команде? ±",
// Grace
L"FW с сервера A.I.M.: Письмо от Грациеллы Джирелли",
L"Вы хотели связаться со мной, но неудачно.± ± Семейное собрание. Думаю, вы понимаете. Я уже устала от семьи и буду рада. Если вы снова свяжетесь со мной через сайт A.I.M. ± ± Чао! ±",
// Rudolf
L"FW с сервера A.I.M.: Письмо от Рудольфа Штайгера",
L"Ты знаешь, сколько звонков я получаю каждый день? Любой придурок считает, что может позвонить мне. ± ± Но я вернулся, если тебе есть чем меня заинтересовать. ±",
// WANNE: Generic mail, for additional merc made by modders, index >= 178
L"FW с сервера A.I.M.: Наёмник доступен",
L"Я на месте. Жду звонка чтобы обсудить условия контракта. ±",
};
// WANNE: These are the missing skills from the impass.edt file
// INFO: Do not replace the ± characters. They indicate the <B2> (-> Newline) from the edt files
STR16 MissingIMPSkillsDescriptions[] =
{
// Sniper
L"Снайпер: У вас глаза ястреба. В свободное время вы развлекаетесь отстреливая крылышки у мух с расстояния 100 метров! ± ", //Sniper: Eyes of a hawk, you can shoot the wings from a fly at a hundred yards!
// Camouflage
L"Маскировка: На вашем фоне кусты выглядят синтетическими! ± ", //Camouflage: Beside you, even bushes look synthetic!
// Ranger
L"Лесничий: Эти рейнджеры из Техаса, на вашем фоне выгледят дилетантами! Вы умеете рационально выбирать путь, стать незаметным для зверя, с одного выстрела из ружья попасть белке в глаз. ± ", //Ranger: Those amateurs from Texas have nothing on you!
// Gunslinger
L"Ковбой: С одним револьвером, либо с двумя - вы так же опасны как Билли Кид! ± ", //Gunslinger: With one handgun or two, you can be as lethal as Billy the Kid!
// Squadleader
L"Командир: Прирождённый лидер, солдаты просто боготворят вас! ± ", //Squadleader: A natural leader, your squadmates look to you for inspiration!
// Technician
L"Механик: Ангус МакГайвер по сравнению с вами просто никто! Механика, электроника или взрывчатка - вы отремонтируете что угодно! ± ", //Technician: MacGyver's got nothing on you! Mechanical, electronic or explosive, you can fix it!
// Doctor
L"Доктор: Будь то царапины или вскрытое брюхо, нужна ампутация или же наоборот, пришить чего-нибудь - вы с лёгкостью справитесь с любым недугом! ± ", //Doctor: From grazes to gutshot, to amputations, you can heal them all!
// Athletics
L"Спортсмен: Ваша скорость и выносливость достойны олимпийца! ± ", //Athletics: Your speed and vitality are worthy of an Olympian!
// Bodybuilding
L"Культурист: Шварц? Да он слабак! Вы с лёгкостью завалите его одной левой! ± ", //Bodybuilding: Arnie? What a wimp! You could beat him with one arm behind your back!
// Demolitions
L"Подрывник: Сеять гранаты, как семена по полю; минировать поле, как картошку садить - густо и минимум 20 соток; а после созерцать на полет конечностей... Вот то, ради чего вы живёте! ± ", //Demolitions: Sowing grenades like seeds, planting bombs, watching the limbs flying.. This is what you live for!
// Scouting
L"Разведчик: Ничто не скроется от вашего зоркого взгляда! ± ", //Scouting: Nothing can escape your notice!
};
STR16 NewInvMessage[] =
{
L"В данный момент поднять рюкзак нельзя.",
L"Вы не можете одновременно носить 2 рюкзака.",
L"Вы потеряли свой рюкзак...",
L"Замок рюкзака работает лишь во время битвы.",
L"Вы не можете передвигаться с открытым рюкзаком.",
L"Вы уверены что хотите продать весь хлам этого сектора голодающему населению Арулько?",
L"Вы уверены что хотите выбросить весь хлам, валяющийся в этом секторе?",
L"Тяжеловато будет взбираться с полным рюкзаком на крышу. Может снимем?",
};
// WANNE - MP: Multiplayer messages
STR16 MPServerMessage[] =
{
// 0
L"Запускается сервер RakNet...",
L"Сервер запущен, ожидание подключений...",
L"Теперь вам надо подключиться к серверу, нажав '2'.",
L"Сервер уже запущен.",
L"Не удалось запустить сервер. Прекращаю работу.",
// 5
L"%d/%d клиентов готовы к режиму реального времени.",
L"Сервер отключился и прекратил свою работу.",
L"Сервер не запущен.",
L"Подождите пожалуйста, игроки все еще загружаются...",
L"Вы не можете изменять зону высадки после запуска сервера.",
// 10
L"Отправка файла '%S' - 100/100", //Sent file '%S' - 100/100
L"Завершена отправка файлов для '%S'.", //Finished sending files to '%S'.
L"Начата отправка файлов для '%S'.", //Started sending files to '%S'.
};
STR16 MPClientMessage[] =
{
// 0
L"Запускается клиент RakNet...",
L"Подключение к IP: %S ...",
L"Получены настройки игры:",
L"Вы уже подключены.",
L"Вы уже подключаетесь...",
// 5
L"Клиент №%d - '%S' нанял %s.",
L"Клиент №%d - '%S' нанял еще бойца.",
L"Вы готовы к бою (всего готово = %d/%d).",
L"Вы отменили готовность к бою (всего готово = %d/%d).",
L"Отряды подтягиваются к месту битвы...", //'Starting battle...'
// 10
L"Клиент №%d - '%S' готов к бою (всего готово = %d/%d).",
L"Клиент №%d - '%S' отменил готовность к бою (всего готово = %d/%d).",
L"Похоже, вы уже готовы к бою, однако, придется подождать остальных. (Если хотите изменить расположение своих бойцов, нажмите кнопку 'ДА').",
L"Начнем же битву!",
L"Для начала игры необходимо запустить клиент.",
// 15
L"Игра не может быть начата, вы не наняли ни одного бойца.",
L"Ждем, когда сервер даст добро на доступ к лэптопу...",
L"Перехвачен", //Interrupted
L"Продолжение после перехвата", //Finish from interrupt
L"Координаты курсора:", //Mouse Grid Coordinates
// 20
L"X: %d, Y: %d",
L"Номер квадрата: %d", //Grid Number
L"Доступно лишь для сервера.",
L"Выберите какую ступень игры принудительно запустить: ('1' - открыть лэптоп/найм бойцов) ('2' - запустить/загрузить уровень) ('3' - разблокировать пользовательский интерфейс) ('4' - завершить расстановку)",
L"Sector=%s, Max Clients=%d, Max Mercs=%d, Game_Mode=%d, Same Merc=%d, Damage Multiplier=%f, Timed Turns=%d, Secs/Tic=%d, Dis BobbyRay=%d, Dis Aim/Merc Equip=%d, Dis Morale=%d, Testing=%d",
// 25
L"",
L"Новый игрок: клиент №%d - '%S'.",
L"Команда: %d.",//not used any more
L"%s (клиент %d - '%S') был убит %s (клиент %d - '%S')",
L"Клиент №%d - '%S' выкинут из игры.",
// 30
L"Принудительно дать ход клиенту. №1: <Отменить>, №2: %S, №3: %S, №4: %S",
L"Начался ход клиента №%d",
L"Запрос перехода в режим реального время...",
L"Переход в режим реального времени.",
L"Ошибка: что-то пошло не так, возвращаю обратно.",
// 35
L"Открыть доступ к лэптопу? (Уверены что все игроки подключились?)",
L"Сервером был открыт доступ к лэптопу. Приступайте к найму бойцов!",
L"Перехватчик.",
L"Клиент не может изменять зону высадки, доступно лишь серверу.",
L"Вы отказались от предложения сдаться, потому что это не актуально в сетевой игре.",
// 40
L"Все ваши бойцы были убиты!",
L"Активизирован режим наблюдения.",
L"Вы потерпели поражение!",
L"Извините, залезать на крышу в сетевой игре запрещено.",
L"Вы наняли %s.",
// 45
L"Вы не можете изменить карту после начала закупки.",
L"Карта изменена на '%s'",
L"Клиент '%s' отключился, убираем его из игры.",
L"Вы были отключены от игры, возвращаемся в главное меню.",
L"Подключиться не удалось. Повторная попытка через 5 секунд (осталось %i попыток)",
//50
L"Подключиться не удалось, сдаюсь...",
L"Вы не можете начать игру во время подключения других игроков.",
L"%s : %s",
L"Отправить всем",
L"Только союзникам",
// 55
L"Не могу присоединиться к игре. Игра уже началась.",
L"%s (команда): %s",
L"#%i - '%s'",
L"%S - 100/100",
L"%S - %i/100",
// 60
L"От сервера получены все необходимые файлы.",
L"'%S' закачка с сервера завершена.",
L"'%S' начата закачка с сервера.",
L"Нельзя начать игру пока все игроки не завершать приём файлов от сервера.",
L"Для игры на этом сервере необходимо скачать некоторые изменённые файлы, желаете продолжить?",
// 65
L"Нажмите 'Готов' для входа на тактическую карту.",
L"Не удаётся подключиться. Версия вашего клиента (%S) отличается от версии сервера (%S).",
L"Вы убили вражеского солдата.",
L"Нельзя запустить игру потому что все команды одинаковые.",
L"Игра на сервере создана с Новым Инвентарём (NIV), а выбранное вами разрешение экрана не поддерживается NIV.",
// 70
// TODO.Translate
L"Невозможно сохранить принятый файл '%S'",
L"%s's бомба была разряжена &s",
L"Вы проиграли. Стыд и срам!", // All over red rover
L"Spectator mode disabled",
L"Укажите номер клиента, который нужно кикнуть. №1: <Отменить>, №2: %S, №3: %S, №4: %S",
// 75
L"Команда #%d уничтожена.",
L"Ошибка при запуске клиента. Завершение операции.",
L"Клиент отсоединился и закрыт.",
L"Клиент не запущен.",
L"INFO: If the game is stuck (the opponents progress bar is not moving), notify the server to press ALT + E to give the turn back to you!", // TODO.Translate
};
STR16 gszMPEdgesText[] =
{
L"С", //N
L"Ю", //S
L"В", //E
L"З", //W
L"Ц", // "C"enter
};
STR16 gszMPTeamNames[] =
{
L"Фокстрот", //Foxtrot
L"Браво", //Bravo
L"Дельта", //Delta
L"Чарли", //Charlie
L"Н/Д", // Acronym of Not Applicable
};
STR16 gszMPMapscreenText[] =
{
L"Тип игры: ", //Game Type:
L"Игроков: ", //Players:
L"Всего бойцов: ", //Mercs each:
L"Нельзя изменять сторону высадки отряда после открытия лэптопа.",
L"Нельзя изменить имя команды после открытия лэптопа.",
L"Случ. бойцы: ", //Random Mercs:
L"Да", //Y
L"Сложность:", //Difficulty:
L"Версия сервера:", //Server Version:
};
STR16 gzMPSScreenText[] =
{
L"Доска счёта", //Scoreboard
L"Продолжить", //Continue
L"Отмена", //Cancel
L"Игрок", //Player
L"Убито", //Kills
L"Погибло", //Deaths
L"Королевская армия", //Queen's Army
L"Выстрелов", //Hits
L"Промахи", //Misses
L"Меткость", //Accuracy
L"Нанесённый урон", //Damage Dealt
L"Полученный урон", //Damage Taken
L"Дождитесь, пожалуйста, пока сервер нажмёт кнопку 'Продолжить'."
};
STR16 gzMPCScreenText[] =
{
L"Отмена", //Cancel
L"Подключаюсь к серверу...", //Connecting to Server
L"Получаю настройки от сервера...", //Getting Server Settings
L"Скачиваю выбранные файлы...", //Downloading custom files
L"Нажмите 'ESC' для отмены или 'Y' чтобы войти в чат.", //Press 'ESC' to cancel or 'Y' to chat
L"Нажмите 'ESC' для отмены", //Press 'ESC' to cancel
L"Выполнено." //Ready
};
STR16 gzMPChatToggleText[] =
{
L"Отправть всем",
L"Отправть только союзникам",
};
STR16 gzMPChatboxText[] =
{
L"Чат сетевой игры Jagged Alliance 2 v1.13",
L"Заметка: нажмите |В|В|О|Д для отправки сообщения, |К|Л|Ю|Ч для выхода из чата.",
};
STR16 pSkillTraitBeginIMPStrings[] =
{
// For old traits
L"На следующей странице вам нужно выбрать профессиональные навыки в соответствии со специализацией вашего наёмника. Вы можете выбрать не более двух разных навыка или один и владеть им в совершенстве.",
L"Можно выбрать всего один навык или вообще остаться без него. Тогда вам будут даны дополнительные баллы для улучшения некоторых параметров. Внимание: навыки электроника, стрельба с двух рук и маскировка не могут быть экспертными.",
// For new major/minor traits
L"Следующий этап - выбор навыков, которые определят специализацию вашего наёмника. На первой странице можно выбрать до двух основных навыков, которые определят роль бойца в отряде. На второй - дополнительные навыки, подчеркивающие личные качества бойца.",
L"Всего можно взять не более трёх навыков. Так, если Вы не выбрали основной навык, то можно взять три дополнительных. Если же вы выбрали оба основных навыка (или один улучшенный), то будет доступен лишь один дополнительный...",
};
STR16 sgAttributeSelectionText[] =
{
L"Откорректируйте свои физические параметры согласно вашим истинным способностям. И не стоит их завышать.",
L"I.M.P.: Параметры и умения.", //I.M.P. Attributes and skills review.
L"Бонус:", //Bonus Pts.
L"Ваш уровень", //Starting Level
// New strings for new traits
L"На следующей странице укажите свои физические параметры и умения. \"Физические параметры\" - это здоровье, ловкость, проворность, сила и мудрость. Они не могут быть ниже %d.",
L"Оставшиеся \"умения\", в отличие от физических параметров, могут быть установлены в ноль, что означает абсолютную некомпетентность в данных областях.",
L"Изначально все параметры установлены на минимум. Заметьте, что минимум для некоторых параметров определяется выбранными навыками, и вы не можете понизить их значение.",
};
STR16 pCharacterTraitBeginIMPStrings[] =
{
L"I.M.P.: Анализ личных качеств", //I.M.P. Character Analysis
L"Следующий шаг - анализ ваших личных качеств. На первой странице вам на выбор будет предложен список черт характера. Уверены, что вам могут быть свойственны несколько из указанных черт, но выбрать нужно лишь одну. Выберите лишь самую ярко выраженную вашу черту характера.",
L"На второй странице вам будет предложен список недостатков, которые, возможно, есть у вас. Если найдёте свой недостаток в списке, отметьте его. Будьте предельно честны при ответах, очень важно предоставить вашим потенциальным работодателям достоверную информацию о вас.",
};
STR16 gzIMPAttitudesText[]=
{
L"Адекватный", //Normal
L"Общительный", //Friendly
L"Одиночка", //Loner
L"Оптимист", //Optimist
L"Пессимист", //Pessimist
L"Агрессивный", //Aggressive
L"Высокомерный", //Arrogant
L"Крутой", //Big Shot
L"Мудак", //Asshole
L"Трус", //Coward
L"I.M.P.: Жизненная позиция", //I.M.P. Attitudes
};
STR16 gzIMPCharacterTraitText[]=
{
L"Обычный", //Neutral
L"Общительный", //Sociable
L"Одиночка", //Loner
L"Оптимист", //Optimist
L"Самоуверенный", //Assertive
L"Мозговитый", //Intellectual
L"Простофиля", //Primitive
L"Агрессивный", //Aggressive
L"Невозмутимый", //Phlegmatic
L"Бесстрашный", //Dauntless
L"Миролюбивый", //Pacifist
L"Злобный", //Malicious
L"Хвастун", //Show-off
L"I.M.P.: Личностные качества", //I.M.P. Character Traits
};
STR16 gzIMPColorChoosingText[] =
{
L"I.M.P.: Расцветка и телосложение",
L"I.M.P.: Расцветка",
L"Выберите соответствующие цвета вашей кожи, волос и одежды, а так же укажите ваше телосложение.",
L"Выберите соответствующие цвета вашей кожи, волос и одежды.",
L"Отметьте здесь чтобы ваш персонаж \nдержал автомат одной рукой.",
L"\n(Важно: вам понадобится прилично сил для этого.)",
};
STR16 sColorChoiceExplanationTexts[]=
{
L"Цвет волос", //Hair Color
L"Цвет кожи", //Skin Color
L"Цвет майки", //Shirt Color
L"Цвет штанов", //Pants Color
L"Нормальное телосложение", //Normal Body
L"Мускулистое телосложение", //Big Body
};
STR16 gzIMPDisabilityTraitText[]=
{
L"Идеален", //No Disability
L"Непереносимость жары", //Heat Intolerant
L"Нервный", //Nervous
L"Клаустрафоб", //Claustrophobic
L"Не умеющий плавать", //Nonswimmer
L"Боязнь насекомых", //Fear of Insects
L"Забывчивый", //Forgetful
L"Психопат", //Psychotic
L"I.M.P.: Недостатки", //I.M.P. Disabilities
};
// HEADROCK HAM 3.6: Error strings for assigning a merc to a facility
STR16 gzFacilityErrorMessage[]=
{
L"%s не хватает Силы чтобы выполнить это действие.",
L"%s не хватает Ловкости чтобы выполнить это действие.",
L"%s не хватает Проворности чтобы выполнить это действие.",
L"%s не хватает Здоровья чтобы выполнить это действие..",
L"%s не хватает Мудрости чтобы выполнить это действие.",
L"%s не хватает Меткости чтобы выполнить это действие.",
// 6 - 10
L"%s не достаточно развит Медицинский навык, чтобы выполнить это действие.",
L"%s не достаточно развит навык Механики, чтобы выполнить это действие.",
L"%s не достаточно развито Лидерство, чтобы выполнить это действие.",
L"%s не достаточно развит навык Взрывчатки, чтобы выполнить это действие.",
L"%s не достаточно Опыта, чтобы выполнить это действие.",
// 11 - 15
L"У %s слишком плохой Боевой дух, чтобы выполнить это действие",
L"%s слишком устал(а), чтобы выполнить это действие.",
L"В городе %s вам пока не доверяют. Местные отказываются выполнить этот приказ.",
L"Слишком много людей уже работают в %s.",
L"Слишком много людей уже выполняют эту задачу в %s.",
// 16 - 20
L"%s не может найти вещи, которые нуждаются в ремонте.",
L"%s потерял(а) часть %s пока работал в секторе %s!",
L"%s потерял(а) часть %s пока работал над %s в %s!",
L"%s получил(а) травму пока работал(а) в секторе %s, и требует незамедлительной медицинской помощи!",
L"%s получил(а) травму пока работал(а) над %s в %s, и требует незамедлительной медицинской помощи!",
// 21 - 25
L"%s получил(а) травму пока работал(а) в секторе %s. Травма незначительная.",
L"%s получил(а) травму пока работал(а) над %s в %s. Травма незначительная.",
L"Жители города %s расстроены тем, что %s пребывает в их городе.",
L"Жители города %s расстроены работой %s в %s.",
L"%s в секторе %s своими действиями понизил репутацию во всём регионе!",
// 26 - 30
L"%s работая над %s в %s привёл(а) к понижению репутации во всём регионе!",
L"%s пьян(а).",
L"%s заболел(а) в секторе %s, и вынужден(а) отложить текущую задачу.",
L"%s заболел(а) и не может продолжить работу над %s в %s.",
L"%s получил(а) травму в секторе %s.",
L"%s получил(а) серьёзную травму в секторе %s.",
};
STR16 gzFacilityRiskResultStrings[]=
{
L"Сила", //Strength
L"Проворность", //Agility
L"Ловкость", //Dexterity
L"Интеллект", //Wisdom
L"Здоровье", //Health
L"Меткость", //Marksmanship
// 5-10
L"Лидерство", //Leadership
L"Механика", //Mechanical skill
L"Медицина", //Medical skill
L"Взрывчатка", //Explosives skill
};
STR16 gzFacilityAssignmentStrings[]=
{
L"AMBIENT",
L"Штат", //Staff
L"Отдых",
L"Ремонт вещей",
L"Ремонт %s", // Vehicle name inserted here
L"Ремонт робота",
// 6-10
L"Доктор",
L"Пациент",
L"Тренинг Силы",
L"Тренинг Ловкости",
L"Тренинг Проворности",
L"Тренинг Здоровья",
// 11-15
L"Тренинг Меткости",
L"Тренинг Медицины",
L"Тренинг Механики",
L"Тренинг Лидерства",
L"Тренинг Взрывчатки",
// 16-20
L"Ученик на Силу",
L"Ученик на Ловкость",
L"Ученик на Проворность",
L"Ученик на Здоровье",
L"Ученик на Меткость",
// 21-25
L"Ученик на Медицину",
L"Ученик на Механику",
L"Ученик на Лидерство",
L"Ученик на Взрывчатку",
L"Тренер на Силу",
// 26-30
L"Тренер на Ловкость",
L"Тренер на Проворность",
L"Тренер на Здоровье",
L"Тренер на Меткость",
L"Тренер на Медицину",
// 30-35
L"Тренер на Механику",
L"Тренер на Лидерство",
L"Тренер на Взрывчатку",
};
STR16 Additional113Text[]=
{
L"Для запуска Jagged Alliance 2 v1.13 в оконном режиме требуется установить 16-битное качество цветопередачи экрана",
// TODO.Translate
// WANNE: Savegame slots validation against INI file
L"Internal error in reading %s slots from Savegame: Number of slots in Savegame (%d) differs from defined slots in ja2_options.ini settings (%d)",
L"Mercenary (MAX_NUMBER_PLAYER_MERCS) / Vehicle (MAX_NUMBER_PLAYER_VEHICLES)",
L"Enemy (MAX_NUMBER_ENEMIES_IN_TACTICAL)",
L"Creature (MAX_NUMBER_CREATURES_IN_TACTICAL)",
L"Militia (MAX_NUMBER_MILITIA_IN_TACTICAL)",
L"Civilian (MAX_NUMBER_CIVS_IN_TACTICAL)",
};
STR16 sEnemyTauntsFireGun[]=
{
L"Отведай ка гостинца!",
L"Поздоровайся с моим дружком!",
L"Иди и получи!",
L"Ты мой!",
L"Сдохни!",
L"Обосрался, говнюк?",
L"Будет больно!",
L"Давай, ублюдок!",
L"Давай! Не весь же день тягаться!",
L"Иди к папочке!",
L"Закопаю моментом!",
L"Домой поедешь в деревянном костюме, неудачник!",
L"Эй, сыграем?",
L"Сидел бы дома, мудила!",
L"С-сука!",
};
STR16 sEnemyTauntsFireLauncher[]=
{
L"Будет, будет... Шашлык из тебя будет!",
L"Держи подарочек!",
L"Бах!",
L"Улыбочку!",
};
STR16 sEnemyTauntsThrow[]=
{
L"Лови!",
L"Держи!",
L"Бум-бах, ой-ой-ой! Умирает зайчик мой!",
L"Это тебе.",
L"Муа-ха-ха!",
L"Лови, свинтус!",
L"Обожаю этот момент.",
};
STR16 sEnemyTauntsChargeKnife[]=
{
L"Твой скальп мой, лошара!",
L"Иди к папочке.",
L"Сейчас посмотрим на твои кишечки!",
L"Порву, как Тузик грелку!",
L"Мясо!",
};
STR16 sEnemyTauntsRunAway[]=
{
L"Кажется, мы в дерьме...",
L"Мне говорили вступать в армию, а не в это дерьмо!",
L"С меня хватит!",
L"О мой Бог!",
L"Нам не доплачивают за это дерьмо, валим отсюда...",
L"Мамочка!",
L"Я вернусь! И нас будут тысячи!",
};
STR16 sEnemyTauntsSeekNoise[]=
{
L"Я тебя слышу!",
L"Кто здесь?",
L"Что это было?",
L"Эй! Какого...",
};
STR16 sEnemyTauntsAlert[]=
{
L"Они здесь!",
L"Сейчас начнётся веселье!",
L"Я надеялся, что этого никогда не случится...",
};
STR16 sEnemyTauntsGotHit[]=
{
L"А-а-г-р-р!",
L"А-а-а!",
L"Как же... больно!",
L"Твою мать!",
L"Ты пожалеешь... у-м-хх... об этом.",
L"Что за!..",
L"Теперь ты меня... разозлил.",
};
//////////////////////////////////////////////////////
// HEADROCK HAM 4: Begin new UDB texts and tooltips
//////////////////////////////////////////////////////
STR16 gzItemDescTabButtonText[] =
{
L"Информация",
L"Параметры",
L"Дополнительно",
};
STR16 gzItemDescTabButtonShortText[] =
{
L"Инфо.",
L"Пар.",
L"Доп.",
};
STR16 gzItemDescGenHeaders[] =
{
L"Основное",
L"Дополнительное",
L"Затраты ОД",
L"Стрельба очередью",
};
STR16 gzItemDescGenIndexes[] =
{
L"Парам.",
L"0",
L"+/-",
L"=",
};
STR16 gzUDBButtonTooltipText[]=
{
L"|И|н|ф|о|р|м|а|ц|и|о|н|н|а|я |ч|а|с|т|ь:\n \nЗдесь вы сможете ознакомиться \nс общим описанием предмета.",
L"|П|а|р|а|м|е|т|р|ы:\n \nЗдесь вы сможете ознакомиться \nс индивидуальными свойствами и параметрами предмета.",
L"|Д|о|п|о|л|н|и|т|е|л|ь|н|а|я| |и|н|ф|о|р|м|а|ц|и|я:\n \nЗдесь вы сможете ознакомиться \nс бонусами, дающимися данным предметом.",
};
STR16 gzUDBHeaderTooltipText[]=
{
L"|О|с|н|о|в|н|ы|е |п|а|р|а|м|е|т|р|ы:\n \nСвойства и данные этого предмета\n(Оружие / Броня / и другое).",
L"|Д|о|п|о|л|н|и|т|е|л|ь|н|ы|е| |п|а|р|а|м|е|т|р|ы:\n \nДополнительные свойства \nи/или возможные вторичные характеристики.",
L"|З|а|т|р|а|т|ы| |О|Д:\n \nКоличество Очков Действия необходимых \nна стрельбу и другие действия с оружием.",
L"|С|т|р|е|л|ь|б|а| |о|ч|е|р|е|д|ь|ю| |- |п|а|р|а|м|е|т|р|ы|:\n \nПараметры данного оружия, \nкасающиеся стрельбы очередью.",
};
STR16 gzUDBGenIndexTooltipText[]=
{
L"|С|и|м|в|о|л|ь|н|о|е| |о|б|о|з|н|а|ч|е|н|и|е| |п|а|р|а|м|е|т|р|о|в\n \nУкажите курсором на символ \nчтобы увидеть что он значит.",
L"|С|т|а|н|д|а|р|т|н|о|е |з|н|а|ч|е|н|и|е\n \nСтандартное значение праметров предмета \n(без штрафов и бонусов навески и аммуниции).",
L"|Б|о|н|у|с|ы| |н|а|в|е|с|к|и\n \nБонусы или штрафы, обусловленные \nнавеской, аммуницией или повреждениями вещи.",
L"|С|у|м|м|а|р|н|о|е| |з|н|а|ч|е|н|и|е\n \nСуммарное значение параметров предмета, \nучитывая все бонусы/штрафы навески и аммуниции.",
};
STR16 gzUDBAdvIndexTooltipText[]=
{
L"Символьное обозначение параметров \n(укажите курсором на символ \nчтобы увидеть что он значит ).",
L"Бонус/штраф если |с|т|о|и|ш|ь.",
L"Бонус/штраф при |г|у|с|и|н|о|м| |ш|а|г|е.",
L"Бонус/штраф если |п|о|л|з|ё|ш|ь.",
L"Даден бонус/штраф",
};
STR16 szUDBGenWeaponsStatsTooltipText[]=
{
L"|A|c|c|u|r|a|c|y",
L"|D|a|m|a|g|e",
L"|R|a|n|g|e",
L"|A|l|l|o|w|e|d |A|i|m|i|n|g |L|e|v|e|l|s",
L"|S|c|o|p|e |M|a|g|n|i|f|i|c|a|t|i|o|n |F|a|c|t|o|r",
L"|P|r|o|j|e|c|t|i|o|n |F|a|c|t|o|r",
L"|H|i|d|d|e|n |M|u|z|z|l|e |F|l|a|s|h",
L"|L|o|u|d|n|e|s|s",
L"|R|e|l|i|a|b|i|l|i|t|y",
L"|R|e|p|a|i|r |E|a|s|e",
L"|M|i|n|. |R|a|n|g|e |f|o|r |A|i|m|i|n|g |B|o|n|u|s",
L"|T|o|-|H|i|t |M|o|d|i|f|i|e|r",
L"", // (12)
L"|A|P|s |t|o |R|e|a|d|y",
L"|A|P|s |t|o |A|t|t|a|c|k",
L"|A|P|s |t|o |B|u|r|s|t",
L"|A|P|s |t|o |A|u|t|o|f|i|r|e",
L"|A|P|s |t|o |R|e|l|o|a|d",
L"|A|P|s |t|o |R|e|c|h|a|m|b|e|r",
L"|L|a|t|e|r|a|l |R|e|c|o|i|l",
L"|V|e|r|t|i|c|a|l |R|e|c|o|i|l",
L"|A|u|t|o|f|i|r|e |B|u|l|l|e|t|s |p|e|r |5 |A|P|s",
};
STR16 szUDBGenWeaponsStatsExplanationsTooltipText[]=
{
L"\n \nDetermines whether bullets fired by\nthis gun will stray far from where\nit is pointed.\n \nScale: 0-100.\nHigher is better.",
L"\n \nDetermines the average amount of damage done\nby bullets fired from this weapon, before\ntaking into account armor or armor-penetration.\n \nHigher is better.",
L"\n \nThe maximum distance (in tiles) that\nbullets fired from this gun will travel\nbefore they begin dropping towards the\nground.\n \nHigher is better.",
L"\n \nThis is the number of Extra Aiming\nLevels you can add when aiming this gun.\n \nThe FEWER aiming levels are allowed, the MORE\nbonus each aiming level gives you. Therefore,\nhaving FEWER levels makes the gun faster to aim,\nwithout making it any less accurate.\n \nLower is better.",
L"\n \nWhen greater than 1.0, will proportionally reduce\naiming errors at a distance.\n \nRemember that high scope magnification is detrimental\nwhen the target is too close!\n \nA value of 1.0 means no scope is installed.",
L"\n \nProportionally reduces aiming errors at a distance.\n \nThis effect works up to a given distance,\nthen begins to dissipate and eventually\ndisappears at sufficient range.\n \nHigher is better.",
L"\n \nWhen this property is in effect, the weapon\nproduces no visible flash when firing.\n \nEnemies will not be able to spot you\njust by your muzzle flash (but they\nmight still HEAR you).",
L"\n \nWhen firing this weapon, Loudness is the\ndistance (in tiles) that the sound of\ngunfire will travel.\n \nEnemies within this distance will probably\nhear the shot.\n \nLower is better.",
L"\n \nDetermines how quickly this weapon will degrade\nwith use.\n \nHigher is better.",
L"\n \nDetermines how difficult it is to repair this weapon.\n \nHigher is better.",
L"\n \nThe minimum range at which a scope can provide it's aimBonus.",
L"\n \nTo hit modifier granted by laser sights.",
L"", // (12)
L"\n \nThe number of APs required to bring this\nweapon up to firing stance.\n \nOnce the weapon is raised, you may fire repeatedly\nwithout paying this cost again.\n \nA weapon is automatically 'Unreadied' if its\nwielder performs any action other than\nfiring or turning.\n \nLower is better.",
L"\n \nThe number of APs required to perform\na single attack with this weapon.\n \nFor guns, this is the cost of firing\na single shot without extra aiming.\n \nIf this icon is greyed-out, single-shots\n are not possible with this weapon.\n \nLower is better.",
L"\n \nThe number of APs required to fire\na burst.\n \nThe number of bullets fired in each burst is\ndetermined by the weapon itself, and indicated\nby the number of bullets shown on this icon.\n \nIf this icon is greyed-out, burst fire\nis not possible with this weapon.\n \nLower is better.",
L"\n \nThe number of APs required to fire\nan Autofire Volley of three bullets.\n \nIf you wish to fire more than 3 bullets,\nyou will need to pay extra APs.\n \nIf this icon is greyed-out, autofire\nis not possible with this weapon.\n \nLower is better.",
L"\n \nThe number of APs required to reload\nthis weapon.\n \nLower is better.",
L"\n \nThe number of APs required to rechamber this weapon\nbetween each and every shot fired.\n \nLower is better.",
L"\n \nThe distance this weapon's muzzle will shift\nhorizontally between each and every bullet in a\nburst or autofire volley.\n \nPositive numbers indicate shifting to the right.\nNegative numbers indicate shifting to the left.\n \nCloser to 0 is better.",
L"\n \nThe distance this weapon's muzzle will shift\nvertically between each and every bullet in a\nburst or autofire volley.\n \nPositive numbers indicate shifting upwards.\nNegative numbers indicate shifting downwards.\n \nCloser to 0 is better.",
L"\n \nIndicates the number of bullets that will be added\nto an autofire volley for every extra 5 APs\nyou spend.\n \nHigher is better.",
};
STR16 szUDBGenArmorStatsTooltipText[]=
{
L"|P|r|o|t|e|c|t|i|o|n |V|a|l|u|e",
L"|C|o|v|e|r|a|g|e",
L"|D|e|g|r|a|d|e |R|a|t|e",
};
STR16 szUDBGenArmorStatsExplanationsTooltipText[]=
{
L"\n \nThis primary armor property defines how much\ndamage the armor will absorb from any attack.\n \nRemember that armor-piercing attacks and\nvarious randomal factors may alter the\nfinal damage reduction.\n \nHigher is better.",
L"\n \nDetermines how much of the protected\nbodypart is covered by the armor.\n \nIf coverage is below 100%, attacks have\na certain chance of bypassing the armor\ncompletely, causing maximum damage\nto the protected bodypart.\n \nHigher is better.",
L"\n \nIndicates how quickly this armor's condition\ndrops when it is struck, proportional to\nthe damage caused by the attack.\n \nLower is better.",
};
STR16 szUDBGenAmmoStatsTooltipText[]=
{
L"|A|r|m|o|r |P|i|e|r|c|i|n|g",
L"|B|u|l|l|e|t |T|u|m|b|l|e",
L"|P|r|e|-|I|m|p|a|c|t |E|x|p|l|o|s|i|o|n",
};
STR16 szUDBGenAmmoStatsExplanationsTooltipText[]=
{
L"\n \nThis is the bullet's ability to penetrate\na target's armor.\n \nWhen above 1.0, the bullet proportionally\nreduces the Protection value of any\narmor it hits.\n \nWhen below 1.0, the bullet increases the\nprotection value of the armor instead.\n \nHigher is better.",
L"\n \nDetermines a proportional increase of damage\npotential once the bullet gets through the\ntarget's armor and hits the bodypart behind it.\n \nWhen above 1.0, the bullet's damage\nincreases after penetrating the armor.\n \nWhen below 1.0, the bullet's damage\npotential decreases after passing through armor.\n \nHigher is better.",
L"\n \nA multiplier to the bullet's damage potential\nthat is applied immediately before hitting the\ntarget.\n \nValues above 1.0 indicate an increase in damage,\nvalues below 1.0 indicate a decrease.\n \nHigher is better.",
};
STR16 szUDBGenExplosiveStatsTooltipText[]=
{
L"|D|a|m|a|g|e",
L"|S|t|u|n |D|a|m|a|g|e",
L"|B|l|a|s|t |R|a|d|i|u|s",
L"|S|t|u|n |B|l|a|s|t |R|a|d|i|u|s",
L"|N|o|i|s|e |B|l|a|s|t |R|a|d|i|u|s",
L"|T|e|a|r|g|a|s |S|t|a|r|t |R|a|d|i|u|s",
L"|M|u|s|t|a|r|d |G|a|s |S|t|a|r|t |R|a|d|i|u|s",
L"|L|i|g|h|t |S|t|a|r|t |R|a|d|i|u|s",
L"|S|m|o|k|e |S|t|a|r|t |R|a|d|i|u|s",
L"|I|n|c|e|n|d|i|a|r|y |S|t|a|r|t |R|a|d|i|u|s",
L"|T|e|a|r|g|a|s |E|n|d |R|a|d|i|u|s",
L"|M|u|s|t|a|r|d |G|a|s |E|n|d |R|a|d|i|u|s",
L"|L|i|g|h|t |E|n|d |R|a|d|i|u|s",
L"|S|m|o|k|e |E|n|d |R|a|d|i|u|s",
L"|I|n|c|e|n|d|i|a|r|y |E|n|d |R|a|d|i|u|s",
L"|E|f|f|e|c|t |D|u|r|a|t|i|o|n",
L"|L|o|u|d|n|e|s|s",
L"|V|o|l|a|t|i|l|i|t|y",
};
STR16 szUDBGenExplosiveStatsExplanationsTooltipText[]=
{
L"\n \nThe amount of damage caused by this explosive.\n \nNote that blast-type explosives deliver this damage\nonly once (when they go off), while prolonged effect\nexplosives deliver this amount of damage every turn until the\neffect dissipates.\n \nHigher is better.",
L"\n \nThe amount of non-lethal (stun) damage caused\nby this explosive.\n \nNote that blast-type explosives deliver their damage\nonly once (when they go off), while prolonged effect\nexplosives deliver this amount of stun damage every\nturn until the effect dissipates.\n \nHigher is better.",
L"\n \nThis is the radius of the explosive blast caused by\nthis explosive item.\n \nTargets will suffer less damage the further they are\nfrom the center of the explosion.\n \nHigher is better.",
L"\n \nThis is the radius of the stun-blast caused by\nthis explosive item.\n \nTargets will suffer less damage the further they are\nfrom the center of the blast.\n \nHigher is better.",
L"\n \nThis is the distance that the noise from this\ntrap will travel. Soldiers within this distance\nare likely to hear the noise and be alerted.\n \nLower is better.",
L"\n \nThis is the starting radius of the tear-gas\nreleased by this explosive item.\n \nEnemies caught within the radius will suffer\nthe listed damage and stun-damage each turn,\nunless wearing a gas mask.\n \nAlso note the end radius and duration\nof the effect (displayed below).\n \nHigher is better.",
L"\n \nThis is the starting radius of the mustard-gas\nreleased by this explosive item.\n \nEnemies caught within the radius will suffer\nthe listed damage and stun-damage each turn,\nunless wearing a gas mask.\n \nAlso note the end radius and duration\nof the effect (displayed below).\n \nHigher is better.",
L"\n \nThis is the starting radius of the light\nemitted by this explosive item.\n \nTiles close to the center of the effect will become\nvery bright, while tiles nearer the edge\nwill only be a little brighter than normal.\n \nAlso note the end radius and duration\nof the effect (displayed below).\n \nAlso remember that unlike other explosives with\ntimed effects, the light effect gets SMALLER\nover time, until it disappears.\n \nHigher is better.",
L"\n \nThis is the starting radius of the smoke\nreleased by this explosive item.\n \nEnemies caught within the radius will suffer\nthe listed damage and stun-damage each turn\n(if any), unless wearing a gas mask. More importantly,\nanyone inside the cloud becomes extremely difficult to spot,\nand also loses a large chunk of sight-range themselves.\n \nAlso note the end radius and duration\nof the effect (displayed below).\n \nHigher is better.",
L"\n \nThis is the starting radius of the flames\ncaused by this explosive item.\n \nEnemies caught within the radius will suffer\nthe listed damage and stun-damage each turn.\n \nAlso note the end radius and duration of the effect\n(displayed below).\n \nHigher is better.",
L"\n \nThis is the final radius of the tear-gas released\nby this explosive item before it dissipates.\n \nEnemies caught within the radius will suffer\nthe listed damage and stun-damage each turn,\nunless wearing a gas mask.\n \nAlso note the start radius and duration\nof the effect.\n \nHigher is better.",
L"\n \nThis is the final radius of the mustard-gas released\nby this explosive item before it dissipates.\n \nEnemies caught within the radius will suffer\nthe listed damage and stun-damage each turn,\nunless wearing a gas mask.\n \nAlso note the start radius and duration\nof the effect.\n \nHigher is better.",
L"\n \nThis is the final radius of the light emitted\nby this explosive item before it dissipates.\n \nTiles close to the center of the effect will become\nvery bright, while tiles nearer the edge\nwill only be a little brighter than normal.\n \nAlso note the start radius and duration\nof the effect.\n \nAlso remember that unlike other explosives with\ntimed effects, the light effect gets SMALLER\nover time, until it disappears.\n \nHigher is better.",
L"\n \nThis is the final radius of the smoke released\nby this explosive item before it dissipates.\n \nEnemies caught within the radius will suffer\nthe listed damage and stun-damage each turn\n(if any), unless wearing a gas mask. More importantly,\nanyone inside the cloud becomes extremely difficult to spot,\nand also loses a large chunk of sight-range themselves.\n \nAlso note the start radius and duration\nof the effect.\n \nHigher is better.",
L"\n \nThis is the final radius of the flames caused\nby this explosive item before they dissipate.\n \nEnemies caught within the radius will suffer\nthe listed damage and stun-damage each turn.\n \nAlso note the start radius and duration of the effect.\n \nHigher is better.",
L"\n \nThis is the duration of the explosive effect.\n \nEach turn, the radius of the effect will grow by\none tile in every direction, until reaching\nthe listed End Radius.\n \nOnce the duration has been reached, the effect\ndissipates completely.\n \nNote that light-type explosives become SMALLER\nover time, unlike other effects.\n \nHigher is better.",
L"\n \nThis is the distance (in Tiles) within which\nsoldiers and mercs will hear the explosion when\nit goes off.\n \nEnemies hearing the explosion will be alerted to your\npresence.\n \nLower is better.",
L"\n \nThis value represents a chance (out of 100) for this\nexplosive to spontaneously explode whenever it is damaged\n(for instance, when other explosions go off nearby).\n \nCarrying highly-volatile explosives into combat\nis therefore extremely risky and should be avoided.\n \nScale: 0-100.\nLower is better.",
};
STR16 szUDBGenSecondaryStatsTooltipText[]=
{
L"|T|r|a|c|e|r |A|m|m|o",
L"|A|n|t|i|-|T|a|n|k |A|m|m|o",
L"|I|g|n|o|r|e|s |A|r|m|o|r",
L"|A|c|i|d|i|c |A|m|m|o",
L"|L|o|c|k|-|B|u|s|t|i|n|g |A|m|m|o",
L"|R|e|s|i|s|t|a|n|t |t|o |E|x|p|l|o|s|i|v|e|s",
L"|W|a|t|e|r|p|r|o|o|f",
L"|E|l|e|c|t|r|o|n|i|c",
L"|G|a|s |M|a|s|k",
L"|N|e|e|d|s |B|a|t|t|e|r|i|e|s",
L"|C|a|n |P|i|c|k |L|o|c|k|s",
L"|C|a|n |C|u|t |W|i|r|e|s",
L"|C|a|n |S|m|a|s|h |L|o|c|k|s",
L"|M|e|t|a|l |D|e|t|e|c|t|o|r",
L"|R|e|m|o|t|e |T|r|i|g|g|e|r",
L"|R|e|m|o|t|e |D|e|t|o|n|a|t|o|r",
L"|T|i|m|e|r |D|e|t|o|n|a|t|o|r",
L"|C|o|n|t|a|i|n|s |G|a|s|o|l|i|n|e",
L"|T|o|o|l |K|i|t",
L"|T|h|e|r|m|a|l |O|p|t|i|c|s",
L"|X|-|R|a|y |D|e|v|i|c|e",
L"|C|o|n|t|a|i|n|s |D|r|i|n|k|i|n|g |W|a|t|e|r",
L"|C|o|n|t|a|i|n|s |A|l|c|o|h|o|l",
L"|F|i|r|s|t |A|i|d |K|i|t",
L"|M|e|d|i|c|a|l |K|i|t",
L"|L|o|c|k |B|o|m|b",
};
STR16 szUDBGenSecondaryStatsExplanationsTooltipText[]=
{
L"\n \nThis ammo creates a tracer effect when firedin\nfull-auto or burst mode.\n \nTracer fire helps keep the volley accurate\nand thus deadly despite the gun's recoil.\n \nAlso, tracer bullets create paths of light that\ncan reveal a target in darkness. However, they\nalso reveal the shooter to the enemy!\n \nTracer Bullets automatically disable any\nMuzzle Flash Suppression items installed on the\nsame weapon.",
L"\n \nThis ammo can damage the armor on a tank.\n \nAmmo WITHOUT this property will do no damage\nat all to tanks.\n \nEven with this property, remember that most guns\ndon't cause enough damage anyway, so don't\nexpect too much.",
L"\n \nThis ammo ignores armor completely.\n \nWhen fired at an armored target, it will behave\nas though the target is completely unarmored,\nand thus transfer all its damage potential to the target!",
L"\n \nWhen this ammo strikes the armor on a target,\n \nit will cause that armor to degrade rapidly.\n \nThis can potentially strip a target of its\narmor!",
L"\n \nThis type of ammo is exceptional at breaking locks.\n \nFire it directly at a locked door or container\nto cause massive damage to the lock.",
L"\n \nThis armor is three times more resistant\nagainst explosives than it should be, given\nits Protection value.\n \nWhen an explosion hits the armor, its Protection\nvalue is considered three times higher than\nthe listed value.",
L"\n \nThis item is imprevious to water. It does not\nreceive damage from being submerged.\n \nItems WITHOUT this property will gradually deteriorate\nif the person carrying them goes for a swim.",
L"\n \nThis item is electronic in nature, and contains\ncomplex circuitry.\n \nElectronic items are inherently more difficult\nto repair, at least without the ELECTRONICS skill.",
L"\n \nWhen this item is worn on a character's face,\nit will protect them from all sorts of noxious gasses.\n \nNote that some gasses are corrosive, and might eat\nright through the mask...",
L"\n \nThis item requires batteries. Without batteries,\nyou cannot activate its primary abilities.\n \nTo use a set of batteries, attach them to\nthis item as you would a scope to a rifle.",
L"\n \nThis item can be used to pick open locked\ndoors or containers.\n \nLockpicking is silent, although it requires\nsubstantial mechanical skill to pick anything\nbut the simplest locks.",
L"\n \nThis item can be used to cut through wire fences.\n \nThis allows a character to rapidly move through\nfenced areas, possibly outflanking the enemy!",
L"\n \nThis item can be used to smash open locked\ndoors or containers.\n \nLock-smashing requires substantial strength,\ngenerates a lot of noise, and can easily\ntire a character out. However, it is a good\nway to get through locks without superior skills or\ncomplicated tools.",
L"\n \nThis item can be used to detect metallic objects\nunder the ground.\n \nNaturally, its primary function is to detect\nmines without the necessary skills to spot them\nwith the naked eye.\n \nMaybe you'll find some buried treasure too.",
L"\n \nThis item can be used to detonate a bomb\nwhich has been set with a remote detonator.\n \nPlant the bomb first, then use the\nRemote Trigger item to set it off when the\ntime is right.",
L"\n \nWhen attached to an explosive device and set up\nin the right position, this detonator can be triggered\nby a (separate) remote device.\n \nRemote Detonators are great for setting traps,\nbecause they only go off when you tell them to.\n \nAlso, you have plenty of time to get away!",
L"\n \nWhen attached to an explosive device and set up\nin the right position, this detonator will count down\nfrom the set amount of time, and explode once the\ntimer expires.\n \nTimer Detonators are cheap and easy to install,\nbut you'll need to time them just right to give\nyourself enough chance to get away!",
L"\n \nThis item contains gasoline (fuel).\n \nIt might come in handy if you ever\nneed to fill up a gas tank...",
L"\n \nThis item contains various tools that can\nbe used to repair other items.\n \nA toolkit item is always required when setting\na character to repair duty.",
L"\n \nWhen worn in a face-slot, this item provides\nthe ability to spot enemies through walls,\nthanks to their heat signature.",
L"\n \nThis powerful device can be used to scan\nfor enemies using X-rays.\n \nIt will reveal all enemies within a certain radius\nfor a short period of time.\n \nKeep away from reproductive organs!",
L"\n \nThis item contains fresh drinking water.\nUse when thirsty.",
L"\n \nThis item contains liquor, alcohol, booze,\nwhatever you fancy calling it.\n \nUse with caution. Do not drink and drive.\nMay cause cirrhosis of the liver.",
L"\n \nThis is a basic field medical kit, containing\nitems required to provide basic medical aid.\n \nIt can be used to bandage wounded characters\nand prevent bleeding.\n \nFor actual healing, use a proper Medical Kit\nand/or plenty of rest.",
L"\n \nThis is a proper medical kit, which can\nbe used in surgery and other serious medicinal\npurposes.\n \nMedical Kits are always required when setting\na character to Doctoring duty.",
L"\n \nThis item can be used to blast open locked\ndoors and containers.\n \nExplosives skill is required to avoid\npremature detonation.\n \nBlowing locks is a relatively easy way of quickly\ngetting through locked doors. However,\nit is very loud, and dangerous to most characters.",
};
STR16 szUDBAdvStatsTooltipText[]=
{
L"|A|c|c|u|r|a|c|y |M|o|d|i|f|i|e|r",
L"|F|l|a|t |S|n|a|p|s|h|o|t |M|o|d|i|f|i|e|r",
L"|P|e|r|c|e|n|t |S|n|a|p|s|h|o|t |M|o|d|i|f|i|e|r",
L"|F|l|a|t |A|i|m|i|n|g |M|o|d|i|f|i|e|r",
L"|P|e|r|c|e|n|t |A|i|m|i|n|g |M|o|d|i|f|i|e|r",
L"|A|l|l|o|w|e|d |A|i|m|i|n|g |L|e|v|e|l|s |M|o|d|i|f|i|e|r",
L"|A|i|m|i|n|g |C|a|p |M|o|d|i|f|i|e|r",
L"|G|u|n |H|a|n|d|l|i|n|g |M|o|d|i|f|i|e|r",
L"|D|r|o|p |C|o|m|p|e|n|s|a|t|i|o|n |M|o|d|i|f|i|e|r",
L"|T|a|r|g|e|t |T|r|a|c|k|i|n|g |M|o|d|i|f|i|e|r",
L"|D|a|m|a|g|e |M|o|d|i|f|i|e|r",
L"|M|e|l|e|e |D|a|m|a|g|e |M|o|d|i|f|i|e|r",
L"|R|a|n|g|e |M|o|d|i|f|i|e|r",
L"|S|c|o|p|e |M|a|g|n|i|f|i|c|a|t|i|o|n |F|a|c|t|o|r",
L"|P|r|o|j|e|c|t|i|o|n |F|a|c|t|o|r",
L"|L|a|t|e|r|a|l |R|e|c|o|i|l |M|o|d|i|f|i|e|r",
L"|V|e|r|t|i|c|a|l |R|e|c|o|i|l |M|o|d|i|f|i|e|r",
L"|M|a|x|i|m|u|m |C|o|u|n|t|e|r|-|F|o|r|c|e |M|o|d|i|f|i|e|r",
L"|C|o|u|n|t|e|r|-|F|o|r|c|e |A|c|c|u|r|a|c|y |M|o|d|i|f|i|e|r",
L"|C|o|u|n|t|e|r|-|F|o|r|c|e |F|r|e|q|u|e|n|c|y |M|o|d|i|f|i|e|r",
L"|T|o|t|a|l |A|P |M|o|d|i|f|i|e|r",
L"|A|P|-|t|o|-|R|e|a|d|y |M|o|d|i|f|i|e|r",
L"|S|i|n|g|l|e|-|a|t|t|a|c|k |A|P |M|o|d|i|f|i|e|r",
L"|B|u|r|s|t |A|P |M|o|d|i|f|i|e|r",
L"|A|u|t|o|f|i|r|e |A|P |M|o|d|i|f|i|e|r",
L"|R|e|l|o|a|d |A|P |M|o|d|i|f|i|e|r",
L"|M|a|g|a|z|i|n|e |S|i|z|e |M|o|d|i|f|i|e|r",
L"|B|u|r|s|t |S|i|z|e |M|o|d|i|f|i|e|r",
L"|H|i|d|d|e|n |M|u|z|z|l|e |F|l|a|s|h",
L"|L|o|u|d|n|e|s|s |M|o|d|i|f|i|e|r",
L"|I|t|e|m |S|i|z|e |M|o|d|i|f|i|e|r",
L"|R|e|l|i|a|b|i|l|i|t|y |M|o|d|i|f|i|e|r",
L"|W|o|o|d|l|a|n|d |C|a|m|o|u|f|l|a|g|e",
L"|U|r|b|a|n |C|a|m|o|u|f|l|a|g|e",
L"|D|e|s|e|r|t |C|a|m|o|u|f|l|a|g|e",
L"|S|n|o|w |C|a|m|o|u|f|l|a|g|e",
L"|S|t|e|a|l|t|h |M|o|d|i|f|i|e|r",
L"|H|e|a|r|i|n|g |R|a|n|g|e |M|o|d|i|f|i|e|r",
L"|G|e|n|e|r|a|l |V|i|s|i|o|n |R|a|n|g|e |M|o|d|i|f|i|e|r",
L"|N|i|g|h|t|-|t|i|m|e |V|i|s|i|o|n |R|a|n|g|e |M|o|d|i|f|i|e|r",
L"|D|a|y|-|t|i|m|e |V|i|s|i|o|n |R|a|n|g|e |M|o|d|i|f|i|e|r",
L"|B|r|i|g|h|t|-|L|i|g|h|t |V|i|s|i|o|n |R|a|n|g|e |M|o|d|i|f|i|e|r",
L"|C|a|v|e |V|i|s|i|o|n |R|a|n|g|e |M|o|d|i|f|i|e|r",
L"|T|u|n|n|e|l |V|i|s|i|o|n",
L"|M|a|x|i|m|u|m |C|o|u|n|t|e|r|-|F|o|r|c|e",
L"|C|o|u|n|t|e|r|-|F|o|r|c|e |F|r|e|q|u|e|n|c|y",
L"|T|o|-|H|i|t |B|o|n|u|s",
L"|A|i|m |B|o|n|u|s",
};
// Alternate tooltip text for weapon Advanced Stats. Just different wording, nothing spectacular.
STR16 szUDBAdvStatsExplanationsTooltipText[]=
{
L"\n \nWhen attached to a ranged weapon, this item\nmodifies the weapon's Accuracy value.\n \nIncreased accuracy allows the gun to hit targets\nat longer ranges more often, assuming it is\nalso well-aimed.\n \nScale: -100 to +100.\nHigher is better.",
L"\n \nThis item modifies the shooter's accuracy\nfor ANY shot with a ranged weapon by the\nlisted amount.\n \nScale: -100 to +100.\nHigher is better.",
L"\n \nThis item modifies the shooter's accuracy\nfor ANY shot with a ranged weapon by the\nlisted percentage, based on their original accuracy.\n \nHigher is better.",
L"\n \nThis item modifies the accuracy gained from each\nextra aiming level you pay for, when aiming\na ranged weapon, by the\nlisted amount.\n \nScale: -100 to +100.\nHigher is better.",
L"\n \nThis item modifies the accuracy gained from each\nextra aiming level you pay for, when aiming\na ranged weapon, by the\nlisted percentage based on the original value.\n \nHigher is better.",
L"\n \nThis item modifies the number of extra aiming\nlevels this gun can take.\n \nReducing the number of allowed aiming levels\nmeans that each level adds proportionally\nmore accuracy to the shot.\nTherefore, the FEWER aiming levels are allowed,\nthe faster you can aim this gun, without losing\naccuracy!\n \nLower is better.",
L"\n \nThis item modifies the shooter's maximum accuracy\nwhen using ranged weapons, as a percentage\nof their original maximum accuracy.\n \nHigher is better.",
L"\n \nWhen attached to a ranged weapon, this item\nmodifies the weapon's Handling difficulty.\n \nBetter handling makes the gun more accurate to fire,\nwith or without extra aiming.\n \nNote that this is based on the gun's original\nGun Handling factor, which is higher for rifles and\nheavy weapons, and lower for pistols and small\nweapons.\n \nLower is better.",
L"\n \nThis item modifies the difficulty of\ncompensating for shots beyond a weapon's range.\n \nA high bonus here can increase a weapon's\nnatural Maximum Range by at least a few tiles.\n \nHigher is better.",
L"\n \nThis item modifies the difficulty of hitting\na moving target with a ranged weapon.\n \nA high bonus here can help hitting\nfast-moving targets, even at a distance.\n \nHigher is better.",
L"\n \nThis item modifies the damage output of\nyour weapon, by the listed amount.\n \nHigher is better.",
L"\n \nThis item modifies the damage output of\nyour melee weapon, by the listed amount.\n \nThis applies only to melee weapons, both sharp\nand blunt.\n \nHigher is better.",
L"\n \nWhen attached to a ranged weapon, this item\nmodifies its maximum effective range.\n \nMaximum Range mainly dictates how far a bullet\nfired from the weapon can fly before it begins\ndropping sharply towards the ground.\n \nHigher is better.",
L"\n \nWhen attached to a ranged weapon, this item\nprovides extra magnification, making shots at a distance\ncomparatively easier to make.\n \nNote that a high Magnification Factor is detrimental\nwhen used at targets CLOSER than the\noptimal distance.\n \nHigher is better.",
L"\n \nWhen attached to a ranged weapon, this item\nprojects a dot on the target, making it easier to hit.\n \nThe projection effect is only useful up to a given\ndistance, beyond which it begins to diminish and\neventually disappears.\n \nHigher is better.",
L"\n \nWhen attached to a ranged weapon capable\nof Burst or Autofire modes, this item modifies\nthe weapon's Horizontal Recoil\nby the listed percentage.\n \nReducing recoil makes it easier to keep the gun's\nmuzzle pointed at the target during a volley.\n \nLower is better.",
L"\n \nWhen attached to a ranged weapon capable\nof Burst or Autofire modes, this item modifies\nthe weapon's Vertical Recoil\nby the listed percentage.\n \nReducing recoil makes it easier to keep the gun's\nmuzzle pointed at the target during a volley.\n \nLower is better.",
L"\n \nThis item modifies the shooter's ability to\ncope with recoil during Burst or Autofire volleys.\n \nWhen high, this can help a shooter to control\nguns with powerful recoil, even if the shooter\nhas low Strength.\n \nHigher is better.",
L"\n \nThis item modifies the shooter's ability to\naccurately apply counter-force against a gun's\nrecoil, during Burst or Autofire volleys.\n \nA high bonus helps the shooter bring the gun's muzzle\nprecisely towards the target, even at longer ranges,\nmaking volleys more accurate as a result.\n \nHigher is better.",
L"\n \nThis item modifies the shooter's ability to\nfrequently reasses how much counter-force they\nneed to apply against a gun's recoil, during Burst\nor Autofire volleys.\n \nHigher frequency makes volleys more accurate on the whole,\nand also makes longer volleys more accurate assuming\nthe shooter can overcome recoil correctly.\n \nHigher is better.",
L"\n \nThis item directly modifies the amount of\nAPs the character gets at the start of each turn.\n \nHigher is better.",
L"\n \nWhen attached to a ranged weapon, this item\nmodifiest the AP cost to bring the weapon to\n'Ready' mode.\n \nLower is better.",
L"\n \nWhen attached to any weapon, this item\nmodifies the AP cost to make a single attack with\nthat weapon.\n \nNote that for Burst/Auto-capable weapons, the\ncost of using these modes is directly influenced\nby this modifier as well!\n \nLower is better.",
L"\n \nWhen attached to a ranged weapon capable of\nBurst-fire mode, this item modifies the AP cost\nof firing a Burst.\n \nLower is better.",
L"\n \nWhen attached to a ranged weapon capable of\nAuto-fire mode, this item modifies the AP cost\nof firing an Autofire Volley.\n \nNote that it does NOT modify the extra AP\ncost for adding bullets to the volley, only\nthe initial cost for starting the volley.\n \nLower is better.",
L"\n \nWhen attached to a ranged weapon, this item\nmodifies the AP cost of reloading the weapon.\n \nLower is better.",
L"\n \nWhen attached to a ranged weapon, this item\nchanges the size of magazines that can be loaded\ninto the weapon.\n \nThat weapon will now accept larger or smaller\nmagazines of the same caliber.\n \nHigher is better.",
L"\n \nWhen attached to a ranged weapon, this item\nmodifies the amount of bullets fired\nby the weapon in Burst mode.\n \nIf the weapon was not initially Burst-Capable, and the\nmodifier is positive, attaching it to the weapon\nwill enable burst-fire mode.\n \nConversely, if the weapon is initially Burst-Capable,\na high-enough negative modifier here can disable\nburst mode completely.\n \nHigher is USUALLY better. Of course, part of the\npoint in Burst Mode is to conserve bullets...",
L"\n \nWhen attached to a ranged weapon, this item\nwill hide the weapon's muzzle flash.\n \nThis makes sure that enemies cannot spot the shooter\nif he is firing while hidden, and is especially\nimportant at night.",
L"\n \nWhen attached to a weapon, this item modifies\nthe range at which firing the weapon can be\nheard by both enemies and mercs.\n \nIf this modifier drops the weapon's Loudness value\nto 0, the weapon becomes completely silent.\n \nLower is better.",
L"\n \nThis item modifies the size of any item it\nis attached to.\n \nSize is important when using the New Inventory system,\nwhere pockets only accept items of specific sizes and shapes.\n \nIncreasing an item's size makes it too big for some pockets\nit used to fit into.\n \nConversely, making an item smaller means it will fit into\nmore pockets, and pockets will be able to contain\nmore of it.\n \nLower is generall better.",
L"\n \nWhen attached to any weapon, this item modifies\nthat weapon's Reliability value.\n \nIf positive, the weapon's condition will deteriorate\nslower when used in combat. Otherwise, the\nweapon deteriorates faster.\n \nHigher is better.",
L"\n \nWhen this item is worn, or attached to a worn\nitem, it modifies the wearer's camouflage in\nwoodland backgrounds.\n \nTo make good on a positive Woodland Camo modifier, the\nwearer needs to stay close to trees or tall grass.\n \nHigher is better.",
L"\n \nWhen this item is worn, or attached to a worn\nitem, it modifies the wearer's camouflage in\nurban backgrounds.\n \nTo make good on a positive Urban Camo modifier, the\nwearer needs to stay close to asphalt or concrete.\n \nHigher is better.",
L"\n \nWhen this item is worn, or attached to a worn\nitem, it modifies the wearer's camouflage in\ndesert backgrounds.\n \nTo make good on a positive Desert Camo modifier, the\nwearer needs to stay close to sand, gravel, or\ndesert vegetation.\n \nHigher is better.",
L"\n \nWhen this item is worn, or attached to a worn\nitem, it modifies the wearer's camouflage in\nsnowy backgrounds.\n \nTo make good on a positive Snow Camo modifier, the\nwearer needs to stay close to snowy tiles.\n \nHigher is better.",
L"\n \nWhen this item is worn, or attached to a worn\nitem, it modifies the wearer's stealth ability by\nmaking it more difficult to HEAR the character moving\nwhile in Sneaking mode.\n \nNote that this does NOT change a character's visibility,\nonly the amount of noise they make while sneaking.\n \nHigher is better.",
L"\n \nWhen this item is worn, or attached to a worn\nitem, it modifies the wearer's Hearing Range by the\nlisted percent.\n \nA positive bonus makes it possible to hear noises\nfrom a greater distance.\n \nConversely, a negative modifier impairs the wearer's hearing.\n \nHigher is better.",
L"\n \nWhen this item is worn, or attached to a worn\nitem, it modifies the wearer's Vision Range by the\nlisted percent.\n \nThis General modifier works in all conditions.\n \nHigher is better.",
L"\n \nWhen this item is worn, or attached to a worn\nitem, it modifies the wearer's Vision Range by the\nlisted percent.\n \nThis Night-Vision modifier works only when light\nlevels are sufficiently low.\n \nHigher is better.",
L"\n \nWhen this item is worn, or attached to a worn\nitem, it modifies the wearer's Vision Range by the\nlisted percent.\n \nThis Day-Vision modifier works only when light\nlevels are average or higher.\n \nHigher is better.",
L"\n \nWhen this item is worn, or attached to a worn\nitem, it modifies the wearer's Vision Range by the\nlisted percent.\n \nThis Bright-Vision modifier works only when light\nlevels are very high, for example when looking\ninto tiles lit by Break-Lights or at high noon.\n \nHigher is better.",
L"\n \nWhen this item is worn, or attached to a worn\nitem, it modifies the wearer's Vision Range by the\nlisted percent.\n \nThis Cave-Vision modifier works only in the dark\nand only underground.\n \nHigher is better.",
L"\n \nWhen this item is worn, or attached to a worn\nitem, it changes the wearer's field-of-view.\n \nNarrowing the field of view shortens sightrange to\neither side.\n \nLower is better.",
L"\n \nThis is the shooter's ability to\ncope with recoil during Burst or Autofire volleys.\n \n\n \nHigher is better.",
L"\n \nThis is the shooter's ability to\nfrequently reasses how much counter-force they\nneed to apply against a gun's recoil, during Burst\nor Autofire volleys.\n \nLower frequency makes volleys more accurate on the whole,\nand also makes longer volleys more accurate assuming\nthe shooter can overcome recoil correctly.\n \nLower is better.",
L"\n \nWhen attached to a ranged weapon, this item\nmodifies the weapon's CTH value.\n \nIncreased CTH allows the gun to hit targets\nmore often, assuming it is also well-aimed.\n \nHigher is better.",
L"\n \nWhen attached to a ranged weapon, this item\nmodifies the weapon's Aim Bonus.\n \nIncreased Aim Bonus allows the gun to hit\ntargets at longer ranges more often, assuming\nit is also well-aimed.\n \nHigher is better.",
};
STR16 szUDBAdvStatsExplanationsTooltipTextForWeapons[]=
{
L"\n \nThis weapon's accuracy is being modified by\nan ammo, attachment, or built-in attributes.\n \nIncreased accuracy allows the gun to hit targets\nat longer ranges more often, assuming it is\nalso well-aimed.\n \nScale: -100 to +100.\nHigher is better.",
L"\n \nThis weapon modifies its shooter's accuracy\nwith ANY shot by the listed amount.\n \nScale: -100 to +100.\nHigher is better.",
L"\n \nThis weapon modifies its shooter's accuracy\nwith ANY shot by the listed percentage\nbased on the shooter's original accuracy.\n \nHigher is better.",
L"\n \nThis weapon modifies the amount of accuracy\ngained from each extra aiming level you\npay for by the listed amount.\n \nScale: -100 to +100.\nHigher is better.",
L"\n \nThis weapon modifies the amount of accuracy\ngained from each extra aiming level you\npay for by the listed percentage, based\non the shooter's original accuracy.\n \nHigher is better.",
L"\n \nThe number of Extra Aiming Levels allowed\nfor this gun has been modified by its ammo,\nattachments, or built-in attributes.\nIf the number of levels is being reduced, the gun is\nfaster to aim without being any less accurate.\n \nConversely, if the number of levels is increased,\nthe gun becomes slower to aim without being\nmore accurate.\n \nLower is better.",
L"\n \nThis weapon modifies the shooter's maximum\naccuracy, as a percentage of the shooter's original\nmaximum accuracy.\n \nHigher is better.",
L"\n \nThis weapon's attachments or inherent abilities\nmodify the weapon's Handling difficulty.\n \nBetter handling makes the gun more accurate to fire,\nwith or without extra aiming.\n \nNote that this is based on the gun's original\nGun Handling factor, which is higher for rifles and\nheavy weapons, and lower for pistols and small\nweapons.\n \nLower is better.",
L"\n \nThis weapon's ability to compensate for shots\nbeyond its maximum range is being modified by\nattachments or the weapon's inherent abilities.\n \nA high bonus here can increase a weapon's\nnatural Maximum Range by at least a few tiles.\n \nHigher is better.",
L"\n \nThis weapon's ability to hit moving targets\nat a distance is being modified by attachments\nor the weapon's inherent abilities.\n \nA high bonus here can help hitting\nfast-moving targets, even at a distance.\n \nHigher is better.",
L"\n \nThis weapon's damage output is being modified\nby its ammo, attachments, or inherent abilities.\n \nHigher is better.",
L"\n \nThis weapon's melee-combat damage output is being\nmodified by its ammo, attachments, or inherent abilities.\n \nThis applies only to melee weapons, both sharp\nand blunt.\n \nHigher is better.",
L"\n \nThis weapon's maximum range has been increased\nor decreased thanks to its ammo, attachments,\nor inherent abilities.\n \nMaximum Range mainly dictates how far a bullet\nfired from the weapon can fly before it begins\ndropping sharply towards the ground.\n \nHigher is better.",
L"\n \nThis weapon is equipped with optical magnification,\nmaking shots at a distance comparatively easier to make.\n \nNote that a high Magnification Factor is detrimental\nwhen used at targets CLOSER than the\noptimal distance.\n \nHigher is better.",
L"\n \nThis weapon is equipped with a projection device\n(possibly a laser), which projects a dot on\nthe target, making it easier to hit.\n \nThe projection effect is only useful up to a given\ndistance, beyond which it begins to diminish and\neventually disappears.\n \nHigher is better.",
L"\n \nThis weapon's horizontal recoil strength is being\nmodified by its ammo, attachments, or inherent\nabilities.\n \nThis has no effect if the weapon lacks both\nBurst and Auto-Fire modes.\n \nReducing recoil makes it easier to keep the gun's\nmuzzle pointed at the target during a volley.\n \nLower is better.",
L"\n \nThis weapon's vertical recoil strength is being\nmodified by its ammo, attachments, or inherent\nabilities.\n \nThis has no effect if the weapon lacks both\nBurst and Auto-Fire modes.\n \nReducing recoil makes it easier to keep the gun's\nmuzzle pointed at the target during a volley.\n \nLower is better.",
L"\n \nThis weapon modifies the shooter's ability to\ncope with recoil during Burst or Autofire volleys,\ndue to its attachments, ammo, or inherent abilities.\n \nWhen high, this can help a shooter to control\nguns with powerful recoil, even if the shooter\nhas low Strength.\n \nHigher is better.",
L"\n \nThis weapon modifies the shooter's ability to\naccurately apply counter-force against its\nrecoil, due to its attachments, ammo, or inherent abilities.\n \nNaturally, this has no effect if the weapon lacks\nboth Burst and Auto-Fire modes.\n \nA high bonus helps the shooter bring the gun's muzzle\nprecisely towards the target, even at longer ranges,\nmaking volleys more accurate as a result.\n \nHigher is better.",
L"\n \nThis weapon modifies the shooter's ability to\nfrequently reasses how much counter-force they\nneed to apply against a gun's recoil, due to its\nattachments, ammo, or inherent abilities.\n \nNaturally, this has no effect if the weapon lacks\nboth Burst and Auto-Fire modes.\n \nHigher frequency makes volleys more accurate on the whole,\nand also makes longer volleys more accurate assuming\nthe shooter can overcome recoil correctly.\n \nHigher is better.",
L"\n \nWhen held in hand, this weapon modifies the amount of\nAPs its user gets at the start of each turn.\n \nHigher is better.",
L"\n \nDue to its attachments, ammo or inherent abilities,\nthe AP cost to bring this weapon to 'Ready' mode has\nbeen modified.\n \nLower is better.",
L"\n \nDue to its attachments, ammo or inherent abilities,\nthe AP cost to make a single attack with this\nweapon has been modified.\n \nNote that for Burst/Auto-capable weapons, the\ncost of using these modes is directly influenced\nby this modifier as well!\n \nLower is better.",
L"\n \nDue to its attachments, ammo or inherent abilities,\nthe AP cost to fire a Burst with this weapon has\nbeen modified.\n \nNaturally, this has no effect if the weapon is not\ncapable of Burst fire.\n \nLower is better.",
L"\n \nDue to its attachments, ammo or inherent abilities,\nthe AP cost to fire an Autofire Volley with this weapon\nhas been modified.\n \nNaturally, this has no effect if the weapon is not\ncapable of Auto Fire.\n \nNote that it does NOT modify the extra AP\ncost for adding bullets to the volley, only\nthe initial cost for starting the volley.\n \nLower is better.",
L"\n \nDue to its attachments, ammo or inherent abilities,\nthe AP cost of reloading this weapon has been modified.\n \nLower is better.",
L"\n \nDue to its attachments, ammo or inherent abilities,\nthe size of magazines that can be loaded into this\nweapon has been modified.\n \nThe weapon will now accept larger or smaller\nmagazines of the same caliber.\n \nHigher is better.",
L"\n \nDue to its attachments, ammo or inherent abilities,\nthe amount of bullets fired by this weapon in Burst mode\nhas been modified.\n \nIf the weapon was not initially Burst-Capable, and the\nmodifier is positive, then this is what\ngives the weapon its burst-fire capability.\n \nConversely, if the weapon was initially Burst-Capable,\na high-enough negative modifier here may have\ndisabled burst mode entirely for this weapon.\n \nHigher is USUALLY better. Of course, part of the\npoint in Burst Mode is to conserve bullets...",
L"\n \nDue to its attachments, ammo or inherent abilities,\nthis weapon produces no muzzle flash.\n \nThis makes sure that enemies cannot spot the shooter\nif he is firing while hidden, and is especially\nimportant at night.",
L"\n \nDue to its attachments, ammo or inherent abilities,\nthis weapon's loudness has been modified. The distance\nat which enemies and mercs can hear the weapon being\nused has subsequently changed.\n \nIf this modifier drops the weapon's Loudness value\nto 0, the weapon becomes completely silent.\n \nLower is better.",
L"\n \nDue to its attachments, ammo or inherent abilities,\nthis weapon's size category has changed.\n \nSize is important when using the New Inventory system,\nwhere pockets only accept items of specific sizes and shapes.\n \nIncreasing an item's size makes it too big for some pockets\nit used to fit into.\n \nConversely, making an item smaller means it will fit into\nmore pockets, and pockets will be able to contain\nmore of it.\n \nLower is generall better.",
L"\n \nDue to its attachments, ammo or inherent abilities,\nthis weapon's reliability has been modified.\n \nIf positive, the weapon's condition will deteriorate\nslower when used in combat. Otherwise, the\nweapon deteriorates faster.\n \nHigher is better.",
L"\n \nWhen this weapon is held in hand, it modifies the\nsoldier's camouflage in woodland backgrounds.\n \nTo make good on a positive Woodland Camo modifier, the\nwearer needs to stay close to trees or tall grass.\n \nHigher is better.",
L"\n \nWhen this weapon is held in hand, it modifies the\nsoldier's camouflage in urban backgrounds.\n \nTo make good on a positive Urban Camo modifier, the\nwearer needs to stay close to asphalt or concrete.\n \nHigher is better.",
L"\n \nWhen this weapon is held in hand, it modifies the\nsoldier's camouflage in desert backgrounds.\n \nTo make good on a positive Desert Camo modifier, the\nwearer needs to stay close to sand, gravel, or\ndesert vegetation.\n \nHigher is better.",
L"\n \nWhen this weapon is held in hand, it modifies the\nsoldier's camouflage in snowy backgrounds.\n \nTo make good on a positive Snow Camo modifier, the\nwearer needs to stay close to snowy tiles.\n \nHigher is better.",
L"\n \nWhen this weapon is held in hand, it modifies the\nsoldier's stealth ability by making it\nmore or less difficult to HEAR the character moving\nwhile in Sneaking mode.\n \nNote that this does NOT change a character's visibility,\nonly the amount of noise they make while sneaking.\n \nHigher is better.",
L"\n \nWhen this weapon is held in hand, it modifies the\nsoldier's Hearing Range by the listed percent.\n \nA positive bonus makes it possible to hear noises\nfrom a greater distance.\n \nConversely, a negative modifier impairs the wearer's hearing.\n \nHigher is better.",
L"\n \nWhen this weapon is raised to the shooting position,\nit modifies the wearer's Vision Range by the\nlisted percent, thanks to attachments or\ninherent properties of the weapon.\n \nThis General modifier works in all conditions.\n \nHigher is better.",
L"\n \nWhen this weapon is raised to the shooting position,\nit modifies the wearer's Vision Range by the\nlisted percent, thanks to attachments or\ninherent properties of the weapon.\n \nThis Night-Vision modifier works only when light\nlevels are sufficiently low.\n \nHigher is better.",
L"\n \nWhen this weapon is raised to the shooting position,\nit modifies the wearer's Vision Range by the\nlisted percent, thanks to attachments or\ninherent properties of the weapon.\n \nThis Day-Vision modifier works only when light\nlevels are average or higher.\n \nHigher is better.",
L"\n \nWhen this weapon is raised to the shooting position,\nit modifies the wearer's Vision Range by the\nlisted percent, thanks to attachments or\ninherent properties of the weapon.\n \nThis Bright-Vision modifier works only when light\nlevels are very high, for example when looking\ninto tiles lit by Break-Lights or at high noon.\n \nHigher is better.",
L"\n \nWhen this weapon is raised to the shooting position,\nit modifies the wearer's Vision Range by the\nlisted percent, thanks to attachments or\ninherent properties of the weapon.\n \nThis Cave-Vision modifier works only in the dark\nand only underground.\n \nHigher is better.",
L"\n \nWhen this weapon is raised to the shooting position,\nit changes the wearer's field-of-view.\n \nNarrowing the field of view shortens sightrange to\neither side.\n \nLower is better.",
L"\n \nThis is the shooter's ability to\ncope with recoil during Burst or Autofire volleys.\n \nHigher is better.",
L"\n \nThis is the shooter's ability to\nfrequently reasses how much counter-force they\nneed to apply against a gun's recoil.\n \nNaturally, this has no effect if the weapon lacks\nboth Burst and Auto-Fire modes.\n \nLower frequency makes volleys more accurate on the whole,\nand also makes longer volleys more accurate assuming\nthe shooter can overcome recoil correctly.\n \nLower is better.",
L"\n \nThis weapon's to-hit is being modified by\nan ammo, attachment, or built-in attributes.\n \nIncreased To-Hit allows the gun to hit targets\nmore often, assuming it is also well-aimed.\n \nHigher is better.",
L"\n \nThis weapon's Aim Bonus is being modified by\nan ammo, attachment, or built-in attributes.\n \nIncreased Aim Bonus allows the gun to hit\ntargets at longer ranges more often, assuming\nit is also well-aimed.\n \nHigher is better.",
};
// HEADROCK HAM 4: Text for the new CTH indicator.
STR16 gzNCTHlabels[]=
{
L"ОДИНОЧНЫЙ", //SINGLE
L"ОД",
};
//////////////////////////////////////////////////////
// HEADROCK HAM 4: End new UDB texts and tooltips
//////////////////////////////////////////////////////
STR16 gzNewLaptopMessages[]=
{
L"Ask about our special offer!",
L"Temporarily Unavailable",
L"This special press preview of Jagged Alliance 2: Unfinished Business contains the only first 6 sector maps. The final version of the game will feature many more - please see the included readme file for details.",
};
STR16 zNewTacticalMessages[]=
{
//L"Расстояние до цели: %d ед., Освещенность: %d/%d",
L"Передатчик подключен к вашему ноутбуку.",
L"Вы не можете нанять %s",
L"Предложение действует ограниченное время и покрывает стоимость найма на всю миссию, плюс вы так же получите оборудование, перечисленное ниже.",
L"Наемник %s - наше невероятное суперпредложение 'одна плата за все'. Вы также бесплатно получите его персональную экипировку.",
L"Гонорар",
L"В секторе кто-то есть...",
//L"Дальнобойность оружия: %d ед., Шанс попасть: %d%%",
L"Показать укрытия",
L"Линия прицела",
L"Новые наемники не могут высадиться здесь.",
L"Так как ваш ноутбук лишился антенны, то вы не сможете нанять новых наемников. Возможно, сейчас вам стоит загрузить одну из сохраненных игр, или начать игру заново!",
L"%s слышит металлический хруст под телом Джерри. Кажется, это чмо сломало антенну вашего ноутбука.", //the %s is the name of a merc.
L"После прочтения записей, оставленных помощником командира Морриса, %s видит, что не все еще потеряно. В записке содержатся координаты городов Арулько для запуска по ним ракет. Кроме того, там также указаны координаты самой ракетной базы.",
L"Изучив панель управления, %s понимает, что координаты цели можно изменить, и тогда ракета уничтожит эту базу. %s не собирается умирать, а значит нужно быстрее отсюда выбираться. Похоже, что самый быстрый способ это лифт...",
L"В начале игры вы выбрали сохранение лишь в \"мирное время\" и теперь не можете записываться во время боя.",
L"(Нельзя сохраняться во время боя)",
L"Текущая кампания длиннее 30 символов.",
L"Текущая кампания не найдена.",
L"Кампания: По умолчанию ( %S )",
L"Кампания: %S",
L"Вы выбрали кампанию %S. Эта кампания является модификацией оригинальной кампании Unfinished Business. Вы уверены, что хотите играть кампанию %S?",
L"Чтобы воспользоваться редактором, смените кампанию по умолчанию на другую.",
};
#endif //RUSSIAN
| [
"jazz_ja@b41f55df-6250-4c49-8e33-4aa727ad62a1"
]
| [
[
[
1,
7107
]
]
]
|
1641f3e3d21f532ca879105f1d486fd3d710f6bf | 5ed707de9f3de6044543886ea91bde39879bfae6 | /ASBasketball/Shared/Source/ASBasketballStatFileLoader.h | 8984a8e65c934aff671c57e4f367cb6d7e30345d | []
| no_license | grtvd/asifantasysports | 9e472632bedeec0f2d734aa798b7ff00148e7f19 | 76df32c77c76a76078152c77e582faa097f127a8 | refs/heads/master | 2020-03-19T02:25:23.901618 | 1999-12-31T16:00:00 | 2018-05-31T19:48:19 | 135,627,290 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,401 | h | /* ASBasketballStatFileLoader.h */
/******************************************************************************/
/******************************************************************************/
#ifndef ASBasketballStatFileLoaderH
#define ASBasketballStatFileLoaderH
#include "ASFantasyStatFileLoader.h"
#include "ASBasketballType.h"
using namespace asfantasy;
namespace asbasketball
{
/******************************************************************************/
class OffGameStatFileLine : public StatFileLine
{
protected:
TFullName fFullName;
TPlayerID fPlayerID;
TProfTeamID fProfTeamID;
TBasketballPosition fPos;
TRosterStatus fRosterStatus;
TOffGameStatDetail fStatDetail;
// don't clear
TStatPeriod fStatPeriod;
TDateTime fStatDate;
bool fAddNewPlayers;
public:
OffGameStatFileLine(const TStatPeriod statPeriod,const TDateTime statDate,
const bool addNewPlayers) : fStatPeriod(statPeriod),fStatDate(statDate),
fAddNewPlayers(addNewPlayers) {}
virtual void clear();
virtual void readFromFiler(TDataFiler& filer);
virtual void writeToFiler(TDataFiler& filer);
virtual void process();
};
/******************************************************************************/
class OffGameStatFileLoader : public StatFileLoader
{
protected:
TStatPeriod fStatPeriod;
bool fAddNewPlayers;
protected:
OffGameStatFileLoader(const DirSpec& dirSpec,const TDateTime fileNameDate,
const TStatPeriod statPeriod,const bool addNewPlayers) :
StatFileLoader(dirSpec,"asbk","pla",fileNameDate),
fStatPeriod(statPeriod),fAddNewPlayers(addNewPlayers) {}
virtual ~OffGameStatFileLoader() {}
public:
static StatFileLoaderPtr newInstance(const DirSpec& dirSpec,
const TDateTime fileNameDate,const TStatPeriod statPeriod,
const bool addNewPlayers) { return(new OffGameStatFileLoader(dirSpec,
fileNameDate,statPeriod,addNewPlayers)); }
protected:
virtual StatFileLine* newLineInstance()
{ return(new OffGameStatFileLine(fStatPeriod,fFileNameDate,
fAddNewPlayers)); }
};
/******************************************************************************/
}; //namespace asbasketball
#endif //ASBasketballStatFileLoaderH
/******************************************************************************/
/******************************************************************************/
| [
"[email protected]"
]
| [
[
[
1,
79
]
]
]
|
543b312201af98c79c69191f5872d6cb7ddc33c3 | e7c45d18fa1e4285e5227e5984e07c47f8867d1d | /Common/Models/MDLBASE/vcs/SR_Vcs-1.cpp | 0d7fe42c5ffa98bf366b3f2d6f029371c8669c3e | []
| no_license | abcweizhuo/Test3 | 0f3379e528a543c0d43aad09489b2444a2e0f86d | 128a4edcf9a93d36a45e5585b70dee75e4502db4 | refs/heads/master | 2021-01-17T01:59:39.357645 | 2008-08-20T00:00:29 | 2008-08-20T00:00:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,963 | cpp | #define SOLVE1 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <setjmp.h>
#include "sr_vcs.h"
int deleteit( int L, int mm )
{
int nnl,k;
double temp,t1;
nnl = L - nc;
if ( L != mr)
{ /* re-arrange data when specie added or removed */
dsw(wt,mr,L);
dsw(w,mr,L);
dsw(ff,mr,L);
dsw(initial_chem_pot,mr,L);
if ( si[mr] == SINGLE )
dsw(fe,mr,L);
swap2((int *)si,mr,L);
dsw(fel,mr,L);
swap2((int *)ic,nr,nnl);
dsw(da,mr,L); /* this seems unnecessary */
swap2(ind,mr,L);
rotate(index2, mr, L);
for ( k = 1; k <= nc; k++)
{
t1 = sc[k][nr];
sc[k][nr] = sc[k][nnl];
sc[k][nnl] = t1;
}
for ( k = 1; k <= no_phases; k++)
{
temp = d_mole[k][nr];
d_mole[k][nr] = d_mole[k][nnl];
d_mole[k][nnl] = temp;
}
for ( k = 1; k <= ne; k++)
{
temp =bm[mr][k];
bm[mr][k] = bm[L][k];
bm[L][k] = temp;
}
}
if (mm != 0)
return (TRUE);
/* ------- extra procedures when removing a species --------------- */
dsw(dg,nr,nnl);
dsw(ds,mr,L);
/* -------- special procedures for removing a phase --------------- */
tmole[si[mr]] -= w[mr];
nr--; /* one less reaction */
mr--; /* one less reaction */
if ( nr == 0 )
return ( FALSE );
else
return ( TRUE );
}
/* ----------- convergence forcer ----------------- */
void force(void)
{
int i;
double s1,s2,al;
/* ------- calculate slope at end of step ----------- */
s2 = 0.0;
for ( i = 1; i <= mr; i++ )
s2 += fe[i]*ds[i];
if ( s2 <= 0.0 )
return;
/* -------- calculate original slope ---------------- */
s1 = 0.0;
for ( i = 1; i <= mr; i++ )
s1 += fel[i]*ds[i];
if ( s1 >= 0.0 )
return;
/* -------- fit parabola -------------- */
al = s1 / (s1 - s2);
if (al >= 0.95)
return;
/* ------- adust mole numbers, chemical potential ------------ */
for (i = 1; i <= mr; i++)
if ( ds[i] != 0.0 )
{
ds[i] *= al;
w[i] += ds[i];
}
for (i = 1; i <= no_phases; i++)
tmole[i] += al*delta_mole[i];
dfe(w,0,iti); /* for tmole and components + all reactions/majors only */
FORCED = TRUE;
return;
}
/* ---------- calculates reaction adjustments (delta sigma) -- */
/* ------ dg[i] must be calulated before using this routine -- */
int st2(void)
{
int i,j,L,k,SOLDEL;
double s,dss,xx;
SOLDEL = FALSE;
for ( i = 1; i <= nr; i++)
{
L = ir[i];
if ( w[L] == 0.0 && si[L] != SINGLE )
{
if ( dg[i] >= -1e-4 )
ds[L] = 0.0;
else
{
ds[L] = 1e-10;
ic[i] = MAJOR;
}
}
else if ((fabs(dg[i]) <= 1e-6) || (ic[i] <= MINOR && dg[i] >= 0.0) )
{}
else
{
/* ------- this is formula 6.4-16 in VCS manual -------- */
if ( si[L] == SINGLE )
s = 0.0;
else
s = 1.0/w[L];
for ( j = 1; j <= nc; j++)
if (si[j] != SINGLE)
s += sc[j][i]*sc[j][i]/w[j];
for (j = 1; j <= no_phases; j++)
if (tmole[j] > 0.0)
s -= d_mole[j][i]*d_mole[j][i]/tmole[j];
if ( s != 0.0 )
ds[L] = -dg[i]/s;
/* --------- reaction entirely among condensed phases ----- */
/* --------- delete one solid and recompute basis --------- */
else
{
#ifdef DEBUG1
fprintf(debug_prn_file,"\n Reaction entirely among condensed phases in 'st2()'");
#endif
if ( dg[i] <= 0.0)
{
dss =1e10;
for (j = 1; j <= nc; j++)
{
if ( sc[j][i] < 0.0 )
{
xx = -w[j]/sc[j][i];
if ( xx < dss)
{
dss = xx;
k = j;
}
}
}
}
else
{
dss = w[L];
k = L;
for (j = 1; j <= nc; j++)
{
if ( sc[j][i] > 0.0 )
{
xx = w[j]/sc[j][i];
if ( xx < dss)
{
dss = xx;
k = j;
}
}
}
dss = -dss;
}
if ( dss != 0.0 )
{
w[L] += dss;
for (j = 1; j <= nc; j++)
w[j] += dss*sc[j][i];
w[k] = 0.0;
if (k != L)
SOLDEL = TRUE;
}
}
}
}
if (SOLDEL)
return (FALSE);
else
return (TRUE);
}
/* ------------ correct elemental abundances ----------------- */
void elcorr(void)
{
int i,j,k,L,ip1;
double par,xx,r;
#ifdef DEBUG
fprintf(debug_prn_file,"\nEntered into 'elcorr()'");
#endif
for (i = 1; i <= nc; i++)
{
sa[i] = ga[i] - gai[i];
for(j = 1; j <= nc; j++)
sm[j][i] = bm[i][j]; /* get a temporary transpose of bm(i,j) */
}
#ifdef DEBUG
fprintf(debug_prn_file,"\nData for bm[i,j] to use in mlequ() in 'basopt(FALSE)'\n");
for (i = 1; i <= m; i++)
{
for (j = 1; j <= ne; j++)
fprintf(debug_prn_file,"%4.2g ",bm[i][j]);
fprintf(debug_prn_file,"\n");
}
fprintf(debug_prn_file,"\nData for sm[i,j] (Transformed bm[i,j])'\n");
for (i = 1; i <= ne; i++)
{
for (j = 1; j <= m; j++)
fprintf(debug_prn_file,"%4.2g ",sm[i][j]);
fprintf(debug_prn_file,"\n");
}
#endif
/* ------- mlequ() --------- */
for ( i = 1; i <= nc; i++) {
if ( sm[i][i] == 0.0 ) {
ip1 = i+1;
for (k = ip1; k <= nc; k++)
if (sm[k][i] != 0.0 ) goto JUMP1;
strcpy( error, "\n No unique solution - Number of components < Number of elements.\nAborting VCS solver ....");
longjmp( e_buf, 1 );
JUMP1: for (j = i; j <= nc; j++) sm[i][j] += sm[k][j];
sa[i] += sa[k];
}
for (L = 1; L <= nc; L++) {
if ( L == i || sm[L][i] == 0.0 ) {
}
else {
r = sm[L][i]/sm[i][i];
for (j = i; j <= nc; j++) sm[L][j] -= sm[i][j]*r;
sa[L] -= sa[i]*r;
}
}
}
for (i = 1; i <= nc; i++)
sa[i] = -sa[i]/sm[i][i];
/* --------- end mlequ() ------------ */
par = 0.5;
for (i = 1; i <= nc; i++) {
xx = -sa[i]/w[i];
if (par < xx) par = xx;
}
par = 1.0/par;
if ( par <= 1.01 && par > 0.0 ) par = .99*par;
else par = 1.0;
for (i = 1; i <= nc; i++)
w[i] += par*sa[i];
#ifdef DEBUG
elab();
fprintf(debug_prn_file,"\n\nElemental abundances");
for (i =1; i <= ne; i++) fprintf(debug_prn_file,"\n %1d %10.5g",i,ga[i]);
#endif
}
/* -------- calculates free energy changes for the reactions --------- */
void deltag(int L, int j, int kp)
{
int i,k,LL;
double sdel[MAXPHASE];
switch ( L ) {
/* -------- majors only --------------- */
case -3 :
case -2 :
case -1 : for (k = 1; k <= nr; k++) {
if ( ic[k] == MAJOR ) {
LL = ir[k];
dg[k] = fe[LL];
for (LL = 1; LL <= nc; LL++)
dg[k] += sc[LL][k]*fe[LL];
}
}
break;
/* ------------- all reactions from j to kp ----------- */
case 0 : for (k = j; k <= kp; k++) {
LL = ir[k];
dg[k] = fe[LL];
for (LL = 1; LL <= nc; LL++)
dg[k] += sc[LL][k]*fe[LL];
}
break;
/* ------------ minors only ( NMINOR + MINOR ) --------------- */
case 1 : for (k =1; k <= nr; k++) {
if ( ic[k] <= MINOR ) {
LL = ir[k];
dg[k] = fe[LL];
for (LL = 1; LL <= nc; LL++)
dg[k] += sc[LL][k]*fe[LL];
}
}
break;
}
/* ------ multispecies phase with nt = 0 ------------- */
for(i = 1; i <= no_phases; i++)
sdel[i] = 0.0;
for (i = 1; i <= nr; i++) {
LL = ir[i];
if ( w[LL] == 0.0 ) {
if ( dg[i] > 50.0 ) dg[i] = 50.0;
if ( dg[i] < -50.0 ) dg[i] = -50.0;
for (k = 1; k <= no_phases; k++)
if ( si[LL] == k ) sdel[k] += exp( -dg[i] );
}
}
for (i = 1; i <= nr; i++) {
LL = ir[i];
if ( w[LL] == 0.0 ) {
for (k = 1; k <= no_phases; k++)
if ( si[LL] == k ) dg[i] = 1 - sdel[k];
}
}
}
/* -------- Chooses optimum basis, calculates stoichiometry ---------- */
void basopt(int FIRST)
{
int k,jr,jl,i,j,L,ip1;
double temp,r;
CONV = FALSE;
nopt++;
for (i = 1; i <= mr; i++) aw[i] = w[i];
for (jr = 1; jr <= nc; jr++) {
do {
k = amax(aw,jr,mr);
if ( aw[k] == 0.0 ) {
CONV = TRUE; /* the biggest specie is zero */
return;
}
if ( aw[k] == TEST ) {
nc = jr - 1;
n = m - nc;
nr = n;
for (i = 1; i <= m; i++) ir[i] = nc + i;
}
aw[k] = TEST;
/* ----- check linear independence with previous species --- */
/* ----- logical function lindep(bm,jr,k,nc) ------ */
jl = jr - 1;
sa[jr] = 0.0;
for (j = 1; j <= nc; j++) sm[j][jr] = bm[k][j];
if ( jl != 0 ) {
for (j = 1; j <= jl; j++) {
ss[j] = 0.0;
for (i = 1; i <= nc; i++) ss[j] += sm[i][jr]*sm[i][j];
ss[j] = ss[j]/sa[j];
}
for (j = 1; j <= jl; j++)
for (L = 1; L <= nc; L++)
sm[L][jr] -= ss[j]*sm[L][j];
}
for (j = 1; j <= nc; j++)
if ( fabs(sm[j][jr]) > 1e-17 )
sa[jr] += sm[j][jr]*sm[j][jr];
}
while ( sa[jr] < 1e-6);
/* ----- rearrange data ---------- */
dsw(w,jr,k);
dsw(wt,jr,k);
dsw(ff,jr,k);
dsw(initial_chem_pot,jr,k);
dsw(fe,jr,k);
dsw(aw,jr,k);
swap2((int *)si,jr,k);
dsw(da,jr,k);
dsw(fel,jr,k);
swap2(ind,jr,k);
rotate(index2, jr, k);
for(j = 1; j <= ne; j++) {
temp = bm[jr][j];
bm[jr][j] = bm[k][j];
bm[k][j] = temp;
}
}
if ( FIRST ) return;
/* ----- evaluate stoichiometric matrix, when FIRST = FALSE ------- */
for (j = 1; j <= nc; j++) { /* Transform bm[] into sm[] */
for (i = 1; i <= nc; i++) sm[i][j] = bm[j][i];
}
#ifdef DEBUG
fprintf(debug_prn_file,"\nData for bm[i,j] to use in mlequ() in 'basopt(FALSE)'\n");
for (i = 1; i <= m; i++) {
for (j = 1; j <= ne; j++)
fprintf(debug_prn_file,"%4.2g ",bm[i][j]);
fprintf(debug_prn_file,"\n");
}
fprintf(debug_prn_file,"\nData for sm[i,j] (Transformed bm[i,j])'\n");
for (i = 1; i <= ne; i++) {
for (j = 1; j <= m; j++)
fprintf(debug_prn_file,"%4.2g ",sm[i][j]);
fprintf(debug_prn_file,"\n");
}
#endif
for (i = 1; i <= n; i++) { /* Transform bm[] into stoich.coeff.matr sc[] */
for(j = 1; j <= nc; j++) sc[j][i] = bm[ir[i]][j];
}
#ifdef DEBUG
fprintf(debug_prn_file,"\nData for sc[i,j] to use in mlequ() in 'basopt(FALSE)'\n");
for (i = 1; i <= nc; i++) {
for (j = 1; j <= n; j++)
fprintf(debug_prn_file,"%4.2g ",sc[i][j]);
fprintf(debug_prn_file,"\n");
}
#endif
/* ------- mlequ() --------- */
/* ------ calculates stoichiometric matrix (reactions) -------- */
for ( i = 1; i <= nc; i++) {
if ( sm[i][i] == 0.0 ) {
ip1 = i+1;
for (k = ip1; k <= nc; k++)
if (sm[k][i] != 0.0 ) goto JUMP;
#ifdef DEBUG
fprintf(debug_prn_file,"\nData for sm[i,j] of mlequ() in 'basopt(FALSE)'\n");
for (jr = 1; jr <= ne; jr++) {
for (j = 1; j <= m; j++)
fprintf(debug_prn_file,"%4.2g ",sm[jr][j]);
fprintf(debug_prn_file,"\n newline \n");
}
#endif
strcpy( error, "\n No unique solution - Number of components < Number of elements.\nAborting VCS solver ....");
longjmp( e_buf, 1 );
JUMP: for (j = i; j <= nc; j++) sm[i][j] += sm[k][j];
for (j = 1; j <= n; j++) sc[i][j] += sc[k][j];
}
for (L = 1; L <= nc; L++) {
if ( L == i || sm[L][i] == 0.0 ) {
}
else {
r = sm[L][i]/sm[i][i];
for (j = i; j <= nc; j++) sm[L][j] -= sm[i][j]*r;
for (j = 1; j <= n; j++) sc[L][j] -= sc[i][j]*r;
}
}
}
for (i = 1; i <= nc; i++)
for (j = 1; j <= n; j++)
sc[i][j] = -sc[i][j]/sm[i][i];
#ifdef DEBUG
fprintf(debug_prn_file,"\nStoichiometric matrix sc[i][j]\n\n");
for (i = 1; i <= nc; i++) {
for (j = 1; j <= n; j++)
fprintf(debug_prn_file,"%4.2g ",sc[i][j]);
fprintf(debug_prn_file,"\n");
}
#endif
/* ------ end of mlequ -------- */
for ( i = 1; i <= n; i++) {
k = ir[i];
for (j = 0; j <= no_phases; j++) d_mole[j][i] = 0.0;
if (si[k] != SINGLE) d_mole[si[k]][i] = 1.0;
for ( j = 1; j <= nc; j++) {
if ( fabs(sc[j][i]) <= 1e-6 ) sc[j][i] = 0.0;
if ( si[j] != SINGLE ) d_mole[si[j]][i] += sc[j][i];
}
}
}
/* ------ computes elemental abundances --------- */
void elab(void)
{
int i,j;
for (i = 1; i <= ne; i++) ga[i] = 0.0;
for (j = 1; j <= ne; j++)
for (i = 1; i <= m; i++)
ga[j] += bm[i][j]*w[i];
}
/* ------ evaluate chemical potential ----------- */
void dfe(DARRAY z, int kk, int LL)
/* kk: >0 -> do it for tmole1
kk:=<0 -> do it for tmole
LL: =0 -> all components + all reactions
LL: >0 -> all components + minor reactions only
LL: <0 -> all components + major reactions only
*/
{
int L1,i,L;
double x[MAXPHASE];
if ( kk > 0 )
{
for (i = 1; i <= no_phases; i++)
{
x[i] = tmole1[i];
if ( x[i] > 0.0 )
x[i] = log((double)x[i]);
}
}
else
{
for (i = 1; i <= no_phases; i++)
{
x[i] = tmole[i];
if ( x[i] > 0.0 )
x[i] = log((double)x[i]);
}
}
if ( LL == 0 )
L1 = mr;
else
L1 = nc;
for (i = 1; i <= L1; i++)
{ /* all reaction species, or components */
if (z[i] != 0.0)
{
if( si[i] != SINGLE)
fe[i] = ff[i] -x[si[i]] + log((double)z[i]);
}
else
fe[i] = ff[i];
}
if (LL < 0)
{
for (i = 1; i <= nr; i++) /* majors only */
{
if ( ic[i] == MAJOR )
{
L = ir[i];
if ( z[L] == 0.0 )
fe[L] = ff[L];
else
{
if (si[L] != SINGLE)
fe[L] = ff[L] -x[si[L]] + log((double)z[L]);
}
}
}
}
else if (LL > 0)
{
for (i = 1; i <= nr; i++) /* minors only */
{
if ( ic[i] <= MINOR )
{
L = ir[i];
if ( z[L] == 0.0 )
fe[L] = ff[L];
else
{
if (si[L] != SINGLE)
fe[L] = ff[L] -x[si[L]] + log((double)z[L]);
}
}
}
}
#ifdef DEBUG2
fprintf(debug_prn_file,"\nCalled dfe()");
for (i = 1; i <= m; i++)
fprintf(debug_prn_file,"\n fe[%1d] = %g",i,fe[i]);
#endif
}
/* ----- the following functions re-arrange the vector elements ------ */
/* --- swap integers ------- */
void swap2(int x[],int j1,int j2)
{
int t;
t = x[j1];
x[j1] = x[j2];
x[j2] = t;
}
void rotate(int x[],int j1,int j2)
{
x[ind[j1]] = j1;
x[ind[j2]] = j2;
}
int amax(DARRAY x,int j,int n)
{
int i,k;
double big;
k = j;
big = x[j];
for (i = j; i <= n; i++) {
if (x[i] > big) {
k = i;
big = x[i];
}
}
return (k);
}
/* ----- swap floating points ----- */
void dsw(DARRAY x, int j1, int j2)
{
double t;
t = x[j1];
x[j1] = x[j2];
x[j2] = t;
}
/* ------------ estimates equilibrium compositions ------------ */
void inest(void)
{
double xt1[MAXPHASE],
xt2[MAXPHASE],
par,xl,ikl,s,s1;
int i,j,k,lt,L;
ikl = 0.0;
lt = 0;
/* -- setup data for linear programming routine --- */
/* -- we will use sc[][] temporaly as the linear programing matrix -- */
for ( i = 1; i <= ne; i++) sc[i][m+ne+1] = gai[i];
for ( j = 1; j <= m ; j++)
for (i = 1; i <= ne; i++) sc[i][j] = bm[j][i]; /* transpose matrix */
for (j = 1; j <= m; j++) sc[ne+2][j] = ff[j]; /* changed -ff[j] to ff[j] and do minimising */
/* ------ insert linear prog here ---------- */
lin_prog(aw,sc);
for (i = 1; i <= m; i++) {
ds[i] = 0.0;
w[i] = aw[i];
if (aw[i] == 0.0) w[i] = 1e-2;
}
for (i = 1; i <= m; i++) wt[i] = w[i];
basopt(FALSE);
/* ----- calculate total gaseous and liquid moles ---- */
/* ----- chemical potentials of basis ---------------- */
for (i = 1; i <= no_phases; i++)
tmole1[i] = tinert[i];
for (i = 1; i <= nc; i++) {
if ( si[i] != SINGLE) tmole1[si[i]] += wt[i];
}
for (i = 1; i <= nc; i++) {
if ( si[i] != SINGLE) fe[i] = ff[i] + log((double)wt[i]/tmole1[si[i]]); /* check if tmole1[] could be zero */
}
for (i = nc+1; i <= m; i++) fe[i] = ff[i];
deltag(0,1,n);
/* ------ estimate reaction adjustments ---------- */
for (i = 1; i <= no_phases; i++) {
delta_mole[i] = 0.0;
if ( tmole1[i] != 0.0 ) {
xt1[i] = log((double)1e32 * tmole1[i]);
xt2[i] = log((double)1e-32 * tmole1[i]);
}
}
/* ++++++ equation 3.4 in Canadian Jour of Chemical Engineer Vol 46 August 1968 +++++ */
for (i = 1; i <= nr; i++)
{
L = ir[i];
if ( si[L] != SINGLE )
{
if ( dg[i] < xt1[si[L]] && dg[i] > xt2[si[L]] )
{
ds[L] = tmole1[si[L]] * exp(-dg[i]);
for (k = 1; k <= nc; k++)
ds[k] += sc[k][i] * ds[L];
delta_mole[si[L]] += d_mole[si[L]][i] * ds[L];
}
}
}
/* ------- keep basis specie positive ------------- */
par = 0.5;
for (i = 1; i <= nc; i++)
if ( par < (-ds[i]/wt[i]) ) par = -ds[i]/wt[i];
par = 1.0/par;
if ( par <= 1.0 && par > 0.0 )
par = 0.8*par;
else
par = 1.0;
/* ------- calculate new mole numbers ------------ */
while(TRUE)
{
for (i = 1; i <= nc; i++)
w[i] = wt[i] + par*ds[i];
for (i = nc+1; i <= m; i++)
if (ds[i] != 0.0 ) w[i] = ds[i]*par;
for (i = 1; i <= no_phases; i++)
tmole[i] = tmole1[i] + delta_mole[i]*par;
if( lt > 0 )
return;
/* ------- convergence - forcing section ---------- */
dfe(w,0,0); /* for tmole and components + all reactions */
s = 0.0;
for (i = 1; i <= mr; i++)
s += ds[i]*fe[i];
if ( s < 0.0 && ikl <= 0.0 )
return;
else if ( s == 0.0 )
return;
if ( ikl <= 0.0 )
{
/* -- try half step size --- */
s1 = s;
par *= 0.5;
ikl = 1.0;
}
else
{
/* ---- fit parabola thro half and full steps ----- */
xl = 0.5 * (1.0 - s/(s1-s));
if ( xl >= 0.0 )
{
if ( xl <= 1.0 )
par *= 2.0*xl;
else /* too big a step, take orginal full step */
par *= 2.0;
}
else /* poor direction reduce step size */
par *= 0.2;
lt = 1;
}
}
}
/* ---------- linear programing --------------------- */
/* minimize (cc*psol) such that ax[ne+2,j]*psol = bb */
/* -------------------------------------------------- */
/* this routine uses the Two-Phase technique from the book */
/* "Some common basic programs-p.103". See also "Operations Research - */
/* H.A.Taha - p.70" */
void lin_prog(DARRAY psol, DMATRIX ax)
{
int b[MAXELEMENT],
leaving,enter,
m1,m2,i,j,i1,j1,
c1,c2,x;
double pivot, temp;
/* -- initialise variables ----- */
m1 = ne + 1;
m2 = ne + 2;
c1 = m + ne + 1;
c2 = m;
/* Check this dynamically */
if( m2 >= sc_max_i || c1 >= sc_max_j )
{
strcpy( error, "Exceeded allocated scratch pad memory. Aborting....");
longjmp( e_buf, 1 );
}
for (i = 1; i <= c1; i++)
ax[m1][i] = 0.0;
// Zero the part which gave me endless problems as Floating point errors
for (i = m+1; i <= c1; i++)
ax[m2][i] = 0.0;
for (i = 1; i <= ne; i++)
{
for (j = 1; j <= m; j++) ax[m1][j] -= ax[i][j];
for (j = m+1; j <= (m+ne); j++) ax[i][j]=0.0;
ax[i][m+i] = 1.0; /* artificial variables */
b[i] = m + i;
}
x = m1;
while ( x <= m2 ) {
do {
/* ---- price out columns (find entering variable ) ----- */
temp = -1e-5;
for (j = 1; j <= m; j++) {
if ( ax[x][j] < temp ) {
enter = j; /* enter = biggest negative value */
temp = ax[x][j];
}
}
if ( temp != -1e-5 ) {
/* --- find leaving variable ---- */
temp = 1e38;
/* ----- choose smallest positive ratio -------- */
for (i = 1; i <= ne; i++) {
if ( ax[i][enter] > 1e-5 && ax[i][c1]/ax[i][enter] < temp ) {
leaving = i;
temp = ax[i][c1]/ax[i][enter];
}
}
if ( temp == 1e38 ) {
strcpy( error, "The LP-solution is unbounded !!!!\nAborting VCS solver ....");
longjmp( e_buf, 1 );
}
else {
/* ----- preform pivoting ----- */
pivot = ax[leaving][enter];
for (j = 1; j <= c1; j++) ax[leaving][j] /= pivot;
for (i = 1; i <= m2; i++) {
if ( i != leaving) {
for (j = 1; j <= c1; j++) {
if ( j != enter) {
ax[i][j] -= ax[i][enter]*ax[leaving][j];
if ( fabs(ax[i][j]) < 1e-5 )
ax[i][j] = 0.0;
}
}
}
}
for (i = 1; i <= m2; i++) ax[i][enter] = 0.0;
ax[leaving][enter] = 1.0;
b[leaving] = enter;
}
}
}
while ( temp != -1e-5 );
if ( x == m1 ) {
for (i1 = 1; i1 <= ne; i1++) {
if ( b[i1] > c2 ) {
if ( ax[i1][c1] > 1e-5 ) {
strcpy( error, "The LP-problem has no feasible solution.\nAborting VCS solver ....");
longjmp( e_buf, 1 );
}
else {
for (j1 =1 ; j1 <= c2 ; j1++) {
if ( fabs(ax[i1][j1]) > 1e-5 ) {
leaving = i1;
enter = j1;
/* ----- preform pivoting ----- */
pivot = ax[leaving][enter];
for (j = 1; j <= c1; j++) ax[leaving][j] /= pivot;
for (i = 1; i <= m2; i++) {
if ( i != leaving) {
for (j = 1; j <= c1; j++) {
if ( j != enter) {
ax[i][j] -= ax[i][enter]*ax[leaving][j];
if ( fabs(ax[i][j]) < 1e-5 )
ax[i][j] = 0.0;
}
}
}
}
for (i = 1; i <= m2; i++) ax[i][enter] = 0.0;
ax[leaving][enter] = 1.0;
b[leaving] = enter;
j1 = c2;
}
}
}
}
}
}
x++;
}
for (i = 1; i <= m; i++) psol[i] = 0.0;
for (i = 1; i <= ne; i++)
psol[b[i]] = ax[i][c1];
}
| [
"[email protected]"
]
| [
[
[
1,
866
]
]
]
|
92499d03c46b9d141fa44b48a8add0112d3a4aeb | 016774685beb74919bb4245d4d626708228e745e | /iOS/Pulmon/ozcollide/obb.h | 6764821b1b759ac5bd5d0a457a8fb6f6136fd7fc | []
| no_license | sutuglon/Motor | 10ec08954d45565675c9b53f642f52f404cb5d4d | 16f667b181b1516dc83adc0710f8f5a63b00cc75 | refs/heads/master | 2020-12-24T16:59:23.348677 | 2011-12-20T20:44:19 | 2011-12-20T20:44:19 | 1,925,770 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,144 | h | /*
OZCollide - Collision Detection Library
Copyright (C) 2006 Igor Kravtchenko
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Contact the author: [email protected]
*/
#ifndef OZCOLLIDE_OBB_H
#define OZCOLLIDE_OBB_H
#ifndef OZCOLLIDE_PCH
#include <ozcollide/ozcollide.h>
#endif
#include <ozcollide/box.h>
#include <ozcollide/matrix.h>
ENTER_NAMESPACE_OZCOLLIDE
class OBB : public Box {
public:
Matrix3x3 matrix;
};
LEAVE_NAMESPACE
#endif
| [
"[email protected]"
]
| [
[
[
1,
41
]
]
]
|
68487578367f986bee5e6cc9516768881bf0e78c | 968aa9bac548662b49af4e2b873b61873ba6f680 | /imgtools/imgcheck/src/cmdlinewriter.cpp | 95e4c15ca45d1f165dad96c3130f98f71529e622 | []
| no_license | anagovitsyn/oss.FCL.sftools.dev.build | b3401a1ee3fb3c8f3d5caae6e5018ad7851963f3 | f458a4ce83f74d603362fe6b71eaa647ccc62fee | refs/heads/master | 2021-12-11T09:37:34.633852 | 2010-12-01T08:05:36 | 2010-12-01T08:05:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,008 | cpp | /*
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
* Generates commandline report.
*
*/
/**
@file
@internalComponent
@released
*/
#include "cmdlinewriter.h"
#include <stdio.h>
/**
Constructor: CmdLineWriter class
@internalComponent
@released
*/
CmdLineWriter::CmdLineWriter(unsigned int aInputOptions)
: iForDepAlign(0), iFormatSize(0), iRptType(KCmdLine), iCmdOptions(aInputOptions) {
//iFormatMessage.flush();
}
/**
Destructor: CmdLineWriter class
Clear the Buffer.
@internalComponent
@released
*/
CmdLineWriter::~CmdLineWriter(void) {
}
/**
Writes report header to the cmd line..
Allocates the memory for formatting purpose.
@internalComponent
@released
*/
void CmdLineWriter::StartReport(void) {
}
/**
Writes the end report info..
Transfer the stream data to stdout.
@internalComponent
@released
*/
void CmdLineWriter::EndReport(void) {
iFormatMessage.flush();
string str ;
while(!iFormatMessage.eof()){
getline(iFormatMessage,str);
cout << str.c_str()<<endl ;
}
}
/**
Writes the executable element footer.
@internalComponent
@released
*/
void CmdLineWriter::EndExecutable(void) {
iFormatMessage << endl;
iForDepAlign = false;
}
/**
Writes the Delimiter to cmd line.
@internalComponent
@released
*/
void CmdLineWriter::WriteDelimiter(void) {
if(iCmdOptions & KNoCheck) {
iFormatMessage << KCmdLineDelimiterNoStatus << endl;
}
else {
iFormatMessage << KCmdLineDelimiter << endl;
}
}
/**
Formats the given element based on set size and places to outstream.
@internalComponent
@released
@param aElement - Reference element to be formated
*/
void CmdLineWriter::FormatAndWriteElement(const string& aElement) {
if(aElement.length() < iFormatSize)
iFormatMessage << setw(iFormatSize) << aElement.c_str();
else
iFormatMessage << aElement.c_str() << ' ';
}
/**
Writes the note about unknown dependency.
@internalComponent
@released
*/
void CmdLineWriter::WriteNote(void){
iFormatMessage << KNote << ": " << KUnknownDependency << KNoteMesg << endl;
}
/**
Writes the image element footer.
@internalComponent
@released
*/
void CmdLineWriter::EndImage(void){
WriteDelimiter();
}
/**
Writes the executable name element.
@internalComponent
@released
@param aExeName - Reference to executable name.
*/
void CmdLineWriter::StartExecutable(const unsigned int /* aSerNo */, const string& aExeName) {
iFormatSize = KCmdFormatTwentyEightWidth;
FormatAndWriteElement(aExeName);
iForDepAlign = true;
}
/**
Writes the image name element.
@internalComponent
@released
@param aImageName - Reference to image name.
*/
void CmdLineWriter::StartImage(const string& aImageName) {
WriteDelimiter();
iFormatMessage << KCmdImageName << aImageName.c_str() << endl;
WriteDelimiter();
iFormatMessage << setw(KCmdFormatTwentyEightWidth) << left <<setfill(' ')<< "Executable" ;
iFormatMessage << setw(KCmdFormatTwelveWidth) << "Attribute" ;
iFormatMessage << setw(KCmdFormatTwelveWidth) << "Value" ;
if(0 == (iCmdOptions & KNoCheck)) {
iFormatMessage << setw(KCmdFormatTwelveWidth) << "Status" ;
}
iFormatMessage<<endl;
WriteDelimiter();
}
/**
Writes the attribute, their values and the status along with formating the output.
@internalComponent
@released
@param aOneSetExeAtt - Reference to the attributes, their value and status
*/
void CmdLineWriter::WriteExeAttribute(ExeAttribute& aOneSetExeAtt) {
if(!iForDepAlign) {
iFormatSize = KCmdFormatTwentyEightWidth;
FormatAndWriteElement("");
}
iFormatSize = KCmdFormatTwelveWidth;
if(KCmdDbgName != aOneSetExeAtt.iAttName) {
FormatAndWriteElement(aOneSetExeAtt.iAttName);
}
else {
FormatAndWriteElement(KCmdDbgDisplayName);
}
if (KCmdDepName != aOneSetExeAtt.iAttName && KCmdDbgName != aOneSetExeAtt.iAttName) {
unsigned int val = Common::StringToInt(aOneSetExeAtt.iAttValue);
char str[20];
sprintf(str,"0x%08X",val);
// to display the hex value in the format of 0x00000000 if the value is 0
iFormatMessage << setw(KCmdFormatTwelveWidth) << str ;
}
else {
iFormatSize = KCmdFormatTwentyEightWidth;
FormatAndWriteElement(aOneSetExeAtt.iAttValue);
}
iFormatSize = KCmdFormatTwelveWidth;
FormatAndWriteElement(aOneSetExeAtt.iAttStatus);
iFormatMessage << endl;
iForDepAlign = false;
}
/**
Returns the report type.
@internalComponent
@released
*/
const string& CmdLineWriter::ReportType(void) {
return iRptType;
}
| [
"none@none"
]
| [
[
[
1,
234
]
]
]
|
bd3c08c81613994fb319df75afcb0847aab0e491 | 29c5bc6757634a26ac5103f87ed068292e418d74 | /src/tlclasses/CQuestManager.h | 2ab48a38a477bd1650c2203237a1d4a6d16c61f8 | []
| no_license | drivehappy/tlapi | d10bb75f47773e381e3ba59206ff50889de7e66a | 56607a0243bd9d2f0d6fb853cddc4fce3e7e0eb9 | refs/heads/master | 2021-03-19T07:10:57.343889 | 2011-04-18T22:58:29 | 2011-04-18T22:58:29 | 32,191,364 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 650 | h | #pragma once
#include "CRunicCore.h"
#include "CQuest.h"
#include "CCharacter.h"
namespace TLAPI
{
struct CResourceManager;
#pragma pack(1)
struct CQuestManager : CRunicCore
{
u32 unk0;
CCharacter *pCharacter;
CList<CQuest*> questList;
PVOID pCSoundBank;
CResourceManager *pResourceManager;
//
EVENT_DECL(CQuestManager, void, QuestManagerSetQuestCompleted,
(CQuestManager*, CQuest*, CCharacter*, u32, bool&),
((CQuestManager*)e->_this, (CQuest*)Pz[0], (CCharacter*)Pz[1], Pz[2], e->calloriginal));
};
#pragma pack()
};
| [
"drivehappy@53ea644a-42e2-1498-a4e7-6aa81ae25522"
]
| [
[
[
1,
32
]
]
]
|
5ec0f45d2af096bcc6cba14c849d42a954cac7b8 | 74c8da5b29163992a08a376c7819785998afb588 | /NetAnimal/Game/wheel/WheelAnimalModel/src/WheelAnimalScene.cpp | b607e5a3b0f67a4a0c5713afd0b9a644cfbf9eef | []
| no_license | dbabox/aomi | dbfb46c1c9417a8078ec9a516cc9c90fe3773b78 | 4cffc8e59368e82aed997fe0f4dcbd7df626d1d0 | refs/heads/master | 2021-01-13T14:05:10.813348 | 2011-06-07T09:36:41 | 2011-06-07T09:36:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,897 | cpp |
#include "WheelAnimalModelStableHeaders.h"
#include "WheelAnimalGame.h"
#include "WheelEvents.h"
#include "WheelAnimalUI.h"
#include "WheelGameInterface.h"
#include "WheelAnimalScene.h"
using namespace Orz;
WheelAnimalScene::WheelAnimalScene(const std::string & name):Scene(name)
{
ORZ_LOG_NORMAL_MESSAGE("Create a WheelAnimalScene Object;");
}
WheelAnimalScene::~WheelAnimalScene(void)
{
ORZ_LOG_NORMAL_MESSAGE("Destroy a WheelAnimalScene Object;");
}
void WheelAnimalScene::doExecute(Event * evt)
{
_controller->notice(evt);
//_processManager->notice(evt);
}
void WheelAnimalScene::doEnable(void)
{
WheelUIInterfacePtr ui(new WheelAnimalUI());
WheelGameInterface::getSingleton().active(ui);
_controller.reset(new WheelAnimalGame());
enableUpdate();
setChannel(EventChannel::create().addUserChannel<CHANNEL_PROCESS>());
}
void WheelAnimalScene::doDisable(void)
{
WheelGameInterface::getSingleton().active(WheelUIInterfacePtr());
/*_processManager.reset();*/
_controller.reset();
}
void WheelAnimalScene::doFrame(unsigned int step)
{
_controller->update(step* WORLD_UPDATE_INTERVAL);
// _scene->update(0.015f);
}
///////////////////////////////
class WheelAnimalSceneFactory: public IFactory<Scene>
{
public:
virtual const std::string & getTypeName() const
{
static const std::string name("WheelScene");
return name;
}
virtual pointer_type createInstance(const std::string& instanceName = IDManager::BLANK, parameter_type parameter = NULL)
{
return pointer_type(new WheelAnimalScene(instanceName));
}
};
Orz::SceneFactoryPtr sf(new WheelAnimalSceneFactory());
extern "C" void dllStartPlugin(void)
{
GameFactories::getInstance().addFactory(sf.get());
}
extern "C" void dllStopPlugin(void)
{
GameFactories::getInstance().removeFactory(sf.get());
}
| [
"[email protected]"
]
| [
[
[
1,
91
]
]
]
|
3184e0a8310648430ce2efaf0cde2c214a757319 | fbe2cbeb947664ba278ba30ce713810676a2c412 | /iptv_root/skin_lite/src/SkinLite/PlaylistFrame.cpp | ec05ab76126c6f33e8a0c4c98728f670e58adcef | []
| no_license | abhipr1/multitv | 0b3b863bfb61b83c30053b15688b070d4149ca0b | 6a93bf9122ddbcc1971dead3ab3be8faea5e53d8 | refs/heads/master | 2020-12-24T15:13:44.511555 | 2009-06-04T17:11:02 | 2009-06-04T17:11:02 | 41,107,043 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 22,900 | cpp | /////////////////////////////////////////////////////////////////////////////
// Name: PlaylistFrame.cpp
// Purpose:
// Author:
// Modified by:
// Created: 11/11/2008 11:09:11
// RCS-ID:
// Copyright:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
////@begin includes
#include <fstream>
using namespace std;
////@end includes
#include "PlaylistFrame.h"
#include "SkinLite.h"
#include "MessageDialog.h"
//#include "PlaylistItem.h"
////@begin XPM images
////@end XPM images
/*!
* PlaylistFrame type definition
*/
IMPLEMENT_CLASS( PlaylistFrame, wxFrame )
/*!
* PlaylistFrame event table definition
*/
BEGIN_EVENT_TABLE( PlaylistFrame, wxFrame )
////@begin PlaylistFrame event table entries
EVT_BUTTON( ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_INSERT, PlaylistFrame::OnBmpBtnPlaylistInsertClick )
EVT_BUTTON( ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_DELETE, PlaylistFrame::OnBmpBtnPlaylistDeleteClick )
EVT_BUTTON( ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_MOVEUP, PlaylistFrame::OnBmpBtnPlaylistMoveUpClick )
EVT_BUTTON( ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_MOVEDOWN, PlaylistFrame::OnBmpBtnPlaylistMoveDownClick )
EVT_BUTTON( ID_PLAYLISTFRAME_BTN_PLAYLIST_OPEN, PlaylistFrame::OnBtnPlaylistOpenClick )
EVT_BUTTON( ID_PLAYLISTFRAME_BTN_PLAYLIST_SAVE, PlaylistFrame::OnBtnPlaylistSaveClick )
EVT_BUTTON( ID_PLAYLISTFRAME_BTN_START, PlaylistFrame::OnBtnStartClick )
EVT_BUTTON( ID_PLAYLISTFRAME_BTN_CANCEL, PlaylistFrame::OnBtnCancelClick )
EVT_TIMER(wxID_ANY, PlaylistFrame::OnTimer)
////@end PlaylistFrame event table entries
END_EVENT_TABLE()
#define PLAYLISTFRAME_BMP_ADD wxT("Graphics/SkinLite/bmpAdd.png")
#define PLAYLISTFRAME_BMP_DELETE wxT("Graphics/SkinLite/bmpDelete.png")
#define PLAYLISTFRAME_BMP_MOVEUP wxT("Graphics/SkinLite/bmpMoveUp.png")
#define PLAYLISTFRAME_BMP_MOVEDOWN wxT("Graphics/SkinLite/bmpMoveDown.png")
#define PLAYLISTFRAME_FILEDLG_WILDCARD _("Media files|*.wmv;*.wma")
/** PlaylistFrame default constructor.
*
*/
PlaylistFrame::PlaylistFrame()
{
Init();
}
/** PlaylistFrame constructor.
* @param[in] parent. Parent Window.
* @param[in] iface. Interface with application.
* @param[in] id. Window id. Default SYMBOL_PLAYLISTFRAME_IDNAME.
* @param[in] caption. Window caption. Default SYMBOL_PLAYLISTFRAME_TITLE.
* @param[in] pos. Window position. Default SYMBOL_PLAYLISTFRAME_POSITION.
* @param[in] size. Window size. Default SYMBOL_PLAYLISTFRAME_SIZE.
* @param[in] style. Window style. Default SYMBOL_PLAYLISTFRAME_STYLE.
*/
PlaylistFrame::PlaylistFrame( wxWindow* parent, AppInterface *iface, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
Init();
m_appInterface = iface;
Create( parent, id, caption, pos, size, style );
SessionWindow *sessionWnd = ((SessionWindow *)GetParent());
SkinLite *skinLite = (SkinLite *)(sessionWnd->GetParent());
skinLite->ChangePlaylistExistsStatus(true);
sessionWnd->DisableSendFileTransfer();
}
/*!
* PlaylistFrame creator
*/
bool PlaylistFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
////@begin PlaylistFrame creation
wxFrame::Create( parent, id, caption, pos, size, style );
CreateControls();
CreateStatusBar();
Centre();
////@end PlaylistFrame creation
return true;
}
/** PlaylistFrame destructor.
*
*/
PlaylistFrame::~PlaylistFrame()
{
////@begin PlaylistFrame destruction
SessionWindow *sessionWnd = ((SessionWindow *)GetParent());
SkinLite *skinLite = (SkinLite *)(sessionWnd->GetParent());
skinLite->ChangePlaylistExistsStatus(false);
if (skinLite->CheckSessionWindowExists())
sessionWnd->EnableSendFileTransfer();
////@end PlaylistFrame destruction
}
/*!
* Member initialisation
*/
void PlaylistFrame::Init()
{
////@begin PlaylistFrame member initialisation
m_mainVertSizer = NULL;
m_mainPanel = NULL;
m_mainPanelVertSizer = NULL;
m_lblPlaylistCaption = NULL;
m_lstBoxPlaylist = NULL;
m_PlaylistControlHorSizer = NULL;
m_bmpBtnPlaylistInsert = NULL;
m_bmpBtnPlaylistDelete = NULL;
m_bmpBtnPlaylistMoveUp = NULL;
m_bmpBtnPlaylistMoveDown = NULL;
m_playlistSaveHorSizer = NULL;
m_btnPlaylistOpen = NULL;
m_btnPlaylistSave = NULL;
m_ctrlHorSizer = NULL;
m_chkBoxRepeat = NULL;
m_ctrlBtnHorSizer = NULL;
m_btnStart = NULL;
m_btnCancel = NULL;
m_wasStarted = false;
m_mediaId = 0;
m_itemPlaying = 0;
m_timer.SetOwner(this);
m_timer.Stop();
m_finishBtnPressed = false;
////@end PlaylistFrame member initialisation
}
/*!
* Control creation for PlaylistFrame
*/
void PlaylistFrame::CreateControls()
{
////@begin PlaylistFrame content construction
PlaylistFrame* itemFrame1 = this;
m_mainVertSizer = new wxBoxSizer(wxVERTICAL);
itemFrame1->SetSizer(m_mainVertSizer);
m_mainPanel = new wxPanel( itemFrame1, ID_PLAYLISTFRAME_MAINPANEL, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
m_mainVertSizer->Add(m_mainPanel, 1, wxGROW, 5);
m_mainPanelVertSizer = new wxBoxSizer(wxVERTICAL);
m_mainPanel->SetSizer(m_mainPanelVertSizer);
m_lblPlaylistCaption = new wxStaticText( m_mainPanel, wxID_STATIC, _("Select videos to be shown:"), wxDefaultPosition, wxDefaultSize, 0 );
m_mainPanelVertSizer->Add(m_lblPlaylistCaption, 0, wxALIGN_LEFT|wxALL, 5);
wxArrayString m_lstBoxPlaylistStrings;
m_lstBoxPlaylist = new wxListBox( m_mainPanel, ID_PLAYLISTFRAME_LSTBOX_PLAYLIST, wxDefaultPosition, wxDefaultSize, m_lstBoxPlaylistStrings, wxLB_ALWAYS_SB );
m_mainPanelVertSizer->Add(m_lstBoxPlaylist, 1, wxGROW|wxALL, 5);
m_PlaylistControlHorSizer = new wxBoxSizer(wxHORIZONTAL);
m_mainPanelVertSizer->Add(m_PlaylistControlHorSizer, 0, wxGROW|wxALL, 5);
wxBitmap bmpAdd(PLAYLISTFRAME_BMP_ADD, wxBITMAP_TYPE_PNG);
wxBitmap bmpDelete(PLAYLISTFRAME_BMP_DELETE, wxBITMAP_TYPE_PNG);
wxBitmap bmpMoveUp(PLAYLISTFRAME_BMP_MOVEUP, wxBITMAP_TYPE_PNG);
wxBitmap bmpMoveDown(PLAYLISTFRAME_BMP_MOVEDOWN, wxBITMAP_TYPE_PNG);
m_bmpBtnPlaylistInsert = new wxBitmapButton( m_mainPanel, ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_INSERT, bmpAdd, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_PlaylistControlHorSizer->Add(m_bmpBtnPlaylistInsert, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_bmpBtnPlaylistInsert->SetToolTip(_("Add video"));
m_bmpBtnPlaylistDelete = new wxBitmapButton( m_mainPanel, ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_DELETE, bmpDelete, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_PlaylistControlHorSizer->Add(m_bmpBtnPlaylistDelete, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_bmpBtnPlaylistDelete->SetToolTip(_("Delete video"));
m_bmpBtnPlaylistMoveUp = new wxBitmapButton( m_mainPanel, ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_MOVEUP, bmpMoveUp, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_PlaylistControlHorSizer->Add(m_bmpBtnPlaylistMoveUp, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_bmpBtnPlaylistMoveUp->SetToolTip(_("Move Up"));
m_bmpBtnPlaylistMoveDown = new wxBitmapButton( m_mainPanel, ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_MOVEDOWN, bmpMoveDown, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW );
m_PlaylistControlHorSizer->Add(m_bmpBtnPlaylistMoveDown, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_bmpBtnPlaylistMoveDown->SetToolTip(_("Move Down"));
m_PlaylistControlHorSizer->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_playlistSaveHorSizer = new wxBoxSizer(wxHORIZONTAL);
m_PlaylistControlHorSizer->Add(m_playlistSaveHorSizer, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_btnPlaylistOpen = new wxButton( m_mainPanel, ID_PLAYLISTFRAME_BTN_PLAYLIST_OPEN, _("Open"), wxDefaultPosition, wxDefaultSize, 0 );
m_playlistSaveHorSizer->Add(m_btnPlaylistOpen, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_btnPlaylistSave = new wxButton( m_mainPanel, ID_PLAYLISTFRAME_BTN_PLAYLIST_SAVE, _("Save"), wxDefaultPosition, wxDefaultSize, 0 );
m_playlistSaveHorSizer->Add(m_btnPlaylistSave, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_ctrlHorSizer = new wxBoxSizer(wxHORIZONTAL);
m_mainPanelVertSizer->Add(m_ctrlHorSizer, 0, wxGROW|wxALL, 5);
m_chkBoxRepeat = new wxCheckBox( m_mainPanel, ID_PLAYLISTFRAME_CHKBOX_REPEAT, _("Repeat video sequence"), wxDefaultPosition, wxDefaultSize, 0 );
m_chkBoxRepeat->SetValue(false);
m_ctrlHorSizer->Add(m_chkBoxRepeat, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_ctrlHorSizer->Add(5, 5, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_ctrlBtnHorSizer = new wxBoxSizer(wxHORIZONTAL);
m_ctrlHorSizer->Add(m_ctrlBtnHorSizer, 0, wxGROW|wxALL, 5);
m_btnStart = new wxButton( m_mainPanel, ID_PLAYLISTFRAME_BTN_START, _("Start"), wxDefaultPosition, wxDefaultSize, 0 );
m_ctrlBtnHorSizer->Add(m_btnStart, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
m_btnCancel = new wxButton( m_mainPanel, ID_PLAYLISTFRAME_BTN_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
m_ctrlBtnHorSizer->Add(m_btnCancel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
////@end PlaylistFrame content construction
}
/*!
* Should we show tooltips?
*/
bool PlaylistFrame::ShowToolTips()
{
return true;
}
/*!
* Get bitmap resources
*/
wxBitmap PlaylistFrame::GetBitmapResource( const wxString& name )
{
// Bitmap retrieval
////@begin PlaylistFrame bitmap retrieval
wxUnusedVar(name);
return wxNullBitmap;
////@end PlaylistFrame bitmap retrieval
}
/*!
* Get icon resources
*/
wxIcon PlaylistFrame::GetIconResource( const wxString& name )
{
// Icon retrieval
////@begin PlaylistFrame icon retrieval
wxUnusedVar(name);
return wxNullIcon;
////@end PlaylistFrame icon retrieval
}
//Auxiliary functions
/** Updates the playlist listbox.
*
*/
void PlaylistFrame::UpdatePlaylist()
{
//Clear playlist
m_lstBoxPlaylist->Clear();
m_lstBoxPlaylist->SetForegroundColour(wxColour(0,255,0));
PlaylistItem item;
std::list<PlaylistItem>::const_iterator it;
for(it = m_playlist.Begin(); it != m_playlist.End(); it++)
{
item = *it;
m_lstBoxPlaylist->Append(item.GetFilename());
}
}
//END Auxiliary functions
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_INSERT
*/
void PlaylistFrame::OnBmpBtnPlaylistInsertClick( wxCommandEvent& event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_INSERT in PlaylistFrame.
wxString wildcard = PLAYLISTFRAME_FILEDLG_WILDCARD;
wxFileDialog dlg(this, _("Choose a file"), wxEmptyString, wxEmptyString, wildcard, wxFD_OPEN);
if (dlg.ShowModal() == wxID_OK)
{
wxString path = dlg.GetPath();
wxString filename = dlg.GetFilename();
m_playlist.Add(path, filename);
UpdatePlaylist();
}
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_INSERT in PlaylistFrame.
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_LSTBOX_BMPBTN_PLAYLIST_DELETE
*/
void PlaylistFrame::OnBmpBtnPlaylistDeleteClick( wxCommandEvent& event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_LSTBOX_BMPBTN_PLAYLIST_DELETE in PlaylistFrame.
int index = m_lstBoxPlaylist->GetSelection();
wxString filename = m_lstBoxPlaylist->GetStringSelection();
if ((!m_wasStarted) || (m_wasStarted && (index != m_itemPlaying)))
{
//Change the number of the current item playing if it�s before item playing
if (index < m_itemPlaying)
m_itemPlaying--;
m_playlist.Delete(index, filename);
UpdatePlaylist();
}
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_LSTBOX_BMPBTN_PLAYLIST_DELETE in PlaylistFrame.
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_MOVEUP
*/
void PlaylistFrame::OnBmpBtnPlaylistMoveUpClick( wxCommandEvent& event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_MOVEUP in PlaylistFrame.
int index = m_lstBoxPlaylist->GetSelection();
wxString filename = m_lstBoxPlaylist->GetStringSelection();
if ((!m_wasStarted) || (m_wasStarted && (index > (m_itemPlaying + 1))))
{
m_playlist.MoveUp(index, filename);
UpdatePlaylist();
if (index > 0)
m_lstBoxPlaylist->SetSelection(index - 1);
else
m_lstBoxPlaylist->SetSelection(index);
}
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_MOVEUP in PlaylistFrame.
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_MOVEDOWN
*/
void PlaylistFrame::OnBmpBtnPlaylistMoveDownClick( wxCommandEvent& event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_MOVEDOWN in PlaylistFrame.
int index = m_lstBoxPlaylist->GetSelection();
wxString filename = m_lstBoxPlaylist->GetStringSelection();
if ((!m_wasStarted) || (m_wasStarted && (index > m_itemPlaying)))
{
m_playlist.MoveDown(index, filename);
UpdatePlaylist();
int size = m_playlist.GetSize();
if (index < (size-1))
m_lstBoxPlaylist->SetSelection(index + 1);
else
m_lstBoxPlaylist->SetSelection(index);
}
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BMPBTN_PLAYLIST_MOVEDOWN in PlaylistFrame.
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BTN_PLAYLIST_OPEN
*/
void PlaylistFrame::OnBtnPlaylistOpenClick( wxCommandEvent& event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BTN_PLAYLIST_SAVE in PlaylistFrame.
// Before editing this code, remove the block markers.
OpenPlaylist();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BTN_PLAYLIST_SAVE in PlaylistFrame.
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BTN_PLAYLIST_SAVE
*/
void PlaylistFrame::OnBtnPlaylistSaveClick( wxCommandEvent& event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BTN_PLAYLIST_SAVE in PlaylistFrame.
// Before editing this code, remove the block markers.
SavePlaylist();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BTN_PLAYLIST_SAVE in PlaylistFrame.
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BTN_START
*/
void PlaylistFrame::OnBtnStartClick( wxCommandEvent& event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BTN_START in PlaylistFrame.
// Before editing this code, remove the block markers.
wxCHECK_RET(m_appInterface, wxT("PlaylistFrame::OnBtnStartClick(): I need AppInterface to work!!"));
if (m_wasStarted)
{
PlaylistFinishTransmission();
}
else
{
m_itemPlaying = 0;
PlaylistStartTransmission();
}
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BTN_START in PlaylistFrame.
}
/** Start playlist transmission.
* Private method.
*/
void PlaylistFrame::PlaylistStartTransmission()
{
BeginPlayFile();
}
/** Finish current movie transmission and begin the next one..
* Private method.
*/
void PlaylistFrame::PlaylistFinishTransmission()
{
/*bool ret = m_appInterface->MovieCancelTransmission(m_mediaId);
if (!ret)
BeginPlayFile();*/
m_finishBtnPressed = true;
if (!m_timer.IsRunning())
{
m_initTime= wxDateTime::UNow();
m_timer.Start(PLAYLISTFRAME_TIMER_INTERVAL);
}
}
/** Change Start/Finish button state according transmission.
* @param[in] fieldsEnable. If true, button state equal finish, else start.
* Private method.
*/
void PlaylistFrame::SetFieldsStates(const bool &fieldsEnable)
{
if (fieldsEnable)
{
m_wasStarted = true;
m_btnStart->SetLabel(_("Finish"));
/*m_btnPlaylistSave->Enable(false);
m_btnPlaylistOpen->Enable(false);*/
}
else
{
m_wasStarted = false;
m_btnStart->SetLabel(_("Start"));
/*m_btnPlaylistSave->Enable(true);
m_btnPlaylistOpen->Enable(true);*/
}
}
/** Begin play a movie in the playlist.
* Private method.
*/
void PlaylistFrame::BeginPlayFile()
{
if (m_itemPlaying < m_playlist.GetSize())
{
const Channel *channel = m_appInterface->GetCurrentChannel();
//Get channel bitrate
Mode mode;
ModeList modeList = channel->GetModeList();
modeList.FindMode(IRM_MODE_CHANNEL_BITRATE, mode);
long bitrate;
mode.GetParameter().ToLong(&bitrate);
PlaylistItem item;
std::list<PlaylistItem>::const_iterator it;
it = m_playlist.Begin();
for(int i = 0;i<m_itemPlaying;i++)
it++;
item = *it;
bool ret = m_appInterface->MovieBeginTransmission(channel->GetName(), item.GetPath(), bitrate);
SetFieldsStates(ret);
m_lstBoxPlaylist->SetSelection(m_itemPlaying);
SetStatusText(wxString::Format(_("Playing file: %s"), item.GetFilename().c_str()));
if (!ret)
{
wxString msg = wxString::Format(_("Error while attempt play %s"), item.GetFilename().c_str());
wxMessageBox(msg, wxMessageBoxCaptionStr, wxOK|wxICON_ERROR, this);
}
}
else
{
if (m_chkBoxRepeat->IsChecked())
{
m_itemPlaying = 0;
BeginPlayFile();
}
else
{
wxString msg = _("Finished send transmission of Playlist");
wxMessageBox(msg, _("Information"), wxICON_INFORMATION|wxOK, this);
m_appInterface->MovieCancelTransmission(m_mediaId);
SetFieldsStates(false);
SetStatusText(wxEmptyString);
}
}
}
//Received movie begin
void PlaylistFrame::OnMovieSendBegin(long mediaId, const wxString &channelName)
{
m_mediaId = mediaId;
}
//Received movie eof
void PlaylistFrame::OnMovieSendEof(long mediaId, const wxString &channelName)
{
if (m_finishBtnPressed)
{
m_finishBtnPressed = false;
if (m_itemPlaying < m_playlist.GetSize())
{
m_itemPlaying++;
BeginPlayFile();
}
}
else
{
m_finishBtnPressed = false;
if (!m_timer.IsRunning())
{
m_initTime= wxDateTime::UNow();
m_timer.Start(PLAYLISTFRAME_TIMER_INTERVAL);
}
}
}
void PlaylistFrame::OnTimer(wxTimerEvent &event)
{
wxDateTime curTime = wxDateTime::UNow();
wxTimeSpan elapsedTime;
elapsedTime = curTime - m_initTime;
long sec = elapsedTime.GetSeconds().ToLong();
//Show remaning time to cancel file transmission
if (m_finishBtnPressed)
{
wxString statusText = wxString::Format(_("Time to end of transmission: %d sec"), PLAYLISTFRAME_MAXIMUMFINISHTIME_SEC - sec);
SetStatusText(statusText);
}
if (sec >= PLAYLISTFRAME_MAXIMUMFINISHTIME_SEC)
{
m_timer.Stop();
//Cancel tranmission of current file
if (m_finishBtnPressed)//Finish button was pressed
{
bool ret = m_appInterface->MovieCancelTransmission(m_mediaId);
////Begin the next file
//if (ret)
//{
// if (m_itemPlaying < m_playlist.GetSize())
// {
// m_itemPlaying++;
// BeginPlayFile();
// }
//}
}
else//Movie send EOF
{
if (m_itemPlaying < m_playlist.GetSize())
{
m_itemPlaying++;
BeginPlayFile();
}
}
SetStatusText(wxEmptyString);
}
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BTN_CANCEL
*/
void PlaylistFrame::OnBtnCancelClick( wxCommandEvent& event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BTN_CANCEL in PlaylistFrame.
// Before editing this code, remove the block markers.
m_appInterface->MovieCancelTransmission(m_mediaId);
Close();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PLAYLISTFRAME_BTN_CANCEL in PlaylistFrame.
}
/** Open playlist from file.
* Private method. Return true if file was opened or false if occurs a error.
*/
bool PlaylistFrame::OpenPlaylist()
{
wxString wildcard = _("Playlist|*.ivl");
wxFileDialog fileDlg(this, wxFileSelectorPromptStr, wxEmptyString, wxEmptyString, wildcard, wxFD_OPEN);
if (fileDlg.ShowModal() == wxID_OK)
{
wxString filePath = fileDlg.GetPath();
if (!wxFile::Access(filePath, wxFile::read))
{
wxMessageBox(_("Inexistent file."), _("ERROR"), wxOK, this);
return false;
}
ifstream playlistFile(WX_TO_FILE_CSTR(filePath));
// get length of file:
playlistFile.seekg (0, ios::end);
int length = playlistFile.tellg();
playlistFile.seekg (0, ios::beg);
// allocate memory:
char * buffer = new char [length];
PlaylistItem item;
m_playlist.Clear();
while(!playlistFile.eof())
{
playlistFile.getline(buffer, length);
filePath = WX_FROM_FILE_CSTR(buffer);
item.SetPath(filePath);
#ifdef __WXGTK__
item.SetFilename(filePath.AfterLast('/'));
#else
item.SetFilename(filePath.AfterLast('\\'));
#endif
m_playlist.Add(item);
}
m_playlist.Delete(m_playlist.GetSize() - 1, wxEmptyString);
playlistFile.close();
UpdatePlaylist();
delete [] buffer;
//When move receive EOF, before BeginPlayFile(), the item instructed to play is going to begin of list
if (m_wasStarted)
m_itemPlaying = -1;
wxMessageBox(_("Playlist loaded successfully."), _("Information"), wxOK, this);
}
return true;
}
/** Save playlist to file.
* Private method. Return true if file was saved or false if occurs a error.
*/
bool PlaylistFrame::SavePlaylist()
{
//If don�t have playlist, don�t create file
if (m_playlist.GetSize() == 0)
return false;
wxString wildcard = _("Playlist|*.ivl");
wxFileDialog fileDlg(this, wxFileSelectorPromptStr, wxEmptyString, wxEmptyString, wildcard, wxFD_SAVE);
if (fileDlg.ShowModal() == wxID_OK)
{
wxString filePath = fileDlg.GetPath();
if (wxFile::Access(filePath, wxFile::write))
{
MessageDialog msgDlg(this, _("Confirm"), _("Overwite file?"));
if ( msgDlg.ShowModal() == ID_MESSAGEDIALOG_BTN_NO)
return false;
}
#ifdef __WXGTK__
filePath += wxT(".ivl");
ofstream playlistFile(WX_TO_FILE_CSTR(filePath));
#else
ofstream playlistFile(WX_TO_FILE_CSTR(filePath));
#endif
PlaylistItem item;
std::list<PlaylistItem>::iterator it;
for(it = m_playlist.Begin(); it != m_playlist.End(); it++)
{
item = *it;
playlistFile << WX_TO_FILE_CSTR(item.GetPath()) << "\n";
}
playlistFile.close();
wxMessageBox(_("Playlist saved successfully."), _("Information"), wxOK, this);
}
return true;
}
| [
"heineck@c016ff2c-3db2-11de-a81c-fde7d73ceb89"
]
| [
[
[
1,
752
]
]
]
|
f597da0df97486430c1c6e0fdf6e3d32f6434d36 | 99d3989754840d95b316a36759097646916a15ea | /tags/2011_09_07_to_baoxin_gpd_0.1/ferrylibs/src/ferry/imutil/io/AVIWriter.cpp | d947b35cbde52872249537a5bd36aca4ca299bb5 | []
| no_license | svn2github/ferryzhouprojects | 5d75b3421a9cb8065a2de424c6c45d194aeee09c | 482ef1e6070c75f7b2c230617afe8a8df6936f30 | refs/heads/master | 2021-01-02T09:20:01.983370 | 2011-10-20T11:39:38 | 2011-10-20T11:39:38 | 11,786,263 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 93 | cpp | #include ".\aviwriter.h"
namespace ferry { namespace imutil { namespace io {
} } }
| [
"ferryzhou@b6adba56-547e-11de-b413-c5e99dc0a8e2"
]
| [
[
[
1,
6
]
]
]
|
e241d8b7acaa189e3d30b56b6c36ceb2bf930e83 | efad0fc148c66bc46cf252f2d8303d76830333c3 | /src/Types/Types.hpp | 1abd0824fe056700c31852fbbb4a01761d936606 | [
"MIT"
]
| permissive | pdragows/DisCODe | a0989803f68f13d0ae84a79f7aecec8dc66575a8 | 9ec93b36c8ea6bfee5ea8aac7aa2865c897d15ad | refs/heads/master | 2020-12-24T20:33:50.678948 | 2011-03-18T16:55:46 | 2011-03-18T16:55:46 | 2,875,107 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 269 | hpp | /*!
* \file Types.hpp
* \brief Documentation and include file for Types namespace.
* \author mstefanc
* \date 26.04.2010
*/
/*!
* \namespace Types
* \brief This namespace contains all custom data types
* \author mstefanc
*/
#include "Blob.hpp"
| [
"[email protected]"
]
| [
[
[
1,
14
]
]
]
|
546e1b2436f346eae186ac1269a01208009a1f88 | f486530c25f94b5be53b5511b9ae2b30ac74f9ea | /common/utility.cpp | 0c6fb8c62fcd5fc5f98e309f0662e688f80fb7b1 | []
| no_license | bjlovegithub/CLPIM | d69712cc7d9eabd285d3aa1ea80b7e906a396a3c | aca78fc0c155392618ded3b18bdf628e475db2a8 | refs/heads/master | 2021-01-01T20:05:33.381748 | 2011-02-13T15:28:05 | 2011-02-13T15:28:05 | 1,257,190 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,736 | cpp | ////////////////////////////////////////////////////////////////////////////////
// utility.cpp
// billjeff Aug/28/2008
//
// CL-PIM
// http://code.google.com/p/clpim/
//
// This file defines the functions which are declared in utility.h.
//
// Revision History:
// Aug/28/2008 - Add the definition of OpenFile and CloseFile.
//
////////////////////////////////////////////////////////////////////////////////
#include "utility.h"
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <string>
using namespace std;
const int MAX_NAME_LENGTH = 256 ;
const char MSG_CREATE_NEW[] = " is not existed, create a new one instead!" ;
const char MSG_ERROR[] = "Fetal Error! Exit CL-PIM. Cannot create file: " ;
// Implementation fo OpenFile
FILE * CLPIM::OpenFile( const char *name, const char *mode )
{
int name_len = 0 ;
// check the legitimation of file name.
{
if ( !name ){
//logger.WriteLog( "File name is invalid! Fetal Error!" ) ;
LOG_ERROR("File name is invalid! Fatal Error!");
return NULL;
}
// check the length of file name
bool f = true ;
for ( int i = 0 ; i < MAX_NAME_LENGTH ; ++i, ++name_len )
if ( name[i] == '\0' ){
f = false ;
break ;
}
if ( f ){
//logger.WriteLog( "File name is too long! Fetal Error!" ) ;
LOG_DEBUG("File name is too long!");
return NULL;
}
// file name is empty...
if ( name_len == 0 ){
//logger.WriteLog( "File name is too short! Fetal Error!" ) ;
LOG_DEBUG("File name is too short!");
return NULL;
}
}
FILE * f = fopen( name, mode ) ;
// file is not existed, write information to terminal and log file.
if ( !f ){
char buf[MAX_NAME_LENGTH*2] ;
strncpy( buf, name, name_len ) ;
strncpy( buf+name_len, MSG_CREATE_NEW, strlen(MSG_CREATE_NEW) ) ;
buf[name_len+strlen(MSG_CREATE_NEW)] = '\0' ;
//logger.WriteLog(buf) ;
LOG_DEBUG(buf);
// create a new file.
f = fopen( name, "w" ) ;
// if file cannot be created, exit CL-PIM
if ( !f ){
int len = strlen(MSG_ERROR) ;
strncpy( buf, MSG_ERROR, len ) ;
strncpy( buf+len, name, name_len ) ;
buf[len+name_len] = '\0' ;
//logger.WriteLog(buf) ;
LOG_DEBUG(buf);
}
}
return f ;
}
bool CLPIM::CloseFile( FILE *file )
{
if ( !file ) return false ;
if ( fclose(file) == 0 ){
//logger.WriteLog("Close file successfully in CloseFile Func!");
LOG_DEBUG("Close file successfully in CloseFile Func!");
return true ;
}
return false ;
}
int8_t CLPIM::CheckEndian()
{
uint32_t val = 0x01020304;
uint8_t *ptr = (uint8_t*)&val;
/// big endian case
if (*ptr == 1 && *(ptr+1) == 2 && *(ptr+2) == 3 && *(ptr+3) == 4)
return 1;
if (*ptr == 4 && *(ptr+1) == 3 && *(ptr+2) == 2 && *(ptr+3) == 1)
return 0;
return -1;
}
void CLPIM::ReverseStr(string &str)
{
if (str.size() < 2)
return;
size_t start = 0, end = str.size()-1;
while (start < end) {
swap(str[start], str[end]);
++start;
--end;
}
}
uint64_t CLPIM::Binary2Uint64(const string &str)
{
uint64_t val = 0;
uint64_t exp = 1;
size_t len = str.size();
for (int i = 0; i < len; ++i) {
val += exp * uint8_t(str[i]);
exp <<= 8;
}
return val;
}
| [
"[email protected]"
]
| [
[
[
1,
130
]
]
]
|
782de31edf1c12a8682d309c1cee6fac4fdd5ca0 | e9522499ed4d3b89f8538f5507347a255cd7fa52 | /drawcli/splitfrm.cpp | 263583a9fad9ef920e483a58dab5e55385882b02 | []
| no_license | markraz/hhhjjjff | 380f075bb468b8c8cda48b25f592498d1a937ba7 | bd81c2f6e97e232645aff745e557760f9cea698d | refs/heads/master | 2021-01-23T07:26:59.874200 | 2009-06-11T05:14:14 | 2009-06-11T05:14:14 | 35,393,785 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 979 | cpp | // splitfrm.cpp : implementation file
#include "stdafx.h"
#include "drawcli.h"
#include "splitfrm.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSplitFrame
IMPLEMENT_DYNCREATE(CSplitFrame, CMDIChildWnd)
CSplitFrame::CSplitFrame()
{
}
CSplitFrame::~CSplitFrame()
{
}
BOOL CSplitFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{
return m_wndSplitter.Create(this,
2, 2, // TODO: adjust the number of rows, columns
CSize(10, 10), // TODO: adjust the minimum pane size
pContext);
}
BEGIN_MESSAGE_MAP(CSplitFrame, CMDIChildWnd)
//{{AFX_MSG_MAP(CSplitFrame)
// NOTE - the ClassWizard will add and remove mapping macros here.
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSplitFrame message handlers
| [
"[email protected]@cfa3df76-2cb6-11de-b2a4-4f96ceaaac44"
]
| [
[
[
1,
41
]
]
]
|
f5aac55892e49bad377711021541a4c98dddd333 | d8f64a24453c6f077426ea58aaa7313aafafc75c | /DKER/TestDLL/Logger.h | 9be019c96cde6cf474afd87c7b0accce173f2ee4 | []
| no_license | dotted/wfto | 5b98591645f3ddd72cad33736da5def09484a339 | 6eebb66384e6eb519401bdd649ae986d94bcaf27 | refs/heads/master | 2021-01-20T06:25:20.468978 | 2010-11-04T21:01:51 | 2010-11-04T21:01:51 | 32,183,921 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 308 | h | #ifndef LOGGER_H
#define LOGGER_H
#include <iostream>
#include <fstream>
#include <string>
class CLogger
{
public:
static void init(std::string fileName);
static void addEntry(std::string line);
private:
static std::ofstream oFile;
static bool LOGALL;
};
#endif // LOGGER_H | [
"[email protected]"
]
| [
[
[
1,
22
]
]
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.