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
7594b92a87c29ebd081aab605f7e3d7ce6bd4005
81f33602a4a6d057b084bdeb237e832068affb38
/reinforce/sarsaview.cpp
f5399e16fc38e86fa5f9522b877e94341a355575
[]
no_license
cider-load-test/plus7pub
e641e29649e0937c3ed254c30bb48b17f04148a9
d0d22c247de81d7ce180fd49a430f0553d33f274
refs/heads/master
2021-12-02T06:22:06.430279
2009-08-31T07:25:10
2009-08-31T07:25:10
null
0
0
null
null
null
null
SHIFT_JIS
C++
false
false
3,495
cpp
#include "sarsaview.h" #include <QPainter> #include <QPen> SarsaView::SarsaView(QWidget * iParent, Qt::WindowFlags iFlags) : QWidget(iParent, iFlags), m_Q(NULL) { setup(); setBackgroundRole(QPalette::Base); // (2) setAutoFillBackground(true); } SarsaView::~SarsaView() { } QSize SarsaView::sizeHint() const { return QSize(350, 250); } void SarsaView::paintEvent(QPaintEvent* iPaintEvent) { QPainter painter(this); if(!m_Q) return; // レンダーヒント painter.setRenderHint(QPainter::Antialiasing); // ペン QPen pen(Qt::black, 1, Qt::DashDotLine, Qt::RoundCap, Qt::RoundJoin); // (4) painter.setPen(pen); // ブラシ QBrush brush(Qt::magenta, Qt::CrossPattern); // (5) painter.setBrush(brush); // フォント QFont font; // (6) font.setPointSize(30); painter.setFont(font); // 描画 //painter.drawRect(m_Rectangle); //painter.drawPolyline(m_Polyline); //painter.drawText(m_Point, m_Text); int i,j; Action a; Status s; int grid; Reward d; QMap<MyQ, Reward>::iterator p; grid = 30; for(i=0;i<19;i++){ for(j=0;j<9;j++){ s = Status(i,j); p = m_Q->find(MyQ(s,Action(1,0))); if(p != m_Q->end()){ d = p.value(); painter.drawLine(QPointF(i*grid,j*grid),QPointF(i*grid+d*4,j*grid)); } p = m_Q->find(MyQ(s,Action(0,1))); if(p != m_Q->end()){ d = p.value(); painter.drawLine(QPointF(i*grid,j*grid),QPointF(i*grid,j*grid+d*4)); } p = m_Q->find(MyQ(s,Action(-1,0))); if(p != m_Q->end()){ d = p.value(); painter.drawLine(QPointF(i*grid,j*grid),QPointF(i*grid-d*4,j*grid)); } p = m_Q->find(MyQ(s,Action(0,-1))); if(p != m_Q->end()){ d = p.value(); painter.drawLine(QPointF(i*grid,j*grid),QPointF(i*grid,j*grid-d*4)); } p = m_Q->find(MyQ(s,Action(1,1))); if(p != m_Q->end()){ d = p.value(); painter.drawLine(QPointF(i*grid,j*grid),QPointF(i*grid+d*4,j*grid+d*4)); } p = m_Q->find(MyQ(s,Action(1,-1))); if(p != m_Q->end()){ d = p.value(); painter.drawLine(QPointF(i*grid,j*grid),QPointF(i*grid+d*4,j*grid-d*4)); } p = m_Q->find(MyQ(s,Action(-1,1))); if(p != m_Q->end()){ d = p.value(); painter.drawLine(QPointF(i*grid,j*grid),QPointF(i*grid-d*4,j*grid+d*4)); } p = m_Q->find(MyQ(s,Action(-1,-1))); if(p != m_Q->end()){ d = p.value(); painter.drawLine(QPointF(i*grid,j*grid),QPointF(i*grid-d*4,j*grid-d*4)); } } } } void SarsaView::setup() { // 四角形 m_Rectangle = QRect(20, 20, 130, 100); // 折れ線(Polyline) m_Polyline.push_back(QPoint(180, 120)); m_Polyline.push_back(QPoint(190, 30)); m_Polyline.push_back(QPoint(300, 130)); m_Polyline.push_back(QPoint(320, 30)); // テキスト m_Text = QString::fromLocal8Bit("Qtプログラミング"); // (3) m_Point.setX(30); m_Point.setY(200); }
[ [ [ 1, 121 ] ] ]
db46a809d09027d8dd96c51f4757ea8762908771
4813a54584f8e8a8a2d541291a08b244640a7f77
/libxl/src/ui/Control.cpp
fec0fc97c84d6a1212c702e97559a4e67c7bb2c7
[]
no_license
cyberscorpio/libxl
fcc0c67390dd8eae4bb7d36f6a459ffed368183a
8d27566f45234af214a7a1e19c455e9721073e8c
refs/heads/master
2021-01-19T16:56:51.990977
2010-06-30T08:18:41
2010-06-30T08:18:41
38,444,794
0
0
null
null
null
null
UTF-8
C++
false
false
11,114
cpp
#include <assert.h> #include "../../include/common.h" #include "../../include/ui/Gdi.h" #include "../../include/ui/Control.h" #include "../../include/ui/CtrlMain.h" #ifndef NDEBUG static int s_control_counts = 0; #endif XL_BEGIN UI_BEGIN void CControl::_LayoutChildren () { CRect rc = getClientRect(); for (CControlConstIter it = m_controls.begin(); it != m_controls.end(); ++ it) { rc = (*it)->layout(rc); } } void CControl::_SetParent (CControlPtr parent) { if (_GetMainCtrl() != NULL) { onDetach(); } m_parent = parent; if (_GetMainCtrl() != NULL) { onAttach(); } } // void CControl::_SetTarget (CCtrlTargetRawPtr target) { // m_target = target; // for (CControlIter it = m_controls.begin(); it != m_controls.end(); ++ it) { // (*it)->_SetTarget(target); // } // } CCtrlTargetRawPtr CControl::_GetTarget () { CCtrlMain *pCtrlMain = _GetMainCtrl(); if (pCtrlMain != NULL) { return pCtrlMain->_GetTarget(); } else { return CCtrlTargetRawPtr(NULL); } } COLORREF CControl::_GetColor () { return disable ? ::GetSysColor(COLOR_GRAYTEXT) : color; } HFONT CControl::_GetFont () { CResMgr *pResMgr = CResMgr::getInstance(); uint style = 0; if (fontweight == FONTW_BOLD) { style |= CResMgr::FS_BOLD; } return pResMgr->getSysFont(fontsize, style); } void CControl::_DrawBorder (HDC hdc) { CDCHandle dc(hdc); COLORREF gray = RGB(127,127,127); if (border.top.width > 0) { dc.FillSolidRect(m_rect.left, m_rect.top, m_rect.Width(), border.top.width, disable ? gray : border.top.color); } if (border.right.width > 0) { dc.FillSolidRect(m_rect.right - border.right.width, m_rect.top, border.right.width, m_rect.Height(), disable ? gray : border.right.color); } if (border.bottom.width > 0) { dc.FillSolidRect(m_rect.left, m_rect.bottom - border.bottom.width, m_rect.Width(), border.bottom.width, disable ? gray : border.bottom.color); } if (border.left.width > 0) { dc.FillSolidRect(m_rect.left, m_rect.top, border.left.width, m_rect.Height(), disable ? gray : border.left.color); } } void CControl::_DrawBackground (HDC hdc) { if (background.type == BGT_NONE) { return; } CRect rc = m_rect; rc.DeflateRect(border.left.width, border.top.width, border.right.width, border.bottom.width); if (background.type == BGT_RGB) { CDCHandle dc(hdc); dc.FillSolidRect(rc, background.color); return; } assert(false); // to be implement later } bool CControl::_Capture (bool capture) { CCtrlMain *pCtrlMain = _GetMainCtrl(); CControlPtr pThis = shared_from_this(); assert (pCtrlMain); CControlPtr ctrlCapture = pCtrlMain->getCaptureCtrl(); if (capture) { if (ctrlCapture != pThis) { if (ctrlCapture != NULL) { ctrlCapture->onLostCapture(); } return pCtrlMain->_SetCaptureCtrl(pThis); } else { return true; } } else { if (ctrlCapture == pThis) { return pCtrlMain->_SetCaptureCtrl(CControlPtr()); } else { return true; } } } uint CControl::_SetTimer (uint elapse, uint id) { CCtrlMain *pCtrlMain = _GetMainCtrl(); assert(pCtrlMain); if (!pCtrlMain) { return 0; } if (id == 0) { id = (uint)this; } return pCtrlMain->_SetTimer(shared_from_this(), elapse, id); } CCtrlMain* CControl::_GetMainCtrl () { CControlPtr parent = m_parent.lock(); if (parent != NULL) { return parent->_GetMainCtrl(); } return NULL; } CControl::CControl (uint id) : m_id(id) , m_rect(0, 0, 0, 0) { if (m_id == 0) { m_id = (uint)this; // this should be unique ? } #ifndef NDEBUG ++ s_control_counts; #endif } CControl::~CControl () { #ifndef NDEBUG -- s_control_counts; // ATLTRACE (_T("%d control(s) remains\n"), s_control_counts); #endif } CRect CControl::getClientRect () const { CRect rc = m_rect; rc.top += border.top.width + padding.top; rc.right -= border.right.width + padding.right; rc.bottom -= border.bottom.width + padding.bottom; rc.left += border.left.width + padding.left; return rc; } bool CControl::insertChild (CControlPtr child) { CCtrlMain *pCtrlMain = _GetMainCtrl(); if (pCtrlMain) { pCtrlMain->lock(); } m_controls.push_back(child); child->_SetParent(shared_from_this()); if (pCtrlMain) { pCtrlMain->unlock(); pCtrlMain->reLayout(); } return true; } bool CControl::isChild (CControlPtr control) { if (control == NULL) { return false; } else { CControlPtr parent = control->m_parent.lock(); while (parent != NULL) { if (parent.get() == this) { return true; } parent = parent->m_parent.lock(); } } return false; } CControlPtr CControl::removeChild (uint id) { CControlPtr ctrl = getControlByID(id); if (ctrl != NULL) { CCtrlMain *pCtrlMain = _GetMainCtrl(); if (pCtrlMain) { pCtrlMain->_BeforeRemoveCtrl(ctrl); } CControlPtr parent = ctrl->m_parent.lock(); assert(parent != NULL); bool found = false; for (CControlIter it = parent->m_controls.begin(); it != parent->m_controls.end(); ++ it) { if ((*it)->getID() == id) { found = true; parent->m_controls.erase(it); break; } } assert(found); ctrl->_SetParent(CControlPtr()); if (pCtrlMain) { pCtrlMain->reLayout(); } } return ctrl; } CControlPtr CControl::getControlByID (uint id) { for (CControlIter it = m_controls.begin(); it != m_controls.end(); ++ it) { if ((*it)->getID() == id) { return *it; } CControlPtr ctrl = (*it)->getControlByID(id); if (ctrl != NULL) { return ctrl; } } return CControlPtr(); } CControlPtr CControl::getControlByPoint (CPoint pt) { if (display && isPointIn(pt)) { for (CControlIterR itr = m_controls.rbegin(); itr != m_controls.rend(); ++ itr) { if ((*itr)->isPointIn(pt)) { CControlPtr ctrl = (*itr)->getControlByPoint(pt); if (ctrl != NULL) { return ctrl; } } } return shared_from_this(); } return CControlPtr(); } void CControl::invalidate () { CCtrlMain *pCtrlMain = _GetMainCtrl(); if (pCtrlMain) { pCtrlMain->invalidateControl(shared_from_this()); } } void CControl::resetStyle () { CWinStyle::_Reset(); CCtrlMain *pCtrlMain = _GetMainCtrl(); if (pCtrlMain) { pCtrlMain->reLayout(); } } void CControl::setStyle (const tstring &style) { bool relayout = false, redraw = false; CWinStyle::_SetStyle(style, relayout, redraw); CCtrlMain *pCtrlMain = _GetMainCtrl(); if (pCtrlMain) { if (relayout) { pCtrlMain->reLayout(); } else if (redraw) { pCtrlMain->invalidateControl(shared_from_this()); } } } void CControl::setOpacity (int opacity) { assert(opacity >= 0 && opacity <= 100); tchar buf[32]; _stprintf_s(buf, 32, _T("opacity:%d"), opacity); setStyle(buf); } void CControl::draw (HDC hdc, CRect rcClip) { // check paint condition if (m_rect.Width() <= 0 || m_rect.Height() <= 0) { return; } if (opacity == 0 || !display) { return; } CRect rc = m_rect; CRect rcTest = rc; if (!rcTest.IntersectRect(rcTest, rcClip)) { return; } HDC hdcPaint = hdc; CControlPtr parent = m_parent.lock(); std::auto_ptr<CMemoryDC> mdc; if (parent == NULL || opacity != 100/* || transparent*/) { mdc.reset(new CMemoryDC(hdc, rc)); if (parent != NULL) { mdc->BitBlt(rc.left, rc.top, rc.Width(), rc.Height(), hdc, m_rect.left, m_rect.top, SRCCOPY); } hdcPaint = mdc->m_hDC; } _DrawBorder(hdcPaint); _DrawBackground(hdcPaint); drawMe(hdcPaint); for (CControlIter it = m_controls.begin(); it != m_controls.end(); ++ it) { (*it)->draw(hdcPaint, rcClip); } if (opacity != 100) { mdc->m_paintWhenDestroy = false; CDCHandle dc(hdc); BLENDFUNCTION bf = {AC_SRC_OVER, 0, (uint8)(255 * opacity / 100), 0}; dc.AlphaBlend(rc.left, rc.top, rc.Width(), rc.Height(), hdcPaint, rc.left, rc.top, rc.Width(), rc.Height(), bf); } } CRect CControl::layout (CRect rc) { CControlPtr parent = m_parent.lock(); int x = 0, y = 0, width, height; CRect rcRemain = rc; CRect rcOld = m_rect; if (isfloat) { assert (parent != NULL); rc = parent->m_rect; } if (margin.left == EDGE_AUTO && margin.right == EDGE_AUTO) { assert (this->width != SIZE_FILL); } if (margin.top == EDGE_AUTO && margin.bottom == EDGE_AUTO) { assert (this->height != SIZE_FILL); } // width if (this->width == SIZE_FILL) { width = rc.Width() - margin.width(); } else { width = this->width + padding.width() + border.width(); if (width > rc.Width()) { width = rc.Width(); } } // height if (this->height == SIZE_FILL) { height = rc.Height() - margin.height(); } else { height = this->height + padding.height() + border.height(); if (height > rc.Height()) { height = rc.Height(); } } // x if (margin.left == EDGE_AUTO || margin.right == EDGE_AUTO) { x = (rc.Width() - width) / 2; rcRemain.left = rcRemain.right; // no space remains } else { switch (px) { case PX_LEFT: x = rc.left + margin.left; rcRemain.left = x + width + margin.right; break; case PX_RIGHT: x = rc.right - margin.right - width; rcRemain.right = x - margin.left; break; default: assert (false); } } // y if (margin.top == EDGE_AUTO || margin.bottom == EDGE_AUTO) { y = (rc.Height() - height) / 2; rcRemain.top = rcRemain.bottom; // nospace remains } else { switch (py) { case PY_TOP: y = rc.top + margin.top; if (this->width == SIZE_FILL) { rcRemain.top = y + height + margin.bottom; } break; case PY_BOTTOM: y = rc.bottom - margin.bottom - height; if (this->width == SIZE_FILL) { rcRemain.bottom = y - margin.top; } break; default: assert (false); } } m_rect.left = x; m_rect.top = y; m_rect.right = x + width; m_rect.bottom = y + height; _LayoutChildren(); // adjust rcRemain if (this->width == SIZE_FILL) { rcRemain.left = rc.left; rcRemain.right = rc.right; // switch (py) { // case PY_TOP: // rcRemain.top = rc.top + margin.top + height + margin.bottom; // rcRemain.bottom = rc.bottom; // break; // case PY_BOTTOM: // rcRemain.top = rc.top; // rcRemain.bottom = rc.bottom - margin.top - height - margin.bottom; // break; // default: // assert (false); // break; // } } if (isfloat) { rcRemain = rc; } if (rcOld != m_rect) { onSize(); } return rcRemain; } bool CControl::isPointIn (CPoint pt) const { return m_rect.PtInRect(pt) ? true : false; } bool CControl::isCursorIn () { CCtrlMain *pCtrlMain = _GetMainCtrl(); assert(pCtrlMain != NULL); if (!isPointIn(pCtrlMain->getCursorPos())) { return false; } else { CControlPtr ctrlHover = pCtrlMain->getHoverCtrl(); if (ctrlHover.get() == this || isChild(ctrlHover)) { return true; } else { return false; } } } void CControl::drawMe (HDC /*hdc*/) { } UI_END XL_END
[ "[email protected]", "doudehou@59b6eb50-eb15-11de-b362-3513cf04e977" ]
[ [ [ 1, 4 ], [ 6, 6 ], [ 11, 16 ], [ 18, 21 ], [ 23, 23 ], [ 26, 26 ], [ 28, 31 ], [ 34, 39 ], [ 42, 44 ], [ 46, 46 ], [ 50, 59 ], [ 61, 63 ], [ 65, 65 ], [ 68, 69 ], [ 73, 76 ], [ 78, 79 ], [ 83, 84 ], [ 86, 101 ], [ 103, 104 ], [ 106, 108 ], [ 110, 110 ], [ 116, 119 ], [ 122, 134 ], [ 138, 140 ], [ 146, 146 ], [ 152, 153 ], [ 158, 158 ], [ 162, 164 ], [ 167, 167 ], [ 170, 171 ], [ 183, 187 ], [ 190, 193 ], [ 195, 196 ], [ 213, 217 ], [ 219, 241 ], [ 273, 280 ], [ 302, 308 ], [ 311, 311 ], [ 317, 317 ], [ 333, 333 ], [ 339, 340 ], [ 342, 343 ], [ 350, 350 ], [ 352, 365 ], [ 373, 374 ], [ 376, 376 ], [ 378, 384 ], [ 386, 386 ], [ 388, 393 ], [ 410, 412 ], [ 432, 471 ], [ 476, 497 ] ], [ [ 5, 5 ], [ 7, 10 ], [ 17, 17 ], [ 22, 22 ], [ 24, 25 ], [ 27, 27 ], [ 32, 33 ], [ 40, 41 ], [ 45, 45 ], [ 47, 49 ], [ 60, 60 ], [ 64, 64 ], [ 66, 67 ], [ 70, 72 ], [ 77, 77 ], [ 80, 82 ], [ 85, 85 ], [ 102, 102 ], [ 105, 105 ], [ 109, 109 ], [ 111, 115 ], [ 120, 121 ], [ 135, 137 ], [ 141, 145 ], [ 147, 151 ], [ 154, 157 ], [ 159, 161 ], [ 165, 166 ], [ 168, 169 ], [ 172, 182 ], [ 188, 189 ], [ 194, 194 ], [ 197, 212 ], [ 218, 218 ], [ 242, 272 ], [ 281, 301 ], [ 309, 310 ], [ 312, 316 ], [ 318, 332 ], [ 334, 338 ], [ 341, 341 ], [ 344, 349 ], [ 351, 351 ], [ 366, 372 ], [ 375, 375 ], [ 377, 377 ], [ 385, 385 ], [ 387, 387 ], [ 394, 409 ], [ 413, 431 ], [ 472, 475 ] ] ]
396f98fc6718df823ef6e699c37f29d72b7cb7d5
92ac0ac49f0ffbcf6d5b1aea83e1e342688ef6d6
/bootloader_host/src/mem.cpp
e6a264ee606ffe402653508a0e539d05f270a9a3
[]
no_license
avbotz/beagleboard
2225e8c4b98e256741134e254cda8ebb84e54068
207cf8316c164c36cada3fccc6e785393bd52295
refs/heads/master
2021-05-27T14:13:11.069660
2011-11-12T01:38:52
2011-11-12T01:38:52
2,329,969
0
0
null
null
null
null
UTF-8
C++
false
false
3,947
cpp
#include "stdafx.h" extern bool WriteCommBlock (int pComdDev, char *pBuffer , int BytesToWrite); extern void ReceiveData(int pComDev, char * pBuffer, int BytesToReceive); /******************************************************************************/ mem_cMemRow::mem_cMemRow(eType Type, unsigned int StartAddr, int RowNumber, eFamily Family) { int Size; m_RowNumber = RowNumber; m_eFamily = Family; m_eType = Type; m_bEmpty = TRUE; if(m_eType == Program) { if(m_eFamily == dsPIC30F) { m_RowSize = PM30F_ROW_SIZE; } else { m_RowSize = PM33F_ROW_SIZE; } } else { m_RowSize = EE30F_ROW_SIZE; } if(m_eType == Program) { Size = m_RowSize * 3; m_Address = StartAddr + RowNumber * m_RowSize * 2; } if(m_eType == EEProm) { Size = m_RowSize * 2; m_Address = StartAddr + RowNumber * m_RowSize * 2; } if(m_eType == Configuration) { Size = 3; m_Address = StartAddr + RowNumber * 2; } m_pBuffer = (char *)malloc(Size); memset(m_Data, 0xFFFF, sizeof(unsigned short)*PM33F_ROW_SIZE*2); } /******************************************************************************/ bool mem_cMemRow::InsertData(unsigned int Address, char * pData) { if(Address < m_Address) { return FALSE; } if((m_eType == Program) && (Address >= (m_Address + m_RowSize * 2))) { return FALSE; } if((m_eType == EEProm) && (Address >= (m_Address + m_RowSize * 2))) { return FALSE; } if((m_eType == Configuration) && (Address >= (m_Address + 2))) { return FALSE; } m_bEmpty = FALSE; sscanf(pData, "%4hx", &(m_Data[Address - m_Address])); return TRUE; } /******************************************************************************/ void mem_cMemRow::FormatData(void) { if(m_bEmpty == TRUE) { return; } if(m_eType == Program) { for(int Count = 0; Count < m_RowSize; Count += 1) { m_pBuffer[0 + Count * 3] = (m_Data[Count * 2] >> 8) & 0xFF; m_pBuffer[1 + Count * 3] = (m_Data[Count * 2]) & 0xFF; m_pBuffer[2 + Count * 3] = (m_Data[Count * 2 + 1] >> 8) & 0xFF; } } else if(m_eType == Configuration) { m_pBuffer[0] = (m_Data[0] >> 8) & 0xFF; m_pBuffer[1] = (m_Data[0]) & 0xFF; m_pBuffer[2] = (m_Data[1] >> 8) & 0xFF; } else { for(int Count = 0; Count < m_RowSize; Count++) { m_pBuffer[0 + Count * 2] = (m_Data[Count * 2] >> 8) & 0xFF; m_pBuffer[1 + Count * 2] = (m_Data[Count * 2]) & 0xFF; } } } /******************************************************************************/ void mem_cMemRow::SendData(int pComDev) { char Buffer[4] = {0,0,0,0}; if((m_bEmpty == TRUE) && (m_eType != Configuration)) { return; } while(Buffer[0] != COMMAND_ACK) { if(m_eType == Program) { Buffer[0] = COMMAND_WRITE_PM; Buffer[1] = (m_Address) & 0xFF; Buffer[2] = (m_Address >> 8) & 0xFF; Buffer[3] = (m_Address >> 16) & 0xFF; WriteCommBlock(pComDev, Buffer, 4); WriteCommBlock(pComDev, m_pBuffer, m_RowSize); msleep(10); WriteCommBlock(pComDev, m_pBuffer+m_RowSize, m_RowSize); msleep(10); WriteCommBlock(pComDev, m_pBuffer+m_RowSize+m_RowSize, m_RowSize); msleep(10); } else if((m_eType == Configuration) && (m_RowNumber == 0)) { Buffer[0] = COMMAND_WRITE_CM; Buffer[1] = (char)(m_bEmpty)& 0xFF; Buffer[2] = m_pBuffer[0]; Buffer[3] = m_pBuffer[1]; WriteCommBlock(pComDev, Buffer, 4); } else if((m_eType == Configuration) && (m_RowNumber != 0)) { if((m_eFamily == dsPIC30F) && (m_RowNumber == 7)) { return; } Buffer[0] = (char)(m_bEmpty)& 0xFF; Buffer[1] = m_pBuffer[0]; Buffer[2] = m_pBuffer[1]; WriteCommBlock(pComDev, Buffer, 3); } else { assert(!"Unknown memory type"); } ReceiveData(pComDev, Buffer, 1); } }
[ [ [ 1, 177 ] ] ]
7f8bf7060614b58a23a13e9fffefe95079320183
968aa9bac548662b49af4e2b873b61873ba6f680
/imgtools/imgcheck/libimgutils/inc/e32reader.h
40016626dadb2e310941e5d05694a21f0c89eb2a
[]
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
1,333
h
/* * 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: * E32Reader class * @internalComponent * @released * */ #ifndef E32READER_H #define E32READER_H #include "imagereader.h" #include "e32image.h" class E32Image : public E32ImageFile { public: E32Image(void); ~E32Image(void); char** GetImportExecutableNames(int& count); }; /** class to read E32 image @internalComponent @released */ class E32Reader : public ImageReader { private: StringList iDependencyList; E32Image *iE32Image; string iExeName; public: void ReadImage(void); void ProcessImage(void); E32Reader(const char* aImageName); ~E32Reader(void); const StringList& GetDependencyList(void) const ; ExeNamesVsDepListMap& GatherDependencies(void); static bool IsE32Image(const char* aImageName); void PrepareExeVsIdMap(void); const ExeVsIdDataMap& GetExeVsIdMap() const; }; #endif //E32READER_H
[ "none@none" ]
[ [ [ 1, 62 ] ] ]
2dfd3c3afc1450f5886962390a61337546cec713
d752d83f8bd72d9b280a8c70e28e56e502ef096f
/EXEGen/Linker/LinkWriter.cpp
2dc8448b1945b1d8178a862e0e4dda032f302f56
[]
no_license
apoch/epoch-language.old
f87b4512ec6bb5591bc1610e21210e0ed6a82104
b09701714d556442202fccb92405e6886064f4af
refs/heads/master
2021-01-10T20:17:56.774468
2010-03-07T09:19:02
2010-03-07T09:19:02
34,307,116
0
0
null
null
null
null
UTF-8
C++
false
false
2,382
cpp
// // The Epoch Language Project // Win32 EXE Generator // // Wrapper object for emitting the final linked binary file // #include "pch.h" #include "LinkWriter.h" //------------------------------------------------------------------------------- // LinkWriter implementation //------------------------------------------------------------------------------- // // Construct and initialize the file writer wrapper // LinkWriter::LinkWriter(std::ofstream& outputstream) : OutputStream(outputstream) { } // // Write a single byte to the output file // void LinkWriter::EmitByte(unsigned char out) { OutputStream << out; } // // Write a WORD (16 bits) to the output file // void LinkWriter::EmitWORD(WORD out) { OutputStream << static_cast<unsigned char>(out & 0xff) << static_cast<unsigned char>((out >> 8) & 0xff); } // // Write a DWORD (32 bits) to the output file // void LinkWriter::EmitDWORD(DWORD out) { OutputStream << static_cast<unsigned char>(out & 0xff) << static_cast<unsigned char>((out >> 8) & 0xff) << static_cast<unsigned char>((out >> 16) & 0xff) << static_cast<unsigned char>((out >> 24) & 0xff); } // // Write a narrow (ASCII) string to the output file // void LinkWriter::EmitNarrowString(const std::string& out) { OutputStream << out << '\0'; } // // Write a wide (UTF-16) string to the output file // void LinkWriter::EmitWideString(const std::wstring& out) { for(std::wstring::const_iterator iter = out.begin(); iter != out.end(); ++iter) EmitWORD(*iter); EmitWORD(0); } // // Write a structure or other buffer to the output file // void LinkWriter::EmitBlob(void* data, size_t size) { OutputStream.write(reinterpret_cast<Byte*>(data), static_cast<std::streamsize>(size)); } // // Output bytes until the file reaches a given size // void LinkWriter::Pad(std::streamsize size, unsigned char byte) { if(OutputStream.tellp() > size) { #ifdef _DEBUG std::streamsize curpos = OutputStream.tellp(); // Just so we can read the value during debugging #endif throw Exception("Already wrote past the end of padding area; aborting!"); } while(OutputStream.tellp() < size) OutputStream << byte; } // // Return the current write offset in the file // DWORD LinkWriter::GetOffset() const { return OutputStream.tellp(); }
[ [ [ 1, 101 ] ] ]
40b7f5df8e8eca4949cecdb44ef803a62be83626
b4bff7f61d078e3dddeb760e21174a781ed7f985
/Source/Contrib/UserInterface/src/UndoableEdit/OSGCompoundUndoableEdit.cpp
22042e4b70aa2f0f54693f71348fd6fb13073721
[]
no_license
Langkamp/OpenSGToolbox
8283edb6074dffba477c2c4d632e954c3c73f4e3
5a4230441e68f001cdf3e08e9f97f9c0f3c71015
refs/heads/master
2021-01-16T18:15:50.951223
2010-05-19T20:24:52
2010-05-19T20:24:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,678
cpp
/*---------------------------------------------------------------------------*\ * OpenSG ToolBox UserInterface * * * * * * * * * * www.vrac.iastate.edu * * * * Authors: David Kabala, Alden Peterson, Lee Zaniewski, Jonathan Flory * * * \*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*\ * License * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Library General Public License as published * * by the Free Software Foundation, version 2. * * * * 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 * * Library General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this library; if not, write to the Free Software * * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * * \*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*\ * Changes * * * * * * * * * * * * * \*---------------------------------------------------------------------------*/ //--------------------------------------------------------------------------- // Includes //--------------------------------------------------------------------------- #include <stdlib.h> #include <stdio.h> #define OSG_COMPILEUSERINTERFACELIB #include "OSGConfig.h" #include <assert.h> #include "OSGCompoundUndoableEdit.h" OSG_BEGIN_NAMESPACE /***************************************************************************\ * Description * \***************************************************************************/ /*! \class OSG::CompoundUndoableEdit A CompoundUndoableEdit. */ /***************************************************************************\ * Class variables * \***************************************************************************/ /***************************************************************************\ * Class methods * \***************************************************************************/ /***************************************************************************\ * Instance methods * \***************************************************************************/ bool CompoundUndoableEdit::addEdit(const UndoableEditPtr anEdit) { if(_IsInProgress) { if(_Edits.size() != 0) { if(!_Edits.back()->addEdit(anEdit)) { if(anEdit->replaceEdit(_Edits.back())) { _Edits.pop_back(); } _Edits.push_back(anEdit); } } else { _Edits.push_back(anEdit); } return true; } else { return false; } } bool CompoundUndoableEdit::canRedo(void) const { return Inherited::canRedo() && !_IsInProgress; } bool CompoundUndoableEdit::canUndo(void) const { return Inherited::canUndo() && !_IsInProgress; } void CompoundUndoableEdit::die(void) { for(EditVector::reverse_iterator Itor(_Edits.rbegin()) ; Itor != _Edits.rend() ; ++Itor) { (*Itor)->die(); } } std::string CompoundUndoableEdit::getPresentationName(void) const { if(_Edits.size() != 0) { return _Edits.back()->getPresentationName(); } else { return Inherited::getPresentationName(); } } std::string CompoundUndoableEdit::getRedoPresentationName(void) const { if(_Edits.size() != 0) { return _Edits.back()->getRedoPresentationName(); } else { return Inherited::getPresentationName(); } } std::string CompoundUndoableEdit::getUndoPresentationName(void) const { if(_Edits.size() != 0) { return _Edits.back()->getUndoPresentationName(); } else { return Inherited::getPresentationName(); } } bool CompoundUndoableEdit::isSignificant(void) const { for(EditVector::const_iterator Itor(_Edits.begin()) ; Itor != _Edits.end() ; ++Itor) { if((*Itor)->isSignificant()) { return true; } } return false; } void CompoundUndoableEdit::redo(void) { for(EditVector::reverse_iterator Itor(_Edits.rbegin()) ; Itor != _Edits.rend() ; ++Itor) { (*Itor)->redo(); } } void CompoundUndoableEdit::undo(void) { for(EditVector::reverse_iterator Itor(_Edits.rbegin()) ; Itor != _Edits.rend() ; ++Itor) { (*Itor)->undo(); } } bool CompoundUndoableEdit::isInProgress(void) const { return _IsInProgress; } void CompoundUndoableEdit::end(void) { _IsInProgress = false; } UndoableEditPtr CompoundUndoableEdit::lastEdit(void) { return _Edits.back(); } /*-------------------------------------------------------------------------*\ - private - \*-------------------------------------------------------------------------*/ /*----------------------- constructors & destructors ----------------------*/ CompoundUndoableEdit::CompoundUndoableEdit(void) : Inherited(), _IsInProgress(true) { } CompoundUndoableEdit::CompoundUndoableEdit(const CompoundUndoableEdit& source) : Inherited(source), _IsInProgress(source._IsInProgress), _Edits(source._Edits) { } void CompoundUndoableEdit::operator=(const CompoundUndoableEdit& source) { Inherited::operator=(source); _IsInProgress = source._IsInProgress; _Edits = source._Edits; } CompoundUndoableEdit::~CompoundUndoableEdit(void) { } CompoundUndoableEditPtr CompoundUndoableEdit::create(void) { return CompoundUndoableEditPtr(new CompoundUndoableEdit()); } /*----------------------------- class specific ----------------------------*/ OSG_END_NAMESPACE
[ [ [ 1, 234 ] ] ]
3aecc1bbc27541abb6739f9e69c5e27f8f7cda60
82afdf1a0de48235b75a9b6ca61c9dbcfefcfafa
/TypeExpr.h
13aef5c00619195610e4322f9fe9217c4661f061
[]
no_license
shilrobot/shilscript_plus_plus
eec85d01074ec379da63abe00562d7663c664398
09dbdbdadc28d131fa3c8026b14015336a55ed62
refs/heads/master
2021-01-25T00:17:10.004698
2009-12-16T22:45:52
2009-12-16T22:45:52
2,589,159
0
0
null
null
null
null
UTF-8
C++
false
false
2,204
h
#ifndef SS_TYPEEXPR_H #define SS_TYPEEXPR_H #include "Node.h" #include "CompileErrors.h" #include "Name.h" namespace SS { class TypeExpr : public Node { public: SS_CLASS(TypeExpr, "TypeExpr", Node) virtual String Dump() const=0; }; // Just a name class NameTypeExpr : public TypeExpr { public: SS_CLASS(NameTypeExpr, "NameTypeExpr", TypeExpr) NameTypeExpr() {} // TODO: Maybe this isn't the right way to do this SS_NAMED_NODE; String Dump() const { return GetName(); } }; // TODO: Move elsewhere enum BasicTypeId { BT_VOID, BT_BOOL, BT_U1, BT_I1, BT_U2, BT_I2, BT_U4, BT_I4, BT_U8, BT_I8, BT_FLOAT, BT_DOUBLE, BT_CHAR, BT_STRING, BT_OBJECT, }; class BasicTypeExpr : public TypeExpr { public: SS_CLASS(BasicTypeExpr, "BasicTypeExpr", TypeExpr) BasicTypeExpr(BasicTypeId typeId = BT_VOID) : m_typeid(typeId) {} SS_GETSET(BasicTypeId, TypeId, m_typeid); // TODO: Join this with other code that has this same switch() String Dump() const { switch(m_typeid) { case BT_VOID: return "void"; case BT_BOOL: return "bool"; case BT_U1: return "byte"; case BT_I1: return "sbyte"; case BT_U2: return "ushort"; case BT_I2: return "short"; case BT_U4: return "uint"; case BT_I4: return "int"; case BT_U8: return "ulong"; case BT_I8: return "long"; case BT_FLOAT: return "float"; case BT_DOUBLE: return "double"; case BT_CHAR: return "char"; case BT_STRING: return "string"; case BT_OBJECT: return "object"; default: SS_UNREACHABLE; return "???"; } } private: BasicTypeId m_typeid; }; class DottedTypeExpr : public TypeExpr { public: SS_CLASS(DottedTypeExpr, "DottedTypeExpr", TypeExpr) DottedTypeExpr() : m_left(0), m_right(0) { } ~DottedTypeExpr() { delete m_left; delete m_right; } SS_GETSET(TypeExpr*, Left, m_left); SS_GETSET(TypeExpr*, Right, m_right); String Dump() const { return m_left->Dump() + "." + m_right->Dump(); } private: TypeExpr* m_left; TypeExpr* m_right; }; // TODO: list<T>, dict<T,U>, typename keywords (int, object, ...) } #endif // SS_TYPEEXPR_H
[ "shilbert@6dcb506c-49f4-8c44-b148-53dce8eab73e" ]
[ [ [ 1, 120 ] ] ]
80559a53dcd910aebdb79746b13a47d09f7b882f
0c84ebd32a2646b5582051216d6e7c8283bb4f23
/wxListDialog.h
a692c033d61e84ff45012f3d9c003fdabdc19bfa
[]
no_license
AudioAnecdotes/wxWizApp
97932d2e6fd2c38934c16629a5e3d6023e0978ac
129dfad68be44581c97249d2975efca2fa7578b7
refs/heads/master
2021-01-18T06:36:29.316270
2007-01-02T06:02:13
2007-01-02T06:02:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
718
h
// wxListDialog.h: interface for the wxListDialog class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_WXLISTDIALOG_H__90834051_7472_42CA_A7B8_146B1541F380__INCLUDED_) #define AFX_WXLISTDIALOG_H__90834051_7472_42CA_A7B8_146B1541F380__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #include "wxWizBaseDlg.h" class wxListDialog : public wxWizBaseDlg { public: wxListDialog(WizAppData* data,bool Multiple); virtual ~wxListDialog(); protected: virtual void OnButtonPressed(int errlevel); bool m_Multiple; wxListBox* m_box; }; #endif // !defined(AFX_WXLISTDIALOG_H__90834051_7472_42CA_A7B8_146B1541F380__INCLUDED_)
[ "gsilber" ]
[ [ [ 1, 27 ] ] ]
770979828262804e09bc4b1fad2c84b8710045f8
fac8de123987842827a68da1b580f1361926ab67
/inc/physics/Physics/Dynamics/Constraint/Bilateral/Prismatic/hkpPrismaticConstraintData.inl
1469ffec5e8876b2ae71e38a4357f2f0330ff61b
[]
no_license
blockspacer/transporter-game
23496e1651b3c19f6727712a5652f8e49c45c076
083ae2ee48fcab2c7d8a68670a71be4d09954428
refs/heads/master
2021-05-31T04:06:07.101459
2009-02-19T20:59:59
2009-02-19T20:59:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,246
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-2008 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement. * */ inline void hkpPrismaticConstraintData::setMaxLinearLimit(hkReal mmax) { m_atoms.m_linLimit.m_max = mmax; } inline void hkpPrismaticConstraintData::setMinLinearLimit(hkReal mmin) { m_atoms.m_linLimit.m_min = mmin; } inline void hkpPrismaticConstraintData::setMaxFrictionForce(hkReal fmag) { m_atoms.m_friction.m_maxFrictionForce = fmag; } inline hkReal hkpPrismaticConstraintData::getMaxLinearLimit() const { return m_atoms.m_linLimit.m_max; } inline hkReal hkpPrismaticConstraintData::getMinLinearLimit() const { return m_atoms.m_linLimit.m_min; } inline hkReal hkpPrismaticConstraintData::getMaxFrictionForce() const { return m_atoms.m_friction.m_maxFrictionForce; } inline hkpConstraintMotor* hkpPrismaticConstraintData::getMotor() const { return m_atoms.m_motor.m_motor; } inline void hkpPrismaticConstraintData::setMotorTargetPosition( hkReal pos ) { m_atoms.m_motor.m_targetPosition = pos; } inline hkReal hkpPrismaticConstraintData::getMotorTargetPosition() { return m_atoms.m_motor.m_targetPosition; } /* * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20080529) * * Confidential Information of Havok. (C) Copyright 1999-2008 * 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 * */
[ "uraymeiviar@bb790a93-564d-0410-8b31-212e73dc95e4" ]
[ [ [ 1, 69 ] ] ]
98e88fdf2ede3dddda939d4a2854eb371729e2a3
12732dc8a5dd518f35c8af3f2a805806f5e91e28
/trunk/Plugin/async_executable_cmd.h
74c0294051d3b4c39d06f63675e158d1e28b8873
[]
no_license
BackupTheBerlios/codelite-svn
5acd9ac51fdd0663742f69084fc91a213b24ae5c
c9efd7873960706a8ce23cde31a701520bad8861
refs/heads/master
2020-05-20T13:22:34.635394
2007-08-02T21:35:35
2007-08-02T21:35:35
40,669,327
0
0
null
null
null
null
UTF-8
C++
false
false
1,733
h
#ifndef ASYNC_EXECUTABLE_CMD_H #define ASYNC_EXECUTABLE_CMD_H #include "wx/event.h" #include "cl_process.h" #include "wx/timer.h" #ifdef WXMAKINGDLL_LE_SDK # define WXDLLIMPEXP_LE_SDK WXEXPORT #elif defined(WXUSINGDLL_LE_SDK) # define WXDLLIMPEXP_LE_SDK WXIMPORT #else /* not making nor using FNB as DLL */ # define WXDLLIMPEXP_LE_SDK #endif // WXMAKINGDLL_LE_SDK DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_LE_SDK, wxEVT_ASYNC_PROC_ADDLINE, wxID_ANY) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_LE_SDK, wxEVT_ASYNC_PROC_STARTED, wxID_ANY) DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_LE_SDK, wxEVT_ASYNC_PROC_ENDED, wxID_ANY) class WXDLLIMPEXP_LE_SDK AsyncExeCmd : public wxEvtHandler { protected: clProcess *m_proc; wxEvtHandler *m_owner; wxTimer *m_timer; bool m_busy; bool m_stop; wxString m_cmdLine; protected: virtual void OnTimer(wxTimerEvent &event); virtual void PrintOutput(); public: bool IsBusy() const { return m_busy; } void SetBusy(bool busy) { m_busy = busy; } void Stop(); void ProcessEnd(wxProcessEvent& event); clProcess *GetProcess() { return m_proc; } public: //construct a compiler action // \param owner the window owner for this action AsyncExeCmd(wxEvtHandler *owner) : m_proc(NULL) , m_owner(owner) , m_busy(false) , m_stop(false) { m_timer = new wxTimer(this); }; virtual ~AsyncExeCmd(); virtual void Execute(const wxString &cmdLine); wxOutputStream *GetOutputStream() { if(m_proc){ return m_proc->GetOutputStream(); } return NULL; } void AppendLine(const wxString &line); void SendStartMsg(); void SendEndMsg(int exitCode); void Terminate(); }; #endif // ASYNC_EXECUTABLE_CMD_H
[ "eranif@b1f272c1-3a1e-0410-8d64-bdc0ffbdec4b" ]
[ [ [ 1, 69 ] ] ]
dd1af187c2ffebdb78017f3cceb4d06da2405a82
f12a33df3711392891e10b97ae18f687041e846b
/canon_noir/ModeleCpp/ChoixCouleur.h
6a424854c73871757e850b5d974a985daac45424
[]
no_license
MilenaKasaka/poocanonnoir
63e9cc68f0e560dece36f01f28df88a1bd46cbc6
04750469ac30fd9f59730c7b93154c3261a74f93
refs/heads/master
2020-05-18T06:34:07.996980
2011-01-26T18:39:29
2011-01-26T18:39:29
32,133,754
0
0
null
null
null
null
ISO-8859-1
C++
false
false
956
h
/** * \file ChoixCouleur.h * \brief Fichier d'en-tete decrivant la classe ChoixCouleur * \author Sophie Le Corre * \author Gregoire Lecourt * \version 1.0 * \date 26/01/2011 */ #ifndef CHOIX_COULEUR_H #define CHOIX_COULEUR_H #include "State.h" /** * \class ChoixCouleur * \brief Etat correspondant au choix de la couleur de son port par chacun des joueurs * (PAS UTILISE DANS CETTE VERSION DU JEU) */ class ChoixCouleur : public State { public: /** * \fn ChoixCouleur(Moteur* m) * \brief Construit un état ChoixCouleur en lui passant l'instance de Moteur * \param[in] m instance de Moteur */ ChoixCouleur(Moteur* m); /** * \fn ~ChoixCouleur() * \brief Permet de détruire un objet ChoixCouleur */ ~ChoixCouleur(); /** * \fn void gerer() * \brief Permet de gérer le choix de la couleur du port pour chacun des joueurs * (NE FAIT RIEN DANS CETTE VERSION DU JEU) */ void gerer(); }; #endif
[ "[email protected]@c2238186-79af-eb75-5ca7-4ae61b27dd8b" ]
[ [ [ 1, 44 ] ] ]
96320f9afb702d4e18de353394029247c89d8079
1e976ee65d326c2d9ed11c3235a9f4e2693557cf
/ConfigurationManager.h
6fb53ebbe1231e17637d87c3ccd110cbd75b0da7
[]
no_license
outcast1000/Jaangle
062c7d8d06e058186cb65bdade68a2ad8d5e7e65
18feb537068f1f3be6ecaa8a4b663b917c429e3d
refs/heads/master
2020-04-08T20:04:56.875651
2010-12-25T10:44:38
2010-12-25T10:44:38
19,334,292
3
0
null
null
null
null
UTF-8
C++
false
false
1,628
h
// /* // * // * Copyright (C) 2003-2010 Alexandros Economou // * // * This file is part of Jaangle (http://www.jaangle.com) // * // * 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, 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 GNU Make; see the file COPYING. If not, write to // * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // * http://www.gnu.org/copyleft/gpl.html // * // */ #ifndef _CONFIGURATIONMANAGER_H #define _CONFIGURATIONMANAGER_H #include <set> #include "IConfigurable.h" //********************************************************************* // SkinManager //********************************************************************* class AppSettings; class ConfigurationManager : public IConfigurationManager { public: ConfigurationManager(); virtual ~ConfigurationManager(); public: virtual void RegisterConfigurable(IConfigurable& configurable); virtual void UnRegisterConfigurable(IConfigurable& configurable); virtual void UpdateConfigurables(); private: std::set<IConfigurable*> m_configurables; }; #endif
[ "outcast1000@dc1b949e-fa36-4f9e-8e5c-de004ec35678" ]
[ [ [ 1, 49 ] ] ]
5d9766f5bad7c884ee28ecdc0216303bd8276d34
4de35be6f0b79bb7eeae32b540c6b1483b933219
/aura/irc.h
c7a2d4f86ce501b8b205d08555b7bafc52dcd673
[]
no_license
NoodleBoy/aura-bot
67b2cfb44a0c8453f54cbde0526924e416a2a567
2a7d84dc56653c7a4a8edc1552a90bc848b5a5a9
refs/heads/master
2021-01-17T06:52:05.819609
2010-12-30T15:18:41
2010-12-30T15:18:41
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,199
h
/* Copyright [2010] [Josko Nikolic] 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. CODE PORTED FROM THE ORIGINAL GHOST PROJECT: http://ghost.pwner.org/ */ #define LF ('\x0A') #define CR ('\x0D') #define SOH ('\x01') class CAura; class CTCPClient; class CDCC; class CIRC { public: CAura *m_Aura; CTCPClient *m_Socket; vector<CDCC *> m_DCC; vector<string> m_Locals; vector<string> m_Channels; string m_Server; string m_ServerIP; string m_Nickname; string m_NicknameCpy; string m_Username; string m_CommandTrigger; string m_Password; uint16_t m_Port; bool m_Exiting; bool m_WaitingToConnect; bool m_OriginalNick; uint32_t m_LastConnectionAttemptTime; uint32_t m_LastPacketTime; uint32_t m_LastAntiIdleTime; CIRC( CAura *nAura, string nServer, string nNickname, string nUsername, string nPassword, vector<string> nChannels, uint16_t nPort, string nCommandTrigger, vector<string> nLocals ); ~CIRC( ); unsigned int SetFD( void *fd, void *send_fd, int *nfds ); bool Update( void *fd, void *send_fd ); inline void ExtractPackets( ); void SendIRC( const string &message ); void SendDCC( const string &message ); void SendMessageIRC( const string &message, const string &target ); }; class CAura; class CIRC; class CTCPClient; class CDCC { public: CTCPClient *m_Socket; string m_Nickname; CIRC *m_IRC; string m_IP; uint16_t m_Port; CDCC( CIRC *nIRC, string nIP, uint16_t nPort, const string &nNickname ); ~CDCC( ); unsigned int SetFD( void *fd, void *send_fd, int *nfds ); void Update( void *fd, void *send_fd ); void Connect( const string &IP, uint16_t Port ); };
[ "[email protected]", "[email protected]@268e31a9-a219-ec89-1cb4-ecc417c412f6" ]
[ [ [ 1, 19 ], [ 25, 25 ], [ 32, 32 ], [ 52, 52 ], [ 63, 63 ] ], [ [ 20, 24 ], [ 26, 31 ], [ 33, 51 ], [ 53, 62 ], [ 64, 83 ] ] ]
2368b14943d7e245b041863fa5f6ddeca078397c
8f816734df7cb71af9c009fa53eeb80a24687e63
/EngineCore/src/Camera/BaseCamera.cpp
aa6721f4130dc95da30af2bd297429645957df10
[]
no_license
terepe/rpgskyengine
46a3a09a1f4d07acf1a04a1bcefff2a9aabebf56
fbe0ddc86440025d9670fc39fb7ca72afa223953
refs/heads/master
2021-01-23T13:18:32.028357
2011-06-01T13:35:16
2011-06-01T13:35:16
35,915,383
0
0
null
null
null
null
GB18030
C++
false
false
3,857
cpp
#include "BaseCamera.h" CBaseCamera::CBaseCamera() { // Set attributes for the view matrix Vec3D vEyePt = Vec3D(0.0f,0.0f,0.0f); Vec3D vLookatPt = Vec3D(0.0f,0.0f,1.0f); // Setup the view matrix SetViewParams(vEyePt, vLookatPt); // Setup the projection matrix SetProjParams(3.14159f/4, 800, 600, 1.0f, 1000.0f); m_fYawAngle = 0.0f; m_fPitchAngle = 0.0f; m_vVelocity = Vec3D(0.0f,0.0f,0.0f); m_bMovementDrag = true; m_vVelocityDrag = Vec3D(0.0f,0.0f,0.0f); m_fDragTimer = 0.0f; m_fTotalDragTimeToZero = 1.25; m_vRotVelocity = Vec3D(0.0f,0.0f,0.0f); m_fRotationScaler = 0.01f; m_fMoveScaler = 5.0f; m_vMouseDelta = Vec3D(0.0f,0.0f,0.0f); } void CBaseCamera::SetViewParams(Vec3D& vEyePt, Vec3D& vLookatPt) { m_vDefaultEye = m_vEyePt = vEyePt; m_vDefaultLookAt = m_vLookAt = vLookatPt; // Calc the view matrix Vec3D vUp(0,1,0); m_mViewMatrix.MatrixLookAtLH(vEyePt, vLookatPt, vUp); Matrix mInvView = m_mViewMatrix; mInvView.Invert(); // The axis basis vectors and camera position are stored inside the // position matrix in the 4 rows of the camera's world matrix. // To figure out the yaw/pitch of the camera, we just need the Z basis vector // [badcode] Vec3D* pZBasis = (Vec3D*) &mInvView.m[2][0]; m_fYawAngle = atan2f(pZBasis->x, pZBasis->z); float fLen = sqrtf(pZBasis->z*pZBasis->z + pZBasis->x*pZBasis->x); m_fPitchAngle = -atan2f(pZBasis->y, fLen); } void CBaseCamera::SetProjParams(float fFOV, int nWidth, int nHeight, float fNearPlane, float fFarPlane) { // Set attributes for the projection matrix m_fFOV = fFOV; m_nSceneWidth = nWidth; m_nSceneHeight = nHeight; m_fAspect = nWidth / (float)nHeight; m_fNearPlane = fNearPlane; m_fFarPlane = fFarPlane; m_mProjMatrix.MatrixPerspectiveFovLH(fFOV, m_fAspect, fNearPlane, fFarPlane); } void CBaseCamera::SetFarClip(float fFarPlane) { m_fFarPlane = fFarPlane; m_mProjMatrix.MatrixPerspectiveFovLH(m_fFOV, m_fAspect, m_fNearPlane, fFarPlane); } void CBaseCamera::UpdateVelocity(float fElapsedTime) { Matrix mRotDelta; m_vRotVelocity = m_vMouseDelta * m_fRotationScaler; m_vMouseDelta=Vec3D(0.0f,0.0f,0.0f); Vec3D vAccel;// // Normalize vector so if moving 2 dirs (left & forward), // the camera doesn't move faster than if moving in 1 dir vAccel.normalize(); // 加速度尺量的尺度 vAccel *= m_fMoveScaler; // 是否拖曳 if(m_bMovementDrag) { // Is there any acceleration this frame? if(vAccel.lengthSquared() > 0) { // If so, then this means the user has pressed a movement key\ // so change the velocity immediately to acceleration // upon keyboard input. This isn't normal physics // but it will give a quick response to keyboard input m_vVelocity = vAccel; m_fDragTimer = m_fTotalDragTimeToZero; m_vVelocityDrag = vAccel / m_fDragTimer; } else { // If no key being pressed, then slowly decrease velocity to 0 if(m_fDragTimer > 0) { // Drag until timer is <= 0 m_vVelocity -= m_vVelocityDrag * fElapsedTime; m_fDragTimer -= fElapsedTime; } else { // Zero velocity m_vVelocity = Vec3D(0.0f,0.0f,0.0f); } } } else { // 没有拖动 所以立即改变周转率 m_vVelocity = vAccel; } } void CBaseCamera::Reset() { SetViewParams(m_vDefaultEye, m_vDefaultLookAt); }
[ "rpgsky.com@97dd8ffa-095c-11df-8772-5d79768f539e" ]
[ [ [ 1, 132 ] ] ]
ca12c4d91968653f9e61eb53badce9da1180dd68
9df4b47eb2d37fd7f08b8e723e17f733fd21c92b
/plugintemplate/libs/MRecipientFilter.h
86ab4acfd4f6299f40a379e87e8eab69c47b30bf
[]
no_license
sn4k3/sourcesdk-plugintemplate
d5a806f8793ad328b21cf8e7af81903c98b07143
d89166b79a92b710d275c817be2fb723f6be64b5
refs/heads/master
2020-04-09T07:11:55.754168
2011-01-23T22:58:09
2011-01-23T22:58:09
32,112,282
1
0
null
null
null
null
ISO-8859-1
C++
false
false
3,445
h
#ifndef _MRECIPIENT_FILTER_H #define _MRECIPIENT_FILTER_H #include "irecipientfilter.h" //========= Copyright © 2010-2011, Tiago Conceição, All rights reserved. ============ // Plugin Template // // Please Read (LICENSE.txt) and (README.txt) // Dont Forget Visit: // (http://www.sourceplugins.com) -> VPS Plugins // (http://www.sourcemm.net) (http://forums.alliedmods.net/forumdisplay.php?f=52) - MMS Plugins // //=================================================================================== #define LIB_MRECIPIENTFILTER_VERSION "1.0" #define LIB_MRECIPIENTFILTER_CLASS MRecipientFilter enum PlayerState { Unas, Spec, Terror, Countert, All, Bot, Human, Live, Dead, ERROR_s }; class LIB_MRECIPIENTFILTER_CLASS : public IRecipientFilter { public: // MRecipientFilter Constructors. LIB_MRECIPIENTFILTER_CLASS(void); // Delete MRecipientFilter. ~LIB_MRECIPIENTFILTER_CLASS(void); // Is reliable. // Not used. virtual bool IsReliable( void ) const; // Is init message // Not used. virtual bool IsInitMessage( void ) const; // Get players count. virtual int GetRecipientCount( void ) const; // Get recipient index. // Player Index. virtual int GetRecipientIndex( int slot ) const; // Get pEntity from recipient index. edict_t *GetRecipientEdict(int slot); // Get CBaseEntity from recipient index. CBaseEntity *GetRecipientBaseEntity(int slot); // Add players by filter. // # for begin a player filter. // ! for remove a player filter. // a = All players. // u or 0 = Unsigned Team. // s or 1 = Spectator Team. // t or 2 = Terrorist Team (Team 2) // c or 3 = Countert-Terrorist Team (Team 3) // b = Bots // h = humman players. // l = Living players. // d = Dead players. // // if '|' is the first char on the filter string, partial will be activated (set to true) // Set 'forceDisablePartial' to true for disable so, (filter string can't activate partial '|' itself) // // Also support player names, userid, steamid with multi players. // "2 3 4 playername STEAM_1:1:25416446" OR "2" OR "STEAM_0:0:1111" OR "nameonly" // Multi players are only recomendate for Userids and SteamIds, players name sometimes have spaces. // // 'Partial' allow you add players by steam or by name with partial name eg // eg. true player name: "my name is player" in partial can be "my " or "my name" ... // // Return player count. int AddByFilter(const char *filter, bool partial = true, bool forceDisablePartial = false); // Add all players. void AddAllPlayers(); // Add add dead players. void AddAllDeadPlayers(); // Add all alive players. void AddAllAlivePlayers(); // Add all humans players void AddAllHumans(); // Add all Humans by team. void AddAllTeamHumans(int TeamIndex); // Add all players within a radius void AddWithinRadius(Vector vecTarget, float fRadius); // Add player. bool AddRecipient (int iPlayer); // Add by player slot. void AddBySlot(int slot); // Add by player Entity. bool AddByEntity(edict_t *pEntity); // Remove all saved players. void RemoveAll(); private: // Is Reliable bool m_bReliable; // Init Message bool m_bInitMessage; // Filters Enum PlayerState TeamToEnum(char teamselection); // Player data CUtlVector<int> m_Recipients; }; #endif
[ "[email protected]@2dd402b7-31f5-573d-f87e-a7bc63fa017b" ]
[ [ [ 1, 121 ] ] ]
1d96d551cf20828728456f462de7707190d9a85c
5095bbe94f3af8dc3b14a331519cfee887f4c07e
/Shared/Components/Data/TAPSTable_2_TDataSet.h
2a613e0451ed56b86ff017d4ceab535e371cd1f6
[]
no_license
sativa/apsim_development
efc2b584459b43c89e841abf93830db8d523b07a
a90ffef3b4ed8a7d0cce1c169c65364be6e93797
refs/heads/master
2020-12-24T06:53:59.364336
2008-09-17T05:31:07
2008-09-17T05:31:07
64,154,433
0
0
null
null
null
null
UTF-8
C++
false
false
1,320
h
//--------------------------------------------------------------------------- #ifndef TAPSTable_2_TDataSetH #define TAPSTable_2_TDataSetH //--------------------------------------------------------------------------- #include <SysUtils.hpp> #include <Controls.hpp> #include <Classes.hpp> #include <Forms.hpp> #include "kbmMemTable.hpp" #include <Db.hpp> #include <DBTables.hpp> #include "TAPSTable.h" // ------------------------------------------------------------------ // Short description: // this class is derived from memory table and is capable of displaying // the data in a TAPSTable component. // Notes: // Changes: // DPH 5/2/98 // ------------------------------------------------------------------ class PACKAGE TAPSTable_2_TDataSet : public TkbmMemTable { private: TAPSTable* FAPSTable; void __fastcall Set_APSTable (TAPSTable* APSTable); void __fastcall DoBeforeOpen(void); void __fastcall DoAfterOpen(void); protected: public: __fastcall TAPSTable_2_TDataSet(TComponent* Owner); void __fastcall Refresh (void); __published: __property TAPSTable* APSTable = {read=FAPSTable, write=FAPSTable}; }; //--------------------------------------------------------------------------- #endif
[ "devoilp@8bb03f63-af10-0410-889a-a89e84ef1bc8" ]
[ [ [ 1, 43 ] ] ]
a744ffa8cf00f06ac28cb63b7bca625af41b0d70
b3b0c727bbafdb33619dedb0b61b6419692e03d3
/Source/TestCase/TestCase/Calculation.h
1407f2eb68824be5bccdf63091b3893eb28ea644
[]
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
UTF-8
C++
false
false
634
h
// Calculation.h: interface for the CCalculation class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_CALCULATION_H__37A188B1_8F17_4B6E_8266_666640356A52__INCLUDED_) #define AFX_CALCULATION_H__37A188B1_8F17_4B6E_8266_666640356A52__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 class CCalculation { public: CCalculation(); virtual ~CCalculation(); int Add(int a, int b); int Sub(int a, int b); int Mul(int a, int b); int Div(int a, int b); }; #endif // !defined(AFX_CALCULATION_H__37A188B1_8F17_4B6E_8266_666640356A52__INCLUDED_)
[ [ [ 1, 24 ] ] ]
3be37056e00875cda71f38fb5242ea0e51d890e5
c6f4fe2766815616b37beccf07db82c0da27e6c1
/VisualVertexArraySphere.cpp
146b1300f734cd2d4bccae98660c803ac58ebd44
[]
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
6,440
cpp
#define _USE_MATH_DEFINES #include <windows.h> #include <gl/gl.h> #include <cmath> #include "VisualVertexArraySphere.h" #include "Object.h" #include "Material.h" #include "Texture.h" namespace tlib { OCVisualVertexArraySphere::OCVisualVertexArraySphere( float fRadius, int iStacks, int iSlices ): m_fRadius(fRadius), m_iStacks(iStacks), m_iSlices(iSlices) { create(); } // ------------------------------------------------------------------------ // Code for the creation of the sphere is taken from the opengl tutorials // ------------------------------------------------------------------------ bool OCVisualVertexArraySphere::create() { int array_size; float stack_inc; float slice_inc; float x, y, z; int vertex_count; int index_count; int temp_vc; float temp_tex; float temp_rad; int stacks = m_iStacks; int slices = m_iSlices; array_size = (slices+1)*(stacks-1)+2; // +2 is for the top and bottom vertex m_VertexArray = new float[array_size][3]; m_NormalArray = new float[array_size][3]; m_IndexArray = new GLuint[2+(stacks-1)*(slices+1)*2]; m_TexArray = new float[array_size][2]; if ((stacks < 2) & (slices <2)) return false; stack_inc = 1.0f/(float)stacks; slice_inc = float(M_PI)*2.0f/slices; // define the vertex array // top point vertex_count = 0; m_VertexArray[vertex_count][0] = 0.0f; m_VertexArray[vertex_count][1] = m_fRadius; m_VertexArray[vertex_count][2] = 0.0f; m_NormalArray[vertex_count][0] = 0.0f; m_NormalArray[vertex_count][1] = 1.0f; m_NormalArray[vertex_count][2] = 0.0f; m_TexArray[vertex_count][0] = 0; m_TexArray[vertex_count++][1] = 1; // bottom point m_VertexArray[vertex_count][0] = 0.0f; m_VertexArray[vertex_count][1] = -m_fRadius; m_VertexArray[vertex_count][2] = 0.0f; m_NormalArray[vertex_count][0] = 0.0f; m_NormalArray[vertex_count][1] = -1.0f; m_NormalArray[vertex_count][2] = 0.0f; m_TexArray[vertex_count][0] = 0; m_TexArray[vertex_count++][1] = 0; for (int i = 1; i < stacks; i++) { y = sin(float(M_PI)*(1/2.0f - stack_inc*(float)i)); temp_rad = cos(float(M_PI)*(1/2.0f - stack_inc*(float)i)); temp_vc = vertex_count; temp_tex = 1.0f - stack_inc*(float)i; for(int j = 0; j < slices; j++) { x = cos((float)j*slice_inc); z = -sin((float)j*slice_inc); m_VertexArray[vertex_count][0] = m_fRadius*temp_rad*x; m_VertexArray[vertex_count][1] = m_fRadius*y; m_VertexArray[vertex_count][2] = m_fRadius*temp_rad*z; m_NormalArray[vertex_count][0] = temp_rad*x; m_NormalArray[vertex_count][1] = y; m_NormalArray[vertex_count][2] = temp_rad*z; m_TexArray[vertex_count][0] = (float)j/(float)slices; m_TexArray[vertex_count++][1] = temp_tex; }; m_VertexArray[vertex_count][0] = m_VertexArray[temp_vc][0]; m_VertexArray[vertex_count][1] = m_VertexArray[temp_vc][1]; m_VertexArray[vertex_count][2] = m_VertexArray[temp_vc][2]; m_NormalArray[vertex_count][0] = m_NormalArray[temp_vc][0]; m_NormalArray[vertex_count][1] = m_NormalArray[temp_vc][1]; m_NormalArray[vertex_count][2] = m_NormalArray[temp_vc][2]; m_TexArray[vertex_count][0] = 1; m_TexArray[vertex_count++][1] = temp_tex; }; // now generate the index array // start with triangle fans for the top index_count = 0; vertex_count =2; m_IndexArray[index_count++] = 0; // very top vertex for(int j = 0; j<= slices; j++) { m_IndexArray[index_count++] = vertex_count++; }; vertex_count -= (slices+1); // now do the main strips for(int i = 0; i< (stacks-2); i++) { for(int j = 0; j<= slices; j++) { m_IndexArray[index_count++] = vertex_count++; m_IndexArray[index_count++] = slices+vertex_count; }; }; m_IndexArray[index_count++] = 1; // very bottom vertex for(int j = 0; j<= slices; j++) { m_IndexArray[index_count++] = vertex_count+slices-j; }; return true; } // end create() // ------------------------------------------------------------------------ void OCVisualVertexArraySphere::render() const { glPushMatrix(); { // get the object's position const Vector3f& pos = getOwner()->getPos(); glTranslatef( pos.x(), pos.y(), pos.z() ); // Apply material if component exists IOCMaterial *cMaterial = (IOCMaterial*)m_oOwner->getComponent("material"); if( cMaterial ) cMaterial->apply(); // Apply texture if component exists IOCTexture *cTexture = (IOCTexture*)m_oOwner->getComponent("texture"); if( cTexture ) { cTexture->apply(); glEnableClientState (GL_TEXTURE_COORD_ARRAY); glTexCoordPointer (2, GL_FLOAT, 0, m_TexArray); } // Enable client states glEnableClientState (GL_NORMAL_ARRAY); glNormalPointer (GL_FLOAT, 0, m_NormalArray); glEnableClientState (GL_VERTEX_ARRAY); glVertexPointer (3, GL_FLOAT, 0, m_VertexArray); // Draw sphere glDrawElements(GL_TRIANGLE_FAN, m_iSlices+2, GL_UNSIGNED_INT, &m_IndexArray[0]); for (int i = 0; i < (m_iStacks-2); i++) { glDrawElements(GL_TRIANGLE_STRIP, (m_iSlices+1)*2, GL_UNSIGNED_INT, &m_IndexArray[m_iSlices+2+i*(m_iSlices+1)*2]); }; glDrawElements(GL_TRIANGLE_FAN, m_iSlices+2, GL_UNSIGNED_INT, &m_IndexArray[m_iSlices+2+(m_iStacks-2)*(m_iSlices+1)*2]); // Turn of texturing in case texture component turned it on if( cTexture ) { glDisableClientState(GL_TEXTURE_COORD_ARRAY); cTexture->reset(); } // Disable client states glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); } glPopMatrix(); } // end render() } // end of namespace tlib
[ "john.fragkoulis@201bd241-053d-0410-948a-418211174e54" ]
[ [ [ 1, 182 ] ] ]
fd136aa6a783088610965dfe48b7dea5b26533ce
252e638cde99ab2aa84922a2e230511f8f0c84be
/reflib/src/StopOwnerViewForm.h
2decdbdabf43af5e5a6a3be3d5a8e3850d6fc3fc
[]
no_license
openlab-vn-ua/tour
abbd8be4f3f2fe4d787e9054385dea2f926f2287
d467a300bb31a0e82c54004e26e47f7139bd728d
refs/heads/master
2022-10-02T20:03:43.778821
2011-11-10T12:58:15
2011-11-10T12:58:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,628
h
//--------------------------------------------------------------------------- #ifndef StopOwnerViewFormH #define StopOwnerViewFormH //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include "Placemnt.h" #include "RXDBCtrl.h" #include "TableGridViewForm.h" #include "VADODataSourceOrdering.h" #include "VCustomDataSourceOrdering.h" #include "VDBGridFilterDialog.h" #include "VDBSortGrid.h" #include "VStringStorage.h" #include <ActnList.hpp> #include <ADODB.hpp> #include <ComCtrls.hpp> #include <Db.hpp> #include <DBGrids.hpp> #include <Grids.hpp> #include <ImgList.hpp> #include <Menus.hpp> #include <ToolWin.hpp> #include "VCustomDBGridFilterDialog.h" //--------------------------------------------------------------------------- class TTourRefBookStopOwnerViewForm : public TTourRefBookTableGridViewForm { __published: // IDE-managed Components TStringField *MainQuerystopowner_id; TStringField *MainQuerystopowner_name; void __fastcall NewActionExecute(TObject *Sender); void __fastcall EditActionExecute(TObject *Sender); void __fastcall FormClose(TObject *Sender, TCloseAction &Action); private: // User declarations public: // User declarations __fastcall TTourRefBookStopOwnerViewForm(TComponent* Owner); }; //--------------------------------------------------------------------------- extern PACKAGE TTourRefBookStopOwnerViewForm *TourRefBookStopOwnerViewForm; //--------------------------------------------------------------------------- #endif
[ [ [ 1, 44 ] ] ]
1a1787bb20ddab871943c07579cdd186dac23a0c
de98f880e307627d5ce93dcad1397bd4813751dd
/3libs/ut/include/OXFileChanger.h
a60097bf21da5b612a11229de03998d99b353915
[]
no_license
weimingtom/sls
7d44391bc0c6ae66f83ddcb6381db9ae97ee0dd8
d0d1de9c05ecf8bb6e4eda8a260c7a2f711615dd
refs/heads/master
2021-01-10T22:20:55.638757
2011-03-19T06:23:49
2011-03-19T06:23:49
44,464,621
2
0
null
null
null
null
WINDOWS-1252
C++
false
false
9,758
h
// ========================================================================== // Class Specification : COXFileChanger // ========================================================================== // This software along with its related components, documentation and files ("The Libraries") // is © 1994-2007 The Code Project (1612916 Ontario Limited) and use of The Libraries is // governed by a software license agreement ("Agreement"). Copies of the Agreement are // available at The Code Project (www.codeproject.com), as part of the package you downloaded // to obtain this file, or directly from our office. For a copy of the license governing // this software, you may contact us at [email protected], or by calling 416-849-8900. // // Version: 9.3 // ////////////////////////////////////////////////////////////////////////// // Properties: // NO Abstract class (does not have any objects) // NO Derived from CObject // // NO Is a CWnd. // NO Two stage creation (constructor & Create()) // NO Has a message map // NO Needs a resource (template) // // NO Persistent objects (saveable on disk) // YES Uses exceptions // // Description: COXFileChanger is a class that organizes search/replace of a // file's contents. So the class can search the contents of a // file for a certain part and (optionally) replace it by // another part. The class can operate both on text (ansi, non- // unicode) files and binary files. // Algorithm: Boyer-Moore // Original publication : R.S. Boyer, J.S.Moore, "A fast string searching // algorithm", Comm. ACM, 20, 10 (Oct 77), p. 762-772. // Other source : "Algorithms in C++", Robert Sedgewick, Princeton University, // Addison-Wesley, 1992, pp 286-289. // ///////////////////////////////////////////////////////////////////////////// #ifndef __OXFILECHANGER_H__ #define __OXFILECHANGER_H__ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 #include "OXDllExt.h" #include "OXMainRes.h" ///////////////////////////////////////////////////////////////////////////// class OX_CLASS_DECL COXFileChanger : public CObject { DECLARE_DYNAMIC(COXFileChanger); // Data members ------------------------------------------------------------- public: class OX_CLASS_DECL COXFileChangerData { public: CFile* m_pFile; // --- A CFile pointer to the input file (default) or output file (WM_OX_FILE_POST_REPLACE) LONG m_nPos; // --- The absolute position (zero-based) of the first character of // the found or replaced part in the input file BOOL& m_bContinue; // --- TRUE by default if bAll was TRUE, otherwise FALSE by default. // This value may be changed from within the notification handler COXFileChangerData(CFile* pFile, LONG nPos, BOOL& bContinue) : m_pFile(pFile), m_nPos(nPos), m_bContinue(bContinue) { } }; static LONG m_nBufferSize; // ... Maximum search/replace length (64K). It can be increased for larger searching block. // Theoretical upper limit is the biggest int (31 bits), yet limited by // run-time memory footprint protected: HWND m_hNotifyWnd; UINT m_nFlag; CFile* m_pFileIn; CFile* m_pFileOut; CFile m_fileIn; CFile m_fileOut; CString m_sInputFileName; CString m_sOutputFileName; CByteArray* m_pSearch; CByteArray* m_pSearchOppositeCase; CByteArray* m_pReplace; static const int m_nFlagUseCFile; static const int m_nFlagOverwrite; static const int m_nFlagReplace; static const int m_nFlagText; static const int m_nFlagAll; static const int m_nFlagMatchCase; static const int m_nFlagWholeWord; static LPCTSTR m_sTempFilePrefix; private: // Member functions --------------------------------------------------------- public: COXFileChanger(); // --- In : // --- Out : // --- Returns : // --- Effect : Constructor of object virtual ~COXFileChanger(); // --- In : // --- Out : // --- Returns : // --- Effect : Destructor of object void UseFiles(LPCTSTR pszInputFileName, LPCTSTR pszOutputFileName = NULL); // --- In : pszInputFileName, pathname of the input file (file to be // searched in) // pszOutputFileName, pathname of the output file (when // Replace() will be called); if NULL, the input file // will be overwritten with the Replace() result // --- Out : // --- Returns : // --- Effect : provides the input and output files to the class // NOTE: the files will not be opened only until Search() or // Replace() is called void UseFiles(CFile* pInputFile, CFile* pOutputFile = NULL); // --- In : pInputFile, a CFile pointer to the input file (file to // be searched in) // pOutputFile, a CFile pointer to the output file (when // Replace() will be called); cannot be NULL if Replace() // will be called. // NOTE: these two pointers cannot be the same. The objects // will not be opened or closed by the COXFileChanger, so // they should have already been opened. // --- Out : // --- Returns : // --- Effect : provides the input and output files to the class void SetNotificationWnd(CWnd* pNotifyWnd); // --- In: pNotifyWnd : CWnd to which notification messages are sent // --- Out: // --- Returns: // --- Effect: This window will receive the OnFound, OnPreReplace and OnPostReplace // messages. This can be used to visiually inform the user of the progress // (WM_OX_FILE_MATCH_FOUND, WM_OX_FILE_PRE_REPLACE, WM_OX_FILE_POST_REPLACE) UINT Search (LPCTSTR pszText, BOOL bAll = FALSE, BOOL bMatchCase = FALSE, BOOL bWholeWordOnly = FALSE); UINT Search (const CByteArray& binary, BOOL bAll = FALSE); // --- In : pszText, the text to search for in the input file // binary, the binary to search for in the input file // bAll, specifies whether all occurrences should be found // (TRUE) or only the first one (FALSE). // bMatchCase, specifies whether the search is case // sensitive (TRUE) or not (FALSE) // bWholeWordOnly, if TRUE, specifies that the characters // proceding and trailing the found word should not be // alphanumeric character (a-z, A-Z, 0-9); if FALSE, any // character may surround the found word. // --- Out : // --- Returns : the number of times the text (binary) was found // --- Effect : search text or binary contents in the input file // NOTE: in the case of CFile pointer is supplied in // UseFiles(), the file pointers will not be set to the // beginning after search // NOTE: OnFound() can be derived to handle an event // when a match is found UINT Replace(LPCTSTR pszText, LPCTSTR pszReplaceText, BOOL bAll = FALSE, BOOL bMatchCase = FALSE, BOOL bWholeWordOnly = FALSE); UINT Replace(const CByteArray& binary, const CByteArray& replaceBinary, BOOL bAll = FALSE); // --- In : pszText, the text to be replaced in the input file // pszReplaceText, the text to change to in the output file // binary, the binary to be replaced in the input file // replaceBinary, the binary to change to in the output file // bAll, specifies whether all occurrences should be // replaced (TRUE) or only the first one (FALSE). // bMatchCase, specifies whether the search is case // sensitive (TRUE) or not (FALSE) // bWholeWordOnly, if TRUE, specifies that the characters // proceding and trailing the word to be replaced should // not be alphanumeric character (a-z, A-Z, 0-9); // if FALSE, any character may surround it. // --- Out : // --- Returns : occurence of the replacement // --- Effect : search text or binary contents in the input file, and // replace it with another text or binary in the output // file // NOTE: in the case of CFile pointer is supplied in // UseFiles(), the file pointers will not be set to the // beginning after search // NOTE: OnPreReplace() and OnPostReplace() can be derived // to handle the events before or after the replacement #ifdef _DEBUG virtual void AssertValid() const; // --- In : // --- Out : // --- Returns : // --- Effect : AssertValid performs a validity check on this object // by checking its internal state. // In the Debug version of the library, AssertValid may assert and // thus terminate the program. virtual void Dump(CDumpContext& dc) const; // --- In : dc : The diagnostic dump context for dumping, usually afxDump. // --- Out : // --- Returns : // --- Effect : Dumps the contents of the object to a CDumpContext object. // It provides diagnostic services for yourself and // other users of your class. // Note The Dump function does not print a newline character // at the end of its output. #endif protected: virtual BOOL OnFound (CFile* pInputFile, LONG nInPos, BOOL& bContinue); virtual BOOL OnPreReplace (CFile* pInputFile, LONG nInPos, BOOL& bContinue); virtual void OnPostReplace (CFile* pOutputFile, LONG nOutPos); void SetFlag(UINT nOXFCFLAG, BOOL bValue = TRUE); BOOL GetFlag(UINT nOXFCFLAG); UINT Run(); void OpenFiles(); void CloseFiles(); static void CopyTextToByteArray(LPCTSTR pszText, CByteArray* pBuffer); static void ReverseCase(CString& sText); static CString GetUniqueTempName(); private: }; ///////////////////////////////////////////////////////////////////////////// #endif // __OXFILECHANGER_H__ // end of OXFileChanger.h
[ [ [ 1, 246 ] ] ]
389240ca2c8e73583c77d452ef28af5b3f983b25
e6abea92f59a1031d94bbcb3cee828da264c04cf
/NppPluginIface/src/NppPluginIface_ExtLexer.cpp
837e9e074ab05a9bd170ae483d5863314e0a8b3d
[]
no_license
bruderstein/nppifacelib_mob
5b0ad8d47a19a14a9815f6b480fd3a56fe2c5a39
a34ff8b5a64e237372b939106463989b227aa3b7
refs/heads/master
2021-01-15T18:59:12.300763
2009-08-13T19:57:24
2009-08-13T19:57:24
285,922
0
1
null
null
null
null
UTF-8
C++
false
false
11,997
cpp
/* NppPluginIface_ExtLexer.cpp * * This file is part of the Notepad++ Plugin Interface Lib. * Copyright 2008 - 2009 Thell Fowler ([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., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* * Notepad++ Plugin Interface Lib extension providing helper functions for implementing * Scintilla External Lexers within a Notepad++ plugin. * */ /* * Both Notepad's PluginsManager and Scintilla's LexerManager need to know the details of * lexers included in this plugin. * * Notepad++ fills in the language menu and the style preferences dialog, as well as handles * style properties control with Scintilla. * * Scintilla does all of the accessing of the document, application of styles, folding, and so * on using the information provided by Notepad++ and this plugin's messaging. * */ #include "NppPluginIface_ExtLexer.h" namespace npp_plugin { // Namespace Extension for External Lexer Interface namespace external_lexer { // Unnamed namespace for private variables namespace { // Parameter constants - From Npp's Parameters.h const int NB_MAX_EXTERNAL_LANG = 30; const int MAX_EXTERNAL_LEXER_NAME_LEN = 16; const int MAX_EXTERNAL_LEXER_DESC_LEN = 32; // <--- Just for a little clarity in the function calls ---> const bool FOLD = true; const bool LEX = false; // <--- Containers ---> std::vector<FuncItem> _LexerFuncVector; // Container for lexer function commands. std::vector<FuncItem> ReturnVector; // Container for the ordered function commands. std::vector<Lexer> _LexerDetailVector; // Container for lexer details. // Required Notepad++ External Lexer Function // Returns a count of lexers initialized from this plugin. int __stdcall GetLexerCount() { return _LexerDetailVector.size(); } // Returns a count of all lexer menu function items in this plugin. int getLexerFuncCount () { return _LexerFuncVector.size(); } // Both Notepad++ and Scintilla use this. Scintilla expects char and Notepad++ will // convert it for unicode if needed. void __stdcall GetLexerName(unsigned int Index, char *name, int buflength) { std::string currLangName = _LexerDetailVector.at(Index)._name; if (buflength > 0 ) { buflength--; int n = currLangName.length(); if (n > buflength) n = buflength; memcpy(name, currLangName.c_str(), n), name[n] = '\0'; } } // Notepad++ uses this, but Scintilla does not. Which allows use of TCHAR vs char. void __stdcall GetLexerStatusText(unsigned int Index, TCHAR *desc, int buflength) { tstring currLangDesc = _LexerDetailVector.at(Index)._description;; if (buflength > 0) { buflength--; int n = currLangDesc.length(); if (n > buflength) n = buflength; TMEMCPY(desc, currLangDesc.c_str(), n), desc[n] = '\0'; } } // Lexer Function called by Scintilla // This is a forwarder to one of this plugins registered lexers LexOrFold functions. // Upon an initial call from Scintilla the Scintilla assigned lexer ID is also stored. void __stdcall Lex(unsigned int langID, unsigned int startPos, int length, int initStyle, char *words[], WindowID window, char *props) { Lexer* currLexer = &_LexerDetailVector.at(langID); if (! ( currLexer->SCI_LEXERID >= SCLEX_AUTOMATIC ) || ( npp_plugin::isNppReady() ) ) { // Each lexer has a LEXERID that Scintilla assigns. For external lexers this ID isn't // known until Scintilla's first call for a lexer to lex a document. // When that happens the ID is stored and used for filtering notification messages. int lexerID = ::SendMessage(npp_plugin::hCurrView(), SCI_GETLEXER, 0, 0); currLexer->SCI_LEXERID = lexerID; } else if ( currLexer->SCI_LEXERID < SCLEX_AUTOMATIC ) { ::MessageBox(npp_plugin::hNpp(), TEXT(" SCI_LEXERID is less than SCLEX_AUTOMATIC and Npp reports ready! " ), TEXT(" Npp External Lexer Problem "), MB_OK | MB_ICONEXCLAMATION ); return; // This shouldn't happen! } currLexer->_pLexOrFold(0, startPos, length, initStyle, words, window, props); } // Lexer Function called by Scintilla // This is a forwarder to one of this plugins registered lexers LexOrFold functions. void __stdcall Fold(int langID, unsigned int startPos, int length, int initStyle, char *words[], WindowID window, char *props) { Lexer* currLexer = &_LexerDetailVector.at(langID); currLexer->_pLexOrFold(1, startPos, length, initStyle, words, window, props); } } // End:: Unnamed namespace for private implementation. // Notepad++ External Lexer Initialization: used by both N++ and Scintilla // // Plugins can contain multiple external lexers registered in the DLLMain, each lexer must // have a unique name. // name: text that appears in the N++ languages menu. /* "LexerName" */ // statusText: text that appears in the N++ status bar. /* TEXT("Status-Bar Text") */ // pLexOrFold: pointer to the lexers LexOrFold funtion. /* NameSpace::LexOrFold */ // pMenuDlg: lexer's main menu dialog function. /* NameSpace::MenuDlg */ void initLexer(std::string Name, tstring statusText, NppExtLexerFunction pLexOrFold, PFUNCPLUGINCMD pMenuDlg) { // Notify if length is too long. if ( Name.length() > MAX_EXTERNAL_LEXER_NAME_LEN ) ::MessageBox(npp_plugin::hNpp(), TEXT("Lexer name is too long and will be truncated."), TEXT("Lexer Name Alert"), MB_ICONINFORMATION); if ( statusText.length() > MAX_EXTERNAL_LEXER_DESC_LEN ) ::MessageBox(npp_plugin::hNpp(), TEXT("Lexer description is too long and will be truncated."), TEXT("Lexer Description Alert"), MB_ICONINFORMATION); // The lexer details vector is used to store the SCI lexerID and the pointer to the // lexers entry point function ( usually LexOrFold() ). Lexer thisLexer; thisLexer._name.assign(Name); thisLexer._description.assign(statusText); thisLexer._pLexOrFold = pLexOrFold; thisLexer.SCI_LEXERID = NULL; _LexerDetailVector.push_back(thisLexer); /* * This plugin extension uses the lexer's name for the menu. Since the lexer name is also * used by Notepad++ and Scintilla as a char* value and the FuncItem expects a TCHAR* * convert it prior to registering the FuncItem. * */ // Create a tstring and copy the standard character string into it. Should work for both // unicode and ansi. int len = Name.length(); tstring itemName = tstring(len, '\0'); std::copy(Name.begin(), Name.end(), itemName.begin()); setLexerFuncItem(itemName, pMenuDlg); } // Registers additional menu function items for a lexer that will be displayed in the N++ // Plugins menu. void setLexerFuncItem(tstring Name, PFUNCPLUGINCMD pFunction, int cmdID, bool init2Check, ShortcutKey* pShKey) { // Notify if length is too long. if ( !( Name.length() < nbChar ) ) ::MessageBox(npp_plugin::hNpp(), TEXT("Function name is too long and will be truncated."), TEXT("Function Item Name Alert"), MB_ICONINFORMATION); FuncItem thisFunction; Name.copy(thisFunction._itemName, Name.length()); thisFunction._itemName[ Name.length() ] = '\0'; thisFunction._cmdID = cmdID; thisFunction._pFunc = pFunction; thisFunction._init2Check = init2Check; thisFunction._pShKey = pShKey; _LexerFuncVector.push_back(thisFunction); } // Returns the SCI_LEXERID at vector index. int getSCILexerIDByIndex(int index) { return ( _LexerDetailVector.at(index).SCI_LEXERID ); } // Returns the SCI_LEXERID matching name. // Returns -1 if no match found. int getSCILexerIDByName( std::string name ) { std::vector<Lexer>::iterator currLexer = _LexerDetailVector.begin(); for (currLexer; currLexer < _LexerDetailVector.end(); currLexer++ ) { if ( currLexer->_name.compare( name ) == 0 ) return currLexer->SCI_LEXERID; } return ( -1 ); } // Provides a response for a namespace's extension to retrieve and work with the // plugin's function item vector. // // Useful to merge additional function items together before responding to the // Npp plugin manager's getFuncArray() call. std::vector<FuncItem> getLexerFuncVector() { return ( _LexerFuncVector ); } // Provides a response for a namespace's extension to retrieve and work with the // plugin's function item vector. // // Useful to merge additional function items together before responding to the // Npp plugin manager's getFuncArray() call. std::vector<Lexer> getLexerDetailVector() { return ( _LexerDetailVector ); } // 'Virtualized' base plugin FuncItem functions. // // These functions will be used instead of the base plugin functions to allow for the // inclusion of a sorted lexer FuncItem list in the menu above the base plugins. namespace virtual_plugin_func { // Provides a response to PluginsManager's getFuncArray. // Return this plugin's sorted FuncItem array. FuncItem * getPluginFuncArray() { /* * In order to have the function items show up in the Notepad++ plugins menu with * the base plugins' function items at the bottom a new vector is created and the existing * vectors are copied into it with the lexer functions first. * */ // <--- Local function for sorting criteria predicate. ---> struct sortByName { bool operator()(FuncItem& f1, FuncItem& f2) { return ( _tcscmp(f1._itemName, f2._itemName) < 0 ); } }; if ( _LexerFuncVector.empty() ) { // Doesn't look like there are any lexer function items so just send the plugin's. ReturnVector = npp_plugin::getPluginFuncVector(); } else { // Sort the lexer function items vector. std::sort(_LexerFuncVector.begin(), _LexerFuncVector.end(), sortByName()); // Copy it to the vector that will be returned to Notepad++'s PluginsManager. ReturnVector = _LexerFuncVector; // Append the base plugin's function items (ie 'Help', 'About', etc... std::vector<FuncItem> tmpVector = npp_plugin::getPluginFuncVector(); std::copy(tmpVector.begin(), tmpVector.end(), std::back_inserter(ReturnVector)); } return ( &ReturnVector[0] ); } // Provides a response to PluginsManager's getFuncArray call 'size' and allows for extensions // to work with generating an array to send back that includes their own FuncItems. int getPluginFuncCount() { return ( npp_plugin::getPluginFuncCount() + getLexerFuncCount() ); } /* ****************** Put this somewhere to keep ********************** * TODO: Modify this to open a registered lexer's style configuration. // Opens the Notepad++ Style Configurator to the specified Language. void dlg_StyleConfig() { // This function doesn't actually change the styles, that is done when Notepad++ // sends the WORDSSTYLESUPDATED notification. ::SendMessage( pIface::hNpp(), NPPM_MENUCOMMAND, 0, IDM_LANGSTYLE_CONFIG_DLG); HWND hStyleDlg = ::FindWindow( NULL, TEXT("Style Configurator") ); int langID = ::SendDlgItemMessage( hStyleDlg, IDC_LANGUAGES_LIST, LB_SELECTSTRING, -1, (LPARAM)TEXT("Changed Line") ); WPARAM msg = ( LBN_SELCHANGE << 16 ) | (IDC_LANGUAGES_LIST); ::SendMessage( hStyleDlg, WM_COMMAND, msg, 0); } */ } // End namespace: virtual_plugin_func } // End namespace: external_lexer } // End namespace: npp_plugin
[ "T B Fowler@2fa2a738-4fc5-9a49-b7e4-8bd4648edc6b" ]
[ [ [ 1, 321 ] ] ]
c390afa2da8977f9657a1c1748dbf81f35107eea
4c3c35e4fe1ff2567ef20f0b203fe101a4a2bf20
/HW5/src/GzCommon.h
00edb97a98642c3962b4329f21dcbde0a89bc836
[]
no_license
kolebole/monopolocoso
63c0986707728522650bd2704a5491d1da20ecf7
a86c0814f5da2f05e7676b2e41f6858d87077e6a
refs/heads/master
2021-01-19T15:04:09.283953
2011-03-27T23:21:53
2011-03-27T23:21:53
34,309,551
0
0
null
null
null
null
UTF-8
C++
false
false
4,552
h
#ifndef __GZ_COMMON_H_ #define __GZ_COMMON_H_ #include <vector> using namespace std; //============================================================================ //Declarations in Assignment #1 //============================================================================ //Common data type------------------------------------------------------------ typedef int GzInt; typedef bool GzBool; typedef double GzReal; typedef unsigned int GzFunctional; typedef unsigned int GzPrimitiveType; typedef unsigned int GzMatrixModeType; //---------------------------------------------------------------------------- //Funtional constants--------------------------------------------------------- #define GZ_DEPTH_TEST 0x00000001 #define GZ_COLOR_BUFFER 0x00000002 #define GZ_DEPTH_BUFFER 0x00000004 //---------------------------------------------------------------------------- //Primitive types------------------------------------------------------------- #define GZ_POINTS 0 //---------------------------------------------------------------------------- //3D coordinate data type----------------------------------------------------- #define X 0 #define Y 1 #define Z 2 struct GzVertex:public vector<GzReal> { GzVertex():vector<GzReal>(3, 0) {} GzVertex(GzReal x, GzReal y, GzReal z):vector<GzReal>(3, 0) { at(X)=x; at(Y)=y; at(Z)=z; } }; //---------------------------------------------------------------------------- //Color data type------------------------------------------------------------- #define R 0 #define G 1 #define B 2 #define A 3 struct GzColor:public vector<GzReal> { GzColor():vector<GzReal>(4, 0) {at(A)=1;} GzColor(GzReal r, GzReal g, GzReal b):vector<GzReal>(4, 0) { at(R)=r; at(G)=g; at(B)=b; at(A)=1; } GzColor(GzReal r, GzReal g, GzReal b, GzReal a):vector<GzReal>(4, 0) { at(R)=r; at(G)=g; at(B)=b; at(A)=a; } }; //---------------------------------------------------------------------------- //============================================================================ //End of Declarations in Assignment #1 //============================================================================ //============================================================================ //Declarations in Assignment #2 //============================================================================ //Primitive types------------------------------------------------------------- #define GZ_TRIANGLES 1 //---------------------------------------------------------------------------- //============================================================================ //End of Declarations in Assignment #2 //============================================================================ //============================================================================ //Declarations in Assignment #4 //============================================================================ //Funtional constants--------------------------------------------------------- #define GZ_LIGHTING 0x00000008 //---------------------------------------------------------------------------- //Shade model----------------------------------------------------------------- #define GZ_GOURAUD 1 #define GZ_PHONG 2 //---------------------------------------------------------------------------- //============================================================================ //End of Declarations in Assignment #4 //============================================================================ //============================================================================ //Declarations in Assignment #5 //============================================================================ //Funtional constants--------------------------------------------------------- #define GZ_TEXTURE 0x00000010 //---------------------------------------------------------------------------- //Texture coordinate data type------------------------------------------------ #define U 0 #define V 1 struct GzTexCoord:public vector<GzReal> { GzTexCoord():vector<GzReal>(2, 0) {} GzTexCoord(GzReal u, GzReal v):vector<GzReal>(2, 0) { at(U)=u; at(V)=v; } }; //---------------------------------------------------------------------------- //============================================================================ //End of Declarations in Assignment #5 //============================================================================ #endif
[ "[email protected]@a7811d78-34aa-4512-2aaf-9c23cbf1bc95" ]
[ [ [ 1, 129 ] ] ]
e5de595ff8ab2a5380d00fe78449d68176f8f935
b08e948c33317a0a67487e497a9afbaf17b0fc4c
/Pathfind/AStarTypes.h
5103fa0a3b49352342e6931e1fc125d9bad1bb9e
[]
no_license
15831944/bastionlandscape
e1acc932f6b5a452a3bd94471748b0436a96de5d
c8008384cf4e790400f9979b5818a5a3806bd1af
refs/heads/master
2023-03-16T03:28:55.813938
2010-05-21T15:00:07
2010-05-21T15:00:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
760
h
#ifndef __ASTARTYPES_H__ #define __ASTARTYPES_H__ namespace ElixirEngine { //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------- class AStarNode; typedef AStarNode* AStarNodePtr; typedef AStarNode& AStarNodeRef; typedef vector<AStarNodePtr> AStarNodePtrVec; class AStarNodeContainer; typedef AStarNodeContainer* AStarNodeContainerPtr; typedef AStarNodeContainer& AStarNodeContainerRef; class AStar; typedef AStar* AStarPtr; typedef AStar& AStarRef; } #endif // __ASTARTYPES_H__
[ "voodoohaust@97c0069c-804f-11de-81da-11cc53ed4329" ]
[ [ [ 1, 24 ] ] ]
15e976b6d011fcc49df70289d329240cad5d0fed
ee065463a247fda9a1927e978143186204fefa23
/Src/Depends/ClanLib/ClanLib2.0/Sources/Core/XML/dom_text.cpp
dfa3fb237a49c683b37a56af8f2aa3658aa9941d
[]
no_license
ptrefall/hinsimviz
32e9a679170eda9e552d69db6578369a3065f863
9caaacd39bf04bbe13ee1288d8578ece7949518f
refs/heads/master
2021-01-22T09:03:52.503587
2010-09-26T17:29:20
2010-09-26T17:29:20
32,448,374
1
0
null
null
null
null
UTF-8
C++
false
false
2,202
cpp
/* ** ClanLib SDK ** Copyright (c) 1997-2010 The ClanLib Team ** ** This software is provided 'as-is', without any express or implied ** warranty. In no event will the authors be held liable for any damages ** arising from the use of this software. ** ** Permission is granted to anyone to use this software for any purpose, ** including commercial applications, and to alter it and redistribute it ** freely, subject to the following restrictions: ** ** 1. The origin of this software must not be misrepresented; you must not ** claim that you wrote the original software. If you use this software ** in a product, an acknowledgment in the product documentation would be ** appreciated but is not required. ** 2. Altered source versions must be plainly marked as such, and must not be ** misrepresented as being the original software. ** 3. This notice may not be removed or altered from any source distribution. ** ** Note: Some of the libraries ClanLib may link to may have additional ** requirements or restrictions. ** ** File Author(s): ** ** Magnus Norddahl */ #include "Core/precomp.h" #include "API/Core/XML/dom_text.h" #include "dom_node_generic.h" ///////////////////////////////////////////////////////////////////////////// // CL_DomText construction: CL_DomText::CL_DomText() { } CL_DomText::CL_DomText(CL_DomDocument &doc, const CL_DomString &data) : CL_DomCharacterData(doc, TEXT_NODE) { set_node_value(data); } CL_DomText::CL_DomText(CL_DomDocument &doc, unsigned short node_type) : CL_DomCharacterData(doc, node_type) { } CL_DomText::CL_DomText(const CL_SharedPtr<CL_DomNode_Generic> &impl) : CL_DomCharacterData(impl) { } CL_DomText::~CL_DomText() { } ///////////////////////////////////////////////////////////////////////////// // CL_DomText attributes: ///////////////////////////////////////////////////////////////////////////// // CL_DomText operations: CL_DomText CL_DomText::split_text(unsigned long offset) { throw CL_Exception("Implement me"); } ///////////////////////////////////////////////////////////////////////////// // CL_DomText implementation:
[ "[email protected]@28a56cb3-1e7c-bc60-7718-65c159e1d2df" ]
[ [ [ 1, 71 ] ] ]
24986136ed97e15d8a9b4804a61bdfd5259cdadc
f0c08b3ddefc91f1fa342f637b0e947a9a892556
/branches/develop/calcioIA/GlutApp/GlutLoggerWriter.cpp
6443500b1faa8407515fef0d617bed8fae8aab5a
[]
no_license
BackupTheBerlios/coffeestore-svn
1db0f60ddb85ccbbdfeb9b3271a687b23e29fc8f
ddee83284fe9875bf0d04e6b7da7a2113e85a040
refs/heads/master
2021-01-01T05:30:22.345767
2009-10-11T08:55:35
2009-10-11T08:55:35
40,725,038
0
0
null
null
null
null
UTF-8
C++
false
false
474
cpp
#include "GlutLoggerWriter.h" #include "Application.h" #include "Point.h" void GlutLoggerWriter::flush(const Application& application) { if (!_lines.empty()) { float y = 10; for (std::vector<std::string>::const_iterator it = _lines.begin(); it != _lines.end(); ++it) { application.writeString(Point(10, y), *it); y += 14.0f; } _lines.clear(); } } void GlutLoggerWriter::write(const std::string line) { _lines.push_back(line); }
[ "fabioppp@e591b805-c13a-0410-8b2d-a75de64125fb" ]
[ [ [ 1, 23 ] ] ]
a93b4e7285f4d6c2ebeba2c66c1e8f6974c567ef
81e051c660949ac0e89d1e9cf286e1ade3eed16a
/quake3ce/code/game/g_combat.cpp
4468a962149b6fcff53c25058689006b24016920
[]
no_license
crioux/q3ce
e89c3b60279ea187a2ebcf78dbe1e9f747a31d73
5e724f55940ac43cb25440a65f9e9e12220c9ada
refs/heads/master
2020-06-04T10:29:48.281238
2008-11-16T15:00:38
2008-11-16T15:00:38
32,103,416
5
0
null
null
null
null
UTF-8
C++
false
false
31,695
cpp
/* =========================================================================== Copyright (C) 1999-2005 Id Software, Inc. This file is part of Quake III Arena source code. Quake III Arena source code 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. Quake III Arena source code 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 Foobar; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA =========================================================================== */ // // g_combat.c #include"game_pch.h" /* ============ ScorePlum ============ */ void ScorePlum( gentity_t *ent, bvec3_t origin, int score ) { gentity_t *plum; plum = G_TempEntity( origin, EV_SCOREPLUM ); // only send this temp entity to a single client plum->r.svFlags |= SVF_SINGLECLIENT; plum->r.singleClient = ent->s.number; // plum->s.otherEntityNum = ent->s.number; plum->s.time = score; } /* ============ AddScore Adds score to both the client and his team ============ */ void AddScore( gentity_t *ent, bvec3_t origin, int score ) { if ( !ent->client ) { return; } // no scoring during pre-match warmup if ( level.warmupTime ) { return; } // show score plum ScorePlum(ent, origin, score); // ent->client->ps.persistant[PERS_SCORE] += score; if ( g_gametype.integer == GT_TEAM ) level.teamScores[ ent->client->ps.persistant[PERS_TEAM] ] += score; CalculateRanks(); } /* ================= TossClientItems Toss the weapon and powerups for the killed player ================= */ void TossClientItems( gentity_t *self ) { gitem_t *item; int weapon; afixed angle; int i; gentity_t *drop; // drop the weapon if not a gauntlet or machinegun weapon = self->s.weapon; // make a special check to see if they are changing to a new // weapon that isn't the mg or gauntlet. Without this, a client // can pick up a weapon, be killed, and not drop the weapon because // their weapon change hasn't completed yet and they are still holding the MG. if ( weapon == WP_MACHINEGUN || weapon == WP_GRAPPLING_HOOK ) { if ( self->client->ps.weaponstate == WEAPON_DROPPING ) { weapon = self->client->pers.cmd.weapon; } if ( !( self->client->ps.stats[STAT_WEAPONS] & ( 1 << weapon ) ) ) { weapon = WP_NONE; } } if ( weapon > WP_MACHINEGUN && weapon != WP_GRAPPLING_HOOK && self->client->ps.ammo[ weapon ] ) { // find the item type for this weapon item = BG_FindItemForWeapon( (weapon_t)weapon ); // spawn the item Drop_Item( self, item, AFIXED_0 ); } // drop all the powerups if not in teamplay if ( g_gametype.integer != GT_TEAM ) { angle = AFIXED(45,0); for ( i = 1 ; i < PW_NUM_POWERUPS ; i++ ) { if ( self->client->ps.powerups[ i ] > level.time ) { item = BG_FindItemForPowerup( (powerup_t)i ); if ( !item ) { continue; } drop = Drop_Item( self, item, angle ); // decide how many seconds it has left drop->count = ( self->client->ps.powerups[ i ] - level.time ) / 1000; if ( drop->count < 1 ) { drop->count = 1; } angle += AFIXED(45,0); } } } } #ifdef MISSIONPACK /* ================= TossClientCubes ================= */ extern gentity_t *neutralObelisk; void TossClientCubes( gentity_t *self ) { gitem_t *item; gentity_t *drop; bvec3_t velocity; bvec3_t angles; bvec3_t origin; self->client->ps.generic1 = 0; // this should never happen but we should never // get the server to crash due to skull being spawned in if (!G_EntitiesFree()) { return; } if( self->client->sess.sessionTeam == TEAM_RED ) { item = BG_FindItem( "Red Cube" ); } else { item = BG_FindItem( "Blue Cube" ); } angles[YAW] = MAKE_GFIXED(level.time % 360); angles[PITCH] = 0; // always forward angles[ROLL] = 0; AngleVectors( angles, velocity, NULL, NULL ); FIXED_VEC3SCALE( velocity, GFIXED(150,0), velocity ); velocity[2] += GFIXED(200 ,0)+ crandom() * GFIXED(50,0); if( neutralObelisk ) { VectorCopy( neutralObelisk->s.pos.trBase, origin ); origin[2] += GFIXED(44,0); } else { VectorClear( origin ) ; } drop = LaunchItem( item, origin, velocity ); drop->nextthink = level.time + g_cubeTimeout.integer * 1000; drop->think = G_FreeEntity; drop->spawnflags = self->client->sess.sessionTeam; } /* ================= TossClientPersistantPowerups ================= */ void TossClientPersistantPowerups( gentity_t *ent ) { gentity_t *powerup; if( !ent->client ) { return; } if( !ent->client->persistantPowerup ) { return; } powerup = ent->client->persistantPowerup; powerup->r.svFlags &= ~SVF_NOCLIENT; powerup->s.eFlags &= ~EF_NODRAW; powerup->r.contents = CONTENTS_TRIGGER; _G_trap_LinkEntity( powerup ); ent->client->ps.stats[STAT_PERSISTANT_POWERUP] = 0; ent->client->persistantPowerup = NULL; } #endif /* ================== LookAtKiller ================== */ void LookAtKiller( gentity_t *self, gentity_t *inflictor, gentity_t *attacker ) { bvec3_t dir; avec3_t angles; if ( attacker && attacker != self ) { VectorSubtract (attacker->s.pos.trBase, self->s.pos.trBase, dir); } else if ( inflictor && inflictor != self ) { VectorSubtract (inflictor->s.pos.trBase, self->s.pos.trBase, dir); } else { self->client->ps.stats[STAT_DEAD_YAW] = FIXED_TO_INT(self->s.angles[YAW]); return; } self->client->ps.stats[STAT_DEAD_YAW] = FIXED_TO_INT(vectoyaw ( dir )); angles[YAW] = vectoyaw ( dir ); angles[PITCH] = AFIXED_0; angles[ROLL] = AFIXED_0; } /* ================== GibEntity ================== */ void GibEntity( gentity_t *self, int killer ) { gentity_t *ent; int i; //if this entity still has kamikaze if (self->s.eFlags & EF_KAMIKAZE) { // check if there is a kamikaze timer around for this owner for (i = 0; i < MAX_GENTITIES; i++) { ent = &g_entities[i]; if (!ent->inuse) continue; if (ent->activator != self) continue; if (strcmp(ent->classname, "kamikaze timer")) continue; G_FreeEntity(ent); break; } } G_AddEvent( self, EV_GIB_PLAYER, killer ); self->takedamage = qfalse; self->s.eType = ET_INVISIBLE; self->r.contents = 0; } /* ================== body_die ================== */ void body_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ) { if ( self->health > GIB_HEALTH ) { return; } if ( !g_blood.integer ) { self->health = GIB_HEALTH+1; return; } GibEntity( self, 0 ); } // these are just for logging, the client prints its own messages const char *modNames[] = { "MOD_UNKNOWN", "MOD_SHOTGUN", "MOD_GAUNTLET", "MOD_MACHINEGUN", "MOD_GRENADE", "MOD_GRENADE_SPLASH", "MOD_ROCKET", "MOD_ROCKET_SPLASH", "MOD_PLASMA", "MOD_PLASMA_SPLASH", "MOD_RAILGUN", "MOD_LIGHTNING", "MOD_BFG", "MOD_BFG_SPLASH", "MOD_WATER", "MOD_SLIME", "MOD_LAVA", "MOD_CRUSH", "MOD_TELEFRAG", "MOD_FALLING", "MOD_SUICIDE", "MOD_TARGET_LASER", "MOD_TRIGGER_HURT", #ifdef MISSIONPACK "MOD_NAIL", "MOD_CHAINGUN", "MOD_PROXIMITY_MINE", "MOD_KAMIKAZE", "MOD_JUICED", #endif "MOD_GRAPPLE" }; #ifdef MISSIONPACK /* ================== Kamikaze_DeathActivate ================== */ void Kamikaze_DeathActivate( gentity_t *ent ) { G_StartKamikaze(ent); G_FreeEntity(ent); } /* ================== Kamikaze_DeathTimer ================== */ void Kamikaze_DeathTimer( gentity_t *self ) { gentity_t *ent; ent = G_Spawn(); ent->classname = "kamikaze timer"; VectorCopy(self->s.pos.trBase, ent->s.pos.trBase); ent->r.svFlags |= SVF_NOCLIENT; ent->think = Kamikaze_DeathActivate; ent->nextthink = level.time + 5 * 1000; ent->activator = self; } #endif /* ================== CheckAlmostCapture ================== */ void CheckAlmostCapture( gentity_t *self, gentity_t *attacker ) { gentity_t *ent; bvec3_t dir; const char *classname; // if this player was carrying a flag if ( self->client->ps.powerups[PW_REDFLAG] || self->client->ps.powerups[PW_BLUEFLAG] || self->client->ps.powerups[PW_NEUTRALFLAG] ) { // get the goal flag this player should have been going for if ( g_gametype.integer == GT_CTF ) { if ( self->client->sess.sessionTeam == TEAM_BLUE ) { classname = "team_CTF_blueflag"; } else { classname = "team_CTF_redflag"; } } else { if ( self->client->sess.sessionTeam == TEAM_BLUE ) { classname = "team_CTF_redflag"; } else { classname = "team_CTF_blueflag"; } } ent = NULL; do { ent = G_Find(ent, FOFS(classname), classname); } while (ent && (ent->flags & FL_DROPPED_ITEM)); // if we found the destination flag and it's not picked up if (ent && !(ent->r.svFlags & SVF_NOCLIENT) ) { // if the player was *very* close VectorSubtract( self->client->ps.origin, ent->s.origin, dir ); if ( FIXED_VEC3LEN(dir) < BFIXED(200 ,0)) { self->client->ps.persistant[PERS_PLAYEREVENTS] ^= PLAYEREVENT_HOLYSHIT; if ( attacker->client ) { attacker->client->ps.persistant[PERS_PLAYEREVENTS] ^= PLAYEREVENT_HOLYSHIT; } } } } } /* ================== CheckAlmostScored ================== */ void CheckAlmostScored( gentity_t *self, gentity_t *attacker ) { gentity_t *ent; bvec3_t dir; const char *classname; // if the player was carrying cubes if ( self->client->ps.generic1 ) { if ( self->client->sess.sessionTeam == TEAM_BLUE ) { classname = "team_redobelisk"; } else { classname = "team_blueobelisk"; } ent = G_Find(NULL, FOFS(classname), classname); // if we found the destination obelisk if ( ent ) { // if the player was *very* close VectorSubtract( self->client->ps.origin, ent->s.origin, dir ); if ( FIXED_VEC3LEN(dir) < BFIXED(200 ,0)) { self->client->ps.persistant[PERS_PLAYEREVENTS] ^= PLAYEREVENT_HOLYSHIT; if ( attacker->client ) { attacker->client->ps.persistant[PERS_PLAYEREVENTS] ^= PLAYEREVENT_HOLYSHIT; } } } } } /* ================== player_die ================== */ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int damage, int meansOfDeath ) { gentity_t *ent; int anim; int contents; int killer; int i; const char *killerName, *obit; if ( self->client->ps.pm_type == PM_DEAD ) { return; } if ( level.intermissiontime ) { return; } // check for an almost capture CheckAlmostCapture( self, attacker ); // check for a player that almost brought in cubes CheckAlmostScored( self, attacker ); if (self->client && self->client->hook) { Weapon_HookFree(self->client->hook); } #ifdef MISSIONPACK if ((self->client->ps.eFlags & EF_TICKING) && self->activator) { self->client->ps.eFlags &= ~EF_TICKING; self->activator->think = G_FreeEntity; self->activator->nextthink = level.time; } #endif self->client->ps.pm_type = PM_DEAD; if ( attacker ) { killer = attacker->s.number; if ( attacker->client ) { killerName = attacker->client->pers.netname; } else { killerName = "<non-client>"; } } else { killer = ENTITYNUM_WORLD; killerName = "<world>"; } if ( killer < 0 || killer >= MAX_CLIENTS ) { killer = ENTITYNUM_WORLD; killerName = "<world>"; } if ( meansOfDeath < 0 || meansOfDeath >= sizeof( modNames ) / sizeof( modNames[0] ) ) { obit = "<bad obituary>"; } else { obit = modNames[ meansOfDeath ]; } G_LogPrintf("Kill: %i %i %i: %s killed %s by %s\n", killer, self->s.number, meansOfDeath, killerName, self->client->pers.netname, obit ); // broadcast the death event to everyone ent = G_TempEntity( self->r.currentOrigin, EV_OBITUARY ); ent->s.eventParm = meansOfDeath; ent->s.otherEntityNum = self->s.number; ent->s.otherEntityNum2 = killer; ent->r.svFlags = SVF_BROADCAST; // send to everyone self->enemy = attacker; self->client->ps.persistant[PERS_KILLED]++; if (attacker && attacker->client) { attacker->client->lastkilled_client = self->s.number; if ( attacker == self || OnSameTeam (self, attacker ) ) { AddScore( attacker, self->r.currentOrigin, -1 ); } else { AddScore( attacker, self->r.currentOrigin, 1 ); if( meansOfDeath == MOD_GAUNTLET ) { // play humiliation on player attacker->client->ps.persistant[PERS_GAUNTLET_FRAG_COUNT]++; // add the sprite over the player's head attacker->client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET | EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP ); attacker->client->ps.eFlags |= EF_AWARD_GAUNTLET; attacker->client->rewardTime = level.time + REWARD_SPRITE_TIME; // also play humiliation on target self->client->ps.persistant[PERS_PLAYEREVENTS] ^= PLAYEREVENT_GAUNTLETREWARD; } // check for two kills in a short amount of time // if this is close enough to the last kill, give a reward sound if ( level.time - attacker->client->lastKillTime < CARNAGE_REWARD_TIME ) { // play excellent on player attacker->client->ps.persistant[PERS_EXCELLENT_COUNT]++; // add the sprite over the player's head attacker->client->ps.eFlags &= ~(EF_AWARD_IMPRESSIVE | EF_AWARD_EXCELLENT | EF_AWARD_GAUNTLET | EF_AWARD_ASSIST | EF_AWARD_DEFEND | EF_AWARD_CAP ); attacker->client->ps.eFlags |= EF_AWARD_EXCELLENT; attacker->client->rewardTime = level.time + REWARD_SPRITE_TIME; } attacker->client->lastKillTime = level.time; } } else { AddScore( self, self->r.currentOrigin, -1 ); } // Add team bonuses Team_FragBonuses(self, inflictor, attacker); // if I committed suicide, the flag does not fall, it returns. if (meansOfDeath == MOD_SUICIDE) { if ( self->client->ps.powerups[PW_NEUTRALFLAG] ) { // only happens in One Flag CTF Team_ReturnFlag( TEAM_FREE ); self->client->ps.powerups[PW_NEUTRALFLAG] = 0; } else if ( self->client->ps.powerups[PW_REDFLAG] ) { // only happens in standard CTF Team_ReturnFlag( TEAM_RED ); self->client->ps.powerups[PW_REDFLAG] = 0; } else if ( self->client->ps.powerups[PW_BLUEFLAG] ) { // only happens in standard CTF Team_ReturnFlag( TEAM_BLUE ); self->client->ps.powerups[PW_BLUEFLAG] = 0; } } // if client is in a nodrop area, don't drop anything (but return CTF flags!) contents = _G_trap_PointContents( self->r.currentOrigin, -1 ); if ( !( contents & CONTENTS_NODROP )) { TossClientItems( self ); } else { if ( self->client->ps.powerups[PW_NEUTRALFLAG] ) { // only happens in One Flag CTF Team_ReturnFlag( TEAM_FREE ); } else if ( self->client->ps.powerups[PW_REDFLAG] ) { // only happens in standard CTF Team_ReturnFlag( TEAM_RED ); } else if ( self->client->ps.powerups[PW_BLUEFLAG] ) { // only happens in standard CTF Team_ReturnFlag( TEAM_BLUE ); } } #ifdef MISSIONPACK TossClientPersistantPowerups( self ); if( g_gametype.integer == GT_HARVESTER ) { TossClientCubes( self ); } #endif Cmd_Score_f( self ); // show scores // send updated scores to any clients that are following this one, // or they would get stale scoreboards for ( i = 0 ; i < level.maxclients ; i++ ) { gclient_t *client; client = &level.clients[i]; if ( client->pers.connected != CON_CONNECTED ) { continue; } if ( client->sess.sessionTeam != TEAM_SPECTATOR ) { continue; } if ( client->sess.spectatorClient == self->s.number ) { Cmd_Score_f( g_entities + i ); } } self->takedamage = qtrue; // can still be gibbed self->s.weapon = WP_NONE; self->s.powerups = 0; self->r.contents = CONTENTS_CORPSE; self->s.angles[0] = AFIXED_0; self->s.angles[2] = AFIXED_0; LookAtKiller (self, inflictor, attacker); VectorCopy( self->s.angles, self->client->ps.viewangles ); self->s.loopSound = 0; self->r.maxs[2] = -BFIXED(8,0); // don't allow respawn until the death anim is done // g_forcerespawn may force spawning at some later time self->client->respawnTime = level.time + 1700; // remove powerups memset( self->client->ps.powerups, 0, sizeof(self->client->ps.powerups) ); // never gib in a nodrop if ( (self->health <= GIB_HEALTH && !(contents & CONTENTS_NODROP) && g_blood.integer) || meansOfDeath == MOD_SUICIDE) { // gib death GibEntity( self, killer ); } else { // normal death static int i; switch ( i ) { case 0: anim = BOTH_DEATH1; break; case 1: anim = BOTH_DEATH2; break; case 2: default: anim = BOTH_DEATH3; break; } // for the no-blood option, we need to prevent the health // from going to gib level if ( self->health <= GIB_HEALTH ) { self->health = GIB_HEALTH+1; } self->client->ps.legsAnim = ( ( self->client->ps.legsAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim; self->client->ps.torsoAnim = ( ( self->client->ps.torsoAnim & ANIM_TOGGLEBIT ) ^ ANIM_TOGGLEBIT ) | anim; G_AddEvent( self, EV_DEATH1 + i, killer ); // the body can still be gibbed self->die = body_die; // globally cycle through the different death animations i = ( i + 1 ) % 3; #ifdef MISSIONPACK if (self->s.eFlags & EF_KAMIKAZE) { Kamikaze_DeathTimer( self ); } #endif } _G_trap_LinkEntity (self); } /* ================ CheckArmor ================ */ int CheckArmor (gentity_t *ent, int damage, int dflags) { gclient_t *client; int save; int count; if (!damage) return 0; client = ent->client; if (!client) return 0; if (dflags & DAMAGE_NO_ARMOR) return 0; // armor count = client->ps.stats[STAT_ARMOR]; save = FIXED_TO_INT(FIXED_CEIL( MAKE_GFIXED(damage) * ARMOR_PROTECTION )); if (save >= count) save = count; if (!save) return 0; client->ps.stats[STAT_ARMOR] -= save; return save; } /* ================ RaySphereIntersections ================ */ int RaySphereIntersections( bvec3_t origin, bfixed radius, bvec3_t point, avec3_t dir, bvec3_t intersections[2] ) { bfixed b, c, d, t; // | origin - (point + t * dir) | = radius // a = dir[0]^2 + dir[1]^2 + dir[2]^2; // b = 2 * (dir[0] * (point[0] - origin[0]) + dir[1] * (point[1] - origin[1]) + dir[2] * (point[2] - origin[2])); // c = (point[0] - origin[0])^2 + (point[1] - origin[1])^2 + (point[2] - origin[2])^2 - radius^2; // normalize dir so a = 1 VectorNormalize(dir); b = FIXED_MULPOW2((dir[0] * (point[0] - origin[0]) + dir[1] * (point[1] - origin[1]) + dir[2] * (point[2] - origin[2])),1); c = (point[0] - origin[0]) * (point[0] - origin[0]) + (point[1] - origin[1]) * (point[1] - origin[1]) + (point[2] - origin[2]) * (point[2] - origin[2]) - radius * radius; d = b * b - BFIXED(4 ,0) * c; if (d > BFIXED_0) { t = FIXED_DIVPOW2((- b + FIXED_SQRT(d)),1); FIXED_VEC3MA_R(point, t, dir, intersections[0]); t = FIXED_DIVPOW2((- b - FIXED_SQRT(d)),1); FIXED_VEC3MA_R(point, t, dir, intersections[1]); return 2; } else if (d == BFIXED_0) { t = (- b ) / BFIXED(2,0); FIXED_VEC3MA_R(point, t, dir, intersections[0]); return 1; } return 0; } #ifdef MISSIONPACK /* ================ G_InvulnerabilityEffect ================ */ int G_InvulnerabilityEffect( gentity_t *targ, avec3_t dir, bvec3_t point, bvec3_t impactpoint, bvec3_t bouncedir ) { gentity_t *impact; bvec3_t intersections[2], vec; int n; if ( !targ->client ) { return qfalse; } VectorCopy(dir, vec); VectorInverse(vec); // sphere model radius = 42 units n = RaySphereIntersections( targ->client->ps.origin, 42, point, vec, intersections); if (n > 0) { impact = G_TempEntity( targ->client->ps.origin, EV_INVUL_IMPACT ); VectorSubtract(intersections[0], targ->client->ps.origin, vec); vectoangles(vec, impact->s.angles); impact->s.angles[0] += 90; if (impact->s.angles[0] > 360) impact->s.angles[0] -= 360; if ( impactpoint ) { VectorCopy( intersections[0], impactpoint ); } if ( bouncedir ) { VectorCopy( vec, bouncedir ); VectorNormalize( bouncedir ); } return qtrue; } else { return qfalse; } } #endif /* ============ T_Damage targ entity that is being damaged inflictor entity that is causing the damage attacker entity that caused the inflictor to damage targ example: targ=monster, inflictor=rocket, attacker=player dir direction of the attack for knockback point point at which the damage is being inflicted, used for headshots damage amount of damage being inflicted knockback force to be applied against targ as a result of the damage inflictor, attacker, dir, and point can be NULL for environmental effects dflags these flags are used to control how T_Damage works DAMAGE_RADIUS damage was indirect (from a nearby explosion) DAMAGE_NO_ARMOR armor does not protect from this damage DAMAGE_NO_KNOCKBACK do not affect velocity, just view angles DAMAGE_NO_PROTECTION kills godmode, armor, everything ============ */ void G_Damage( gentity_t *targ, gentity_t *inflictor, gentity_t *attacker, avec3_t dir, bvec3_t point, int damage, int dflags, int mod ) { gclient_t *client; int take; int save; int asave; int knockback; int max; #ifdef MISSIONPACK bvec3_t bouncedir, impactpoint; #endif if (!targ->takedamage) { return; } // the intermission has allready been qualified for, so don't // allow any extra scoring if ( level.intermissionQueued ) { return; } #ifdef MISSIONPACK if ( targ->client && mod != MOD_JUICED) { if ( targ->client->invulnerabilityTime > level.time) { if ( dir && point ) { G_InvulnerabilityEffect( targ, dir, point, impactpoint, bouncedir ); } return; } } #endif if ( !inflictor ) { inflictor = &g_entities[ENTITYNUM_WORLD]; } if ( !attacker ) { attacker = &g_entities[ENTITYNUM_WORLD]; } // shootable doors / buttons don't actually have any health if ( targ->s.eType == ET_MOVER ) { if ( targ->use && targ->moverState == MOVER_POS1 ) { targ->use( targ, inflictor, attacker ); } return; } #ifdef MISSIONPACK if( g_gametype.integer == GT_OBELISK && CheckObeliskAttack( targ, attacker ) ) { return; } #endif // reduce damage by the attacker's handicap value // unless they are rocket jumping if ( attacker->client && attacker != targ ) { max = attacker->client->ps.stats[STAT_MAX_HEALTH]; #ifdef MISSIONPACK if( bg_itemlist[attacker->client->ps.stats[STAT_PERSISTANT_POWERUP]].giTag == PW_GUARD ) { max /= 2; } #endif damage = damage * max / 100; } client = targ->client; if ( client ) { if ( client->noclip ) { return; } } if ( !dir ) { dflags |= DAMAGE_NO_KNOCKBACK; } else { VectorNormalize(dir); } knockback = damage; if ( knockback > 200 ) { knockback = 200; } if ( targ->flags & FL_NO_KNOCKBACK ) { knockback = 0; } if ( dflags & DAMAGE_NO_KNOCKBACK ) { knockback = 0; } // figure momentum add, even if the damage won't be taken if ( knockback && targ->client ) { bvec3_t kvel; bfixed mass; mass = BFIXED(200,0); FIXED_VEC3SCALE_R (dir, MAKE_BFIXED(g_knockback.value) * MAKE_BFIXED(knockback) / mass, kvel); VectorAdd (targ->client->ps.velocity, kvel, targ->client->ps.velocity); // set the timer so that the other client can't cancel // out the movement immediately if ( !targ->client->ps.pm_time ) { int t; t = knockback * 2; if ( t < 50 ) { t = 50; } if ( t > 200 ) { t = 200; } targ->client->ps.pm_time = t; targ->client->ps.pm_flags |= PMF_TIME_KNOCKBACK; } } // check for completely getting out of the damage if ( !(dflags & DAMAGE_NO_PROTECTION) ) { // if TF_NO_FRIENDLY_FIRE is set, don't do damage to the target // if the attacker was on the same team #ifdef MISSIONPACK if ( mod != MOD_JUICED && targ != attacker && !(dflags & DAMAGE_NO_TEAM_PROTECTION) && OnSameTeam (targ, attacker) ) { #else if ( targ != attacker && OnSameTeam (targ, attacker) ) { #endif if ( !g_friendlyFire.integer ) { return; } } #ifdef MISSIONPACK if (mod == MOD_PROXIMITY_MINE) { if (inflictor && inflictor->parent && OnSameTeam(targ, inflictor->parent)) { return; } if (targ == attacker) { return; } } #endif // check for godmode if ( targ->flags & FL_GODMODE ) { return; } } // battlesuit protects from all radius damage (but takes knockback) // and protects 50% against all damage if ( client && client->ps.powerups[PW_BATTLESUIT] ) { G_AddEvent( targ, EV_POWERUP_BATTLESUIT, 0 ); if ( ( dflags & DAMAGE_RADIUS ) || ( mod == MOD_FALLING ) ) { return; } damage = FIXED_TO_INT(MAKE_GFIXED(damage) * GFIXED(0,5)); } // add to the attacker's hit counter (if the target isn't a general entity like a prox mine) if ( attacker->client && targ != attacker && targ->health > 0 && targ->s.eType != ET_MISSILE && targ->s.eType != ET_GENERAL) { if ( OnSameTeam( targ, attacker ) ) { attacker->client->ps.persistant[PERS_HITS]--; } else { attacker->client->ps.persistant[PERS_HITS]++; } attacker->client->ps.persistant[PERS_ATTACKEE_ARMOR] = (targ->health<<8)|(client->ps.stats[STAT_ARMOR]); } // always give half damage if hurting self // calculated after knockback, so rocket jumping works if ( targ == attacker) { damage = FIXED_TO_INT(MAKE_GFIXED(damage) * GFIXED(0,5)); } if ( damage < 1 ) { damage = 1; } take = damage; save = 0; // save some from armor asave = CheckArmor (targ, take, dflags); take -= asave; if ( g_debugDamage.integer ) { G_Printf( "%i: client:%i health:%i damage:%i armor:%i\n", level.time, targ->s.number, targ->health, take, asave ); } // add to the damage inflicted on a player this frame // the total will be turned into screen blends and view angle kicks // at the end of the frame if ( client ) { if ( attacker ) { client->ps.persistant[PERS_ATTACKER] = attacker->s.number; } else { client->ps.persistant[PERS_ATTACKER] = ENTITYNUM_WORLD; } client->damage_armor += asave; client->damage_blood += take; client->damage_knockback += knockback; if ( dir ) { VectorCopy ( dir, client->damage_from ); client->damage_fromWorld = qfalse; } else { //VectorCopy ( targ->r.currentOrigin, client->damage_from ); client->damage_fromWorld = qtrue; } } // See if it's the player hurting the emeny flag carrier #ifdef MISSIONPACK if( g_gametype.integer == GT_CTF || g_gametype.integer == GT_1FCTF ) { #else if( g_gametype.integer == GT_CTF) { #endif Team_CheckHurtCarrier(targ, attacker); } if (targ->client) { // set the last client who damaged the target targ->client->lasthurt_client = attacker->s.number; targ->client->lasthurt_mod = mod; } // do the damage if (take) { targ->health = targ->health - take; if ( targ->client ) { targ->client->ps.stats[STAT_HEALTH] = targ->health; } if ( targ->health <= 0 ) { if ( client ) targ->flags |= FL_NO_KNOCKBACK; if (targ->health < -999) targ->health = -999; targ->enemy = attacker; targ->die (targ, inflictor, attacker, take, mod); return; } else if ( targ->pain ) { targ->pain (targ, attacker, take); } } } /* ============ CanDamage Returns qtrue if the inflictor can directly damage the target. Used for explosions and melee attacks. ============ */ qboolean CanDamage (gentity_t *targ, bvec3_t origin) { bvec3_t dest; trace_t tr; bvec3_t midpoint; // use the midpoint of the bounds instead of the origin, because // bmodels may have their origin is 0,0,0 VectorAdd (targ->r.absmin, targ->r.absmax, midpoint); FIXED_VEC3SCALE (midpoint, BFIXED(0,5), midpoint); VectorCopy (midpoint, dest); _G_trap_Trace ( &tr, origin, bvec3_origin, bvec3_origin, dest, ENTITYNUM_NONE, MASK_SOLID); if (tr.fraction == GFIXED_1 || tr.entityNum == targ->s.number) return qtrue; // this should probably check in the plane of projection, // rather than in world coordinate, and also include Z VectorCopy (midpoint, dest); dest[0] += BFIXED(15,0); dest[1] += BFIXED(15,0); _G_trap_Trace ( &tr, origin, bvec3_origin, bvec3_origin, dest, ENTITYNUM_NONE, MASK_SOLID); if (tr.fraction == GFIXED_1) return qtrue; VectorCopy (midpoint, dest); dest[0] += BFIXED(15,0); dest[1] -= BFIXED(15,0); _G_trap_Trace ( &tr, origin, bvec3_origin, bvec3_origin, dest, ENTITYNUM_NONE, MASK_SOLID); if (tr.fraction == GFIXED_1) return qtrue; VectorCopy (midpoint, dest); dest[0] -= BFIXED(15,0); dest[1] += BFIXED(15,0); _G_trap_Trace ( &tr, origin, bvec3_origin, bvec3_origin, dest, ENTITYNUM_NONE, MASK_SOLID); if (tr.fraction == GFIXED_1) return qtrue; VectorCopy (midpoint, dest); dest[0] -= BFIXED(15,0); dest[1] -= BFIXED(15,0); _G_trap_Trace ( &tr, origin, bvec3_origin, bvec3_origin, dest, ENTITYNUM_NONE, MASK_SOLID); if (tr.fraction == GFIXED_1) return qtrue; return qfalse; } /* ============ G_RadiusDamage ============ */ qboolean G_RadiusDamage ( bvec3_t origin, gentity_t *attacker, gfixed damage, bfixed radius, gentity_t *ignore, int mod) { gfixed points; bfixed dist; gentity_t *ent; int entityList[MAX_GENTITIES]; int numListedEntities; bvec3_t mins, maxs; bvec3_t v; bvec3_t dir; int i, e; qboolean hitClient = qfalse; if ( radius < BFIXED_1 ) { radius = BFIXED_1; } for ( i = 0 ; i < 3 ; i++ ) { mins[i] = origin[i] - radius; maxs[i] = origin[i] + radius; } numListedEntities = _G_trap_EntitiesInBox( mins, maxs, entityList, MAX_GENTITIES ); for ( e = 0 ; e < numListedEntities ; e++ ) { ent = &g_entities[entityList[ e ]]; if (ent == ignore) continue; if (!ent->takedamage) continue; // find the distance from the edge of the bounding box for ( i = 0 ; i < 3 ; i++ ) { if ( origin[i] < ent->r.absmin[i] ) { v[i] = ent->r.absmin[i] - origin[i]; } else if ( origin[i] > ent->r.absmax[i] ) { v[i] = origin[i] - ent->r.absmax[i]; } else { v[i] = BFIXED_0; } } dist = FIXED_VEC3LEN( v ); if ( dist >= radius ) { continue; } points = damage*(GFIXED_1 - MAKE_GFIXED(dist / radius)); if( CanDamage (ent, origin) ) { if( LogAccuracyHit( ent, attacker ) ) { hitClient = qtrue; } VectorSubtract (ent->r.currentOrigin, origin, dir); // push the center of mass higher than the origin so players // get knocked into the air more dir[2] += BFIXED(24,0); avec3_t adir; VectorNormalizeB2A(dir,adir); G_Damage (ent, NULL, attacker, adir, origin, FIXED_TO_INT(points), DAMAGE_RADIUS, mod); } } return hitClient; }
[ "jack.palevich@684fc592-8442-0410-8ea1-df6b371289ac", "crioux@684fc592-8442-0410-8ea1-df6b371289ac" ]
[ [ [ 1, 285 ], [ 287, 358 ], [ 360, 408 ], [ 410, 444 ], [ 446, 1199 ] ], [ [ 286, 286 ], [ 359, 359 ], [ 409, 409 ], [ 445, 445 ] ] ]
eeb2420cf43660531c3588ea18a4343a2efcfd9b
3da0b0276bc8c3d7d1bcdbabfb0e763a38d3a24c
/zju.finished/1331.cpp
628c8c6c6bb8f8f567720e4b1a17be57784703ef
[]
no_license
usherfu/zoj
4af6de9798bcb0ffa9dbb7f773b903f630e06617
8bb41d209b54292d6f596c5be55babd781610a52
refs/heads/master
2021-05-28T11:21:55.965737
2009-12-15T07:58:33
2009-12-15T07:58:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,177
cpp
#include<iostream> #include<algorithm> #include<map> using namespace std; int cube[204]; multimap<int, int, greater<int> > table; void init(){ int i,j,k; int index; int t; for(i=2;i<=200;i++){ cube[i] = i * i * i; } for(i=2;i<=200;i++){ for(j=i+1;j<=200;j++){ for(k=j+1;k<=200;k++){ t = cube[i] + cube[j] + cube[k]; if(t > cube[200]){ break; } else { index = (i<<16) + (j<<8) + k; table.insert(pair<int,int> (t, index) ); } } } } multimap<int, int, greater<int> >::iterator first, last; for(t=2;t<=200;t++){ first = table.lower_bound(cube[t]); last = table.upper_bound(cube[t]); for(; first!= last; first ++){ i = first->second >>16; j = (first->second >>8) &0xff; k = (first->second ) &0xff; cout<<"Cube = "<<t <<", Triple = ("<<i<<","<<j<<","<<k <<")"<<endl; } } } int main(){ init(); return 0; }
[ [ [ 1, 52 ] ] ]
527a96b789c15a153da66075a143ec573fbd0597
61576c87f5a1c6a1e94ede4cba8ecf84978836ae
/src/article_catcher.cpp
31f74a7b4a5b0d6eedb937694ab6498aea740e50
[]
no_license
jdmichaud/newswatch
183553c166860475e055f87c94ab783e1e0d0c11
97aac3d9b16e8160fd407bb3d07c4873291f0500
refs/heads/master
2021-01-21T19:27:53.853232
2008-04-27T19:39:41
2008-04-27T19:39:41
32,138,021
0
0
null
null
null
null
UTF-8
C++
false
false
797
cpp
#include "logging.hpp" #include "article_catcher.hpp" void article_catcher_new_article_handler_t::set_article_catcher(article_catcher &te) { m_te = &te; } void article_catcher_new_article_handler_t::operator()() { assert(m_te); m_te->new_article(this); } void article_catcher::register_callbacks(callback_handler &ch) { m_new_article_handler.set_article_catcher(*this); ch.register_to_new_article(&m_new_article_handler); } void article_catcher::new_article(article_catcher_new_article_handler_t *handler) { assert(handler); boost::mutex::scoped_lock scoped_lock(m_new_article_mutex); unsigned int uid = handler->m_uids.back(); handler->m_uids.pop_back(); LOGLITE_LOG_(LOGLITE_LEVEL_1, "article_catcher::new_article: article uid: " << uid); }
[ "jean.daniel.michaud@750302d9-4032-0410-994c-055de1cff029" ]
[ [ [ 1, 29 ] ] ]
aaae19e8f120d05d90363ead10959cc065ec8176
be7184f3874d3c5cc39f47991a9b00d3f2d2c95c
/PopViewer/GLWin.h
58eff35d8fc87fb12e83fd6b76154f52eda871c7
[ "MIT" ]
permissive
TambourineReindeer/populousmapviewer
7d4e990fe7f58948cd18c88b859345cb1a1ca2d3
b1157b4c0bbe024e2d3ff8fedc9d02aa2974fcb9
refs/heads/master
2016-09-13T19:30:37.374299
2010-11-28T12:33:58
2010-11-28T12:33:58
56,489,769
1
1
null
null
null
null
UTF-8
C++
false
false
1,366
h
//Copyright (c) 2010 Omkar Kanase // //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 <Windows.h> #include <gl/GL.h> #include <gl/GLU.h> #include "MapView.h" class GLWin { bool init; HDC dc; HGLRC gldc; HWND hWnd; public: GLWin(HWND hWnd); ~GLWin(); void Update(); bool GetInit(); void Release(); };
[ [ [ 1, 39 ] ] ]
69904a07590afeccc42dfe6cd13dd1a91d5e5884
535d66763ae4d6957b7ca38f1c940720ed34fcfe
/ParameterDialog.cpp
eea24d15d5262bdbd0408860fba9db68b5085edd
[]
no_license
beru/pngquant_gui
b038ed2d47417beb9b310274b236d96f7585d922
f883848b1fd14c5c30fdc0683739f3cbfa412499
refs/heads/master
2021-01-01T18:07:45.246457
2011-10-16T14:06:38
2011-10-16T14:06:38
2,585,340
0
0
null
null
null
null
UTF-8
C++
false
false
1,454
cpp
// This file was generated by WTL Dialog wizard // ParameterDialog.cpp : Implementation of CParameterDialog #include "stdafx.h" #include "ParameterDialog.h" // CParameterDialog CParameterDialog::CParameterDialog() { } CParameterDialog::~CParameterDialog() { } LRESULT CParameterDialog::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { DoDataExchange(); m_wndSpinColor.SetRange(2, 256); m_wndSpinSpeed.SetRange(1, 10); m_wndSpinColor.SetPos(16); m_wndSpinSpeed.SetPos(3); return 1; // Let the system set the focus } LRESULT CParameterDialog::OnClickedOK(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { // DoDataExchange(TRUE); // EndDialog(wID); return 0; } LRESULT CParameterDialog::OnClickedCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { // EndDialog(wID); return 0; } void CParameterDialog::onChange() { if (m_onParameterChangeDelegate) { m_onParameterChangeDelegate(GetParameter()); } } LRESULT CParameterDialog::OnBnClickedButtonUpdate(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/) { onChange(); return 0; } Parameter CParameterDialog::GetParameter() { Parameter param; param.nofs = IsDlgButtonChecked(IDC_CHECK_NOFS); param.speed = m_wndSpinSpeed.GetPos(); param.color = m_wndSpinColor.GetPos(); param.iebug = IsDlgButtonChecked(IDC_CHECK_IEBUG); return param; }
[ [ [ 1, 65 ] ] ]
f77b4d2f05366722285a8a92728740812bed2d2d
18760393ff08e9bdefbef1d5ef054065c59cedbc
/Source/KaroTestGUI/KaroEngine/VisitedList.cpp
adfca3b6ca4cf29dea21ae5585799a2117379c7d
[]
no_license
robertraaijmakers/koppijn
530d0b0111c8416ea7a688c3e5627fd421b41068
5af4f9c8472570aa2f2a70e170e671c6e338c3c6
refs/heads/master
2021-01-17T22:13:45.697435
2011-06-23T19:27:59
2011-06-23T19:27:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
564
cpp
#include "StdAfx.h" #include "VisitedList.h" VisitedList::VisitedList(void) {} int VisitedList::Size(){ return this->visitedList.size(); } bool VisitedList::isInArray(int index){ map<int,int>::iterator iter; iter = this->visitedList.find(index); if (iter != this->visitedList.end()) { //index is found in the map return true; } else{ return false; } } void VisitedList::insertAt(int index){ this->visitedList.insert(std::pair<int,int>(index, index)); } void VisitedList::Clear(){ this->visitedList.clear(); }
[ [ [ 1, 29 ] ] ]
e14e8fee0b3d609cb3f46769864efe5b75c4454f
2b80036db6f86012afcc7bc55431355fc3234058
/src/core/Indexer.h
c187919361774203553bcf2c787833f084e0a354
[ "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-9
C++
false
false
4,631
h
////////////////////////////////////////////////////////////////////////////// // // License Agreement: // // The following are Copyright © 2008, Daniel Önnerby // // 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. // ////////////////////////////////////////////////////////////////////////////// #pragma once //#include <core/config.h> #include <core/ThreadHelper.h> #include <core/db/Connection.h> #include <core/Plugin/IMetaDataReader.h> #include <sigslot/sigslot.h> #include <boost/thread/thread.hpp> //#include <boost/thread/condition.hpp> //#include <boost/thread/mutex.hpp> #include <deque> #include <vector> ////////////////////////////////////////////////////////////////////////////// namespace musik{ namespace core{ ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////// ///\brief ///The Indexer is the class that syncronizes musik tracks with the database /// ///The Indexer is often a member of classes like the LocalDB ///but can also be used as a standalone class for indexing files. ///All you need to do is create a Indexer object and call Startup() ////////////////////////////////////////// class Indexer : public ThreadHelper,private boost::noncopyable { public: Indexer(void); ~Indexer(void); void AddPath(utfstring sPath); void RemovePath(utfstring sPath); std::vector<utfstring> GetPaths(); bool Startup(utfstring setLibraryPath); void ThreadLoop(); utfstring GetStatus(); void RestartSync(bool bNewRestart=true); bool Restarted(); utfstring database; sigslot::signal0<> SynchronizeStart; sigslot::signal0<> SynchronizeEnd; sigslot::signal0<> PathsUpdated; sigslot::signal0<> TrackRefreshed; private: db::Connection dbConnection; utfstring libraryPath; int status; bool restart; boost::thread *thread; boost::mutex progressMutex; double progress; double progress2; int nofFiles; int filesIndexed; int filesSaved; void CountFiles(utfstring &sFolder); void Synchronize(); void SyncDirectory(utfstring &sFolder,DBINT iParentFolderId,DBINT iPathId,utfstring &syncPath); void SyncDelete(std::vector<DBINT> aPaths); void SyncCleanup(); void SyncAddRemovePaths(); void SyncOptimize(); void RunAnalyzers(); class _AddRemovePath{ public: bool add; utfstring path; }; typedef std::vector<boost::shared_ptr<Plugin::IMetaDataReader> > MetadataReaderList; std::deque<_AddRemovePath> addRemoveQueue; MetadataReaderList metadataReaders; }; ////////////////////////////////////////////////////////////////////////////// } } // musik::core //////////////////////////////////////////////////////////////////////////////
[ "onnerby@6a861d04-ae47-0410-a6da-2d49beace72e", "urioxis@6a861d04-ae47-0410-a6da-2d49beace72e", "[email protected]@6a861d04-ae47-0410-a6da-2d49beace72e" ]
[ [ [ 1, 38 ], [ 40, 47 ], [ 50, 51 ], [ 53, 67 ], [ 69, 88 ], [ 90, 95 ], [ 98, 98 ], [ 101, 101 ], [ 107, 115 ], [ 117, 136 ] ], [ [ 39, 39 ], [ 48, 49 ], [ 52, 52 ], [ 68, 68 ] ], [ [ 89, 89 ], [ 96, 97 ], [ 99, 100 ], [ 102, 106 ], [ 116, 116 ] ] ]
d4b35ca6fa757b9e479f61095e7daa57897a0e29
1cc5720e245ca0d8083b0f12806a5c8b13b5cf98
/v101/ok/10127/c.cpp
c663116cd4eab87bfe97b2e8bf47b1034684c5e7
[]
no_license
Emerson21/uva-problems
399d82d93b563e3018921eaff12ca545415fd782
3079bdd1cd17087cf54b08c60e2d52dbd0118556
refs/heads/master
2021-01-18T09:12:23.069387
2010-12-15T00:38:34
2010-12-15T00:38:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
236
cpp
#include <iostream> using namespace std; int main() { long v,val; int i; while((cin >> v)) { val=1;i=1; while(true) { if(val%v==0) break; val = (val%v)*10+1; i++; } cout << i << endl; } return 0; }
[ [ [ 1, 16 ] ] ]
af21517a1764b09163f26f132b99ddce78b8035a
40b507c2dde13d14bb75ee1b3c16b4f3f82912d1
/public/extensions/IBinTools.h
beda6ee6bed68b00a4dd1051bd0e83fbb51d3d2f
[]
no_license
Nephyrin/-furry-octo-nemesis
5da2ef75883ebc4040e359a6679da64ad8848020
dd441c39bd74eda2b9857540dcac1d98706de1de
refs/heads/master
2016-09-06T01:12:49.611637
2008-09-14T08:42:28
2008-09-14T08:42:28
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,283
h
/** * vim: set ts=4 : * ============================================================================= * SourceMod BinTools Extension * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved. * ============================================================================= * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License, version 3.0, as published by the * Free Software Foundation. * * 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, see <http://www.gnu.org/licenses/>. * * As a special exception, AlliedModders LLC gives you permission to link the * code of this program (as well as its derivative works) to "Half-Life 2," the * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software * by the Valve Corporation. You must obey the GNU General Public License in * all respects for all other code used. Additionally, AlliedModders LLC grants * this exception to all derivative works. AlliedModders LLC defines further * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007), * or <http://www.sourcemod.net/license.php>. * * Version: $Id$ */ #ifndef _INCLUDE_SMEXT_BINTOOLS_H_ #define _INCLUDE_SMEXT_BINTOOLS_H_ #include <IShareSys.h> #define SMINTERFACE_BINTOOLS_NAME "IBinTools" #define SMINTERFACE_BINTOOLS_VERSION 2 /** * @brief Function calling encoding utilities * @file IBinTools.h */ namespace SourceMod { /** * @brief Supported calling conventions */ enum CallConvention { CallConv_ThisCall, /**< This call (object pointer required) */ CallConv_Cdecl, /**< Standard C call */ }; /** * @brief Describes how a parameter should be passed */ enum PassType { PassType_Basic, /**< Plain old register data (pointers, integers) */ PassType_Float, /**< Floating point data */ PassType_Object, /**< Object or structure */ }; #define PASSFLAG_BYVAL (1<<0) /**< Passing by value */ #define PASSFLAG_BYREF (1<<1) /**< Passing by reference */ #define PASSFLAG_ODTOR (1<<2) /**< Object has a destructor */ #define PASSFLAG_OCTOR (1<<3) /**< Object has a constructor */ #define PASSFLAG_OASSIGNOP (1<<4) /**< Object has an assignment operator */ /** * @brief Parameter passing information */ struct PassInfo { PassType type; /**< PassType value */ unsigned int flags; /**< Pass/return flags */ size_t size; /**< Size of the data being passed */ }; /** * @brief Parameter encoding information */ struct PassEncode { PassInfo info; /**< Parameter information */ size_t offset; /**< Offset into the virtual stack */ }; /** * @brief Wraps a C/C++ call. */ class ICallWrapper { public: /** * @brief Returns the calling convention. * * @return CallConvention value. */ virtual CallConvention GetCallConvention() =0; /** * @brief Returns parameter info. * * @param num Parameter number to get (starting from 0). * @return A PassInfo pointer. */ virtual const PassEncode *GetParamInfo(unsigned int num) =0; /** * @brief Returns return type info. * * @return A PassInfo pointer. */ virtual const PassInfo *GetReturnInfo() =0; /** * @brief Returns the number of parameters. * * @return Number of parameters. */ virtual unsigned int GetParamCount() =0; /** * @brief Execute the contained function. * * @param vParamStack A blob of memory containing stack data. * @param retBuffer Buffer to store return value. */ virtual void Execute(void *vParamStack, void *retBuffer) =0; /** * @brief Destroys all resources used by this object. */ virtual void Destroy() =0; }; /** * @brief Binary tools interface. */ class IBinTools : public SMInterface { public: virtual const char *GetInterfaceName() { return SMINTERFACE_BINTOOLS_NAME; } virtual unsigned int GetInterfaceVersion() { return SMINTERFACE_BINTOOLS_VERSION; } public: /** * @brief Creates a call decoder. * * Note: CallConv_ThisCall requires an implicit first parameter * of PassType_Basic / PASSFLAG_BYVAL / sizeof(void *). However, * this should only be given to the Execute() function, and never * listed in the paramInfo array. * * @param address Address to use as a call. * @param cv Calling convention. * @param retInfo Return type information, or NULL for void. * @param paramInfo Array of parameters. * @param numParams Number of parameters in the array. * @return A new ICallWrapper function. */ virtual ICallWrapper *CreateCall(void *address, CallConvention cv, const PassInfo *retInfo, const PassInfo paramInfo[], unsigned int numParams) =0; /** * @brief Creates a vtable call decoder. * * Note: CallConv_ThisCall requires an implicit first parameter * of PassType_Basic / PASSFLAG_BYVAL / sizeof(void *). However, * this should only be given to the Execute() function, and never * listed in the paramInfo array. * * @param vtblIdx Index into the virtual table. * @param vtblOffs Offset of the virtual table. * @param thisOffs Offset of the this pointer of the virtual table. * @param retInfo Return type information, or NULL for void. * @param paramInfo Array of parameters. * @param numParams Number of parameters in the array. * @return A new ICallWrapper function. */ virtual ICallWrapper *CreateVCall(unsigned int vtblIdx, unsigned int vtblOffs, unsigned int thisOffs, const PassInfo *retInfo, const PassInfo paramInfo[], unsigned int numParams) =0; }; } #endif //_INCLUDE_SMEXT_BINTOOLS_H_
[ [ [ 1, 2 ], [ 7, 7 ], [ 11, 11 ], [ 28, 37 ], [ 39, 120 ], [ 123, 127 ], [ 131, 132 ], [ 138, 201 ] ], [ [ 3, 3 ], [ 6, 6 ], [ 8, 10 ], [ 12, 15 ], [ 17, 18 ], [ 20, 27 ] ], [ [ 4, 5 ], [ 16, 16 ], [ 19, 19 ], [ 38, 38 ], [ 121, 122 ], [ 128, 130 ], [ 133, 137 ] ] ]
6a5f91de5c39233815c5a9f710d2abb0cf9c1dd1
c0bd82eb640d8594f2d2b76262566288676b8395
/src/game/Creature.h
e767641c2e8bf61ef5d810d03143bc4a0a1a4be5
[ "FSFUL" ]
permissive
vata/solution
4c6551b9253d8f23ad5e72f4a96fc80e55e583c9
774fca057d12a906128f9231831ae2e10a947da6
refs/heads/master
2021-01-10T02:08:50.032837
2007-11-13T22:01:17
2007-11-13T22:01:17
45,352,930
0
1
null
null
null
null
UTF-8
C++
false
false
11,739
h
// Copyright (C) 2004 WoW Daemon // // 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 WOWSERVER_CREATURE_H #define WOWSERVER_CREATURE_H class CreatureTemplate; #define MAX_CREATURE_ITEMS 128 #define MAX_CREATURE_LOOT 8 #define MAX_PET_SPELL 4 struct CreatureItem { uint32 itemid; int amount; }; struct CreatureInfo { uint32 Id; std::string Name; std::string SubName; uint32 Flags1; uint32 Type; uint32 Family; uint32 Rank; uint32 Unknown1; uint32 SpellDataID; uint32 DisplayID; uint8 Civilian; uint8 Leader; }; struct CreatureSpawnTemplate { uint32 EntryID; uint32 MaxHealth; uint32 MaxMana; uint32 Armor; uint32 Level; uint32 Faction; uint32 Flag; float Scale; float Speed; float MinDamage; float MaxDamage; float MinRangedDamage; float MaxRangedDamage; uint32 BaseAttackTime; uint32 RangedAttackTime; float BoundingRadius; float CombatReach; uint32 MountModelID; uint32 Slot1Model; uint8 Slot1Info1; uint8 Slot1Info2; uint8 Slot1Info3; uint8 Slot1Info4; uint8 Slot1Info5; uint32 Slot2Model; uint8 Slot2Info1; uint8 Slot2Info2; uint8 Slot2Info3; uint8 Slot2Info4; uint8 Slot2Info5; uint32 Slot3Model; uint8 Slot3Info1; uint8 Slot3Info2; uint8 Slot3Info3; uint8 Slot3Info4; uint8 Slot3Info5; }; enum UNIT_TYPE { NOUNITTYPE = 0, BEAST = 1, DRAGONSKIN = 2, DEMON = 3, ELEMENTAL = 4, GIANT = 5, UNDEAD = 6, HUMANOID = 7, CRITTER = 8, MECHANICAL = 9, UNIT_TYPE_MISC = 10, }; enum FAMILY { FAMILY_WOLF = 1, FAMILY_CAT, FAMILY_SPIDER, FAMILY_BEAR, FAMILY_BOAR, FAMILY_CROCILISK, FAMILY_CARRION_BIRD, FAMILY_CRAB, FAMILY_GORILLA, FAMILY_RAPTOR = 11, FAMILY_TALLSTRIDER , FAMILY_FELHUNTER = 15, FAMILY_VOIDWALKER, FAMILY_SUCCUBUS, FAMILY_DOOMGUARD = 19, FAMILY_SCORPID, FAMILY_TURTLE, FAMILY_IMP = 23, FAMILY_BAT, FAMILY_HYENA, FAMILY_OWL, FAMILY_WIND_SERPENT }; enum ELITE { ELITE_NORMAL = 0, ELITE_ELITE, ELITE_RAREELITE, ELITE_WORLDBOSS, ELITE_RARE }; struct PetSpellCooldown { uint32 spellId; int32 cooldown; }; class CreatureAIScript; class GossipScript; struct Trainer; #define CALL_SCRIPT_EVENT(obj, func) if(obj->GetTypeId() == TYPEID_UNIT && static_cast<Creature*>(obj)->GetScript() != NULL) static_cast<Creature*>(obj)->GetScript()->func /////////////////// /// Creature object class WOWD_SERVER_DECL Creature : public Unit { public: Creature(uint32 high, uint32 low); virtual ~Creature(); void AddToWorld(); void RemoveFromWorld(); /// Creation void Create ( const char* creature_name, uint32 mapid, float x, float y, float z, float ang); void Create ( CreatureSpawnTemplate *pSpawnTemplate, uint32 mapid, float x, float y, float z, float ang ); void CreateWayPoint ( uint32 WayPointID, uint32 mapid, float x, float y, float z, float ang); /// Updates virtual void Update( uint32 time ); /// Creature inventory inline uint32 GetItemIdBySlot(uint32 slot) { return m_SellItems->at(slot).itemid; } inline uint32 GetItemAmountBySlot(uint32 slot) { return m_SellItems->at(slot).amount; } inline bool HasItems() { return ((m_SellItems != NULL) ? true : false); } int32 GetSlotByItemId(uint32 itemid) { uint32 slot = 0; for(std::vector<CreatureItem>::iterator itr = m_SellItems->begin(); itr != m_SellItems->end(); ++itr) { if(itr->itemid == itemid) return slot; else ++slot; } return -1; } uint32 GetItemAmountByItemId(uint32 itemid) { for(std::vector<CreatureItem>::iterator itr = m_SellItems->begin(); itr != m_SellItems->end(); ++itr) { if(itr->itemid == itemid) return ((itr->amount < 1) ? 1 : itr->amount); } return 0; } inline void GetSellItemBySlot(uint32 slot, CreatureItem &ci) { ci = m_SellItems->at(slot); } void GetSellItemByItemId(uint32 itemid, CreatureItem &ci) { for(std::vector<CreatureItem>::iterator itr = m_SellItems->begin(); itr != m_SellItems->end(); ++itr) { if(itr->itemid == itemid) { ci = (*itr); return; } } ci.amount = 0; ci.itemid = 0; } inline std::vector<CreatureItem>::iterator GetSellItemBegin() { return m_SellItems->begin(); } inline std::vector<CreatureItem>::iterator GetSellItemEnd() { return m_SellItems->end(); } inline uint32 GetSellItemCount() { return m_SellItems->size(); } void RemoveVendorItem(uint32 itemid) { for(std::vector<CreatureItem>::iterator itr = m_SellItems->begin(); itr != m_SellItems->end(); ++itr) { if(itr->itemid == itemid) { m_SellItems->erase(itr); return; } } } void AddVendorItem(uint32 itemid, uint32 amount); /// Quests void _LoadQuests(); bool HasQuests() { return m_quests != NULL; }; bool HasQuest(uint32 id, uint32 type) { if(!m_quests) return false; for(std::list<QuestRelation*>::iterator itr = m_quests->begin(); itr != m_quests->end(); ++itr) { if((*itr)->qst->id == id && (*itr)->type & type) return true; } return false; } void AddQuest(QuestRelation *Q); void DeleteQuest(QuestRelation *Q); Quest *FindQuest(uint32 quest_id, uint8 quest_relation); uint16 GetQuestRelation(uint32 quest_id); uint32 NumOfQuests(); list<QuestRelation *>::iterator QuestsBegin() { return m_quests->begin(); }; list<QuestRelation *>::iterator QuestsEnd() { return m_quests->end(); }; void SetQuestList(std::list<QuestRelation *>* qst_lst) { m_quests = qst_lst; }; inline bool isQuestGiver() { return HasFlag( UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER ); }; int32 FlatResistanceMod[7]; int32 BaseResistanceModPct[7]; int32 ResistanceModPct[7]; int32 FlatStatMod[5]; int32 StatModPct[5]; int32 TotalStatModPct[5]; int32 ModDamageDone[7]; float ModDamageDonePct[7]; void CalcResistance(uint32 type); void CalcStat(uint32 type); void RegenerateHealth(); void RegenerateMana(); inline bool CanSee(Unit* obj) { if(!obj->m_stealth) return true; float visibility = (float)GetStealthDetect()/(float)obj->GetStealthLevel(); float invisRange = visibility * 3 + GetFloatValue (UNIT_FIELD_BOUNDINGRADIUS) +obj->GetFloatValue (UNIT_FIELD_BOUNDINGRADIUS); if (GetDistance2dSq (obj) <= invisRange * invisRange) return true; else return false; } //Make this unit face another unit bool setInFront(Unit* target); /// Looting void generateLoot(); bool Skinned; bool Tagged; uint64 TaggerGuid; /// Name const char* GetName() const { return m_name.c_str(); }; void SetName(const char* name) { m_name = name; } /// Misc inline void setEmoteState(uint8 emote) { m_emoteState = emote; }; inline uint32 getNameEntry() { return m_nameEntry; }; inline uint32 GetSQL_id() { return m_sqlid; }; virtual void setDeathState(DeathState s); uint32 GetOldEmote() { return m_oldEmote; } // Serialization void SaveToDB(); void SaveToFile(std::stringstream & name); bool LoadFromDB(uint32 guid); bool LoadFromDB(CreatureTemplate *t); void LoadAIAgents(CreatureTemplate * t); void LoadAIAgents(); void DeleteFromDB(); /// Respawn Coordinates float respawn_cord[4]; void OnJustDied(); void OnRemoveCorpse(); void OnRespawn(); void SafeDelete(); void DeleteMe(); void Despawn(); // Temp void _LoadHealth(); void _ApplyHealth(CreatureTemplate * t); // In Range void AddInRangeObject(Object* pObj); void RemoveInRangeObject(Object* pObj); void ClearInRangeSet(); // Demon void EnslaveExpire(); // Pet void UpdatePet(); uint32 GetEnslaveCount() { return m_enslaveCount; } void SetEnslaveCount(uint32 count) { m_enslaveCount = count; } uint32 GetEnslaveSpell() { return m_enslaveSpell; } void SetEnslaveSpell(uint32 spellId) { m_enslaveSpell = spellId; } bool RemoveEnslave(); inline Player *GetTotemOwner() { return totemOwner; } inline void SetTotemOwner(Player *owner) { totemOwner = owner; } inline uint32 GetTotemSlot() { return totemSlot; } inline void SetTotemSlot(uint32 slot) { totemSlot = slot; } inline bool IsPickPocketed() { return m_PickPocketed; } inline void SetPickPocketed(bool val = true) { m_PickPocketed = val; } bool m_BeingRemoved; inline CreatureAIScript * GetScript() { return _myScriptClass; } void LoadScript(); void LoadProperties(); void CallScriptUpdate(); uint32 m_TaxiNode; inline GossipScript* GetGossipScript() { return _gossipScript; } inline void SetGossipScript(GossipScript* GS) { _gossipScript = GS; } inline Trainer* GetTrainer() { return mTrainer; } void RegenerateFocus(); CreatureFamilyEntry * myFamily; inline bool IsTotem() { return totemOwner != 0 && totemSlot != -1; } void TotemExpire(); void FormationLinkUp(uint32 SqlId); bool haslinkupevent; WayPoint * CreateWaypointStruct(); protected: CreatureAIScript *_myScriptClass; GossipScript *_gossipScript; Trainer* mTrainer; void _LoadGoods(); void _LoadGoods(std::list<CreatureItem*>* lst); void _LoadMovement(); /// Timers uint32 m_deathTimer; // timer for death or corpse disappearance uint32 m_respawnTimer; // timer for respawn to happen uint32 m_respawnDelay; // delay between corpse disappearance and respawning uint32 m_corpseDelay; // delay between death and corpse disappearance /// Vendor data std::vector<CreatureItem>* m_SellItems; /// Taxi data uint32 mTaxiNode; /// Quest data std::list<QuestRelation *>* m_quests; /// Misc std::string m_name; uint32 m_nameEntry; uint32 m_sqlid; /// Pet uint32 m_enslaveCount; uint32 m_enslaveSpell; Player * totemOwner; int32 totemSlot; bool m_PickPocketed; }; #endif
[ [ [ 1, 421 ] ] ]
b239fadc2831e732325ff65d58ffa0c70d12702d
f87f0a2e6c60be6dd7d126dfd7342dfb18f37092
/Source/TWM/util/math.hpp
b6d21e4e39d2a043e746560556ac13544e1380c7
[ "MIT" ]
permissive
SamOatesUniversity/Year-2---Animation-Simulation---PigDust
aa2d9d3a6564abd5440b8e9fdc0e24f65a44d75c
2948d39d5e24137b25c91878eaeebe3c8e9e00d1
refs/heads/master
2021-01-10T20:10:29.003591
2011-04-29T20:45:19
2011-04-29T20:45:19
41,170,833
0
0
null
null
null
null
UTF-8
C++
false
false
3,368
hpp
/* Copyright (c) 2010 Tyrone Davison, Teesside University 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. */ #pragma once #ifndef __TWM_UTIL_MATH__ #define __TWM_UTIL_MATH__ #define _USE_MATH_DEFINES #include <cmath> #include "twm/core/types.hpp" namespace twm { Vector Cross( const Vector&, const Vector& ); float Dot( const Vector&, const Vector& ); float Length( const Vector& ); Vector Unit( const Vector& ); Vector Standardize( const HVector& ); Vector Truncate( const HVector& ); Matrix Inverse( const Matrix& ); Matrix Transpose( const Matrix& ); namespace operators { Vector operator-( const Vector& ); Vector operator+( const Vector&, const Vector& ); Vector operator-( const Vector&, const Vector& ); Vector operator*( float, const Vector& ); Vector operator*( const Vector&, float ); Vector operator/( const Vector&, float ); const Vector& operator+=( Vector&, const Vector& ); const Vector& operator-=( Vector&, const Vector& ); const Vector& operator*=( Vector&, float ); const Vector& operator/=( Vector&, float ); HVector operator* ( const HVector&, const Matrix& ); HVector operator* ( const Matrix&, const HVector& ); const Matrix& operator*=( Matrix&, const Matrix& ); const Matrix& operator+=( Matrix&, const Matrix& ); const Matrix& operator-=( Matrix&, const Matrix& ); const Matrix& operator*=( Matrix&, float ); Matrix operator*( const Matrix&, const Matrix& ); Matrix operator*( const Matrix&, float ); Matrix operator*( float, const Matrix& ); Matrix operator+( const Matrix&, const Matrix& ); Matrix operator-( const Matrix&, const Matrix& ); Colour operator-( const Colour& ); Colour operator+( const Colour&, const Colour& ); Colour operator-( const Colour&, const Colour& ); Colour operator*( const Colour&, const Colour& ); Colour operator*( float, const Colour& ); Colour operator*( const Colour&, float ); Colour operator/( const Colour&, float ); const Colour& operator+=( Colour&, const Colour& ); const Colour& operator-=( Colour&, const Colour& ); const Colour& operator*=( Colour&, const Colour& ); const Colour& operator*=( Colour&, float ); const Colour& operator/=( Colour&, float ); } } #endif
[ [ [ 1, 88 ] ] ]
9fe2bd3f163a1d3252777fd8a08de9ae17e628bb
89d2197ed4531892f005d7ee3804774202b1cb8d
/GWEN/src/Controls/TextBox.cpp
e4bdd38018a30d9cb9869b618543ff33e8b250cd
[ "MIT", "Zlib" ]
permissive
hpidcock/gbsfml
ef8172b6c62b1c17d71d59aec9a7ff2da0131d23
e3aa990dff8c6b95aef92bab3e94affb978409f2
refs/heads/master
2020-05-30T15:01:19.182234
2010-09-29T06:53:53
2010-09-29T06:53:53
35,650,825
0
0
null
null
null
null
UTF-8
C++
false
false
7,798
cpp
/* GWEN Copyright (c) 2010 Facepunch Studios See license in Gwen.h */ #include "stdafx.h" #include "Gwen/Gwen.h" #include "Gwen/Controls/TextBox.h" #include "Gwen/Skin.h" #include "Gwen/Utility.h" #include "Gwen/Platform.h" using namespace Gwen; using namespace Gwen::Controls; GWEN_CONTROL_CONSTRUCTOR( TextBox ) { SetSize( 200, 20 ); SetMouseInputEnabled( true ); SetKeyboardInputEnabled( true ); SetAlignment( Pos::Left | Pos::CenterV ); SetTextPadding( Padding( 4, 2, 4, 2 ) ); m_iCursorPos = 0; m_iCursorEnd = 0; m_bSelectAll = false; SetTextColor( Gwen::Color( 50, 50, 50, 255 ) ); // TODO: From Skin SetTabable( true ); AddAccelerator( L"Ctrl + c", &TextBox::OnCopy ); AddAccelerator( L"Ctrl + x", &TextBox::OnCut ); AddAccelerator( L"Ctrl + v", &TextBox::OnPaste ); AddAccelerator( L"Ctrl + a", &TextBox::OnSelectAll ); } bool TextBox::OnChar( Gwen::UnicodeChar c ) { if ( c == '\t' ) return false; Gwen::UnicodeString str; str += c; InsertText( str ); return true; } void TextBox::InsertText( const Gwen::UnicodeString& strInsert ) { // TODO: Make sure fits (implement maxlength) // TODO: Make sure content is right (numberic only?) if ( HasSelection() ) { EraseSelection(); } if ( m_iCursorPos > TextLength() ) m_iCursorPos = TextLength(); if ( !IsTextAllowed( strInsert, m_iCursorPos ) ) return; UnicodeString str = GetText(); str.insert( m_iCursorPos, strInsert ); SetText( str ); m_iCursorPos += (int) strInsert.size(); m_iCursorEnd = m_iCursorPos; RefreshCursorBounds(); } void TextBox::Render( Skin::Base* skin ) { if ( ShouldDrawBackground() ) skin->DrawTextBox( this ); if ( !HasFocus() ) return; if ( m_rectCursorBounds.w == 1 ) { skin->GetRender()->SetDrawColor( Gwen::Color( 0, 0, 0, 200 ) ); skin->GetRender()->DrawFilledRect( m_rectCursorBounds ); } else { skin->GetRender()->SetDrawColor( Gwen::Color( 50, 150, 255, 250 ) ); skin->GetRender()->DrawFilledRect( m_rectCursorBounds ); } } void TextBox::RefreshCursorBounds() { MakeCaratVisible(); Point pA = GetCharacterPosition( m_iCursorPos ); Point pB = GetCharacterPosition( m_iCursorEnd ); m_rectCursorBounds.x = Utility::Min( pA.x, pB.x ); m_rectCursorBounds.y = m_Text->Y() - 1; m_rectCursorBounds.w = Utility::Max( pA.x, pB.x ) - m_rectCursorBounds.x; m_rectCursorBounds.h = m_Text->Height() + 2; if ( m_iCursorPos == m_iCursorEnd ) { m_rectCursorBounds.w = 1; } Redraw(); } void TextBox::OnPaste() { InsertText( Platform::GetClipboardText() ); } void TextBox::OnCopy() { if ( !HasSelection() ) return; Platform::SetClipboardText( GetSelection() ); } void TextBox::OnCut() { if ( !HasSelection() ) return; Platform::SetClipboardText( GetSelection() ); EraseSelection(); } void TextBox::OnSelectAll() { m_iCursorEnd = 0; m_iCursorPos = TextLength(); RefreshCursorBounds(); } void TextBox::OnMouseDoubleClickLeft( int x, int y ) { OnSelectAll(); } UnicodeString TextBox::GetSelection() { if ( !HasSelection() ) return L""; int iStart = Utility::Min( m_iCursorPos, m_iCursorEnd ); int iEnd = Utility::Max( m_iCursorPos, m_iCursorEnd ); const UnicodeString& str = GetText(); return str.substr( iStart, iEnd - iStart ); } bool TextBox::OnKeyReturn( bool bDown ) { if ( bDown ) return true; OnEnter(); // Try to move to the next control, as if tab had been pressed OnKeyTab( true ); // If we still have focus, blur it. if ( HasFocus() ) { Blur(); } return true; } bool TextBox::OnKeyBackspace( bool bDown ) { if ( !bDown ) return true; if ( HasSelection() ) { EraseSelection(); return true; } if ( m_iCursorPos == 0 ) return true; DeleteText( m_iCursorPos-1, 1 ); return true; } bool TextBox::OnKeyDelete( bool bDown ) { if ( !bDown ) return true; if ( HasSelection() ) { EraseSelection(); return true; } if ( m_iCursorPos >= TextLength() ) return true; DeleteText( m_iCursorPos, 1 ); return true; } bool TextBox::OnKeyLeft( bool bDown ) { if ( !bDown ) return true; if ( m_iCursorPos > 0 ) m_iCursorPos--; if ( !Gwen::Input::IsKeyDown( Key::Shift ) ) { m_iCursorEnd = m_iCursorPos; } RefreshCursorBounds(); return true; } bool TextBox::OnKeyRight( bool bDown ) { if ( !bDown ) return true; if ( m_iCursorPos < TextLength() ) m_iCursorPos++; if ( !Gwen::Input::IsKeyDown( Key::Shift ) ) { m_iCursorEnd = m_iCursorPos; } RefreshCursorBounds(); return true; } bool TextBox::OnKeyHome( bool bDown ) { if ( !bDown ) return true; m_iCursorPos = 0; if ( !Gwen::Input::IsKeyDown( Key::Shift ) ) { m_iCursorEnd = m_iCursorPos; } RefreshCursorBounds(); return true; } bool TextBox::OnKeyEnd( bool bDown ) { m_iCursorPos = TextLength(); if ( !Gwen::Input::IsKeyDown( Key::Shift ) ) { m_iCursorEnd = m_iCursorPos; } RefreshCursorBounds(); return true; } void TextBox::SetCursorPos( int i ) { if ( m_iCursorPos == i ) return; m_iCursorPos = i; RefreshCursorBounds(); } void TextBox::SetCursorEnd( int i ) { if ( m_iCursorEnd == i ) return; m_iCursorEnd = i; RefreshCursorBounds(); } void TextBox::DeleteText( int iStartPos, int iLength ) { UnicodeString str = GetText(); str.erase( iStartPos, iLength ); SetText( str ); if ( m_iCursorPos > iStartPos ) { SetCursorPos( m_iCursorPos - iLength ); } SetCursorEnd( m_iCursorPos ); } bool TextBox::HasSelection() { return m_iCursorPos != m_iCursorEnd; } void TextBox::EraseSelection() { int iStart = Utility::Min( m_iCursorPos, m_iCursorEnd ); int iEnd = Utility::Max( m_iCursorPos, m_iCursorEnd ); DeleteText( iStart, iEnd - iStart ); } void TextBox::OnMouseClickLeft( int x, int y, bool bDown ) { if ( m_bSelectAll ) { OnSelectAll(); m_bSelectAll = false; return; } int iChar = m_Text->GetClosestCharacter( m_Text->CanvasPosToLocal( Point( x, y ) ) ); if ( bDown ) { SetCursorPos( iChar ); if ( !Gwen::Input::IsKeyDown( Key::Shift ) ) SetCursorEnd( iChar ); Gwen::MouseFocus = this; } else { if ( Gwen::MouseFocus == this ) { SetCursorPos( iChar ); Gwen::MouseFocus = NULL; } } } void TextBox::OnMouseMoved( int x, int y, int deltaX, int deltaY ) { if ( Gwen::MouseFocus != this ) return; int iChar = m_Text->GetClosestCharacter( m_Text->CanvasPosToLocal( Point( x, y ) ) ); SetCursorPos( iChar ); } void TextBox::MakeCaratVisible() { int iCaratPos = m_Text->GetCharacterPosition( m_iCursorPos ).x; // If the carat is already in a semi-good position, leave it. { int iRealCaratPos = iCaratPos + m_Text->X(); if ( iRealCaratPos > Width() * 0.1f && iRealCaratPos < Width() * 0.9f ) return; } // The ideal position is for the carat to be right in the middle int idealx = -iCaratPos + Width() * 0.5f;; // Don't show too much whitespace to the right if ( idealx + m_Text->Width() < Width() - m_rTextPadding.right ) idealx = -m_Text->Width() + (Width() - m_rTextPadding.right ); // Or the left if ( idealx > m_rTextPadding.left ) idealx = m_rTextPadding.left; m_Text->SetPos( idealx, m_Text->Y() ); } void TextBox::Layout( Skin::Base* skin ) { BaseClass::Layout( skin ); RefreshCursorBounds(); } void TextBox::OnTextChanged() { if ( m_iCursorPos > TextLength() ) m_iCursorPos = TextLength(); if ( m_iCursorEnd > TextLength() ) m_iCursorEnd = TextLength(); onTextChanged.Call( this ); } void TextBox::OnEnter() { onReturnPressed.Call( this ); }
[ "haza55@5bf3a77f-ad06-ad18-b9fb-7d0f6dabd793" ]
[ [ [ 1, 402 ] ] ]
a6584b5e9f6758f03bf6f692d51eeb70ab62a748
7b4c786d4258ce4421b1e7bcca9011d4eeb50083
/_20090206_代码统计专用文件夹/C++Primer中文版(第4版)/第一章 快速入门/20090114_习题1.11_输出10到0递减的自然数.cpp
a090af86d337d88e5dc75885689b65d3df92d983
[]
no_license
lzq123218/guoyishi-works
dbfa42a3e2d3bd4a984a5681e4335814657551ef
4e78c8f2e902589c3f06387374024225f52e5a92
refs/heads/master
2021-12-04T11:11:32.639076
2011-05-30T14:12:43
2011-05-30T14:12:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
147
cpp
#include <iostream> int main() { int i=10; while(i>-0) { std::cout << i << " "; i--; } std::cout << std::endl; return 0; }
[ "baicaibang@70501136-4834-11de-8855-c187e5f49513" ]
[ [ [ 1, 14 ] ] ]
9a3c82b7b40714d5782c54841645768169ef2555
8bbbcc2bd210d5608613c5c591a4c0025ac1f06b
/nes/mapper/099.cpp
425a0f455440809fac58c3e1395301ed46b39c91
[]
no_license
PSP-Archive/NesterJ-takka
140786083b1676aaf91d608882e5f3aaa4d2c53d
41c90388a777c63c731beb185e924820ffd05f93
refs/heads/master
2023-04-16T11:36:56.127438
2008-12-07T01:39:17
2008-12-07T01:39:17
357,617,280
1
0
null
null
null
null
UTF-8
C++
false
false
889
cpp
///////////////////////////////////////////////////////////////////// // Mapper 99 void NES_mapper99_Init() { g_NESmapper.Reset = NES_mapper97_Reset; } void NES_mapper99_Reset() { // set CPU bank pointers if(g_NESmapper.num_8k_ROM_banks > 2) { g_NESmapper.set_CPU_banks4(0,1,2,3); } else if(g_NESmapper.num_8k_ROM_banks > 1) { g_NESmapper.set_CPU_banks4(0,1,0,1); } else { g_NESmapper.set_CPU_banks4(0,0,0,0); } // set VROM bank if(g_NESmapper.num_1k_VROM_banks) { g_NESmapper.set_PPU_banks8(0,1,2,3,4,5,6,7); } } void NES_mapper99_WriteHighRegs(uint32 addr, uint8 data) { if(addr == 0x4016) { if(data & 0x04) { g_NESmapper.set_PPU_banks8(8,9,10,11,12,13,14,15); } else { g_NESmapper.set_PPU_banks8(0,1,2,3,4,5,6,7); } } } /////////////////////////////////////////////////////////////////////
[ "takka@e750ed6d-7236-0410-a570-cc313d6b6496" ]
[ [ [ 1, 47 ] ] ]
3feb781d79e16f03cdbf0acd0849ee2d73de6ebe
c5534a6df16a89e0ae8f53bcd49a6417e8d44409
/trunk/nGENE Proj/DeviceRenderDX9.h
6b1eefcd83b9ea716e314df66d5ef2c4675eb96a
[]
no_license
svn2github/ngene
b2cddacf7ec035aa681d5b8989feab3383dac012
61850134a354816161859fe86c2907c8e73dc113
refs/heads/master
2023-09-03T12:34:18.944872
2011-07-27T19:26:04
2011-07-27T19:26:04
78,163,390
2
0
null
null
null
null
UTF-8
C++
false
false
2,905
h
/* --------------------------------------------------------------------------- This source file is part of nGENE Tech. Copyright (c) 2006- Wojciech Toman This program is free software. File: DeviceRenderDX9.h Version: 0.12 --------------------------------------------------------------------------- */ #pragma once #ifndef __INC_DEVICERENDERDX9_H_ #define __INC_DEVICERENDERDX9_H_ #include <D3D9.h> #include "AutoPointer.h" #include "DeviceRender.h" #include "Prerequisities.h" #include "TypeInfo.h" namespace nGENE { /** A rendering device supporting DirectX 9.0c. @remarks It is obvious that this class could be used on Windows platform only. */ class nGENEDLL DeviceRenderDX9: public DeviceRender { EXPOSE_TYPE private: // Hide assignment operator and copy constructor to prevent // it from being used. DeviceRenderDX9(const DeviceRenderDX9& src); DeviceRenderDX9& operator=(const DeviceRenderDX9& rhs); protected: /// DirectX Direct3D Device IDirect3DDevice9* m_pD3DDev; /// On-screen presentation parameters D3DPRESENT_PARAMETERS& m_Params; /// Direct3D IDirect3D9* m_pD3D; /// Handle to the owner window HWND m_hWnd; /// Device caps. D3DCAPS9 m_DeviceCaps; /// Is PerfHUD enabled (if available)? bool m_bProfile; /// Is multi-threaded flag enabled? bool m_bMultiThreaded; public: /** Creates rendering device. @param d3d a pointer to the Direct3D9 object. @param params parameters of presenting the rendered image on screen. @param type the way the vertices are being processed. */ DeviceRenderDX9(IDirect3D9* _d3d, D3DPRESENT_PARAMETERS& _params, HWND _hwnd=NULL, PROCESSING_TYPE _type=PROCESSING_HARDWARE, bool _profile=false, bool _multiThreaded=false); virtual ~DeviceRenderDX9(); virtual void onDeviceCreate() {} virtual void onDeviceLost(); virtual void onDeviceDestroy() {} /** Tests graphical capabilities of the device. It helps the engine to determine if the application will run properly on the current device. */ virtual bool testCapabilities(nGENE_CAPABILITIES _caps, void* _param); /// Initializes the device. void init(); void cleanup(); virtual void reset(D3DPRESENT_PARAMETERS* _params=NULL); /// Gets the current Direct3D Device. virtual void* getDevicePtr() const; /// Returns pointer to DirectX API object. IDirect3D9* getD3DPtr() const; virtual void beginRender(); virtual void endRender(); }; inline void* DeviceRenderDX9::getDevicePtr() const { return m_pD3DDev; } //---------------------------------------------------------------------- inline IDirect3D9* DeviceRenderDX9::getD3DPtr() const { return m_pD3D; } //---------------------------------------------------------------------- } #endif
[ "Riddlemaster@fdc6060e-f348-4335-9a41-9933a8eecd57" ]
[ [ [ 1, 118 ] ] ]
98774a14704004c91c2dd93efed78b68258b4f07
73c1d366642756888d3c2ce7c57939fda17341cc
/CameraCaptuer/CameraDS.cpp
2b8cf7d62bbdec8460a553b219acdd17f31f3d38
[]
no_license
eeharold/livevideoserver
6bfc7c21929123541a71ad02c4fa1f30453fdfef
d3416cf6c2528880655b46c604ff3334a910eb19
refs/heads/master
2021-01-01T05:24:10.381589
2010-07-18T12:37:37
2010-07-18T12:37:37
56,746,060
1
0
null
null
null
null
GB18030
C++
false
false
14,038
cpp
////////////////////////////////////////////////////////////////////// // Video Capture using DirectShow // Author: Shiqi Yu ([email protected]) // Thanks to: // HardyAI@OpenCV China // flymanbox@OpenCV China (for his contribution to function CameraName, and frame width/height setting) // Last modification: April 9, 2009 ////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// // 使用说明: // 1. 将CameraDS.h CameraDS.cpp以及目录DirectShow复制到你的项目中 // 2. 菜单 Project->Settings->Settings for:(All configurations)->C/C++->Category(Preprocessor)->Additional include directories // 设置为 DirectShow/Include // 3. 菜单 Project->Settings->Settings for:(All configurations)->Link->Category(Input)->Additional library directories // 设置为 DirectShow/Lib ////////////////////////////////////////////////////////////////////// // CameraDS.cpp: implementation of the CCameraDS class. // ////////////////////////////////////////////////////////////////////// //#include "stdafx.h" #include "CameraDS.h" #include "convert.h" #pragma comment(lib,"Strmiids.lib") ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// int CCameraDS::m_iRefCnt = 0; CCameraDS::CCameraDS() { m_bConnected = false; m_nWidth = 0; m_nHeight = 0; m_bLock = false; m_bChanged = false; //m_pFrame = NULL; m_pYUVData = NULL; m_pImgData = NULL; m_nBufferSize = 0; m_pNullFilter = NULL; m_pMediaEvent = NULL; m_pSampleGrabberFilter = NULL; m_pGraph = NULL; CoInitialize(NULL); } CCameraDS::~CCameraDS() { CloseCamera(); CoUninitialize(); } void CCameraDS::CloseCamera() { m_iRefCnt--; if(m_iRefCnt > 0) { return; } if(m_bConnected) m_pMediaControl->Stop(); m_pGraph = NULL; m_pDeviceFilter = NULL; m_pMediaControl = NULL; m_pSampleGrabberFilter = NULL; m_pSampleGrabber = NULL; m_pGrabberInput = NULL; m_pGrabberOutput = NULL; m_pCameraOutput = NULL; m_pMediaEvent = NULL; m_pNullFilter = NULL; m_pNullInputPin = NULL; //if (m_pFrame) // cvReleaseImage(&m_pFrame); delete(m_pImgData); m_pImgData = NULL; delete m_pYUVData; m_pYUVData = NULL; m_bConnected = false; m_nWidth = 0; m_nHeight = 0; m_bLock = false; m_bChanged = false; m_nBufferSize = 0; } bool CCameraDS::OpenCamera(int nCamID, int nWidth, int nHeight) { if(nCamID >= CameraCount()) { return false; } m_iRefCnt++; if(m_iRefCnt > 1) { return true; } bool bDisplayProperties = false; HRESULT hr = S_OK; CoInitialize(NULL); // Create the Filter Graph Manager. hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC, IID_IGraphBuilder, (void **)&m_pGraph); hr = CoCreateInstance(CLSID_SampleGrabber, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (LPVOID *)&m_pSampleGrabberFilter); hr = m_pGraph->QueryInterface(IID_IMediaControl, (void **) &m_pMediaControl); hr = m_pGraph->QueryInterface(IID_IMediaEvent, (void **) &m_pMediaEvent); hr = CoCreateInstance(CLSID_NullRenderer, NULL, CLSCTX_INPROC_SERVER, IID_IBaseFilter, (LPVOID*) &m_pNullFilter); hr = m_pGraph->AddFilter(m_pNullFilter, L"NullRenderer"); hr = m_pSampleGrabberFilter->QueryInterface(IID_ISampleGrabber, (void**)&m_pSampleGrabber); AM_MEDIA_TYPE mt; ZeroMemory(&mt, sizeof(AM_MEDIA_TYPE)); mt.majortype = MEDIATYPE_Video; mt.subtype = MEDIASUBTYPE_RGB24; mt.formattype = FORMAT_VideoInfo; hr = m_pSampleGrabber->SetMediaType(&mt); MYFREEMEDIATYPE(mt); m_pGraph->AddFilter(m_pSampleGrabberFilter, L"Grabber"); // Bind Device Filter. We know the device because the id was passed in BindFilter(nCamID, &m_pDeviceFilter); m_pGraph->AddFilter(m_pDeviceFilter, NULL); CComPtr<IEnumPins> pEnum; m_pDeviceFilter->EnumPins(&pEnum); hr = pEnum->Reset(); hr = pEnum->Next(1, &m_pCameraOutput, NULL); pEnum = NULL; m_pSampleGrabberFilter->EnumPins(&pEnum); pEnum->Reset(); hr = pEnum->Next(1, &m_pGrabberInput, NULL); pEnum = NULL; m_pSampleGrabberFilter->EnumPins(&pEnum); pEnum->Reset(); pEnum->Skip(1); hr = pEnum->Next(1, &m_pGrabberOutput, NULL); pEnum = NULL; m_pNullFilter->EnumPins(&pEnum); pEnum->Reset(); hr = pEnum->Next(1, &m_pNullInputPin, NULL); //SetCrossBar(); if (bDisplayProperties) { CComPtr<ISpecifyPropertyPages> pPages; HRESULT hr = m_pCameraOutput->QueryInterface(IID_ISpecifyPropertyPages, (void**)&pPages); if (SUCCEEDED(hr)) { PIN_INFO PinInfo; m_pCameraOutput->QueryPinInfo(&PinInfo); CAUUID caGUID; pPages->GetPages(&caGUID); OleCreatePropertyFrame(NULL, 0, 0, L"Property Sheet", 1, (IUnknown **)&(m_pCameraOutput.p), caGUID.cElems, caGUID.pElems, 0, 0, NULL); CoTaskMemFree(caGUID.pElems); PinInfo.pFilter->Release(); } pPages = NULL; } else { ////////////////////////////////////////////////////////////////////////////// // 加入由 lWidth和lHeight设置的摄像头的宽和高 的功能,默认320*240 // by flymanbox @2009-01-24 ////////////////////////////////////////////////////////////////////////////// int _Width = nWidth, _Height = nHeight; IAMStreamConfig* iconfig; iconfig = NULL; hr = m_pCameraOutput->QueryInterface(IID_IAMStreamConfig, (void**)&iconfig); AM_MEDIA_TYPE* pmt; if(iconfig->GetFormat(&pmt) !=S_OK) { //printf("GetFormat Failed ! \n"); return false; } VIDEOINFOHEADER* phead; if ( pmt->formattype == FORMAT_VideoInfo) { phead=( VIDEOINFOHEADER*)pmt->pbFormat; phead->bmiHeader.biWidth = _Width; phead->bmiHeader.biHeight = _Height; if(( hr=iconfig->SetFormat(pmt)) != S_OK ) { return false; } } iconfig->Release(); iconfig=NULL; MYFREEMEDIATYPE(*pmt); } hr = m_pGraph->Connect(m_pCameraOutput, m_pGrabberInput); hr = m_pGraph->Connect(m_pGrabberOutput, m_pNullInputPin); if (FAILED(hr)) { switch(hr) { case VFW_S_NOPREVIEWPIN : break; case E_FAIL : break; case E_INVALIDARG : break; case E_POINTER : break; } } m_pSampleGrabber->SetBufferSamples(TRUE); m_pSampleGrabber->SetOneShot(TRUE); hr = m_pSampleGrabber->GetConnectedMediaType(&mt); if(FAILED(hr)) return false; VIDEOINFOHEADER *videoHeader; videoHeader = reinterpret_cast<VIDEOINFOHEADER*>(mt.pbFormat); m_nWidth = videoHeader->bmiHeader.biWidth; m_nHeight = videoHeader->bmiHeader.biHeight; m_bConnected = true; pEnum = NULL; //初始化RGB->YUV RGBYUVConvert::InitLookupTable(); m_pYUVData = new unsigned char[nWidth*nHeight + nWidth*nHeight/2]; return true; } bool CCameraDS::BindFilter(int nCamID, IBaseFilter **pFilter) { if (nCamID < 0) return false; // enumerate all video capture devices CComPtr<ICreateDevEnum> pCreateDevEnum; HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void**)&pCreateDevEnum); if (hr != NOERROR) { return false; } CComPtr<IEnumMoniker> pEm; hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEm, 0); if (hr != NOERROR) { return false; } pEm->Reset(); ULONG cFetched; IMoniker *pM; int index = 0; while(hr = pEm->Next(1, &pM, &cFetched), hr==S_OK, index <= nCamID) { IPropertyBag *pBag; hr = pM->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag); if(SUCCEEDED(hr)) { VARIANT var; var.vt = VT_BSTR; hr = pBag->Read(L"FriendlyName", &var, NULL); if (hr == NOERROR) { if (index == nCamID) { pM->BindToObject(0, 0, IID_IBaseFilter, (void**)pFilter); } SysFreeString(var.bstrVal); } pBag->Release(); } pM->Release(); index++; } pCreateDevEnum = NULL; return true; } //将输入crossbar变成PhysConn_Video_Composite void CCameraDS::SetCrossBar() { int i; IAMCrossbar *pXBar1 = NULL; ICaptureGraphBuilder2 *pBuilder = NULL; HRESULT hr = CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC_SERVER, IID_ICaptureGraphBuilder2, (void **)&pBuilder); if (SUCCEEDED(hr)) { hr = pBuilder->SetFiltergraph(m_pGraph); } hr = pBuilder->FindInterface(&LOOK_UPSTREAM_ONLY, NULL, m_pDeviceFilter,IID_IAMCrossbar, (void**)&pXBar1); if (SUCCEEDED(hr)) { long OutputPinCount; long InputPinCount; long PinIndexRelated; long PhysicalType; long inPort = 0; long outPort = 0; pXBar1->get_PinCounts(&OutputPinCount,&InputPinCount); for( i =0;i<InputPinCount;i++) { pXBar1->get_CrossbarPinInfo(TRUE,i,&PinIndexRelated,&PhysicalType); if(PhysConn_Video_Composite==PhysicalType) { inPort = i; break; } } for( i =0;i<OutputPinCount;i++) { pXBar1->get_CrossbarPinInfo(FALSE,i,&PinIndexRelated,&PhysicalType); if(PhysConn_Video_VideoDecoder==PhysicalType) { outPort = i; break; } } if(S_OK==pXBar1->CanRoute(outPort,inPort)) { pXBar1->Route(outPort,inPort); } pXBar1->Release(); } pBuilder->Release(); } /* The returned image can not be released. */ unsigned char* CCameraDS::QueryFrame() { long evCode; long size = 0; m_pMediaControl->Run(); m_pMediaEvent->WaitForCompletion(INFINITE, &evCode); m_pSampleGrabber->GetCurrentBuffer(&size, NULL); //if the buffer size changed if (size != m_nBufferSize) { delete(m_pImgData); m_pImgData = new unsigned char[size]; m_nBufferSize = size; } m_pSampleGrabber->GetCurrentBuffer(&m_nBufferSize, (long*)m_pImgData); //convert to YUV RGBYUVConvert::ConvertRGB2YUV(m_nWidth, m_nHeight, m_pImgData, m_pYUVData); return m_pYUVData; } int CCameraDS::CameraCount() { int count = 0; CoInitialize(NULL); // enumerate all video capture devices CComPtr<ICreateDevEnum> pCreateDevEnum; HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void**)&pCreateDevEnum); CComPtr<IEnumMoniker> pEm; hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEm, 0); if (hr != NOERROR) { return count; } pEm->Reset(); ULONG cFetched; IMoniker *pM; while(hr = pEm->Next(1, &pM, &cFetched), hr==S_OK) { count++; } pCreateDevEnum = NULL; pEm = NULL; return count; } int CCameraDS::CameraName(int nCamID, char* sName, int nBufferSize) { int count = 0; CoInitialize(NULL); // enumerate all video capture devices CComPtr<ICreateDevEnum> pCreateDevEnum; HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL, CLSCTX_INPROC_SERVER, IID_ICreateDevEnum, (void**)&pCreateDevEnum); CComPtr<IEnumMoniker> pEm; hr = pCreateDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEm, 0); if (hr != NOERROR) return 0; pEm->Reset(); ULONG cFetched; IMoniker *pM; while(hr = pEm->Next(1, &pM, &cFetched), hr==S_OK) { if (count == nCamID) { IPropertyBag *pBag=0; hr = pM->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag); if(SUCCEEDED(hr)) { VARIANT var; var.vt = VT_BSTR; hr = pBag->Read(L"FriendlyName", &var, NULL); //还有其他属性,像描述信息等等... if(hr == NOERROR) { //获取设备名称 WideCharToMultiByte(CP_ACP,0,var.bstrVal,-1,sName, nBufferSize ,"",NULL); SysFreeString(var.bstrVal); } pBag->Release(); } pM->Release(); break; } count++; } pCreateDevEnum = NULL; pEm = NULL; return 1; }
[ "thorqq@16efd569-b5bb-8337-1870-15b9ea1457a7" ]
[ [ [ 1, 503 ] ] ]
29a6e16d8597256ae91114fe14e76e5473f7935e
b08e948c33317a0a67487e497a9afbaf17b0fc4c
/LuaPlus/Samples/UnitTest++/src/Test.h
1aa61b2b60a6a8777084ddcae980f042b10d1d67
[ "MIT" ]
permissive
15831944/bastionlandscape
e1acc932f6b5a452a3bd94471748b0436a96de5d
c8008384cf4e790400f9979b5818a5a3806bd1af
refs/heads/master
2023-03-16T03:28:55.813938
2010-05-21T15:00:07
2010-05-21T15:00:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
628
h
#ifndef UNITTEST_TEST_H #define UNITTEST_TEST_H #include "TestList.h" namespace UnitTest { class TestResults; class Test { public: Test(char const* testName, char const* filename = "", int lineNumber = 0); virtual ~Test(); void Run(TestResults& testResults) const; Test* next; char const* const m_testName; char const* const m_filename; int const m_lineNumber; static TestList& GetTestList(); private: virtual void RunImpl(TestResults& testResults_) const; // revoked Test(Test const&); Test& operator =(Test const&); }; } #endif
[ "voodoohaust@97c0069c-804f-11de-81da-11cc53ed4329" ]
[ [ [ 1, 37 ] ] ]
07ac1d94e215337147c485d79f02c745f69f5f54
b8ac0bb1d1731d074b7a3cbebccc283529b750d4
/Code/controllers/RecollectionBenchmark/robotapi/webts/WebotsCamera.h
3e889e3931d0a3edef01f074c1b6819f79fe4fd4
[]
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
814
h
#ifndef robotapi_webts_WebotsCamera_h #define robotapi_webts_WebotsCamera_h #include <robotapi/ICamera.h> #include <robotapi/webts/WebotsDevice.h> #include <robotapi/webts/WebotsImage.h> #include <webots/Camera.hpp> namespace robotapi { namespace webts { class WebotsCamera : virtual public robotapi::ICamera, public robotapi::webts::WebotsDevice { public: void enable(int ms); void disable(); IImage &getImage(); int saveImage(std::string filename, int quality); // Change parameter to Webots API camera WebotsCamera( webots::Camera & cam ); private: webots::Camera * mycam; robotapi::webts::WebotsImage * wi; }; } /* End of namespace robotapi::webts */ } /* End of namespace robotapi */ #endif // robotapi_webts_WebotsCamera_h
[ "guicamest@d69ea68a-f96b-11de-8cdf-e97ad7d0f28a" ]
[ [ [ 1, 37 ] ] ]
268d58f49e35652a3f60a0ae49079efa7184d5f9
9c62af23e0a1faea5aaa8dd328ba1d82688823a5
/rl/tags/techdemo2/engine/ui/include/DebugWindow.h
1dc9efc1bfee370cc2b5b4e3aa5e4334deb2f40c
[ "ClArtistic", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-unknown-license-reference" ]
permissive
jacmoe/dsa-hl-svn
55b05b6f28b0b8b216eac7b0f9eedf650d116f85
97798e1f54df9d5785fb206c7165cd011c611560
refs/heads/master
2021-04-22T12:07:43.389214
2009-11-27T22:01:03
2009-11-27T22:01:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,614
h
/* This source file is part of Rastullahs Lockenpracht. * Copyright (C) 2003-2005 Team Pantheon. http://www.team-pantheon.de * * This program is free software; you can redistribute it and/or modify * it under the terms of the Clarified Artistic License. * * 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 * Clarified Artistic License for more details. * * You should have received a copy of the Clarified Artistic License * along with this program; if not you can get it here * http://www.jpaulmorrison.com/fbp/artistic2.htm. */ #ifndef __DEBUGWINDOW_H__ #define __DEBUGWINDOW_H__ #include "UiPrerequisites.h" #include <OgreSingleton.h> #include "CeGuiWindow.h" #include "GameTask.h" #include <map> namespace rl { class _RlUiExport DebugWindow : public Ogre::Singleton<DebugWindow>, public GameTask, public CeGuiWindow { public: DebugWindow(void); ~DebugWindow(); static DebugWindow& getSingleton(void); static DebugWindow* getSingletonPtr(void); void setVisible(bool visible, bool destroyAfterHide = false); /** Registers a page on the debug window. * Debug Window allows multiple pages of informations to be registered * This allows components to show debug informations without meddling with * other components debug text. * Only one page at a time is shown. * @param name the key and caption of the registered page. * @throw IllegalArgumentException if there already is a page with this name registered. * @see unregisterPage, setPageText, showNextPage */ void registerPage(const Ogre::String& name); /** Unregisters a page on the debug window. * This page is removed from the DebugWindow and setting its text is no longer allowed. * @param name the key of the to be unregistered page. * @throw IllegalArgumentException if there is no page with this name. * @see registerPage, setPageText, showNextPage */ void unregisterPage(const Ogre::String& name); /** Unregisters a page on the debug window. * This page is removed from the DebugWindow and setting its text is no longer allowed. * @param page the key of the page, whose text shall be set. * @param text the text to be shown on the page. Use '\n' to break it into multiple lines. * @throw IllegalArgumentException if there is no page with this name. */ void setPageText(const Ogre::String& page, const Ogre::String& text); /** Sets the text for the one line StaticText field at the bottom of the window. * This is used for situational short term info. */ void setMessageText(const Ogre::String& text); void run(Ogre::Real elapsedTime); /// Changes the shown page to the next page in the list. void showNextPage(); private: CEGUI::StaticText* mMessageText; CEGUI::StaticText* mPageCaption; CEGUI::MultiLineEditbox* mPageText; typedef std::map<Ogre::String, Ogre::String> PageTextMap; PageTextMap mPageTexts; Ogre::String mCurrentPage; /// Name of the default debug page with FPS statistics Ogre::String mDebugPageName; void updateFps(); void updatePageText(); }; } #endif
[ "tanis@4c79e8ff-cfd4-0310-af45-a38c79f83013" ]
[ [ [ 1, 92 ] ] ]
37ce0b1c39d75293322aa639be4f5de013da7443
69aab86a56c78cdfb51ab19b8f6a71274fb69fba
/Code/inc/pi/bada/BadaFile.h
6cf187b865b1756c00ed1a952b8df396c82dffe2
[ "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
555
h
/* * BadaFile.h * * Created on: 2010-12-10 * Author: artur.m */ #ifndef BADAFILE_H_ #define BADAFILE_H_ #include <GameFile.h> #include <FIo.h> #include <string> class BadaFile : public GameFile { public: BadaFile(const std::string& filePath, const std::string& fileMode); virtual ~BadaFile(); virtual std::string readLine(); virtual std::string read(); //reads whole file virtual bool eof(); unsigned char* buffer; unsigned int size; private: Osp::Io::File m_file; }; #endif /* BADAFILE_H_ */
[ [ [ 1, 34 ] ] ]
c6487867b3382fe5a23ae5bffb52303c7e853330
22a28955f0ce1a038ca86fd22f6c9fb9f50c5625
/pbg6ext/main.h
f80287f8a8a3a03b4456ce82c77c4e5782eb8ed3
[]
no_license
nmlgc/pbg6ext
fc9240e2b3e817e4944cedbe923d5e7e343f348c
62e505ca564ea4f8f31ac5f2144214f8e8df1160
refs/heads/master
2020-06-01T05:01:27.250374
2011-01-25T12:32:27
2015-03-24T18:58:36
32,818,397
2
0
null
null
null
null
WINDOWS-1252
C++
false
false
1,482
h
// PBG6 Extractor // -------------- // main.h - the obligatory project header file (= somewhat interesting) // -------------- // "©" Nmlgc, 2011 typedef unsigned long ulong; typedef unsigned short ushort; typedef unsigned char uchar; #include <stdio.h> #include <stdlib.h> #include <string.h> #ifdef WIN32 #include <windows.h> #endif // Constants // --------- const ulong CP1_SIZE = 0x102; const ulong CP2_SIZE = 0x400; // --------- // Helper // ------ #define SAFE_DELETE(x) if((x)) {free((x)); (x) = NULL;} // ------ // Structures // ---------- // A single, compressed file inside the archive struct PBG6File { wchar_t fn[64]; // Filename size_t fnlen; // Filename length (not actually needed anywhere) ulong pos; // Position inside the archive ulong insize; // Encrypted file size ulong outsize; // Decrypted file size }; // Function class class PBG6Archive { protected: // Variables // --------- ulong pool1[CP1_SIZE]; ulong pool2[CP2_SIZE]; // --------- void InitCryptPools(); void CryptStep(ulong& ecx); public: FILE* ac6; ulong filecount; PBG6File* file; PBG6Archive() {ac6 = NULL;} bool SigCheck(); bool Decrypt(char* dest, const ulong& destsize, const char* source, const ulong& sourcesize); // decrypts [source] buffer bool ReadTOC(); char* GetTOCFileInfo(PBG6File* dest, char* source); // returns pointer to next file void Cleanup(); }; // ----------
[ [ [ 1, 73 ] ] ]
5d9a96cbd0cd1768b6b2ecdc701e3168e37da1de
bf19f77fdef85e76a7ebdedfa04a207ba7afcada
/Base.cpp
f6f31c472c6f68438cffcb47c765f6d9cb0d2e66
[]
no_license
marvelman610/tmntactis
2aa3176d913a72ed985709843634933b80d7cb4a
a4e290960510e5f23ff7dbc1e805e130ee9bb57d
refs/heads/master
2020-12-24T13:36:54.332385
2010-07-12T08:08:12
2010-07-12T08:08:12
39,046,976
0
0
null
null
null
null
UTF-8
C++
false
false
498
cpp
//////////////////////////////////////////////////////// // File Name : "Base.cpp" // // Author : Matthew Di Matteo (MD) // // Purpose : To encapsulate all shared data and functionality // for our game objects //////////////////////////////////////////////////////// #include "Base.h" CBase::CBase(void) { } void CBase::Update(float fElapsedTime) { } void CBase::Render() { } vector<CTile> CBase::Pathfind(void) { vector<CTile> tiles; return tiles; }
[ "marvelman610@7dc79cba-3e6d-11de-b8bc-ddcf2599578a" ]
[ [ [ 1, 29 ] ] ]
115428b92d5b6ad2fccd93e837835a0d3e8b56ed
021e8c48a44a56571c07dd9830d8bf86d68507cb
/build/vtk/vtkQtChartKeyboardHistory.h
313e9d32b95e57a46c1197036867441361b99d75
[ "BSD-3-Clause" ]
permissive
Electrofire/QdevelopVset
c67ae1b30b0115d5c2045e3ca82199394081b733
f88344d0d89beeec46f5dc72c20c0fdd9ef4c0b5
refs/heads/master
2021-01-18T10:44:01.451029
2011-05-01T23:52:15
2011-05-01T23:52:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,632
h
/*========================================================================= Program: Visualization Toolkit Module: vtkQtChartKeyboardHistory.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ /*------------------------------------------------------------------------- Copyright 2008 Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. -------------------------------------------------------------------------*/ /// \file vtkQtChartKeyboardHistory.h /// \date February 23, 2009 #ifndef _vtkQtChartKeyboardHistory_h #define _vtkQtChartKeyboardHistory_h #include "vtkQtChartExport.h" #include "vtkQtChartKeyboardFunction.h" /// \class vtkQtChartKeyboardHistory /// \brief /// The vtkQtChartKeyboardHistory class navigates backwards in the /// chart view history. class VTKQTCHART_EXPORT vtkQtChartKeyboardHistory : public vtkQtChartKeyboardFunction { public: /// \brief /// Creates a chart keyboard history instance. /// \param parent The parent object. vtkQtChartKeyboardHistory(QObject *parent=0); virtual ~vtkQtChartKeyboardHistory() {} /// Changes the chart view to the previous view in the history. virtual void activate(); private: vtkQtChartKeyboardHistory(const vtkQtChartKeyboardHistory &); vtkQtChartKeyboardHistory &operator=(const vtkQtChartKeyboardHistory &); }; /// \class vtkQtChartKeyboardHistoryNext /// \brief /// The vtkQtChartKeyboardHistoryNext class navigates forwards in the /// chart view history. class VTKQTCHART_EXPORT vtkQtChartKeyboardHistoryNext : public vtkQtChartKeyboardFunction { public: /// \brief /// Creates a chart keyboard history next instance. /// \param parent The parent object. vtkQtChartKeyboardHistoryNext(QObject *parent=0); virtual ~vtkQtChartKeyboardHistoryNext() {} /// Changes the chart view to the next view in the history. virtual void activate(); private: vtkQtChartKeyboardHistoryNext(const vtkQtChartKeyboardHistoryNext &); vtkQtChartKeyboardHistoryNext &operator=( const vtkQtChartKeyboardHistoryNext &); }; #endif
[ "ganondorf@ganondorf-VirtualBox.(none)" ]
[ [ [ 1, 78 ] ] ]
f56c30d97b3da0ae22dec965a7dae6e7f30df770
22d9640edca14b31280fae414f188739a82733e4
/Code/VTK/include/vtk-5.2/vtkCompositeDataSet.h
2d289d62d09b71b78cd43822725357195a70d7bb
[]
no_license
tack1/Casam
ad0a98febdb566c411adfe6983fcf63442b5eed5
3914de9d34c830d4a23a785768579bea80342f41
refs/heads/master
2020-04-06T03:45:40.734355
2009-06-10T14:54:07
2009-06-10T14:54:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,169
h
/*========================================================================= Program: Visualization Toolkit Module: $RCSfile: vtkCompositeDataSet.h,v $ Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkCompositeDataSet - abstact superclass for composite // (multi-block or AMR) datasets // .SECTION Description // vtkCompositeDataSet is an abstract class that represents a collection // of datasets (including other composite datasets). It // provides an interface to access the datasets through iterators. // vtkCompositeDataSet provides methods are used by subclasses to store the datasets. // vtkCompositeDataSet provides the datastructure for a full tree // representation. Subclasses provide the semantics for it and control how // this tree is buit. // .SECTION See Also // vtkCompositeDataIterator #ifndef __vtkCompositeDataSet_h #define __vtkCompositeDataSet_h #include "vtkDataObject.h" class vtkCompositeDataIterator; class vtkCompositeDataSetInternals; class vtkInformation; class VTK_FILTERING_EXPORT vtkCompositeDataSet : public vtkDataObject { public: vtkTypeRevisionMacro(vtkCompositeDataSet, vtkDataObject); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Return a new iterator (the iterator has to be deleted by user). virtual vtkCompositeDataIterator* NewIterator(); // Description: // Return class name of data type (see vtkType.h for // definitions). virtual int GetDataObjectType() {return VTK_COMPOSITE_DATA_SET;} // Description: // Get the port currently producing this object. virtual vtkAlgorithmOutput* GetProducerPort(); // Description: // Copies the tree structure from the input. All pointers to non-composite // data objects are intialized to NULL. This also shallow copies the meta data // associated with all the nodes. virtual void CopyStructure(vtkCompositeDataSet* input); // Description: // Sets the data set at the location pointed by the iterator. // The iterator does not need to be iterating over this dataset itself. It can // be any composite datasite with similar structure (achieved by using // CopyStructure). virtual void SetDataSet(vtkCompositeDataIterator* iter, vtkDataObject* dataObj); // Description: // Returns the dataset located at the positiong pointed by the iterator. // The iterator does not need to be iterating over this dataset itself. It can // be an iterator for composite dataset with similar structure (achieved by // using CopyStructure). virtual vtkDataObject* GetDataSet(vtkCompositeDataIterator* iter); // Description: // Returns the meta-data associated with the position pointed by the iterator. // This will create a new vtkInformation object if none already exists. Use // HasMetaData to avoid creating the vtkInformation object unnecessarily. // The iterator does not need to be iterating over this dataset itself. It can // be an iterator for composite dataset with similar structure (achieved by // using CopyStructure). virtual vtkInformation* GetMetaData(vtkCompositeDataIterator* iter); // Description: // Returns if any meta-data associated with the position pointed by the iterator. // The iterator does not need to be iterating over this dataset itself. It can // be an iterator for composite dataset with similar structure (achieved by // using CopyStructure). virtual int HasMetaData(vtkCompositeDataIterator* iter); //BTX // Description: // Retrieve an instance of this class from an information object. static vtkCompositeDataSet* GetData(vtkInformation* info); static vtkCompositeDataSet* GetData(vtkInformationVector* v, int i=0); //ETX // Description: // Restore data object to initial state, virtual void Initialize(); // Description: // Shallow and Deep copy. virtual void ShallowCopy(vtkDataObject *src); virtual void DeepCopy(vtkDataObject *src); // Description: // Returns the total number of points of all blocks. This will // iterate over all blocks and call GetNumberOfPoints() so it // might be expansive. virtual vtkIdType GetNumberOfPoints(); //BTX protected: vtkCompositeDataSet(); ~vtkCompositeDataSet(); // Description: // Set the number of children. void SetNumberOfChildren(unsigned int num); // Description: // Get the number of children. unsigned int GetNumberOfChildren(); // Description: // Set child dataset at a given index. The number of children is adjusted to // to be greater than the index specified. void SetChild(unsigned int index, vtkDataObject*); // Description: // Returns a child dataset at a given index. vtkDataObject* GetChild(unsigned int num); // Description: // Returns the meta-data at a given index. If the index is valid, however, no // information object is set, then a new one will created and returned. // To avoid unnecessary creation, use HasMetaData(). vtkInformation* GetChildMetaData(unsigned int index); // Description: // Sets the meta-data at a given index. void SetChildMetaData(unsigned int index, vtkInformation* info); // Description: // Returns if meta-data information is available for the given child index. // Returns 1 is present, 0 otherwise. int HasChildMetaData(unsigned int index); // The internal datastructure. Subclasses need not access this directly. vtkCompositeDataSetInternals* Internals; friend class vtkCompositeDataIterator; private: vtkCompositeDataSet(const vtkCompositeDataSet&); // Not implemented. void operator=(const vtkCompositeDataSet&); // Not implemented. //ETX }; #endif
[ "nnsmit@9b22acdf-97ab-464f-81e2-08fcc4a6931f" ]
[ [ [ 1, 164 ] ] ]
e6254e8d81d557cfac2e5d84b5c3d6fdb0809d8b
50e7a87a6bf57bf0ebfb52e885cea94a92043d40
/heig-boy/interface/RefreshManager.cpp
419d2cafbaa1b39bb68888bba2ca48a03f1fc3da
[]
no_license
dragon2snow/Heig-Boy-
88ec3bef310448de6c86b916cabcec141704a3e6
dee7e02bc245b50aaabb572d8fe1b9360f393b11
refs/heads/master
2020-04-22T15:17:19.324636
2010-01-20T23:58:56
2010-01-20T23:58:56
170,473,048
0
0
null
null
null
null
ISO-8859-1
C++
false
false
3,781
cpp
#include "wx/wx.h" //Pour les About Box #include "wx/aboutdlg.h" //Pour les dialog de parcours #include "wx/artprov.h" #include "MainFrame.h" #include "RefreshManager.h" extern "C" { #include "../core/emu.h" #include "../core/lcd.h" #include "../win32/os_specific.h" } RefreshManager::RefreshManager(MainWindow *frame) : wxThread(wxTHREAD_JOINABLE), frame(frame) { fastMode = false; romLoaded = false; //permet d'attendre le chargement d'une ROM au lancement mutexRomLoaded.Lock(); pauseActive = false; fin = false; Create(); Run(); } void *RefreshManager::Entry() { bool retard = false; int skippedFrames = 0; // Initialisation sound_driver_init(); synchroInit(); // Boucle principale while (!fin) { //Attendre qu'une ROM soit chargée if (!romLoaded) { mutexRomLoaded.Lock(); mutexRomLoaded.Unlock(); if (fin) break; } //Se mettre en pause si nécessaire if (pauseActive) { mutexPause.Lock(); mutexPause.Unlock(); if (fin) break; } // Fait avancer le CPU d'une image mutexInFrame.Lock(); emu_do_frame(!retard); mutexInFrame.Unlock(); // Récupère et met à jour l'affichage de la fenêtre if (!retard) { lcd_copy_to_buffer(frame->getPixels(), 160); frame->Refresh(false); } // Synchro à 60 images seconde Yield(); if (fastMode) retard = false; else retard = synchroDo(); // S'assure qu'on ne saute pas trop de frames non plus // (famine sinon) if (!retard) skippedFrames = 0; else if (++skippedFrames > 4) { retard = false; // Réinitialisation du retard skippedFrames = 0; lastTime = getTime(); } } return NULL; } bool RefreshManager::synchroDo() { unsigned long long curTime; // Attend que 16 millisecondes se soient écoulées // Attente active nécessaire, car le noyau Windows est // cadencé à 20 millisec do { curTime = getTime(); } while (curTime - lastTime < 16667); lastTime += 16667; // En retard? return curTime - lastTime >= 16667; } /** Permet de charger un jeu */ void RefreshManager::loadRom() { romLoaded = false; //On ne doit pas changer de rom pendant la création d'une frame mutexInFrame.Lock(); wxFileDialog dialog(frame, _T("Please choose the game to load"), wxEmptyString, wxEmptyString, _T("*.gb"), wxFD_OPEN); if (dialog.ShowModal() == wxID_OK) { //Récupèration du chemin wxString filename(dialog.GetPath()); // Chargement de l'image ROM if (!emu_load_cart(filename.ToAscii())) throw "Could not find ROM file."; //Le jeux peux commencer romLoaded = true; mutexRomLoaded.Unlock(); } mutexInFrame.Unlock(); } /** Mettre la partie en pause \param active Pour activer ou désactiver la pause */ void RefreshManager::pause(bool active) { if (active) { pauseActive = true; mutexPause.Lock(); } else { pauseActive = false; mutexPause.Unlock(); } } void RefreshManager::turbo(bool active) { fastMode = active; } bool RefreshManager::isPlaying() { return romLoaded; } void RefreshManager::endGame() { fin = true; } #ifdef WIN32 #include <windows.h> void RefreshManager::synchroInit() { QueryPerformanceFrequency((LARGE_INTEGER*)&frequency); lastTime = getTime(); } unsigned long long RefreshManager::getTime() { __int64 curTime; QueryPerformanceCounter((LARGE_INTEGER*)&curTime); return 1000000 * curTime / frequency; } #else #include <sys/time.h> void RefreshManager::synchroInit() { lastTime = getTime(); } unsigned long long RefreshManager::getTime() { struct timeval t; gettimeofday(&t, NULL); return (unsigned long long)t.tv_sec * 1000000 + t.tv_usec; } #endif
[ "gabranth@bfddfde6-68e7-4156-9405-ca205172725d" ]
[ [ [ 1, 183 ] ] ]
50778915ea3d9ee5e3b77c63f153ed858a0362b2
203f8465075e098f69912a6bbfa3498c36ce2a60
/sandbox/geometric_blur/example/cal_gb_des.cpp
fa2052380085a97577518dfd7cba30a2645d79e6
[]
no_license
robcn/personalrobots-pkg
a4899ff2db9aef00a99274d70cb60644124713c9
4dcf3ca1142d3c3cb85f6d42f7afa33c59e2240a
refs/heads/master
2021-06-20T16:28:29.549716
2009-09-04T23:56:10
2009-09-04T23:56:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,559
cpp
#include <iostream> #include <fstream> #include <vector> #include <cv.h> #include "highgui.h" #include "cxcore.h" #include "cvaux.h" #include "geometric_blur/gb.h" using namespace std; using namespace cv; void writeFloat2Bin( string filename, float dsize, float num_item, vector< vector< float> > & features) { ofstream fout(filename.c_str(), ios::out | ios::binary);; fout.write((char *) &dsize, sizeof(float)); fout.write((char *) &num_item, sizeof(float)); for (int k = 0; k < features.size(); k++){ for (int i = 0; i < features[k].size(); i++){ fout.write((char *) &features[k][i], sizeof(float)); } } fout.close(); } void writeRect2text( string filename, vector<Rect> & Rect_) { ofstream fout; fout.open(filename.c_str()); if (!fout) return; // Failure int vector_size = Rect_.size(); for (int k = 0; k < vector_size; k++){ fout << Rect_[k].x << " " << Rect_[k].y << " " << Rect_[k].width << " " << Rect_[k].height << endl; } fout.close(); } int main(int argc, char** argv) { // parameters Size paddingTL_(0,0); Size paddingBR_(0,0); bool DenseSample_ = true; bool gammaCorrection_=true; int NumScale_=64; Size winSize_; Size winStride_; float alpha_ = 0.5; float beta_ = 1; int nbins_ = 4; cv::Mat img; // get input float ScaleRatio_= atof(argv[1]);; winSize_.width = atoi(argv[2]); winSize_.height = atoi(argv[3]); winStride_.width = atoi(argv[4]); winStride_.height = atoi(argv[5]); img = cv::imread(argv[6]); string FeatureFilename = argv[7]; string ROIFilename = argv[8]; gb gb_des( nbins_, gammaCorrection_, paddingTL_, paddingBR_, DenseSample_, ScaleRatio_, NumScale_, winSize_, winStride_, alpha_, beta_); vector<Mat> fbr; double t = (double)cv::getTickCount(); gb_des.compute_orient_edges(img, fbr); t = (double)cv::getTickCount() - t; printf("oriented edge computing time = %gms\n", t*1000./cv::getTickFrequency()); // calculate gb_des vector< vector<float> > features; t = (double)cv::getTickCount(); gb_des.compute_gb(fbr, features); t = (double)cv::getTickCount() - t; printf("gb descriptor computing time = %gms\n", t*1000./cv::getTickFrequency()); cout << "feaDim " << features[0].size() << " nSamples " << features.size() <<endl; writeFloat2Bin( FeatureFilename, features[0].size(), features.size(), features); writeRect2text( ROIFilename, gb_des.ROI); }
[ "sunmin@f5854215-dd47-0410-b2c4-cdd35faa7885" ]
[ [ [ 1, 86 ] ] ]
64ff1de271fe688b1ecbbed49a504e67aff321e7
d425cf21f2066a0cce2d6e804bf3efbf6dd00c00
/TileEngine/renderworld.cpp
26f5b5a4334271bf3a8860d073eec65543e9cde1
[]
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
211,576
cpp
#include "builddefines.h" #ifdef PRECOMPILEDHEADERS #include "TileEngine All.h" #else #include "math.h" #include <stdio.h> #include <errno.h> #include "worlddef.h" #include "renderworld.h" #include "vsurface.h" #include "input.h" #include "sysutil.h" #include "wchar.h" #include "video.h" #include "vobject_blitters.h" #include "debug.h" #include "wcheck.h" #include "worldman.h" #include "jascreens.h" #include "edit_sys.h" #include "Isometric Utils.h" #include "line.h" #include "Animation Control.h" #include "Animation Data.h" #include "Timer Control.h" #include "Radar Screen.h" #include "Render Dirty.h" #include "Font Control.h" #include "Sys Globals.h" #include "Render Dirty.h" #include "lighting.h" #include "Overhead types.h" #include "Overhead.h" #include "weapons.h" #include "ai.h" #include "vobject.h" #include "render fun.h" #include "los.h" #include "interactive tiles.h" #include "interface cursors.h" #include "rotting corpses.h" #include "tile cache.h" #include "tile animation.h" #include "English.h" #include "world items.h" #include "GameSettings.h" #include "interface control.h" #include "Sound Control.h" #endif /////////////////////////// // C file include here #include "Render Z.h" /////////////////////////// extern CHAR8 gDebugStr[128]; extern BOOLEAN fLandLayerDirty = TRUE; extern INT16 gsVIEWPORT_START_X; extern INT16 gsVIEWPORT_START_Y; extern INT16 gsVIEWPORT_END_Y; extern INT16 gsVIEWPORT_WINDOW_END_Y; extern INT16 gsVIEWPORT_WINDOW_START_Y; extern INT16 gsVIEWPORT_END_X; UINT16 *gpZBuffer = NULL; BOOLEAN gfTagAnimatedTiles = TRUE; INT16 gsCurrentGlowFrame = 0; INT16 gsCurrentItemGlowFrame = 0; extern BOOLEAN gfUIShowExitEast; extern BOOLEAN gfUIShowExitWest; extern BOOLEAN gfUIShowExitNorth; extern BOOLEAN gfUIShowExitSouth; extern BOOLEAN gfTopMessageDirty; // VIEWPORT OFFSET VALUES // NOTE: // THESE VALUES MUST BE MULTIPLES OF TILE SIZES! #define VIEWPORT_XOFFSET_S WORLD_TILE_X*1 #define VIEWPORT_YOFFSET_S WORLD_TILE_Y*2 #define LARGER_VIEWPORT_XOFFSET_S ( VIEWPORT_XOFFSET_S * 3 ) #define LARGER_VIEWPORT_YOFFSET_S ( VIEWPORT_YOFFSET_S * 5 ) #define TILES_TYPE_BITMASK 0x00040000 #define TILES_TYPE_MASK 0x07ffffff #define TILES_DIRTY 0x80000000 #define TILES_DYNAMIC 0x40000000 #define TILES_NOZWRITE 0x20000000 #define TILES_MARKED 0x10000000 #define TILES_NOZ 0x04000000 #define TILES_DOALL 0x02000000 #define TILES_OBSCURED 0x01000000 //#define TILES_MERC 0x00000400 //#define TILES_Z_BLITTER 0x00000200 //#define TILES_Z_WRITE 0x00000100 //#define TILES_SHADOW 0x00000080 //#define TILES_BACKWARDS 0x00000040 #define MAX_RENDERED_ITEMS 3 // RENDERER FLAGS FOR DIFFERENT RENDER LEVELS typedef enum { RENDER_STATIC_LAND, RENDER_STATIC_OBJECTS, RENDER_STATIC_SHADOWS, RENDER_STATIC_STRUCTS, RENDER_STATIC_ROOF, RENDER_STATIC_ONROOF, RENDER_STATIC_TOPMOST, RENDER_DYNAMIC_LAND, RENDER_DYNAMIC_OBJECTS, RENDER_DYNAMIC_SHADOWS, RENDER_DYNAMIC_STRUCT_MERCS, RENDER_DYNAMIC_MERCS, RENDER_DYNAMIC_STRUCTS, RENDER_DYNAMIC_ROOF, RENDER_DYNAMIC_HIGHMERCS, RENDER_DYNAMIC_ONROOF, RENDER_DYNAMIC_TOPMOST, NUM_RENDER_FX_TYPES }; #define SCROLL_INTERTIA_STEP1 3//6 #define SCROLL_INTERTIA_STEP2 4//8 //#define SHORT_ROUND( x ) ( (INT16)( ( x * 1000 ) / 1000 ) ) #define SHORT_ROUND( x ) ( x ) #define NUM_ITEM_CYCLE_COLORS 60 UINT16 us16BPPItemCycleWhiteColors[ NUM_ITEM_CYCLE_COLORS ]; UINT16 us16BPPItemCycleRedColors[ NUM_ITEM_CYCLE_COLORS ]; UINT16 us16BPPItemCycleYellowColors[ NUM_ITEM_CYCLE_COLORS ]; INT16 gsLobOutline; INT16 gsThrowOutline; INT16 gsGiveOutline; INT16 gusNormalItemOutlineColor; INT16 gusYellowItemOutlineColor; INT16 gsRenderHeight = 0; BOOLEAN gfRenderFullThisFrame = 0; INT16 gCenterWorldX; //UINT8 gubIntTileCheckFlags = INTILE_CHECK_FULL; UINT8 gubIntTileCheckFlags = INTILE_CHECK_SELECTIVE; UINT8 ubRGBItemCycleWhiteColors[] = { 25, 25, 25, 50, 50, 50, 75, 75, 75, 100, 100, 100, 125, 125, 125, 150, 150, 150, 175, 175, 175, 200, 200, 200, 225, 225, 225, 250, 250, 250, 250, 250, 250, 225, 225, 225, 200, 200, 200, 175, 175, 175, 150, 150, 150, 125, 125, 125, 100, 100, 100, 75, 75, 75, 50, 50, 50, 25, 25, 25, 25, 25, 25, 50, 50, 50, 75, 75, 75, 100, 100, 100, 125, 125, 125, 150, 150, 150, 175, 175, 175, 200, 200, 200, 225, 225, 225, 250, 250, 250, 250, 250, 250, 225, 225, 225, 200, 200, 200, 175, 175, 175, 150, 150, 150, 125, 125, 125, 100, 100, 100, 75, 75, 75, 50, 50, 50, 25, 25, 25, 25, 25, 25, 50, 50, 50, 75, 75, 75, 100, 100, 100, 125, 125, 125, 150, 150, 150, 175, 175, 175, 200, 200, 200, 225, 225, 225, 250, 250, 250, 250, 250, 250, 225, 225, 225, 200, 200, 200, 175, 175, 175, 150, 150, 150, 125, 125, 125, 100, 100, 100, 75, 75, 75, 50, 50, 50, 25, 25, 25 }; UINT8 ubRGBItemCycleRedColors[] = { 25, 0, 0, 50, 0, 0, 75, 0, 0, 100, 0, 0, 125, 0, 0, 150, 0, 0, 175, 0, 0, 200, 0, 0, 225, 0, 0, 250, 0, 0, 250, 0, 0, 225, 0, 0, 200, 0, 0, 175, 0, 0, 150, 0, 0, 125, 0, 0, 100, 0, 0, 75, 0, 0, 50, 0, 0, 25, 0, 0, 25, 0, 0, 50, 0, 0, 75, 0, 0, 100, 0, 0, 125, 0, 0, 150, 0, 0, 175, 0, 0, 200, 0, 0, 225, 0, 0, 250, 0, 0, 250, 0, 0, 225, 0, 0, 200, 0, 0, 175, 0, 0, 150, 0, 0, 125, 0, 0, 100, 0, 0, 75, 0, 0, 50, 0, 0, 25, 0, 0, 25, 0, 0, 50, 0, 0, 75, 0, 0, 100, 0, 0, 125, 0, 0, 150, 0, 0, 175, 0, 0, 200, 0, 0, 225, 0, 0, 250, 0, 0, 250, 0, 0, 225, 0, 0, 200, 0, 0, 175, 0, 0, 150, 0, 0, 125, 0, 0, 100, 0, 0, 75, 0, 0, 50, 0, 0, 25, 0, 0, }; UINT8 ubRGBItemCycleYellowColors[] = { 25, 25, 0, 50, 50, 0, 75, 75, 0, 100, 100, 0, 125, 125, 0, 150, 150, 0, 175, 175, 0, 200, 200, 0, 225, 225, 0, 250, 250, 0, 250, 250, 0, 225, 225, 0, 200, 200, 0, 175, 175, 0, 150, 150, 0, 125, 125, 0, 100, 100, 0, 75, 75, 0, 50, 50, 0, 25, 25, 0, 25, 25, 0, 50, 50, 0, 75, 75, 0, 100, 100, 0, 125, 125, 0, 150, 150, 0, 175, 175, 0, 200, 200, 0, 225, 225, 0, 250, 250, 0, 250, 250, 0, 225, 225, 0, 200, 200, 0, 175, 175, 0, 150, 150, 0, 125, 125, 0, 100, 100, 0, 75, 75, 0, 50, 50, 0, 25, 25, 0, 25, 25, 0, 50, 50, 0, 75, 75, 0, 100, 100, 0, 125, 125, 0, 150, 150, 0, 175, 175, 0, 200, 200, 0, 225, 225, 0, 250, 250, 0, 250, 250, 0, 225, 225, 0, 200, 200, 0, 175, 175, 0, 150, 150, 0, 125, 125, 0, 100, 100, 0, 75, 75, 0, 50, 50, 0, 25, 25, 0, }; #define NUMSPEEDS 5 UINT8 gubNewScrollXSpeeds[2][ NUMSPEEDS ] = { 40, 80, 100, 180, 200, // Non-video mode scroll 20, 40, 80, 80, 80 // Video mode scroll }; UINT8 gubNewScrollYSpeeds[2][ NUMSPEEDS ] = { 40, 80, 100, 180, 200, // Non-video mode scroll 10, 20, 60, 80, 80 // Video mode scroll }; // These speeds are only an indication of how long to do each subtile step until moving on to another UINT8 gubNewScrollIDSpeeds[ ] = { 10, 10, 20, 20, 20 }; UINT8 gubScrollSpeedStartID = 2; UINT8 gubScrollSpeedEndID = 4; UINT8 gubCurScrollSpeedID = 1; BOOLEAN gfDoVideoScroll = TRUE; BOOLEAN gfDoSubtileScroll = FALSE; BOOLEAN gfScrollPending = FALSE; UINT32 uiLayerUsedFlags = 0xffffffff; UINT32 uiAdditiveLayerUsedFlags = 0xffffffff; // Array of shade values to use..... #define NUM_GLOW_FRAMES 30 #if 0 INT16 gsGlowFrames[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, }; #endif INT16 gsGlowFrames[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 6, 8, 9, 8, 6, 4, 2, 0, }; // This has to be the same # of frames as NUM_GLOW_FRAMES INT16 gsFastGlowFrames[] = { 0, 0, 6, 7, 8, 9, 8, 7, 6, 5, 0, 0, 6, 7, 8, 9, 8, 7, 6, 5, 0, 0, 6, 7, 8, 9, 8, 7, 6, 5, }; // The glow frame pointer can be adjusted to use a faster/ slower glow INT16 *gpGlowFramePointer = gsGlowFrames; UINT32 gScrollDirectionFlags[ NUM_WORLD_DIRECTIONS ] = { SCROLL_UP | SCROLL_RIGHT, SCROLL_RIGHT, SCROLL_DOWN | SCROLL_RIGHT, SCROLL_DOWN, SCROLL_DOWN | SCROLL_LEFT, SCROLL_LEFT, SCROLL_UP | SCROLL_LEFT, SCROLL_UP, }; INT16 SCROLL_X_STEP = ( WORLD_TILE_X ); INT16 SCROLL_Y_STEP = ( WORLD_TILE_Y * 2); /* * ViewPort starting values * What is viewport? * So viewport are coords of map screen (tactical screen) * gsViewport_xxx this variables are related with mouse regions, current rendering region ... * this variables ware unnecessary with this GUI becouse they can be calculated from INTERFACE coords * but i think that they can be realy usefull while we will change GUI for more customisable * any questions? joker */ /* INT16 gsVIEWPORT_START_X = 0; INT16 gsVIEWPORT_START_Y = 0; INT16 gsVIEWPORT_WINDOW_START_Y = 0; INT16 gsVIEWPORT_WINDOW_END_Y = INTERFACE_START_Y;//do zmiany INT16 gsVIEWPORT_END_X = SCREEN_WIDTH; INT16 gsVIEWPORT_END_Y = INTERFACE_START_Y; i changed for dynamic initialization joker */ // still need the global object container defined atleast once outside a header (jonathanl) INT16 gsVIEWPORT_START_X = 0; INT16 gsVIEWPORT_START_Y = 0; INT16 gsVIEWPORT_WINDOW_START_Y = 0; INT16 gsVIEWPORT_WINDOW_END_Y = INTERFACE_START_Y; INT16 gsVIEWPORT_END_X = SCREEN_WIDTH; INT16 gsVIEWPORT_END_Y = INTERFACE_START_Y; INT16 gsTopLeftWorldX, gsTopLeftWorldY; INT16 gsTopRightWorldX, gsTopRightWorldY; INT16 gsBottomLeftWorldX, gsBottomLeftWorldY; INT16 gsBottomRightWorldX, gsBottomRightWorldY; BOOLEAN gfIgnoreScrolling = FALSE; // WANNE: If we are talking? // This check is used, to prevent scrolling in small maps (e.g: Rebel Basement) in higher resolution (1024x768) [2007-05-14] BOOLEAN gfDialogControl = FALSE; BOOLEAN gfIgnoreScrollDueToCenterAdjust = FALSE; // GLOBAL SCROLLING PARAMS INT16 gTopLeftWorldLimitX, gTopLeftWorldLimitY; INT16 gTopRightWorldLimitX, gTopRightWorldLimitY; INT16 gBottomLeftWorldLimitX, gBottomLeftWorldLimitY; INT16 gBottomRightWorldLimitX, gBottomRightWorldLimitY; INT16 Slide, gCenterWorldY; INT16 gsTLX, gsTLY, gsTRX, gsTRY; INT16 gsBLX, gsBLY, gsBRX, gsBRY; INT16 gsCX, gsCY; DOUBLE gdScaleX, gdScaleY; #define FASTMAPROWCOLTOPOS( r, c ) ( (r) * WORLD_COLS + (c) ) BOOLEAN gfScrollInertia = FALSE; // GLOBALS FOR CALCULATING STARTING PARAMETERS INT16 gsStartPointX_W, gsStartPointY_W; INT16 gsStartPointX_S, gsStartPointY_S; INT16 gsStartPointX_M, gsStartPointY_M; INT16 gsEndXS, gsEndYS; // LARGER OFFSET VERSION FOR GIVEN LAYERS INT16 gsLStartPointX_W, gsLStartPointY_W; INT16 gsLStartPointX_S, gsLStartPointY_S; INT16 gsLStartPointX_M, gsLStartPointY_M; INT16 gsLEndXS, gsLEndYS; BOOLEAN gfRenderScroll = FALSE; BOOLEAN gfScrollStart = FALSE; INT16 gsScrollXIncrement; INT16 gsScrollYIncrement; INT32 guiScrollDirection; // Rendering flags (full, partial, etc.) UINT32 gRenderFlags=0; /* You know it was static and now it will be dynamic :P * any questions? joker */ SGPRect gClippingRect;// = { 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - INTERFACE_HEIGHT}; SGPRect gOldClipRect = { 0, 0, 1024, 768 }; // 0verhaul: This MUST mirror the gDirtyClipRect init, otherwise funkiness with video overlays will happen INT16 gsRenderCenterX; INT16 gsRenderCenterY; INT16 gsRenderWorldOffsetX = 0; //lal was -1 : bugfix for merc screen position in tactical on high resolution INT16 gsRenderWorldOffsetY = 10; //lal was -1 SGPRect gSelectRegion; UINT32 fSelectMode = NO_SELECT; SGPPoint gSelectAnchor; typedef struct { BOOLEAN fDynamic; BOOLEAN fZWrite; BOOLEAN fZBlitter; BOOLEAN fShadowBlitter; BOOLEAN fLinkedListDirection; BOOLEAN fMerc; BOOLEAN fCheckForRedundency; BOOLEAN fMultiZBlitter; BOOLEAN fConvertTo16; BOOLEAN fObscured; } RenderFXType; RenderFXType RenderFX[] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, // STATIC LAND FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, // STATIC OBJECTS FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, // STATIC SHADOWS FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, // STATIC STRUCTS FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, // STATIC ROOF FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, // STATIC ONROOF FALSE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, // STATIC TOPMOST TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, // DYNAMIC LAND TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, // DYNAMIC OBJECT TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, // DYNAMIC SHADOW TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, // DYNAMIC STRUCT MERCS TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, // DYNAMIC MERCS TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, // DYNAMIC STRUCT TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, // DYNAMIC ROOF TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, // DYNAMIC HIGHMERCS TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, // DYNAMIC ONROOF TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE // DYNAMIC TOPMOST }; UINT8 RenderFXStartIndex[] = { LAND_START_INDEX, // STATIC LAND OBJECT_START_INDEX, // STATIC OBJECTS SHADOW_START_INDEX, // STATIC SHADOWS STRUCT_START_INDEX, // STATIC STRUCTS ROOF_START_INDEX, // STATIC ROOF ONROOF_START_INDEX, // STATIC ONROOF TOPMOST_START_INDEX, // STATIC TOPMOST LAND_START_INDEX, // DYNAMIC LAND OBJECT_START_INDEX, // DYNAMIC OBJECT SHADOW_START_INDEX, // DYNAMIC SHADOW MERC_START_INDEX, // DYNAMIC STRUCT MERCS MERC_START_INDEX, // DYNAMIC MERCS STRUCT_START_INDEX, // DYNAMIC STRUCT ROOF_START_INDEX, // DYNAMIC ROOF MERC_START_INDEX, // DYNAMIC HIGHMERCS ONROOF_START_INDEX, // DYNAMIC ONROOF TOPMOST_START_INDEX, // DYNAMIC TOPMOST }; //INT16 gsCoordArray[ 500 ][ 500 ][ 4 ]; //INT16 gsCoordArrayX; //INT16 gsCoordArrayY; //void SetRenderGlobals( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS ); //void TempRenderTiles(UINT32 uiFlags, INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS ); //void TempRenderTiles(UINT32 uiFlags, INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS, UINT8 ubNumLevels, UINT32 *puiLevels ); void ExamineZBufferForHiddenTiles( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS ); //void ReRenderWorld(INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom); void ClearMarkedTiles(void); void CorrectRenderCenter( INT16 sRenderX, INT16 sRenderY, INT16 *pSNewX, INT16 *pSNewY ); void ScrollBackground(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScrollYIncrement ); void CalcRenderParameters(INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom ); void ResetRenderParameters( ); void RenderRoomInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS ); #ifdef _DEBUG //extern UINT8 gubFOVDebugInfoInfo[ WORLD_MAX ]; //extern UINT8 gubGridNoMarkers[ WORLD_MAX ]; extern UINT8 * gubFOVDebugInfoInfo; extern UINT8 * gubGridNoMarkers; extern UINT8 gubGridNoValue; extern BOOLEAN gfDisplayCoverValues; extern BOOLEAN gfDisplayGridNoVisibleValues = 0; //extern INT16 gsCoverValue[ WORLD_MAX ]; extern INT16 * gsCoverValue; extern INT16 gsBestCover; void RenderFOVDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS ); void RenderCoverDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS ); void RenderGridNoVisibleDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS ); #endif void DeleteFromWorld( UINT16 usTileIndex, UINT32 uiRenderTiles, UINT16 usIndex ); void RenderHighlight( INT16 sMouseX_M, INT16 sMouseY_M, INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS ); BOOLEAN CheckRenderCenter( INT16 sNewCenterX, INT16 sNewCenterY ); BOOLEAN RevealWalls(INT16 sX, INT16 sY, INT16 sRadius) { LEVELNODE *pStruct; INT16 sCountX, sCountY; UINT32 uiTile; BOOLEAN fRerender=FALSE; TILE_ELEMENT *TileElem; for(sCountY=sY-sRadius; sCountY < (sY+sRadius+2); sCountY++) for(sCountX=sX-sRadius; sCountX < (sX+sRadius+2); sCountX++) { uiTile=FASTMAPROWCOLTOPOS(sCountY, sCountX); pStruct=gpWorldLevelData[uiTile].pStructHead; while(pStruct!=NULL) { TileElem = &(gTileDatabase[pStruct->usIndex]); switch(TileElem->usWallOrientation) { case NO_ORIENTATION: break; case INSIDE_TOP_RIGHT: case OUTSIDE_TOP_RIGHT: if(sCountX >= sX) { pStruct->uiFlags|=LEVELNODE_REVEAL; fRerender=TRUE; } break; case INSIDE_TOP_LEFT: case OUTSIDE_TOP_LEFT: if(sCountY >= sY) { pStruct->uiFlags|=LEVELNODE_REVEAL; fRerender=TRUE; } break; } pStruct=pStruct->pNext; } } /* if(fRerender) SetRenderFlags(RENDER_FLAG_FULL); */ return(TRUE); } BOOLEAN ConcealWalls(INT16 sX, INT16 sY, INT16 sRadius) { LEVELNODE *pStruct; INT16 sCountX, sCountY; UINT32 uiTile; BOOLEAN fRerender=FALSE; TILE_ELEMENT *TileElem; for(sCountY=sY-sRadius; sCountY < (sY+sRadius+2); sCountY++) for(sCountX=sX-sRadius; sCountX < (sX+sRadius+2); sCountX++) { uiTile=FASTMAPROWCOLTOPOS(sCountY, sCountX); pStruct=gpWorldLevelData[uiTile].pStructHead; while(pStruct!=NULL) { TileElem = &(gTileDatabase[pStruct->usIndex]); switch(TileElem->usWallOrientation) { case NO_ORIENTATION: break; case INSIDE_TOP_RIGHT: case OUTSIDE_TOP_RIGHT: if(sCountX >= sX) { pStruct->uiFlags&=(~LEVELNODE_REVEAL); fRerender=TRUE; } break; case INSIDE_TOP_LEFT: case OUTSIDE_TOP_LEFT: if(sCountY >= sY) { pStruct->uiFlags&=(~LEVELNODE_REVEAL); fRerender=TRUE; } break; } pStruct=pStruct->pNext; } } /* if(fRerender) SetRenderFlags(RENDER_FLAG_FULL); */ return(TRUE); } void ConcealAllWalls(void) { LEVELNODE *pStruct; INT32 uiCount; for(uiCount=0; uiCount < WORLD_MAX; uiCount++) { pStruct=gpWorldLevelData[uiCount].pStructHead; while(pStruct!=NULL) { pStruct->uiFlags&=(~LEVELNODE_REVEAL); pStruct=pStruct->pNext; } } } void ResetLayerOptimizing(void) { uiLayerUsedFlags = 0xffffffff; uiAdditiveLayerUsedFlags = 0; } void ResetSpecificLayerOptimizing( UINT32 uiRowFlag ) { uiLayerUsedFlags |= uiRowFlag; } void SumAddiviveLayerOptimization( void ) { uiLayerUsedFlags = uiAdditiveLayerUsedFlags; } void SetRenderFlags(UINT32 uiFlags) { gRenderFlags|=uiFlags; } void ClearRenderFlags(UINT32 uiFlags) { gRenderFlags&=(~uiFlags); } UINT32 GetRenderFlags(void) { return(gRenderFlags); } void RenderSetShadows(BOOLEAN fShadows) { if(fShadows) { gRenderFlags|=RENDER_FLAG_SHADOWS; } else { gRenderFlags&=(~RENDER_FLAG_SHADOWS); } } void RenderTiles(UINT32 uiFlags, INT32 iStartPointX_M, INT32 iStartPointY_M, INT32 iStartPointX_S, INT32 iStartPointY_S, INT32 iEndXS, INT32 iEndYS, UINT8 ubNumLevels, UINT32 *puiLevels, UINT16 *psLevelIDs ) { //#if 0 LEVELNODE *pNode; //, *pLand, *pStruct; //*pObject, *pTopmost, *pMerc; SOLDIERTYPE *pSoldier, *pSelSoldier; HVOBJECT hVObject = NULL; ETRLEObject *pTrav; TILE_ELEMENT *TileElem=NULL; UINT32 uiDestPitchBYTES = 0; UINT8 *pDestBuf=NULL; UINT16 usAnimSurface; INT8 bXOddFlag = 0; INT32 iAnchorPosX_M, iAnchorPosY_M; INT32 iAnchorPosX_S, iAnchorPosY_S; INT32 iTempPosX_M, iTempPosY_M; INT32 iTempPosX_S, iTempPosY_S; FLOAT dOffsetX, dOffsetY; FLOAT dTempX_S, dTempY_S; INT32 uiTileIndex; UINT16 usImageIndex, *pShadeTable, *pDirtyBackPtr; UINT32 uiBrushWidth, uiBrushHeight, uiDirtyFlags; INT16 sTileHeight, sXPos, sYPos, sZLevel; INT16 sMouseX_M, sMouseY_M; BOOLEAN fShadowBlitter=FALSE; BOOLEAN fZBlitter=FALSE; BOOLEAN fZWrite=FALSE; BOOLEAN fLinkedListDirection=TRUE; BOOLEAN fRenderTile=TRUE; BOOLEAN fMerc=FALSE; BOOLEAN fCheckForRedundency=FALSE; UINT32 uiRowFlags; BOOLEAN fDynamic=TRUE; BOOLEAN fEndRenderRow = FALSE; BOOLEAN fEndRenderCol = FALSE; BOOLEAN fPixelate=FALSE; BOOLEAN fMultiZBlitter = FALSE; BOOLEAN fWallTile = FALSE; BOOLEAN fMultiTransShadowZBlitter = FALSE; INT16 sMultiTransShadowZBlitterIndex=-1; BOOLEAN fTranslucencyType=FALSE; INT16 sX, sY; BOOLEAN fTileInvisible = FALSE; BOOLEAN fConvertTo16=FALSE; UINT32 cnt; static UINT8 ubLevelNodeStartIndex[ NUM_RENDER_FX_TYPES ]; BOOLEAN bItemOutline; UINT16 usOutlineColor=0; static INT32 iTileMapPos[ 500 ]; INT32 uiMapPosIndex; UINT8 bBlitClipVal; INT8 bItemCount, bVisibleItemCount; //UINT16 us16BPPIndex; RenderFXType RenderingFX; BOOLEAN fCheckForMouseDetections = FALSE; static RenderFXType RenderFXList[ NUM_RENDER_FX_TYPES ]; BOOLEAN fSaveZ; INT16 sWorldY; INT16 sZOffsetX=-1; INT16 sZOffsetY=-1; BOOLEAN fIntensityBlitter; INT16 gsForceSoldierZLevel; ROTTING_CORPSE *pCorpse=NULL; BOOLEAN fUseTileElem; UINT32 uiLevelNodeFlags; UINT32 uiTileElemFlags=0; INT8 bGlowShadeOffset; BOOLEAN fObscured; BOOLEAN fObscuredBlitter; INT16 sModifiedTileHeight; BOOLEAN fDoRow; INT16 **pShadeStart; UINT32 uiSaveBufferPitchBYTES; UINT8 *pSaveBuf; ITEM_POOL *pItemPool = NULL; BOOLEAN fHiddenTile = FALSE; UINT32 uiAniTileFlags = 0; INT16 sZStripIndex; //Init some variables usImageIndex = 0; sZLevel = 0; uiDirtyFlags = 0; pShadeTable = NULL; // Begin Render Loop iAnchorPosX_M = iStartPointX_M; iAnchorPosY_M = iStartPointY_M; iAnchorPosX_S = iStartPointX_S; iAnchorPosY_S = iStartPointY_S; if(!(uiFlags&TILES_DIRTY)) pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); if ( uiFlags & TILES_DYNAMIC_CHECKFOR_INT_TILE ) { if ( ShouldCheckForMouseDetections( ) ) { BeginCurInteractiveTileCheck( gubIntTileCheckFlags ); fCheckForMouseDetections = TRUE; // If we are in edit mode, don't do this... if ( gfEditMode ) { fCheckForMouseDetections = FALSE; } } } //if((uiFlags&TILES_TYPE_MASK)==TILES_STATIC_LAND) GetMouseXY( &sMouseX_M, &sMouseY_M ); pDirtyBackPtr=NULL; if(gTacticalStatus.uiFlags&TRANSLUCENCY_TYPE) fTranslucencyType=TRUE; for ( cnt = 0; cnt < ubNumLevels; cnt++ ) { ubLevelNodeStartIndex[ cnt ] = RenderFXStartIndex[ psLevelIDs[ cnt ] ]; RenderFXList[ cnt ] = RenderFX[ psLevelIDs[ cnt ] ]; } do { iTempPosX_M = iAnchorPosX_M; iTempPosY_M = iAnchorPosY_M; iTempPosX_S = iAnchorPosX_S; iTempPosY_S = iAnchorPosY_S; uiMapPosIndex = 0; // Build tile index list do { iTileMapPos[ uiMapPosIndex ] = FASTMAPROWCOLTOPOS( iTempPosY_M, iTempPosX_M ); iTempPosX_S += 40; iTempPosX_M ++; iTempPosY_M --; uiMapPosIndex++; } while( iTempPosX_S < iEndXS ); for ( cnt = 0; cnt < ubNumLevels; cnt++ ) { uiRowFlags = puiLevels[ cnt ]; fDoRow = TRUE; if ( ( uiRowFlags & TILES_ALL_DYNAMICS ) && !( uiLayerUsedFlags & uiRowFlags ) && !( uiFlags & TILES_DYNAMIC_CHECKFOR_INT_TILE ) ) { fDoRow = FALSE; } if ( fDoRow ) { iTempPosX_M = iAnchorPosX_M; iTempPosY_M = iAnchorPosY_M; iTempPosX_S = iAnchorPosX_S; iTempPosY_S = iAnchorPosY_S; fEndRenderRow = FALSE; uiMapPosIndex = 0; if(bXOddFlag > 0) iTempPosX_S += 20; do { uiTileIndex = iTileMapPos[ uiMapPosIndex ]; uiMapPosIndex++; //if ( 0 ) if (!TileIsOutOfBounds(uiTileIndex)) { // OK, we're searching through this loop anyway, might as well check for mouse position // over objects... // Experimental! if ( uiFlags & TILES_DYNAMIC_CHECKFOR_INT_TILE ) { if ( fCheckForMouseDetections && gpWorldLevelData[uiTileIndex].pStructHead != NULL ) { LogMouseOverInteractiveTile( uiTileIndex ); } } if((uiFlags&TILES_MARKED) && !(gpWorldLevelData[uiTileIndex].uiFlags&MAPELEMENT_REDRAW)) { pNode=NULL; } else { //pNode = gpWorldLevelData[ uiTileIndex ].pLevelNodes[ RenderFXStartIndex[ psLevelIDs[ cnt ] ] ]; //pNode = gpWorldLevelData[ uiTileIndex ].pLevelNodes[ 0 ]; //pNode=NULL; pNode = gpWorldLevelData[ uiTileIndex ].pLevelNodes[ ubLevelNodeStartIndex[ cnt ] ]; } bItemCount = 0; bVisibleItemCount = 0; pItemPool = NULL; while(pNode!= NULL) { RenderingFX = RenderFXList[ cnt ]; fObscured = RenderingFX.fObscured; fDynamic = RenderingFX.fDynamic; fMerc = RenderingFX.fMerc; fZWrite = RenderingFX.fZWrite; fZBlitter = RenderingFX.fZBlitter; fShadowBlitter = RenderingFX.fShadowBlitter; fLinkedListDirection = RenderingFX.fLinkedListDirection; fCheckForRedundency = RenderingFX.fCheckForRedundency; fMultiZBlitter = RenderingFX.fMultiZBlitter; fConvertTo16 = RenderingFX.fConvertTo16; fIntensityBlitter = FALSE; fSaveZ = FALSE; fWallTile = FALSE; gsForceSoldierZLevel = FALSE; pSoldier = NULL; fUseTileElem = FALSE; fMultiTransShadowZBlitter = FALSE; fObscuredBlitter = FALSE; fTranslucencyType = TRUE; uiAniTileFlags = 0; sZStripIndex = -1; uiLevelNodeFlags = pNode->uiFlags; if ( fCheckForRedundency ) { if ( ( gpWorldLevelData[ uiTileIndex ].uiFlags & MAPELEMENT_REDUNDENT) ) { // IF WE DONOT WANT TO RE-EVALUATE FIRST if ( !( gpWorldLevelData[uiTileIndex].uiFlags & MAPELEMENT_REEVALUATE_REDUNDENCY ) && !(gTacticalStatus.uiFlags & NOHIDE_REDUNDENCY ) ) { pNode = NULL; break; } } } // Force z-buffer blitting for marked tiles ( even ground!) if ( (uiFlags&TILES_MARKED) ) { fZBlitter = TRUE; } //Looking up height every time here is alot better than doing it above! sTileHeight=gpWorldLevelData[uiTileIndex].sHeight; sModifiedTileHeight = ( ( ( sTileHeight / 80 ) - 1 ) * 80 ); if ( sModifiedTileHeight < 0 ) { sModifiedTileHeight = 0; } fRenderTile=TRUE; pDirtyBackPtr=NULL; if(uiLevelNodeFlags&LEVELNODE_REVEAL) { if(!fDynamic) fRenderTile=FALSE; else fPixelate=TRUE; } else fPixelate=FALSE; // non-type specific setup sXPos = (INT16)iTempPosX_S; sYPos = (INT16)iTempPosY_S; // setup for any tile type except mercs if(!fMerc ) { if ( !( uiLevelNodeFlags & ( LEVELNODE_ROTTINGCORPSE | LEVELNODE_CACHEDANITILE ) ) ) { if( ( uiLevelNodeFlags & LEVELNODE_REVEALTREES ) ) { TileElem = &(gTileDatabase[pNode->usIndex + 2]); } else { TileElem = &(gTileDatabase[pNode->usIndex]); } // HANDLE INDEPENDANT-PER-TILE ANIMATIONS ( IE: DOORS, EXPLODING THINGS, ETC ) if ( fDynamic ) { if( ( uiLevelNodeFlags & LEVELNODE_ANIMATION ) ) { if ( pNode->sCurrentFrame != -1 ) { Assert( TileElem->pAnimData != NULL ); TileElem = &gTileDatabase[TileElem->pAnimData->pusFrames[pNode->sCurrentFrame]]; } } } } // Check for best translucency if ( uiLevelNodeFlags & LEVELNODE_USEBESTTRANSTYPE ) { fTranslucencyType = FALSE; } if ( ( uiLevelNodeFlags & ( LEVELNODE_ROTTINGCORPSE | LEVELNODE_CACHEDANITILE ) ) ) { if ( fDynamic ) { if( !(uiLevelNodeFlags & ( LEVELNODE_DYNAMIC ) ) && !(uiLevelNodeFlags & LEVELNODE_LASTDYNAMIC) ) fRenderTile=FALSE; } else if( (uiLevelNodeFlags & ( LEVELNODE_DYNAMIC ) ) ) fRenderTile=FALSE; } else { // Set Tile elem flags here! uiTileElemFlags = TileElem->uiFlags; // Set valid tile elem! fUseTileElem = TRUE; if(fDynamic || fPixelate) { if(!fPixelate) { if(!( uiTileElemFlags & ANIMATED_TILE) && !(uiTileElemFlags & DYNAMIC_TILE) && !(uiLevelNodeFlags & LEVELNODE_DYNAMIC) && !(uiLevelNodeFlags & LEVELNODE_LASTDYNAMIC) ) fRenderTile=FALSE; else if(!(uiTileElemFlags&DYNAMIC_TILE) && !(uiLevelNodeFlags&LEVELNODE_DYNAMIC) && !(uiLevelNodeFlags&LEVELNODE_LASTDYNAMIC) ) // else if((TileElem->uiFlags&ANIMATED_TILE) ) { Assert( TileElem->pAnimData != NULL ); TileElem = &gTileDatabase[TileElem->pAnimData->pusFrames[TileElem->pAnimData->bCurrentFrame]]; uiTileElemFlags = TileElem->uiFlags; } } } else if((uiTileElemFlags & ANIMATED_TILE) || (uiTileElemFlags & DYNAMIC_TILE) || (uiLevelNodeFlags & LEVELNODE_DYNAMIC) ) { if ( !( uiFlags & TILES_OBSCURED ) || ( uiTileElemFlags & ANIMATED_TILE ) ) { fRenderTile=FALSE; } } } // OK, ATE, CHECK FOR AN OBSCURED TILE AND MAKE SURE IF LEVELNODE IS SET // WE DON'T RENDER UNLESS WE HAVE THE RENDER FLAG SET! if ( fObscured ) { if ( ( uiFlags & TILES_OBSCURED ) ) { if ( uiLevelNodeFlags & LEVELNODE_SHOW_THROUGH ) { fObscuredBlitter = TRUE; // ATE: Check if this is a levelnode, and what frame we are on // turn off...... //if ( ( uiLevelNodeFlags & LEVELNODE_ITEM ) && gsCurrentItemGlowFrame < 25 ) //{ // fRenderTile = FALSE; //} } else { // Don;t render if we are not on this render loop! fRenderTile = FALSE; } } else { if ( uiLevelNodeFlags & LEVELNODE_SHOW_THROUGH ) { fRenderTile = FALSE; // ATE: Check if this is a levelnode, and what frame we are on // turn off...... //if ( ( uiLevelNodeFlags & LEVELNODE_ITEM ) && gsCurrentItemGlowFrame < 25 ) //{ // fRenderTile = TRUE; //} } } } // If flag says to do dynamic as well, render! if ( ( uiFlags & TILES_DOALL ) ) { fRenderTile = TRUE; } // If we are on the struct layer, check for if it's hidden! if ( uiRowFlags & ( TILES_STATIC_STRUCTURES | TILES_DYNAMIC_STRUCTURES | TILES_STATIC_SHADOWS | TILES_DYNAMIC_SHADOWS ) ) { if ( fUseTileElem ) { #if 0 // DONOT RENDER IF IT'S A HIDDEN STRUCT AND TILE IS NOT REVEALED if ( uiTileElemFlags & HIDDEN_TILE ) { // IF WORLD IS NOT REVEALED, QUIT #ifdef JA2EDITOR if ( !gfEditMode ) #endif { if ( !(gpWorldLevelData[ uiTileIndex ].uiFlags & MAPELEMENT_REVEALED ) && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) { //CONTINUE, DONOT RENDER if(!fLinkedListDirection) pNode = pNode->pPrevNode; else pNode = pNode->pNext; continue; } } } #endif } } if(fRenderTile) { // Set flag to set layer as used if( fDynamic || fPixelate ) { uiAdditiveLayerUsedFlags |= uiRowFlags; } if ( uiLevelNodeFlags & LEVELNODE_DYNAMICZ ) { fSaveZ = TRUE; fZWrite = TRUE; } if ( ( uiLevelNodeFlags & LEVELNODE_CACHEDANITILE ) ) { hVObject = gpTileCache[ pNode->pAniTile->sCachedTileID ].pImagery->vo; usImageIndex = pNode->pAniTile->sCurrentFrame; uiAniTileFlags = pNode->pAniTile->uiFlags; // Position corpse based on its float position if ( ( uiLevelNodeFlags & LEVELNODE_ROTTINGCORPSE ) ) { pCorpse = &( gRottingCorpse[ pNode->pAniTile->uiUserData ] ); pShadeTable = pCorpse->pShades[ pNode->ubShadeLevel ]; //pShadeTable = pCorpse->p16BPPPalette; dOffsetX = pCorpse->def.dXPos - gsRenderCenterX; dOffsetY = pCorpse->def.dYPos - gsRenderCenterY; // OK, if this is a corpse.... stop if not visible if ( pCorpse->def.bVisible != 1 && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) { //CONTINUE, DONOT RENDER if(!fLinkedListDirection) pNode = pNode->pPrevNode; else pNode = pNode->pNext; continue; } } else { dOffsetX = (FLOAT)( pNode->pAniTile->sRelativeX - gsRenderCenterX ); dOffsetY = (FLOAT)( pNode->pAniTile->sRelativeY - gsRenderCenterY ); } // Calculate guy's position FloatFromCellToScreenCoordinates( dOffsetX, dOffsetY, &dTempX_S, &dTempY_S ); sXPos = ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ) + (INT16)dTempX_S; sYPos = ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ) + (INT16)dTempY_S - sTileHeight; // Adjust for offset position on screen sXPos -= gsRenderWorldOffsetX; sYPos -= gsRenderWorldOffsetY; } else { hVObject = TileElem->hTileSurface; usImageIndex=TileElem->usRegionIndex; // ADJUST FOR WORLD MAPELEM HIEGHT sYPos-=TileElem->sOffsetHeight; if((TileElem->uiFlags&IGNORE_WORLD_HEIGHT) ) { sYPos = sYPos - sModifiedTileHeight; //sYPos -= sTileHeight; } if( !(uiLevelNodeFlags&LEVELNODE_IGNOREHEIGHT) && !(TileElem->uiFlags&IGNORE_WORLD_HEIGHT )) sYPos-=sTileHeight; if(!(uiFlags&TILES_DIRTY)) { hVObject->pShadeCurrent=hVObject->pShades[pNode->ubShadeLevel]; hVObject->pShade8=ubColorTables[pNode->ubShadeLevel]; } } //ADJUST FOR RELATIVE OFFSETS if ( uiLevelNodeFlags & LEVELNODE_USERELPOS ) { sXPos += pNode->sRelativeX; sYPos += pNode->sRelativeY; } if ( uiLevelNodeFlags& LEVELNODE_USEZ ) { sYPos -= pNode->sRelativeZ; } //ADJUST FOR ABSOLUTE POSITIONING if ( uiLevelNodeFlags& LEVELNODE_USEABSOLUTEPOS ) { dOffsetX = (FLOAT)(pNode->sRelativeX - gsRenderCenterX); dOffsetY = (FLOAT)(pNode->sRelativeY - gsRenderCenterY); // OK, DONT'T ASK... CONVERSION TO PROPER Y NEEDS THIS... dOffsetX -= CELL_Y_SIZE; FloatFromCellToScreenCoordinates( dOffsetX, dOffsetY, &dTempX_S, &dTempY_S ); sXPos = ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ) + (INT16)SHORT_ROUND( dTempX_S ); sYPos = ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ) + (INT16)SHORT_ROUND( dTempY_S ); // Adjust for offset position on screen sXPos -= gsRenderWorldOffsetX; sYPos -= gsRenderWorldOffsetY; sYPos -= pNode->sRelativeZ; } } // COUNT # OF ITEMS AT THIS LOCATION if ( uiLevelNodeFlags & LEVELNODE_ITEM ) { // OK set item pool for this location.... if ( bItemCount == 0 ) { pItemPool = pNode->pItemPool; } else { pItemPool = pItemPool->pNext; } if ( bItemCount < MAX_RENDERED_ITEMS ) { bItemCount++; if ( gWorldItems[ pItemPool->iItemIndex ].bVisible == VISIBLE ) { bVisibleItemCount++; } } // LIMIT RENDERING OF ITEMS TO ABOUT 7, DO NOT RENDER HIDDEN ITEMS TOO! if ( bVisibleItemCount == MAX_RENDERED_ITEMS || ( gWorldItems[ pItemPool->iItemIndex ].bVisible != VISIBLE ) || ( pItemPool->usFlags & WORLD_ITEM_DONTRENDER ) ) { if ( !(gTacticalStatus.uiFlags&SHOW_ALL_ITEMS) ) { //CONTINUE, DONOT RENDER if(!fLinkedListDirection) pNode = pNode->pPrevNode; else pNode = pNode->pNext; continue; } } if ( guiCurrentScreen == EDIT_SCREEN ) { // ATE: If in the editor, change this to a little higher value if ( bItemCount == MAX_RENDERED_ITEMS ) { //CONTINUE, DONOT RENDER if(!fLinkedListDirection) pNode = pNode->pPrevNode; else pNode = pNode->pNext; continue; } } if ( pItemPool->bRenderZHeightAboveLevel > 0 ) { sYPos -= pItemPool->bRenderZHeightAboveLevel; } } // If render tile is false... if ( !fRenderTile ) { if(!fLinkedListDirection) pNode = pNode->pPrevNode; else pNode = pNode->pNext; continue; } } // specific code for node types on a per-tile basis switch( uiRowFlags ) { case TILES_STATIC_LAND: sZLevel = LandZLevel( iTempPosX_M, iTempPosY_M ); break; case TILES_STATIC_OBJECTS: // ATE: Modified to use constant z level, as these are same level as land items sZLevel = ObjectZLevel( TileElem, pNode, uiTileElemFlags, iTempPosX_M, iTempPosY_M, sWorldY ); break; case TILES_STATIC_STRUCTURES: StructZLevel( iTempPosX_M, iTempPosY_M ); if ( fUseTileElem && ( TileElem->uiFlags & MULTI_Z_TILE ) ) { fMultiZBlitter = TRUE; } // ATE: if we are a wall, set flag if ( fUseTileElem && ( TileElem->uiFlags & WALL_TILE ) ) { fWallTile = TRUE; } break; case TILES_STATIC_ROOF: sZLevel = RoofZLevel( iTempPosX_M, iTempPosY_M, sWorldY ); // Automatically adjust height! sYPos -= WALL_HEIGHT; // ATE: Added for shadows on roofs if ( fUseTileElem && ( TileElem->uiFlags & ROOFSHADOW_TILE ) ) { fShadowBlitter=TRUE; } break; case TILES_STATIC_ONROOF: sZLevel = OnRoofZLevel( iTempPosX_M, iTempPosY_M, sWorldY, uiLevelNodeFlags ); // Automatically adjust height! sYPos -= WALL_HEIGHT; break; case TILES_STATIC_TOPMOST: sZLevel = TopmostZLevel( iTempPosX_M, iTempPosY_M, sWorldY ); break; case TILES_STATIC_SHADOWS: sZLevel = ShadowZLevel( iTempPosX_M, iTempPosY_M, sWorldY ); if ( uiLevelNodeFlags & LEVELNODE_EXITGRID ) { fIntensityBlitter = TRUE; fShadowBlitter = FALSE; } break; case TILES_DYNAMIC_LAND: sZLevel = LandZLevel( iTempPosX_M, iTempPosY_M ); uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; break; case TILES_DYNAMIC_SHADOWS: sZLevel = ShadowZLevel( iTempPosX_M, iTempPosY_M, sWorldY ); //sZLevel=SHADOW_Z_LEVEL; uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; break; case TILES_DYNAMIC_OBJECTS: sZLevel = ObjectZLevel( TileElem, pNode, uiTileElemFlags, iTempPosX_M, iTempPosY_M, sWorldY ); uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; break; case TILES_DYNAMIC_STRUCTURES: StructZLevel( iTempPosX_M, iTempPosY_M ); uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; if ( uiTileElemFlags & Z_AWARE_DYNAMIC_TILE ) { fMultiZBlitter = TRUE; fZBlitter = TRUE; fWallTile = TRUE; sZStripIndex = 0; } break; case TILES_DYNAMIC_ROOF: sYPos -= WALL_HEIGHT; sZLevel = RoofZLevel( iTempPosX_M, iTempPosY_M, sWorldY ); uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; // For now, adjust to hieght of a wall ( 50 temp, make define ) //if ( TileElem->fType > FOOTPRINTS ) //{ // sYPos -= 58; //} break; case TILES_DYNAMIC_ONROOF: sZLevel = OnRoofZLevel( iTempPosX_M, iTempPosY_M, sWorldY, uiLevelNodeFlags ); uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; // Automatically adjust height! sYPos -= WALL_HEIGHT; break; case TILES_DYNAMIC_TOPMOST: sZLevel = TopmostZLevel( iTempPosX_M, iTempPosY_M, sWorldY ); uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED; break; case TILES_DYNAMIC_MERCS: case TILES_DYNAMIC_HIGHMERCS: case TILES_DYNAMIC_STRUCT_MERCS: // Set flag to set layer as used uiAdditiveLayerUsedFlags |= uiRowFlags; pSoldier=pNode->pSoldier; if ( uiRowFlags == TILES_DYNAMIC_MERCS ) { // If we are multi-tiled, ignore here if ( pSoldier->flags.uiStatusFlags & ( SOLDIER_MULTITILE_Z | SOLDIER_Z ) ) { pNode = pNode->pNext; continue; } // If we are at a higher level, no not do anything unless we are at the highmerc stage if ( pSoldier->pathing.bLevel > 0 ) { pNode = pNode->pNext; continue; } } if ( uiRowFlags == TILES_DYNAMIC_HIGHMERCS ) { // If we are multi-tiled, ignore here if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE_Z ) { pNode = pNode->pNext; continue; } // If we are at a lower level, no not do anything unless we are at the highmerc stage if ( pSoldier->pathing.bLevel == 0 ) { pNode = pNode->pNext; continue; } } if ( uiRowFlags == TILES_DYNAMIC_STRUCT_MERCS ) { // If we are not multi-tiled, ignore here if ( !( pSoldier->flags.uiStatusFlags & ( SOLDIER_MULTITILE_Z | SOLDIER_Z ) ) ) { // If we are at a low level, no not do anything unless we are at the merc stage if ( pSoldier->pathing.bLevel == 0 ) { pNode = pNode->pNext; continue; } } if ( pSoldier->flags.uiStatusFlags & ( SOLDIER_MULTITILE_Z | SOLDIER_Z ) ) { fSaveZ = TRUE; fZBlitter = TRUE; if ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE_Z ) { fMultiTransShadowZBlitter = TRUE; // ATE: Use one direction for queen! if ( pSoldier->ubBodyType == QUEENMONSTER ) { sMultiTransShadowZBlitterIndex = 0; } else { sMultiTransShadowZBlitterIndex = gOneCDirection[ pSoldier->ubDirection ]; } } else { fZWrite = TRUE; } } } // IF we are not active, or are a placeholder for multi-tile animations do nothing //if ( !pSoldier->bActive ) if ( !pSoldier->bActive || (uiLevelNodeFlags & LEVELNODE_MERCPLACEHOLDER) ) { pNode = pNode->pNext; continue; } // Skip if we cannot see the guy! if ( pSoldier->bLastRenderVisibleValue == -1 && !(gTacticalStatus.uiFlags&SHOW_ALL_MERCS) ) { pNode = pNode->pNext; continue; } // Get animation surface.... usAnimSurface = GetSoldierAnimationSurface( pSoldier, pSoldier->usAnimState ); if ( usAnimSurface == INVALID_ANIMATION_SURFACE ) { pNode = pNode->pNext; continue; } // Shade guy always lighter than sceane default! { UINT8 ubShadeLevel; ubShadeLevel = (pNode->ubShadeLevel&0x0f); ubShadeLevel=__max(ubShadeLevel-2, DEFAULT_SHADE_LEVEL); ubShadeLevel|=(pNode->ubShadeLevel&0x30); if ( pSoldier->flags.fBeginFade ) { pShadeTable = pSoldier->pCurrentShade = pSoldier->pShades[ pSoldier->ubFadeLevel ]; } else { pShadeTable = pSoldier->pCurrentShade = pSoldier->pShades[ ubShadeLevel]; } } // Position guy based on guy's position dOffsetX = pSoldier->dXPos - gsRenderCenterX; dOffsetY = pSoldier->dYPos - gsRenderCenterY; // Calculate guy's position FloatFromCellToScreenCoordinates( dOffsetX, dOffsetY, &dTempX_S, &dTempY_S ); sXPos = ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ) + (INT16)dTempX_S; sYPos = ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ) + (INT16)dTempY_S - sTileHeight; // Adjust for offset position on screen sXPos -= gsRenderWorldOffsetX; sYPos -= gsRenderWorldOffsetY; // Adjust for soldier height sYPos -= pSoldier->sHeightAdjustment; // Handle shade stuff.... if ( !pSoldier->flags.fBeginFade ) { // Special effect - draw ghost if is seen by a guy in player's team but not current guy // ATE: Todo: setup flag for 'bad-guy' - can releive some checks in renderer if ( !pSoldier->aiData.bNeutral && (pSoldier->bSide != gbPlayerNum ) ) { if ( gusSelectedSoldier != NOBODY ) { pSelSoldier = MercPtrs[ gusSelectedSoldier ]; } else { pSelSoldier = NULL; } bGlowShadeOffset = 0; if ( gTacticalStatus.ubCurrentTeam == gbPlayerNum ) { // Shade differently depending on visiblity if ( pSoldier->bLastRenderVisibleValue == 0 ) { bGlowShadeOffset = 10; } if ( pSelSoldier != NULL ) { if ( pSelSoldier->aiData.bOppList[ pSoldier->ubID ] != SEEN_CURRENTLY ) { if ( pSoldier->usAnimState != CHARIOTS_OF_FIRE && pSoldier->usAnimState != BODYEXPLODING ) { bGlowShadeOffset = 10; } } } } if ( pSoldier->pathing.bLevel == 0 ) { pShadeStart = (INT16 **) &( pSoldier->pGlowShades[ 0 ] ); } else { pShadeStart = (INT16 **) &( pSoldier->pShades[ 20 ] ); } // Set shade // If a bad guy is highlighted if ( gfUIHandleSelectionAboveGuy == TRUE && MercPtrs[ gsSelectedGuy ]->bSide != gbPlayerNum ) { if ( gsSelectedGuy == pSoldier->ubID ) { pShadeTable = (UINT16 *) pShadeStart[ gsGlowFrames[ gsCurrentGlowFrame ] + bGlowShadeOffset ]; gsForceSoldierZLevel = TOPMOST_Z_LEVEL; } else { // Are we dealing with a not-so visible merc? if ( bGlowShadeOffset == 10 ) { pShadeTable = pSoldier->pEffectShades[ 0 ]; } } } else { // OK,not highlighted, but maybe we are in enemy's turn and they have the baton // AI's turn? if ( gTacticalStatus.ubCurrentTeam != OUR_TEAM ) { // Does he have baton? if ( (pSoldier->flags.uiStatusFlags & SOLDIER_UNDERAICONTROL) ) { pShadeTable = (UINT16 *) pShadeStart[ gpGlowFramePointer[ gsCurrentGlowFrame ] + bGlowShadeOffset ]; if ( gpGlowFramePointer[ gsCurrentGlowFrame ] >= 7 ) { gsForceSoldierZLevel = TOPMOST_Z_LEVEL; } } } else { pShadeTable = (UINT16 *) pShadeStart[ gpGlowFramePointer[ gsCurrentGlowFrame ] + bGlowShadeOffset ]; if ( gpGlowFramePointer[ gsCurrentGlowFrame ] >= 7 ) { gsForceSoldierZLevel = TOPMOST_Z_LEVEL; } } } //if ( gusSelectedSoldier != NOBODY ) //{ // pSelSoldier = MercPtrs[ gusSelectedSoldier ]; // Shade differently depending on visiblity // if ( pSoldier->bVisible == 0 || ( pSelSoldier->aiData.bOppList[ pSoldier->ubID ] == 0 ) ) // { // Shade gray // pShadeTable = pSoldier->pGlowShades[ gpGlowFramePointer[ gsCurrentGlowFrame ] + 10 ]; // } //} } } // Calculate Z level SoldierZLevel( pSoldier, iTempPosX_M, iTempPosY_M ); if(!(uiFlags&TILES_DIRTY)) { if ( pSoldier->flags.fForceShade ) { pShadeTable = pSoldier->pForcedShade; } } // check if we are a merc duplicate, if so, only do minimal stuff! if ( pSoldier->ubID >= MAX_NUM_SOLDIERS ) { // Shade gray pShadeTable = pSoldier->pEffectShades[ 1 ]; } hVObject=gAnimSurfaceDatabase[ usAnimSurface ].hVideoObject; if ( hVObject == NULL ) { pNode = pNode->pNext; continue; } // ATE: If we are in a gridno that we should not use obscure blitter, set! if ( !( gpWorldLevelData[ uiTileIndex ].ubExtFlags[0] & MAPELEMENT_EXT_NOBURN_STRUCT ) ) { fObscuredBlitter = TRUE; } else { // ATE: Artificially increase z=level... sZLevel += 2; } usImageIndex=pSoldier->usAniFrame; uiDirtyFlags=BGND_FLAG_SINGLE|BGND_FLAG_ANIMATED| BGND_FLAG_MERC; break; } // Adjust for interface level sYPos += gsRenderHeight; // OK, check for LEVELNODE HIDDEN... fHiddenTile = FALSE; if ( uiLevelNodeFlags & LEVELNODE_HIDDEN ) { fHiddenTile = TRUE; if ( TileElem != NULL ) { // If we are a roof and have SHOW_ALL_ROOFS on, turn off hidden tile check! if ( ( TileElem->uiFlags & ROOF_TILE ) && ( gTacticalStatus.uiFlags&SHOW_ALL_ROOFS ) ) { // Turn off fHiddenTile = FALSE; } } } if( fRenderTile && !fHiddenTile ) { fTileInvisible = FALSE; if ( ( uiLevelNodeFlags & LEVELNODE_ROTTINGCORPSE ) ) { // Set fmerc flag! fMerc = TRUE; fZWrite = TRUE; //if ( hVObject->ppZStripInfo != NULL ) { sMultiTransShadowZBlitterIndex = GetCorpseStructIndex( &( pCorpse->def ), TRUE ); fMultiTransShadowZBlitter = TRUE; } } if ( (uiLevelNodeFlags & LEVELNODE_LASTDYNAMIC ) && !(uiFlags&TILES_DIRTY) ) { // Remove flags! pNode->uiFlags &= (~LEVELNODE_LASTDYNAMIC ); fZWrite = TRUE; } if ( uiLevelNodeFlags & LEVELNODE_NOWRITEZ ) { fZWrite = FALSE; } if(uiFlags&TILES_NOZWRITE) fZWrite=FALSE; if ( uiFlags & TILES_NOZ ) { fZBlitter = FALSE; } if ( ( uiLevelNodeFlags & LEVELNODE_WIREFRAME ) ) { if ( !gGameSettings.fOptions[ TOPTION_TOGGLE_WIREFRAME ] ) { fTileInvisible = TRUE; } } // RENDER if ( fTileInvisible ) { } else if ( uiLevelNodeFlags & LEVELNODE_DISPLAY_AP && !( uiFlags&TILES_DIRTY ) ) { pTrav = &(hVObject->pETRLEObject[usImageIndex]); sXPos += pTrav->sOffsetX; sYPos += pTrav->sOffsetY; if ( gfUIDisplayActionPointsInvalid ) { SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); } else { SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_WHITE ); } if ( gfUIDisplayActionPointsBlack ) { SetFontBackground( FONT_MCOLOR_BLACK ); SetFontForeground( FONT_MCOLOR_BLACK ); } SetFont( TINYFONT1 ); SetFontDestBuffer( guiSAVEBUFFER , 0, gsVIEWPORT_WINDOW_START_Y, SCREEN_WIDTH, gsVIEWPORT_WINDOW_END_Y, FALSE ); VarFindFontCenterCoordinates( sXPos, sYPos, 1, 1, TINYFONT1, &sX, &sY, L"%d", pNode->uiAPCost ); mprintf_buffer( pDestBuf, uiDestPitchBYTES, TINYFONT1, sX, sY , L"%d", pNode->uiAPCost ); SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); } else if ( ( uiLevelNodeFlags & LEVELNODE_ERASEZ ) && !( uiFlags&TILES_DIRTY ) ) { Zero8BPPDataTo16BPPBufferTransparent( (UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex ); //Zero8BPPDataTo16BPPBufferTransparent( (UINT16*)gpZBuffer, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex ); } else if ( ( uiLevelNodeFlags & LEVELNODE_ITEM ) && !( uiFlags&TILES_DIRTY ) ) { BOOLEAN fZBlit = FALSE; if ( uiRowFlags == TILES_STATIC_ONROOF || uiRowFlags == TILES_DYNAMIC_ONROOF ) { usOutlineColor = gusYellowItemOutlineColor; bItemOutline = TRUE; fZBlit = TRUE; } else { usOutlineColor = gusNormalItemOutlineColor; bItemOutline = TRUE; fZBlit = TRUE; } if ( gGameSettings.fOptions[ TOPTION_GLOW_ITEMS ] ) { if ( uiRowFlags == TILES_STATIC_ONROOF || uiRowFlags == TILES_DYNAMIC_ONROOF ) { usOutlineColor = us16BPPItemCycleYellowColors[ gsCurrentItemGlowFrame ]; bItemOutline = TRUE; } else { if ( gTacticalStatus.uiFlags & RED_ITEM_GLOW_ON ) { usOutlineColor = us16BPPItemCycleRedColors[ gsCurrentItemGlowFrame ]; bItemOutline = TRUE; } else { usOutlineColor = us16BPPItemCycleWhiteColors[ gsCurrentItemGlowFrame ]; bItemOutline = TRUE; } } } //else //{ // usOutlineColor = us16BPPItemCycleWhiteColors[ pItemPool->bFlashColor ]; // bItemOutline = TRUE; //} bBlitClipVal = BltIsClippedOrOffScreen(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); if ( bBlitClipVal == FALSE ) { if ( fZBlit ) { if ( fObscuredBlitter ) { Blt8BPPDataTo16BPPBufferOutlineZPixelateObscured( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, usOutlineColor, bItemOutline ); } else { Blt8BPPDataTo16BPPBufferOutlineZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, usOutlineColor, bItemOutline ); } } else { Blt8BPPDataTo16BPPBufferOutline((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, usOutlineColor, bItemOutline ); } } else if ( bBlitClipVal == TRUE ) { if ( fZBlit ) { if ( fObscuredBlitter ) { Blt8BPPDataTo16BPPBufferOutlineZPixelateObscuredClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, usOutlineColor, bItemOutline, &gClippingRect ); } else { Blt8BPPDataTo16BPPBufferOutlineZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, usOutlineColor, bItemOutline, &gClippingRect ); } } else { Blt8BPPDataTo16BPPBufferOutlineClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, usOutlineColor, bItemOutline, &gClippingRect ); } } } // ATE: Check here for a lot of conditions! else if ( ( ( uiLevelNodeFlags & LEVELNODE_PHYSICSOBJECT ) ) && !( uiFlags&TILES_DIRTY ) ) { bItemOutline = TRUE; if ( uiLevelNodeFlags & LEVELNODE_PHYSICSOBJECT ) { bItemOutline = FALSE; } bBlitClipVal = BltIsClippedOrOffScreen(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); if ( fShadowBlitter ) { if ( bBlitClipVal == FALSE ) { Blt8BPPDataTo16BPPBufferShadowZNB( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex ); } else { Blt8BPPDataTo16BPPBufferShadowZNBClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect ); } } else { if ( bBlitClipVal == FALSE ) { Blt8BPPDataTo16BPPBufferOutlineZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, usOutlineColor, bItemOutline ); } else if ( bBlitClipVal == TRUE ) { Blt8BPPDataTo16BPPBufferOutlineClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, usOutlineColor, bItemOutline, &gClippingRect ); } } } else if(uiFlags&TILES_DIRTY) { if ( !(uiLevelNodeFlags & LEVELNODE_LASTDYNAMIC ) ) { pTrav = &(hVObject->pETRLEObject[usImageIndex]); uiBrushHeight = (UINT32)pTrav->usHeight; uiBrushWidth = (UINT32)pTrav->usWidth; sXPos += pTrav->sOffsetX; sYPos += pTrav->sOffsetY; RegisterBackgroundRect(uiDirtyFlags, NULL, sXPos, sYPos, (INT16)(sXPos + uiBrushWidth), (INT16)(__min((INT16)(sYPos + uiBrushHeight), gsVIEWPORT_WINDOW_END_Y))); if ( fSaveZ ) { RegisterBackgroundRect(uiDirtyFlags | BGND_FLAG_SAVE_Z, NULL, sXPos, sYPos, (INT16)(sXPos + uiBrushWidth), (INT16)(__min((INT16)(sYPos + uiBrushHeight), gsVIEWPORT_WINDOW_END_Y))); } } } else { if(gbPixelDepth==16) { /*if(fConvertTo16) { ConvertVObjectRegionTo16BPP(hVObject, usImageIndex, 4); if(CheckFor16BPPRegion(hVObject, usImageIndex, 4, &us16BPPIndex)) { Blt16BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, us16BPPIndex, &gClippingRect); } }*/ if( fMultiTransShadowZBlitter ) { if ( fZBlitter ) { if ( fObscuredBlitter ) { Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable ); } else { Blt8BPPDataTo16BPPBufferTransZTransShadowIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sMultiTransShadowZBlitterIndex, pShadeTable ); } } else { //Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect ); } } else if( fMultiZBlitter ) { if ( fZBlitter ) { if ( fObscuredBlitter ) { Blt8BPPDataTo16BPPBufferTransZIncObscureClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else { if ( fWallTile ) { if ( sZStripIndex == -1 ) { Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, usImageIndex); } else { Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, sZStripIndex ); } } else { Blt8BPPDataTo16BPPBufferTransZIncClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } } } else { Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect ); } } else { bBlitClipVal = BltIsClippedOrOffScreen(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); if ( bBlitClipVal == TRUE ) { if(fPixelate) { if(fTranslucencyType) { //if(fZWrite) // Blt8BPPDataTo16BPPBufferTransZClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); //else Blt8BPPDataTo16BPPBufferTransZNBClipTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else { //if(fZWrite) // Blt8BPPDataTo16BPPBufferTransZClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); //else Blt8BPPDataTo16BPPBufferTransZNBClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } } else if(fMerc) { if ( fZBlitter ) { if ( fZWrite ) { Blt8BPPDataTo16BPPBufferTransShadowZClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, pShadeTable); } else { if ( fObscuredBlitter ) { Blt8BPPDataTo16BPPBufferTransShadowZNBObscuredClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, pShadeTable); } else { Blt8BPPDataTo16BPPBufferTransShadowZNBClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, pShadeTable); } } if ( (uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE ) ) { pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES ); // BLIT HERE Blt8BPPDataTo16BPPBufferTransShadowClip( (UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, pShadeTable); UnLockVideoSurface(guiSAVEBUFFER); // Turn it off! pNode->uiFlags &= ( ~LEVELNODE_UPDATESAVEBUFFERONCE ); } } else { Blt8BPPDataTo16BPPBufferTransShadowClip( (UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, pShadeTable); } } else if(fShadowBlitter) { if ( fZBlitter ) { if(fZWrite) Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); else Blt8BPPDataTo16BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else { Blt8BPPDataTo16BPPBufferShadowClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } } else if( fIntensityBlitter) { if ( fZBlitter ) { if(fZWrite) Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); else Blt8BPPDataTo16BPPBufferIntensityZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else { Blt8BPPDataTo16BPPBufferIntensityClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } } else if(fZBlitter) { if(fZWrite) { if ( fObscuredBlitter ) { Blt8BPPDataTo16BPPBufferTransZClipPixelateObscured((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else { Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } } else { Blt8BPPDataTo16BPPBufferTransZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } if ( (uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE ) ) { pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES ); // BLIT HERE Blt8BPPDataTo16BPPBufferTransZClip((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); UnLockVideoSurface(guiSAVEBUFFER); // Turn it off! pNode->uiFlags &= ( ~LEVELNODE_UPDATESAVEBUFFERONCE ); } } else Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else if ( bBlitClipVal == FALSE ) { if(fPixelate) { if(fTranslucencyType) { if(fZWrite) Blt8BPPDataTo16BPPBufferTransZTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); else Blt8BPPDataTo16BPPBufferTransZNBTranslucent((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); } else { if(fZWrite) Blt8BPPDataTo16BPPBufferTransZPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); else Blt8BPPDataTo16BPPBufferTransZNBPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); } } else if(fMerc) { if ( fZBlitter ) { if ( fZWrite ) { Blt8BPPDataTo16BPPBufferTransShadowZ( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, pShadeTable); } else { if ( fObscuredBlitter ) { Blt8BPPDataTo16BPPBufferTransShadowZNBObscured( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, pShadeTable); } else { Blt8BPPDataTo16BPPBufferTransShadowZNB( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, pShadeTable); } } if ( (uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE ) ) { pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES ); // BLIT HERE Blt8BPPDataTo16BPPBufferTransShadow( (UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, pShadeTable); UnLockVideoSurface(guiSAVEBUFFER); // Turn it off! pNode->uiFlags &= ( ~LEVELNODE_UPDATESAVEBUFFERONCE ); } } else { Blt8BPPDataTo16BPPBufferTransShadow( (UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, pShadeTable); } } else if(fShadowBlitter) { if ( fZBlitter ) { if(fZWrite) Blt8BPPDataTo16BPPBufferShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); else Blt8BPPDataTo16BPPBufferShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); } else { Blt8BPPDataTo16BPPBufferShadow((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); } } else if( fIntensityBlitter ) { if ( fZBlitter ) { if(fZWrite) Blt8BPPDataTo16BPPBufferIntensityZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); else Blt8BPPDataTo16BPPBufferIntensityZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); } else { Blt8BPPDataTo16BPPBufferIntensity((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); } } else if(fZBlitter) { if(fZWrite) { // TEST //Blt8BPPDataTo16BPPBufferTransZPixelate( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); if ( fObscuredBlitter ) { Blt8BPPDataTo16BPPBufferTransZPixelateObscured( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); } else { Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); } } else Blt8BPPDataTo16BPPBufferTransZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); if ( (uiLevelNodeFlags & LEVELNODE_UPDATESAVEBUFFERONCE ) ) { pSaveBuf = LockVideoSurface(guiSAVEBUFFER, &uiSaveBufferPitchBYTES ); // BLIT HERE Blt8BPPDataTo16BPPBufferTransZ((UINT16*)pSaveBuf, uiSaveBufferPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex ); UnLockVideoSurface(guiSAVEBUFFER); // Turn it off! pNode->uiFlags &= ( ~LEVELNODE_UPDATESAVEBUFFERONCE ); } } else Blt8BPPDataTo16BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); } } } else // 8bpp section { if(fPixelate) { if(fZWrite) Blt8BPPDataTo8BPPBufferTransZClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); else Blt8BPPDataTo8BPPBufferTransZNBClipPixelate((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else if(BltIsClipped(hVObject, sXPos, sYPos, usImageIndex, &gClippingRect)) { if(fMerc) { Blt8BPPDataTo8BPPBufferTransShadowZNBClip( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect, pShadeTable); } else if(fShadowBlitter) if(fZWrite) Blt8BPPDataTo8BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); else Blt8BPPDataTo8BPPBufferShadowZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); else if(fZBlitter) { if(fZWrite) Blt8BPPDataTo8BPPBufferTransZClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); else Blt8BPPDataTo8BPPBufferTransZNBClip((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else Blt8BPPDataTo8BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex, &gClippingRect); } else { if(fMerc) { Blt8BPPDataTo16BPPBufferTransShadowZNBObscured( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex, pShadeTable); // Blt8BPPDataTo8BPPBufferTransShadowZNB( (UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, // hVObject, // sXPos, sYPos, // usImageIndex, // pShadeTable); } else if(fShadowBlitter) { if(fZWrite) Blt8BPPDataTo8BPPBufferShadowZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); else Blt8BPPDataTo8BPPBufferShadowZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); } else if(fZBlitter) { if(fZWrite) Blt8BPPDataTo8BPPBufferTransZ((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); else Blt8BPPDataTo8BPPBufferTransZNB((UINT16*)pDestBuf, uiDestPitchBYTES, gpZBuffer, sZLevel, hVObject, sXPos, sYPos, usImageIndex); } else Blt8BPPDataTo8BPPBufferTransparent((UINT16*)pDestBuf, uiDestPitchBYTES, hVObject, sXPos, sYPos, usImageIndex); } } } // RENDR APS ONTOP OF PLANNED MERC GUY if ( fRenderTile && !( uiFlags&TILES_DIRTY ) ) { if ( fMerc ) { if ( pSoldier != NULL && pSoldier->ubID >= MAX_NUM_SOLDIERS ) { SetFont( TINYFONT1 ); SetFontDestBuffer( guiSAVEBUFFER , 0, gsVIEWPORT_WINDOW_START_Y, SCREEN_WIDTH, gsVIEWPORT_WINDOW_END_Y, FALSE ); VarFindFontCenterCoordinates( sXPos, sYPos, 1, 1, TINYFONT1, &sX, &sY, L"%d", pSoldier->ubPlannedUIAPCost ); mprintf_buffer( pDestBuf, uiDestPitchBYTES, TINYFONT1, sX, sY , L"%d", pSoldier->ubPlannedUIAPCost ); SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); } } } } if(!fLinkedListDirection) pNode = pNode->pPrevNode; else pNode = pNode->pNext; //pNode = NULL; } } else { if( gfEditMode ) { //ATE: Used here in the editor to denote then an area is not in the world //Kris: Fixed a couple things here... // First, there was a problem with the FRAME_BUFFER already being locked which caused failures, // and eventual crashes, so if it reaches this code, the buffer needs to be unlocked first, as // it gets locked and unlocked internally within ColorFillVideoSurfaceArea(). I'm surprised // this problem didn't surface a long time ago. Anyway, it seems that scrolling to the bottom // right hand corner of the map, would cause the end of the world to be drawn. Now, this would // only crash on my computer and not Emmons, so this should work. Also, I changed the color // from fluorescent green to black, which is easier on the eyes, and prevent the drawing of the // end of the world if it would be drawn on the editor's taskbar. if( iTempPosY_S < INTERFACE_START_Y ) { if(!(uiFlags&TILES_DIRTY)) UnLockVideoSurface( FRAME_BUFFER ); ColorFillVideoSurfaceArea( FRAME_BUFFER, iTempPosX_S, iTempPosY_S, (iTempPosX_S + 40), ( min( iTempPosY_S + 20, INTERFACE_START_Y )), Get16BPPColor( FROMRGB( 0, 0, 0 ) ) ); if(!(uiFlags&TILES_DIRTY)) pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); } } } iTempPosX_S += 40; iTempPosX_M ++; iTempPosY_M --; if ( iTempPosX_S >= iEndXS ) { fEndRenderRow = TRUE; } } while( !fEndRenderRow ); } } // } while( FALSE ); if ( bXOddFlag > 0 ) { iAnchorPosY_M ++; } else { iAnchorPosX_M ++; } bXOddFlag = !bXOddFlag; iAnchorPosY_S += 10; if ( iAnchorPosY_S >= iEndYS ) { fEndRenderCol = TRUE; } } while( !fEndRenderCol ); if(!(uiFlags&TILES_DIRTY)) UnLockVideoSurface( FRAME_BUFFER ); if ( uiFlags & TILES_DYNAMIC_CHECKFOR_INT_TILE ) { EndCurInteractiveTileCheck( ); } } /// kONIE Renderowania klastra void DeleteFromWorld( UINT16 usTileIndex, UINT32 uiRenderTiles, UINT16 usIndex ) { switch( uiRenderTiles ) { case TILES_DYNAMIC_LAND: case TILES_STATIC_LAND: RemoveLand( usTileIndex, usIndex ); break; case TILES_DYNAMIC_OBJECTS: case TILES_STATIC_OBJECTS: RemoveObject( usTileIndex, usIndex ); break; case TILES_STATIC_STRUCTURES: case TILES_DYNAMIC_STRUCTURES: RemoveStruct( usTileIndex, usIndex ); break; case TILES_DYNAMIC_ROOF: case TILES_STATIC_ROOF: RemoveRoof( usTileIndex, usIndex ); break; case TILES_STATIC_ONROOF: RemoveOnRoof( usTileIndex, usIndex ); break; case TILES_DYNAMIC_TOPMOST: case TILES_STATIC_TOPMOST: RemoveTopmost( usTileIndex, usIndex ); break; } } // memcpy's the background to the new scroll position, and renders the missing strip // via the RenderStaticWorldRect. Dynamic stuff will be updated on the next frame // by the normal render cycle void ScrollBackground(UINT32 uiDirection, INT16 sScrollXIncrement, INT16 sScrollYIncrement ) { //RestoreBackgroundRects(); if ( !gfDoVideoScroll ) { // Clear z-buffer memset(gpZBuffer, LAND_Z_LEVEL, SCREEN_WIDTH*2* gsVIEWPORT_END_Y ); RenderStaticWorldRect( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_END_Y, FALSE ); FreeBackgroundRectType(BGND_FLAG_ANIMATED); } else { if ( gfRenderScroll == FALSE ) { guiScrollDirection = uiDirection; gfScrollStart = TRUE; gsScrollXIncrement = 0; gsScrollYIncrement = 0; } else { guiScrollDirection |= uiDirection; gfScrollStart = FALSE; } gfRenderScroll = TRUE; gsScrollXIncrement += sScrollXIncrement; gsScrollYIncrement += sScrollYIncrement; } } // Render routine takes center X, Y and Z coordinate and gets world // Coordinates for the window from that using the following functions // For coordinate transformations void RenderWorld( ) { TILE_ELEMENT *TileElem; TILE_ANIMATION_DATA *pAnimData; UINT32 cnt = 0; gfRenderFullThisFrame = FALSE; // If we are testing renderer, set background to pink! if ( gTacticalStatus.uiFlags & DEBUGCLIFFS ) { ColorFillVideoSurfaceArea( FRAME_BUFFER, 0, gsVIEWPORT_WINDOW_START_Y, SCREEN_WIDTH, gsVIEWPORT_WINDOW_END_Y, Get16BPPColor( FROMRGB( 0, 255, 0 ) ) ); SetRenderFlags(RENDER_FLAG_FULL); } if ( gTacticalStatus.uiFlags & SHOW_Z_BUFFER ) { SetRenderFlags(RENDER_FLAG_FULL); } // SetRenderFlags(RENDER_FLAG_FULL); // FOR NOW< HERE, UPDATE ANIMATED TILES if ( COUNTERDONE( ANIMATETILES ) ) { RESETCOUNTER( ANIMATETILES ); while( cnt < gusNumAnimatedTiles ) { TileElem = &(gTileDatabase[ gusAnimatedTiles[ cnt ] ] ); pAnimData = TileElem->pAnimData; Assert( pAnimData != NULL ); pAnimData->bCurrentFrame++; if ( pAnimData->bCurrentFrame >= pAnimData->ubNumFrames ) pAnimData->bCurrentFrame = 0; cnt++; } } // HERE, UPDATE GLOW INDEX if ( COUNTERDONE( GLOW_ENEMYS ) ) { RESETCOUNTER( GLOW_ENEMYS ); gsCurrentGlowFrame++; if ( gsCurrentGlowFrame == NUM_GLOW_FRAMES ) { gsCurrentGlowFrame = 0; } gsCurrentItemGlowFrame++; if ( gsCurrentItemGlowFrame == NUM_ITEM_CYCLE_COLORS ) { gsCurrentItemGlowFrame = 0; } } //RenderStaticWorldRect( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_END_Y ); //AddBaseDirtyRect(gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_END_Y ); //return; //#if 0 if(gRenderFlags&RENDER_FLAG_FULL) { gfRenderFullThisFrame = TRUE; gfTopMessageDirty = TRUE; // Dirty the interface... fInterfacePanelDirty = DIRTYLEVEL2; // Apply scrolling sets some world variables ApplyScrolling( gsRenderCenterX, gsRenderCenterY, TRUE, FALSE ); ResetLayerOptimizing(); if ( (gRenderFlags&RENDER_FLAG_NOZ ) ) { RenderStaticWorldRect( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_END_Y, FALSE ); } else { RenderStaticWorld(); } if(!(gRenderFlags&RENDER_FLAG_SAVEOFF)) UpdateSaveBuffer(); } else if(gRenderFlags&RENDER_FLAG_MARKED) { ResetLayerOptimizing(); RenderMarkedWorld(); if(!(gRenderFlags&RENDER_FLAG_SAVEOFF)) UpdateSaveBuffer(); } if ( gfScrollInertia == FALSE || (gRenderFlags&RENDER_FLAG_NOZ ) || (gRenderFlags&RENDER_FLAG_FULL ) || (gRenderFlags&RENDER_FLAG_MARKED ) ) { RenderDynamicWorld( ); /////////////////////////////////////////////////////////// // ColorFillVideoSurfaceArea( guiSAVEBUFFER, 0, gsVIEWPORT_WINDOW_END_Y, BP_SCREEN_WIDTH_CENTERED, SCREEN_HEIGHT, Get16BPPColor( FROMRGB( 16, 8, 0 ) ) ); /////////////////////////////////////////////////////////// } if ( gfScrollInertia ) { EmptyBackgroundRects( ); } if( gRenderFlags&RENDER_FLAG_ROOMIDS ) { RenderRoomInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS ); } #ifdef _DEBUG if( gRenderFlags&RENDER_FLAG_FOVDEBUG ) { RenderFOVDebugInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS ); } else if (gfDisplayCoverValues) { RenderCoverDebugInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS ); } else if (gfDisplayGridNoVisibleValues) { RenderGridNoVisibleDebugInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS ); } #endif //#endif //RenderStaticWorldRect( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_END_Y ); //AddBaseDirtyRect(gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_END_Y ); if(gRenderFlags&RENDER_FLAG_MARKED) ClearMarkedTiles(); if ( gRenderFlags&RENDER_FLAG_CHECKZ && !(gTacticalStatus.uiFlags & NOHIDE_REDUNDENCY) ) { ExamineZBufferRect( gsVIEWPORT_START_X, gsVIEWPORT_WINDOW_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_WINDOW_END_Y ); } gRenderFlags&=(~(RENDER_FLAG_FULL|RENDER_FLAG_MARKED|RENDER_FLAG_ROOMIDS|RENDER_FLAG_CHECKZ)); if ( gTacticalStatus.uiFlags & SHOW_Z_BUFFER ) { // COPY Z BUFFER TO FRAME BUFFER UINT32 uiDestPitchBYTES; UINT16 *pDestBuf; UINT32 cnt; INT16 zVal; pDestBuf = (UINT16 *)LockVideoSurface(guiRENDERBUFFER, &uiDestPitchBYTES); for ( cnt = 0; cnt < (UINT32)( SCREEN_WIDTH * SCREEN_HEIGHT ); cnt++ ) { // Get Z value zVal = gpZBuffer[ cnt ]; pDestBuf[cnt] = zVal; } UnLockVideoSurface(guiRENDERBUFFER); } } // Start with a center X,Y,Z world coordinate and render direction // Determine WorldIntersectionPoint and the starting block from these // Then render away! //ok tutaj jest renderowane przy przesuwaniu void RenderStaticWorldRect(INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom, BOOLEAN fDynamicsToo ) { UINT32 uiLevelFlags[10]; UINT16 sLevelIDs[10]; UINT32 uiDestPitchBYTES; UINT8 *pDestBuf=NULL; // Calculate render starting parameters CalcRenderParameters( sLeft, sTop, sRight, sBottom ); pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); Assert( pDestBuf); memset(gpZBuffer, LAND_Z_LEVEL, uiDestPitchBYTES * gsVIEWPORT_END_Y ); UnLockVideoSurface( FRAME_BUFFER); // Reset layer optimizations ResetLayerOptimizing( ); //#if 0 // rendering land uiLevelFlags[0] = TILES_STATIC_LAND; sLevelIDs [0] = RENDER_STATIC_LAND; RenderTiles( 0 , gsLStartPointX_M, gsLStartPointY_M, gsLStartPointX_S, gsLStartPointY_S, gsLEndXS, gsLEndYS, 1, uiLevelFlags, sLevelIDs ); //rendering objects uiLevelFlags[0] = TILES_STATIC_OBJECTS; sLevelIDs [0] = RENDER_STATIC_OBJECTS; RenderTiles( 0, gsLStartPointX_M, gsLStartPointY_M, gsLStartPointX_S, gsLStartPointY_S, gsLEndXS, gsLEndYS, 1, uiLevelFlags, sLevelIDs ); if(gRenderFlags&RENDER_FLAG_SHADOWS ) { // If we have to we render shadows uiLevelFlags[0] = TILES_STATIC_SHADOWS; sLevelIDs [0] = RENDER_STATIC_SHADOWS; RenderTiles( 0, gsLStartPointX_M, gsLStartPointY_M, gsLStartPointX_S, gsLStartPointY_S, gsLEndXS, gsLEndYS, 1, uiLevelFlags , sLevelIDs ); } uiLevelFlags[0] = TILES_STATIC_STRUCTURES; sLevelIDs [0] = RENDER_STATIC_STRUCTS; uiLevelFlags[1] = TILES_STATIC_ROOF; sLevelIDs [1] = RENDER_STATIC_ROOF; uiLevelFlags[2] = TILES_STATIC_ONROOF; sLevelIDs [2] = RENDER_STATIC_ONROOF; uiLevelFlags[3] = TILES_STATIC_TOPMOST; sLevelIDs [3] = RENDER_STATIC_TOPMOST; RenderTiles( 0, gsLStartPointX_M, gsLStartPointY_M, gsLStartPointX_S, gsLStartPointY_S, gsLEndXS, gsLEndYS, 4, uiLevelFlags, sLevelIDs ); //ATE: Do obsucred layer! uiLevelFlags[0] = TILES_STATIC_STRUCTURES; sLevelIDs[0] = RENDER_STATIC_STRUCTS; uiLevelFlags[1] = TILES_STATIC_ONROOF; sLevelIDs[1] = RENDER_STATIC_ONROOF; RenderTiles( TILES_OBSCURED, gsLStartPointX_M, gsLStartPointY_M, gsLStartPointX_S, gsLStartPointY_S, gsLEndXS, gsLEndYS, 2, uiLevelFlags, sLevelIDs ); uiLevelFlags[0] = TILES_DYNAMIC_MERCS; //uiLevelFlags[1] = TILES_DYNAMIC_HIGHMERCS; sLevelIDs[0] = RENDER_DYNAMIC_MERCS; //sLevelIDs[1] = RENDER_DYNAMIC_HIGHMERCS; RenderTiles( 0, gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, 1, uiLevelFlags, sLevelIDs ); if ( fDynamicsToo ) { // DYNAMICS uiLevelFlags[0] = TILES_DYNAMIC_LAND; uiLevelFlags[1] = TILES_DYNAMIC_OBJECTS; uiLevelFlags[2] = TILES_DYNAMIC_SHADOWS; uiLevelFlags[3] = TILES_DYNAMIC_STRUCT_MERCS; uiLevelFlags[4] = TILES_DYNAMIC_MERCS; uiLevelFlags[5] = TILES_DYNAMIC_STRUCTURES; uiLevelFlags[6] = TILES_DYNAMIC_ROOF; uiLevelFlags[7] = TILES_DYNAMIC_HIGHMERCS; uiLevelFlags[8] = TILES_DYNAMIC_ONROOF; sLevelIDs[0] = RENDER_DYNAMIC_LAND; sLevelIDs[1] = RENDER_DYNAMIC_OBJECTS; sLevelIDs[2] = RENDER_DYNAMIC_SHADOWS; sLevelIDs[3] = RENDER_DYNAMIC_STRUCT_MERCS; sLevelIDs[4] = RENDER_DYNAMIC_MERCS; sLevelIDs[5] = RENDER_DYNAMIC_STRUCTS; sLevelIDs[6] = RENDER_DYNAMIC_ROOF; sLevelIDs[7] = RENDER_DYNAMIC_HIGHMERCS; sLevelIDs[8] = RENDER_DYNAMIC_ONROOF; RenderTiles( 0, gsLStartPointX_M, gsLStartPointY_M, gsLStartPointX_S, gsLStartPointY_S, gsLEndXS, gsLEndYS, 9, uiLevelFlags , sLevelIDs ); SumAddiviveLayerOptimization( ); } ResetRenderParameters( ); if ( !gfDoVideoScroll ) { //AddBaseDirtyRect(gsVIEWPORT_START_X, gsVIEWPORT_WINDOW_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_WINDOW_END_Y ); AddBaseDirtyRect(sLeft, sTop, sRight, sBottom ); } //#endif } // to jest wykonywane przy kazdym takcie zegara void RenderStaticWorld( ) { UINT32 uiLevelFlags[9]; UINT16 sLevelIDs[9]; UINT32 uiDestPitchBYTES; UINT8 *pDestBuf=NULL; // Calculate render starting parameters CalcRenderParameters( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_END_Y ); // Clear z-buffer pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); Assert( pDestBuf); memset(gpZBuffer, LAND_Z_LEVEL, uiDestPitchBYTES * gsVIEWPORT_END_Y ); UnLockVideoSurface( FRAME_BUFFER); FreeBackgroundRectType(BGND_FLAG_ANIMATED); InvalidateBackgroundRects(); // rendering land tiles uiLevelFlags[0] = TILES_STATIC_LAND; sLevelIDs [0] = RENDER_STATIC_LAND; RenderTiles( 0, gsLStartPointX_M, gsLStartPointY_M, gsLStartPointX_S, gsLStartPointY_S, gsLEndXS, gsLEndYS, 1, uiLevelFlags, sLevelIDs ); //rendering objects uiLevelFlags[0] = TILES_STATIC_OBJECTS; sLevelIDs [0] = RENDER_STATIC_OBJECTS; RenderTiles( 0, gsLStartPointX_M, gsLStartPointY_M, gsLStartPointX_S, gsLStartPointY_S, gsLEndXS, gsLEndYS, 1, uiLevelFlags, sLevelIDs ); // If we have to we render shadows if(gRenderFlags&RENDER_FLAG_SHADOWS ) { uiLevelFlags[0] = TILES_STATIC_SHADOWS; sLevelIDs [0] = RENDER_STATIC_SHADOWS; RenderTiles( 0, gsLStartPointX_M, gsLStartPointY_M, gsLStartPointX_S, gsLStartPointY_S, gsLEndXS, gsLEndYS, 1, uiLevelFlags , sLevelIDs ); } uiLevelFlags[0] = TILES_STATIC_STRUCTURES; sLevelIDs [0] = RENDER_STATIC_STRUCTS; uiLevelFlags[1] = TILES_STATIC_ROOF; sLevelIDs [1] = RENDER_STATIC_ROOF; uiLevelFlags[2] = TILES_STATIC_ONROOF; sLevelIDs [2] = RENDER_STATIC_ONROOF; uiLevelFlags[3] = TILES_STATIC_TOPMOST; sLevelIDs [3] = RENDER_STATIC_TOPMOST; RenderTiles( 0, gsLStartPointX_M, gsLStartPointY_M, gsLStartPointX_S, gsLStartPointY_S, gsLEndXS, gsLEndYS, 4, uiLevelFlags, sLevelIDs ); //ATE: Do obsucred layer! uiLevelFlags[0] = TILES_STATIC_STRUCTURES; sLevelIDs[0] = RENDER_STATIC_STRUCTS; uiLevelFlags[1] = TILES_STATIC_ONROOF; sLevelIDs[1] = RENDER_STATIC_ONROOF; RenderTiles( TILES_OBSCURED, gsLStartPointX_M, gsLStartPointY_M, gsLStartPointX_S, gsLStartPointY_S, gsLEndXS, gsLEndYS, 2, uiLevelFlags, sLevelIDs ); AddBaseDirtyRect(gsVIEWPORT_START_X, gsVIEWPORT_WINDOW_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_WINDOW_END_Y ); ResetRenderParameters( ); } void RenderMarkedWorld(void) { UINT32 uiLevelFlags[4]; UINT16 sLevelIDs[4]; CalcRenderParameters( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_END_Y ); RestoreBackgroundRects(); FreeBackgroundRectType(BGND_FLAG_ANIMATED); InvalidateBackgroundRects(); ResetLayerOptimizing(); uiLevelFlags[0] = TILES_STATIC_LAND; uiLevelFlags[1] = TILES_STATIC_OBJECTS; sLevelIDs[0] = RENDER_STATIC_LAND; sLevelIDs[1] = RENDER_STATIC_OBJECTS; RenderTiles(TILES_MARKED, gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, 2, uiLevelFlags, sLevelIDs ); if(gRenderFlags&RENDER_FLAG_SHADOWS) { uiLevelFlags[0] = TILES_STATIC_SHADOWS; sLevelIDs[0] = RENDER_STATIC_SHADOWS; RenderTiles(TILES_MARKED, gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, 1, uiLevelFlags, sLevelIDs ); } uiLevelFlags[0] = TILES_STATIC_STRUCTURES; sLevelIDs[0] = RENDER_STATIC_STRUCTS; RenderTiles(TILES_MARKED, gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, 1, uiLevelFlags, sLevelIDs ); uiLevelFlags[0] = TILES_STATIC_ROOF; sLevelIDs[0] = RENDER_STATIC_ROOF; RenderTiles(TILES_MARKED, gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, 1, uiLevelFlags, sLevelIDs ); uiLevelFlags[0] = TILES_STATIC_ONROOF; sLevelIDs[0] = RENDER_STATIC_ONROOF; RenderTiles(TILES_MARKED, gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, 1, uiLevelFlags, sLevelIDs ); uiLevelFlags[0] = TILES_STATIC_TOPMOST; sLevelIDs[0] = RENDER_STATIC_TOPMOST; RenderTiles(TILES_MARKED, gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, 1, uiLevelFlags, sLevelIDs ); AddBaseDirtyRect(gsVIEWPORT_START_X, gsVIEWPORT_WINDOW_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_WINDOW_END_Y ); ResetRenderParameters( ); } void RenderDynamicWorld( ) { UINT8 ubNumLevels; UINT32 uiLevelFlags[ 10 ]; UINT16 sLevelIDs[ 10 ]; CalcRenderParameters( gsVIEWPORT_START_X, gsVIEWPORT_START_Y, gsVIEWPORT_END_X, gsVIEWPORT_END_Y ); RestoreBackgroundRects(); if(!gfTagAnimatedTiles) { uiLevelFlags[0] = TILES_DYNAMIC_OBJECTS; uiLevelFlags[1] = TILES_DYNAMIC_SHADOWS; uiLevelFlags[2] = TILES_DYNAMIC_STRUCT_MERCS; uiLevelFlags[3] = TILES_DYNAMIC_MERCS; uiLevelFlags[4] = TILES_DYNAMIC_STRUCTURES; uiLevelFlags[5] = TILES_DYNAMIC_HIGHMERCS; uiLevelFlags[6] = TILES_DYNAMIC_ROOF; uiLevelFlags[7] = TILES_DYNAMIC_ONROOF; uiLevelFlags[8] = TILES_DYNAMIC_TOPMOST; sLevelIDs[0] = RENDER_DYNAMIC_OBJECTS; sLevelIDs[1] = RENDER_DYNAMIC_SHADOWS; sLevelIDs[2] = RENDER_DYNAMIC_STRUCT_MERCS; sLevelIDs[3] = RENDER_DYNAMIC_MERCS; sLevelIDs[4] = RENDER_DYNAMIC_STRUCTS; sLevelIDs[5] = RENDER_DYNAMIC_MERCS; sLevelIDs[6] = RENDER_DYNAMIC_ROOF; sLevelIDs[7] = RENDER_DYNAMIC_ONROOF; sLevelIDs[8] = RENDER_DYNAMIC_TOPMOST; ubNumLevels = 9; } else { gfTagAnimatedTiles=FALSE; //uiLevelFlags[0] = TILES_DYNAMIC_LAND; uiLevelFlags[0] = TILES_DYNAMIC_OBJECTS; uiLevelFlags[1] = TILES_DYNAMIC_SHADOWS; uiLevelFlags[2] = TILES_DYNAMIC_STRUCT_MERCS; uiLevelFlags[3] = TILES_DYNAMIC_MERCS; uiLevelFlags[4] = TILES_DYNAMIC_STRUCTURES; uiLevelFlags[5] = TILES_DYNAMIC_HIGHMERCS; uiLevelFlags[6] = TILES_DYNAMIC_ROOF; uiLevelFlags[7] = TILES_DYNAMIC_ONROOF; uiLevelFlags[8] = TILES_DYNAMIC_TOPMOST; //sLevelIDs[0] = RENDER_DYNAMIC_LAND; sLevelIDs[0] = RENDER_DYNAMIC_OBJECTS; sLevelIDs[1] = RENDER_DYNAMIC_SHADOWS; sLevelIDs[2] = RENDER_DYNAMIC_STRUCT_MERCS; sLevelIDs[3] = RENDER_DYNAMIC_MERCS; sLevelIDs[4] = RENDER_DYNAMIC_STRUCTS; sLevelIDs[5] = RENDER_DYNAMIC_MERCS; sLevelIDs[6] = RENDER_DYNAMIC_ROOF; sLevelIDs[7] = RENDER_DYNAMIC_ONROOF; sLevelIDs[8] = RENDER_DYNAMIC_TOPMOST; ubNumLevels = 9; } RenderTiles(TILES_DIRTY, gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, ubNumLevels, uiLevelFlags, sLevelIDs ); #ifdef JA2EDITOR if( !gfEditMode && !gfAniEditMode ) #endif { RenderTacticalInterface( ); } SaveBackgroundRects(); //uiLevelFlags[0] = TILES_DYNAMIC_LAND; uiLevelFlags[0] = TILES_DYNAMIC_OBJECTS; uiLevelFlags[1] = TILES_DYNAMIC_SHADOWS; uiLevelFlags[2] = TILES_DYNAMIC_STRUCT_MERCS; uiLevelFlags[3] = TILES_DYNAMIC_MERCS; uiLevelFlags[4] = TILES_DYNAMIC_STRUCTURES; //sLevelIDs[0] = RENDER_DYNAMIC_LAND; sLevelIDs[0] = RENDER_DYNAMIC_OBJECTS; sLevelIDs[1] = RENDER_DYNAMIC_SHADOWS; sLevelIDs[2] = RENDER_DYNAMIC_STRUCT_MERCS; sLevelIDs[3] = RENDER_DYNAMIC_MERCS; sLevelIDs[4] = RENDER_DYNAMIC_STRUCTS; RenderTiles( 0, gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, 5, uiLevelFlags , sLevelIDs ); uiLevelFlags[0] = TILES_DYNAMIC_ROOF; uiLevelFlags[1] = TILES_DYNAMIC_HIGHMERCS; uiLevelFlags[2] = TILES_DYNAMIC_ONROOF; sLevelIDs[0] = RENDER_DYNAMIC_ROOF; sLevelIDs[1] = RENDER_DYNAMIC_HIGHMERCS; sLevelIDs[2] = RENDER_DYNAMIC_ONROOF; RenderTiles(0 , gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, 3, uiLevelFlags, sLevelIDs ); uiLevelFlags[0] = TILES_DYNAMIC_TOPMOST; sLevelIDs[0] = RENDER_DYNAMIC_TOPMOST; // ATE: check here for mouse over structs..... RenderTiles( TILES_DYNAMIC_CHECKFOR_INT_TILE, gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS, 1, uiLevelFlags, sLevelIDs ); SumAddiviveLayerOptimization( ); ResetRenderParameters( ); } BOOLEAN HandleScrollDirections( UINT32 ScrollFlags, INT16 sScrollXStep, INT16 sScrollYStep, INT16 *psTempRenderCenterX, INT16 *psTempRenderCenterY, BOOLEAN fCheckOnly ) { BOOLEAN fAGoodMove = FALSE, fMovedPos = FALSE; INT16 sTempX_W, sTempY_W; BOOLEAN fUpOK, fLeftOK; BOOLEAN fDownOK, fRightOK; INT16 sTempRenderCenterX, sTempRenderCenterY; sTempRenderCenterX = sTempRenderCenterY = 0; // This checking sequence just validates the values! if ( ScrollFlags & SCROLL_LEFT ) { FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fMovedPos=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fMovedPos ) { fAGoodMove = TRUE; } if ( !fCheckOnly ) { ScrollBackground(SCROLL_LEFT, sScrollXStep, sScrollYStep ); } } if ( ScrollFlags & SCROLL_RIGHT ) { FromScreenToCellCoordinates( sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fMovedPos=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fMovedPos ) { fAGoodMove = TRUE; } if ( !fCheckOnly ) { ScrollBackground(SCROLL_RIGHT, sScrollXStep, sScrollYStep ); } } if ( ScrollFlags & SCROLL_UP ) { FromScreenToCellCoordinates( 0, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fMovedPos=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fMovedPos ) { fAGoodMove = TRUE; } if ( !fCheckOnly ) { ScrollBackground(SCROLL_UP, sScrollXStep, sScrollYStep ); } } if ( ScrollFlags & SCROLL_DOWN ) { FromScreenToCellCoordinates( 0, sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fMovedPos=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fMovedPos ) { fAGoodMove = TRUE; } if ( !fCheckOnly ) { ScrollBackground(SCROLL_DOWN, sScrollXStep, sScrollYStep ); } } if ( ScrollFlags & SCROLL_UPLEFT ) { // Check up FromScreenToCellCoordinates( 0, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fUpOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); // Check left FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fLeftOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fLeftOK && fUpOK ) { FromScreenToCellCoordinates( (INT16)-sScrollXStep, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) { ScrollBackground(SCROLL_UPLEFT, sScrollXStep, sScrollYStep ); } } else if ( fUpOK ) { fAGoodMove = TRUE; FromScreenToCellCoordinates( 0, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; if ( !fCheckOnly ) { ScrollBackground(SCROLL_UP, sScrollXStep, sScrollYStep ); } } else if ( fLeftOK ) { fAGoodMove = TRUE; FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; if ( !fCheckOnly ) { ScrollBackground(SCROLL_LEFT, sScrollXStep, sScrollYStep ); } } } if ( ScrollFlags & SCROLL_UPRIGHT ) { // Check up FromScreenToCellCoordinates( 0, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fUpOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); // Check right FromScreenToCellCoordinates( sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fRightOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fUpOK && fRightOK ) { FromScreenToCellCoordinates( (INT16)sScrollXStep, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) { ScrollBackground(SCROLL_UPRIGHT, sScrollXStep, sScrollYStep ); } } else if ( fUpOK ) { fAGoodMove = TRUE; FromScreenToCellCoordinates( 0, (INT16)-sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; if ( !fCheckOnly ) { ScrollBackground(SCROLL_UP, sScrollXStep, sScrollYStep ); } } else if ( fRightOK ) { fAGoodMove = TRUE; FromScreenToCellCoordinates( sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; if ( !fCheckOnly ) { ScrollBackground(SCROLL_RIGHT, sScrollXStep, sScrollYStep ); } } } if ( ScrollFlags & SCROLL_DOWNLEFT ) { // Check down...... FromScreenToCellCoordinates( 0, sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fDownOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); // Check left..... FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fLeftOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fLeftOK && fDownOK ) { fAGoodMove = TRUE; FromScreenToCellCoordinates( (INT16)-sScrollXStep, (INT16)sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; if ( !fCheckOnly ) { ScrollBackground(SCROLL_DOWNLEFT, sScrollXStep, sScrollYStep ); } } else if ( fLeftOK ) { FromScreenToCellCoordinates( (INT16)-sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) { ScrollBackground(SCROLL_LEFT, sScrollXStep, sScrollYStep ); } } else if ( fDownOK ) { FromScreenToCellCoordinates( 0, sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) { ScrollBackground(SCROLL_DOWN, sScrollXStep, sScrollYStep ); } } } if ( ScrollFlags & SCROLL_DOWNRIGHT ) { // Check right FromScreenToCellCoordinates( sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fRightOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); // Check down FromScreenToCellCoordinates( 0, sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fDownOK=ApplyScrolling( sTempRenderCenterX, sTempRenderCenterY, FALSE, fCheckOnly ); if ( fDownOK && fRightOK ) { FromScreenToCellCoordinates( (INT16)sScrollXStep, (INT16)sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) { ScrollBackground( SCROLL_DOWNRIGHT, sScrollXStep, sScrollYStep ); } } else if ( fDownOK ) { FromScreenToCellCoordinates( 0, sScrollYStep, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) { ScrollBackground( SCROLL_DOWN, sScrollXStep, sScrollYStep ); } } else if ( fRightOK ) { FromScreenToCellCoordinates( sScrollXStep, 0, &sTempX_W, &sTempY_W ); sTempRenderCenterX = gsRenderCenterX + sTempX_W; sTempRenderCenterY = gsRenderCenterY + sTempY_W; fAGoodMove = TRUE; if ( !fCheckOnly ) { ScrollBackground( SCROLL_RIGHT, sScrollXStep, sScrollYStep ); } } } ( *psTempRenderCenterX ) = sTempRenderCenterX; ( *psTempRenderCenterY ) = sTempRenderCenterY; return( fAGoodMove ); } extern BOOLEAN gfNextRefreshFullScreen; void ScrollWorld( ) { UINT32 ScrollFlags = 0; BOOLEAN fDoScroll = FALSE, fAGoodMove = FALSE; INT16 sTempRenderCenterX, sTempRenderCenterY; INT8 bDirection; INT16 sScrollXStep=-1; INT16 sScrollYStep=-1; BOOLEAN fIgnoreInput = FALSE; static UINT8 ubOldScrollSpeed = 0; static BOOLEAN fFirstTimeInSlideToMode = TRUE; if ( gfIgnoreScrollDueToCenterAdjust ) { // gfIgnoreScrollDueToCenterAdjust = FALSE; return; } if ( gfIgnoreScrolling == 1 ) { return; } if ( gfIgnoreScrolling == 2 ) { fIgnoreInput = TRUE; } if ( gCurrentUIMode == LOCKUI_MODE ) { fIgnoreInput = TRUE; } // If in editor, ignore scrolling if any of the shift keys pressed with arrow keys if ( gfEditMode && ( _KeyDown(CTRL) || _KeyDown(ALT) ) ) return; // Ignore if ALT DONW if ( _KeyDown( ALT ) ) return; do { if ( gfIgnoreScrolling != 3 ) { // Check for sliding if (!TileIsOutOfBounds(gTacticalStatus.sSlideTarget)) { // Ignore all input... // Check if we have reached out dest! if ( fFirstTimeInSlideToMode ) { ubOldScrollSpeed = gubCurScrollSpeedID; fFirstTimeInSlideToMode = FALSE; } // Make faster! //gubCurScrollSpeedID = 2; ScrollFlags = 0; fDoScroll = FALSE; // if ( SoldierLocationRelativeToScreen( gTacticalStatus.sSlideTarget, gTacticalStatus.sSlideReason, &bDirection, &ScrollFlags ) && GridNoOnVisibleWorldTile( gTacticalStatus.sSlideTarget ) ) { ScrollFlags = gScrollDirectionFlags[ bDirection ]; fDoScroll = TRUE; fIgnoreInput = TRUE; } else { // We've stopped! gTacticalStatus.sSlideTarget = NOWHERE; } } else { // Restore old scroll speed if ( !fFirstTimeInSlideToMode ) { gubCurScrollSpeedID = ubOldScrollSpeed; } fFirstTimeInSlideToMode = TRUE; } } if ( !fIgnoreInput ) { // Check keys if ( _KeyDown( UPARROW ) ) { fDoScroll = TRUE; ScrollFlags |= SCROLL_UP; } if ( _KeyDown( DNARROW ) ) { fDoScroll = TRUE; ScrollFlags |= SCROLL_DOWN; } if ( _KeyDown( RIGHTARROW ) ) { fDoScroll = TRUE; ScrollFlags |= SCROLL_RIGHT; } if ( _KeyDown( LEFTARROW ) ) { fDoScroll = TRUE; ScrollFlags |= SCROLL_LEFT; } // Do mouse - PUT INTO A TIMER! // Put a counter on starting from mouse, if we have not started already! if ( !gfScrollInertia && gfScrollPending == FALSE ) { if ( !COUNTERDONE( STARTSCROLL ) ) { break; } RESETCOUNTER( STARTSCROLL ); } if ( gusMouseYPos == 0 ) { fDoScroll = TRUE; ScrollFlags |= SCROLL_UP; } if ( gusMouseYPos >= SCREEN_HEIGHT - 1 ) { fDoScroll = TRUE; ScrollFlags |= SCROLL_DOWN; } if ( gusMouseXPos >= SCREEN_WIDTH - 1 ) { fDoScroll = TRUE; ScrollFlags |= SCROLL_RIGHT; } if ( gusMouseXPos == 0 ) { fDoScroll = TRUE; ScrollFlags |= SCROLL_LEFT; } } } while( FALSE ); if ( fDoScroll ) { if ( gfDoSubtileScroll ) { if ( gfScrollInertia > gubNewScrollIDSpeeds[ gubCurScrollSpeedID ] ) { gubCurScrollSpeedID++; if ( gubCurScrollSpeedID > gubScrollSpeedEndID ) { gubCurScrollSpeedID = gubScrollSpeedEndID; } } } //if ( !gfDoVideoScroll ) //{ // gubCurScrollSpeedID = 4; //} // Adjust speed based on whether shift is down if ( _KeyDown( SHIFT ) ) { sScrollXStep = gubNewScrollXSpeeds[ gfDoVideoScroll ][ 3 ]; sScrollYStep = gubNewScrollYSpeeds[ gfDoVideoScroll ][ 3 ]; } else { sScrollXStep = gubNewScrollXSpeeds[ gfDoVideoScroll ][ gubCurScrollSpeedID ]; sScrollYStep = gubNewScrollYSpeeds[ gfDoVideoScroll ][ gubCurScrollSpeedID ]; } // Set diagonal flags! if ( ( ScrollFlags & SCROLL_LEFT ) && ( ScrollFlags & SCROLL_UP ) ) { ScrollFlags = SCROLL_UPLEFT; } if ( ( ScrollFlags & SCROLL_RIGHT ) && ( ScrollFlags & SCROLL_UP ) ) { ScrollFlags = SCROLL_UPRIGHT; } if ( ( ScrollFlags & SCROLL_LEFT ) && ( ScrollFlags & SCROLL_DOWN ) ) { ScrollFlags = SCROLL_DOWNLEFT; } if ( ( ScrollFlags & SCROLL_RIGHT ) && ( ScrollFlags & SCROLL_DOWN ) ) { ScrollFlags = SCROLL_DOWNRIGHT; } fAGoodMove = HandleScrollDirections( ScrollFlags, sScrollXStep, sScrollYStep, &sTempRenderCenterX, &sTempRenderCenterY, TRUE ); } // Has this been an OK scroll? if ( fAGoodMove ) { if ( COUNTERDONE( NEXTSCROLL ) ) { RESETCOUNTER( NEXTSCROLL ); // Are we starting a new scroll? if ( gfScrollInertia == 0 && gfScrollPending == FALSE ) { // We are starting to scroll - setup scroll pending gfScrollPending = TRUE; // Remove any interface stuff ClearInterface( ); // Return so that next frame things will be erased! return; } // If here, set scroll pending to false gfScrollPending = FALSE; // INcrement scroll intertia gfScrollInertia++; // Now we actually begin our scrolling HandleScrollDirections( ScrollFlags, sScrollXStep, sScrollYStep, &sTempRenderCenterX, &sTempRenderCenterY, FALSE ); if( gfNextRefreshFullScreen ) SetRenderFlags( RENDER_FLAG_FULL ); } } else { // ATE: Also if scroll pending never got to scroll.... if ( gfScrollPending == TRUE ) { // Do a complete rebuild! gfScrollPending = FALSE; // Restore Interface! RestoreInterface( ); // Delete Topmost blitters saved areas DeleteVideoOverlaysArea( ); } // Check if we have just stopped scrolling! if ( gfScrollInertia != FALSE ) { SetRenderFlags( RENDER_FLAG_FULL | RENDER_FLAG_CHECKZ ); // Restore Interface! RestoreInterface( ); // Delete Topmost blitters saved areas DeleteVideoOverlaysArea( ); } gfScrollInertia = FALSE; gfScrollPending = FALSE; if ( gfDoSubtileScroll ) { gubCurScrollSpeedID = gubScrollSpeedStartID; } } } /* Initialization * * any questions? joker */ void InitializeViewPort() { gsVIEWPORT_START_X = 0; gsVIEWPORT_START_Y = 0; gsVIEWPORT_WINDOW_START_Y = 0; gsVIEWPORT_WINDOW_END_Y = INTERFACE_START_Y; gsVIEWPORT_END_X = SCREEN_WIDTH; gsVIEWPORT_END_Y = INTERFACE_START_Y; gClippingRect.iLeft = 0; gClippingRect.iTop = 0; gClippingRect.iRight = SCREEN_WIDTH; gClippingRect.iBottom = SCREEN_HEIGHT - INTERFACE_HEIGHT; } void InitRenderParams( UINT8 ubRestrictionID ) { INT16 gsTilesX, gsTilesY; UINT32 cnt, cnt2; DOUBLE dWorldX, dWorldY; switch( ubRestrictionID ) { case 0: //Default! gTopLeftWorldLimitX = CELL_X_SIZE; gTopLeftWorldLimitY = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; gTopRightWorldLimitX = ( WORLD_COLS / 2 ) * CELL_Y_SIZE; gTopRightWorldLimitY = CELL_X_SIZE; gBottomLeftWorldLimitX = ( ( WORLD_COLS / 2 ) * CELL_Y_SIZE ); gBottomLeftWorldLimitY = ( WORLD_ROWS * CELL_Y_SIZE ); gBottomRightWorldLimitX = ( WORLD_COLS * CELL_Y_SIZE ); gBottomRightWorldLimitY = ( ( WORLD_ROWS / 2 ) * CELL_X_SIZE ); break; case 1: // BAEMENT LEVEL 1 gTopLeftWorldLimitX = ( 3 * WORLD_ROWS / 10 ) * CELL_X_SIZE; gTopLeftWorldLimitY = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; gTopRightWorldLimitX = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; gTopRightWorldLimitY = ( 3 * WORLD_COLS / 10 ) * CELL_X_SIZE; gBottomLeftWorldLimitX = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; gBottomLeftWorldLimitY = ( 7 * WORLD_COLS / 10 ) * CELL_X_SIZE; gBottomRightWorldLimitX = ( 7 * WORLD_ROWS / 10 ) * CELL_X_SIZE; gBottomRightWorldLimitY = ( WORLD_ROWS / 2 ) * CELL_X_SIZE; break; } gCenterWorldX = ( WORLD_ROWS ) / 2 * CELL_X_SIZE; gCenterWorldY = ( WORLD_COLS ) / 2 * CELL_Y_SIZE; // Convert Bounding box into screen coords FromCellToScreenCoordinates( gTopLeftWorldLimitX, gTopLeftWorldLimitY, &gsTLX, &gsTLY ); FromCellToScreenCoordinates( gTopRightWorldLimitX, gTopRightWorldLimitY, &gsTRX, &gsTRY ); FromCellToScreenCoordinates( gBottomLeftWorldLimitX, gBottomLeftWorldLimitY, &gsBLX, &gsBLY ); FromCellToScreenCoordinates( gBottomRightWorldLimitX, gBottomRightWorldLimitY, &gsBRX, &gsBRY ); FromCellToScreenCoordinates( gCenterWorldX , gCenterWorldY, &gsCX, &gsCY ); // Adjust for interface height tabbing! gsTLY += ROOF_LEVEL_HEIGHT; gsTRY += ROOF_LEVEL_HEIGHT; gsCY += ( ROOF_LEVEL_HEIGHT / 2 ); // Take these spaning distances and determine # tiles spaning gsTilesX = ( gsTRX - gsTLX ) / WORLD_TILE_X; gsTilesY = ( gsBRY - gsTRY ) / WORLD_TILE_Y; DebugMsg(TOPIC_JA2, DBG_LEVEL_0, String("World Screen Width %d Height %d", ( gsTRX - gsTLX ), ( gsBRY - gsTRY ))); // Determine scale factors // First scale world screen coords for VIEWPORT ratio dWorldX = (DOUBLE)( gsTRX - gsTLX ); dWorldY = (DOUBLE)( gsBRY - gsTRY ); gdScaleX = (DOUBLE)RADAR_WINDOW_WIDTH / dWorldX; gdScaleY = (DOUBLE)RADAR_WINDOW_HEIGHT / dWorldY; for ( cnt = 0, cnt2 = 0; cnt2 < NUM_ITEM_CYCLE_COLORS; cnt+=3, cnt2++ ) { us16BPPItemCycleWhiteColors[ cnt2 ] = Get16BPPColor( FROMRGB( ubRGBItemCycleWhiteColors[ cnt ], ubRGBItemCycleWhiteColors[ cnt + 1 ], ubRGBItemCycleWhiteColors[ cnt + 2] ) ); us16BPPItemCycleRedColors[ cnt2 ] = Get16BPPColor( FROMRGB( ubRGBItemCycleRedColors[ cnt ], ubRGBItemCycleRedColors[ cnt + 1 ], ubRGBItemCycleRedColors[ cnt + 2] ) ); us16BPPItemCycleYellowColors[ cnt2 ] = Get16BPPColor( FROMRGB( ubRGBItemCycleYellowColors[ cnt ], ubRGBItemCycleYellowColors[ cnt + 1 ], ubRGBItemCycleYellowColors[ cnt + 2] ) ); } gsLobOutline = Get16BPPColor( FROMRGB( 10, 200, 10 ) ); gsThrowOutline = Get16BPPColor( FROMRGB( 253, 212, 10 ) ); gsGiveOutline = Get16BPPColor( FROMRGB( 253, 0, 0 ) ); gusNormalItemOutlineColor = Get16BPPColor( FROMRGB( 255, 255, 255 ) ); gusYellowItemOutlineColor = Get16BPPColor( FROMRGB( 255, 255, 0 ) ); // NOW GET DISTANCE SPANNING WORLD LIMITS IN WORLD COORDS //FromScreenToCellCoordinates( ( gTopRightWorldLimitX - gTopLeftWorldLimitX ), ( gTopRightWorldLimitY - gTopLeftWorldLimitY ), &gsWorldSpanX, &gsWorldSpanY ); // CALCULATE 16BPP COLORS FOR ITEMS } // WANNE: Scrolling: Only scroll, if the map is larger than the radar map // For example: Do not allow scrolling in Rebel Basement. // Appy? HEahehahehahehae..... BOOLEAN ApplyScrolling( INT16 sTempRenderCenterX, INT16 sTempRenderCenterY, BOOLEAN fForceAdjust, BOOLEAN fCheckOnly ) { BOOLEAN fScrollGood = FALSE; BOOLEAN fOutLeft = FALSE; BOOLEAN fOutRight = FALSE; BOOLEAN fOutTop = FALSE; BOOLEAN fOutBottom = FALSE; double dOpp, dAdj, dAngle; INT16 sTopLeftWorldX, sTopLeftWorldY; INT16 sTopRightWorldX, sTopRightWorldY; INT16 sBottomLeftWorldX, sBottomLeftWorldY; INT16 sBottomRightWorldX, sBottomRightWorldY; INT16 sTempPosX_W, sTempPosY_W; // For debug text for all 4 angles double at1, at2, at3, at4; INT16 sX_S, sY_S; INT16 sScreenCenterX, sScreenCenterY; INT16 sDistToCenterY, sDistToCenterX; INT16 sNewScreenX, sNewScreenY; INT16 sMult; INT16 sRadarTLX, sRadarTLY; INT16 sRadarBRX, sRadarBRY; INT16 sRadarCX, sRadarCY; INT16 sHeight, sWidth, sX, sY; // CHRISL: INT16 gsRadarX; INT16 gsRadarY; BOOLEAN fAllowScrollingHorizontal = FALSE; BOOLEAN fAllowScrollingVertical = FALSE; //Makesure it's a multiple of 5 sMult = sTempRenderCenterX / CELL_X_SIZE; sTempRenderCenterX = ( sMult * CELL_X_SIZE ) + ( CELL_X_SIZE / 2 ); //Makesure it's a multiple of 5 sMult = sTempRenderCenterY / CELL_Y_SIZE; sTempRenderCenterY = ( sMult * CELL_Y_SIZE ) + ( CELL_Y_SIZE / 2 ); // Find the diustance from render center to true world center sDistToCenterX = sTempRenderCenterX - gCenterWorldX; sDistToCenterY = sTempRenderCenterY - gCenterWorldY; // From render center in world coords, convert to render center in "screen" coords FromCellToScreenCoordinates( sDistToCenterX , sDistToCenterY, &sScreenCenterX, &sScreenCenterY ); // Subtract screen center sScreenCenterX += gsCX; sScreenCenterY += gsCY; // Adjust for offset position on screen sScreenCenterX -= 0; sScreenCenterY -= 10; // Get corners in screen coords // TOP LEFT sX_S = ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2; sY_S = ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2; sTopLeftWorldX = sScreenCenterX - sX_S; sTopLeftWorldY = sScreenCenterY - sY_S; sTopRightWorldX = sScreenCenterX + sX_S; sTopRightWorldY = sScreenCenterY - sY_S; sBottomLeftWorldX = sScreenCenterX - sX_S; sBottomLeftWorldY = sScreenCenterY + sY_S; sBottomRightWorldX = sScreenCenterX + sX_S; sBottomRightWorldY = sScreenCenterY + sY_S; // WANNE: Scrolling bugfix, if we are talking in a small tactical map (e.g: Rebel Basement) in high resolution (1024x768)[2007-05-14] // Determine radar coordinates sRadarCX = (INT16)( gsCX * gdScaleX ); sRadarCY = (INT16)( gsCY * gdScaleY ); if( guiCurrentScreen == MAP_SCREEN ) { gsRadarX = RADAR_WINDOW_STRAT_X; gsRadarY = RADAR_WINDOW_STRAT_Y; } else if ( gsCurInterfacePanel == SM_PANEL ) { gsRadarX = RADAR_WINDOW_SM_X; gsRadarY = RADAR_WINDOW_SM_Y; } else { gsRadarX = RADAR_WINDOW_TM_X; gsRadarY = RADAR_WINDOW_TM_Y; } sWidth = ( RADAR_WINDOW_WIDTH ); sHeight = ( RADAR_WINDOW_HEIGHT ); sX = gsRadarX; sY = gsRadarY; sRadarTLX = (INT16)( ( sTopLeftWorldX * gdScaleX ) - sRadarCX + sX + ( sWidth /2 ) ); sRadarTLY = (INT16)( ( sTopLeftWorldY * gdScaleY ) - sRadarCY + gsRadarY + ( sHeight /2 ) ); sRadarBRX = (INT16)( ( sBottomRightWorldX * gdScaleX ) - sRadarCX + sX + ( sWidth /2 ) ); sRadarBRY = (INT16)( ( sBottomRightWorldY * gdScaleY ) - sRadarCY + gsRadarY + ( sHeight /2 ) ); // WANNE: Scrolling bugfix, if we are talking in a small tactical map (e.g: Rebel Basement) in high resolution (1024x768)[2007-05-14] if ((sRadarBRX - sRadarTLX) <= RADAR_WINDOW_WIDTH) { fAllowScrollingHorizontal = TRUE; } if ((sRadarBRY - sRadarTLY) <= RADAR_WINDOW_HEIGHT) { fAllowScrollingVertical = TRUE; } if ((fAllowScrollingHorizontal == FALSE || fAllowScrollingVertical == FALSE) && (gfDialogControl == TRUE)) { gfDialogControl = FALSE; return (FALSE); } // WANNE: Scrolling bugfix for small maps in high resolution (eg: Rebel Basement) //if ((fAllowScrollingHorizontal || fAllowScrollingVertical) && gfDialogControl) //{ // Get angles // TOP LEFT CORNER FIRST dOpp = sTopLeftWorldY - gsTLY; dAdj = sTopLeftWorldX - gsTLX; dAngle = (double)atan2( dAdj, dOpp ); at1 = dAngle * 180 / PI; if ( dAngle < 0 ) { fOutLeft = TRUE; } else if ( dAngle > PI/2 ) { fOutTop = TRUE; } // TOP RIGHT CORNER dOpp = sTopRightWorldY - gsTRY; dAdj = gsTRX - sTopRightWorldX; dAngle = (double)atan2( dAdj, dOpp ); at2 = dAngle * 180 / PI; if ( dAngle < 0 ) { fOutRight = TRUE; } else if ( dAngle > PI/2 ) { fOutTop = TRUE; } // BOTTOM LEFT CORNER dOpp = gsBLY - sBottomLeftWorldY; dAdj = sBottomLeftWorldX - gsBLX; dAngle = (double)atan2( dAdj, dOpp ); at3 = dAngle * 180 / PI; if ( dAngle < 0 ) { fOutLeft = TRUE; } else if ( dAngle > PI/2 ) { fOutBottom = TRUE; } // BOTTOM RIGHT CORNER dOpp = gsBRY - sBottomRightWorldY; dAdj = gsBRX - sBottomRightWorldX; dAngle = (double)atan2( dAdj, dOpp ); at4 = dAngle * 180 / PI; if ( dAngle < 0 ) { fOutRight = TRUE; } else if ( dAngle > PI/2 ) { fOutBottom = TRUE; } sprintf( gDebugStr, "Angles: %d %d %d %d", (int)at1, (int)at2, (int)at3, (int)at4 ); if ( !fOutRight && !fOutLeft && !fOutTop && !fOutBottom ) { fScrollGood = TRUE; } // If in editor, anything goes if ( gfEditMode && _KeyDown( SHIFT ) ) { fScrollGood = TRUE; } // Reset some UI flags gfUIShowExitEast = FALSE; gfUIShowExitWest = FALSE; gfUIShowExitNorth = FALSE; gfUIShowExitSouth = FALSE; if ( !fScrollGood ) { // Force adjustment, if true if ( fForceAdjust ) { if ( fOutTop ) { // Adjust screen coordinates on the Y! CorrectRenderCenter( sScreenCenterX, (INT16)(gsTLY + sY_S ), &sNewScreenX, &sNewScreenY ); FromScreenToCellCoordinates( sNewScreenX, sNewScreenY , &sTempPosX_W, &sTempPosY_W ); sTempRenderCenterX = sTempPosX_W; sTempRenderCenterY = sTempPosY_W; fScrollGood = TRUE; } if ( fOutBottom ) { // OK, Ajust this since we get rounding errors in our two different calculations. CorrectRenderCenter( sScreenCenterX, (INT16)(gsBLY - sY_S - 50 ), &sNewScreenX, &sNewScreenY ); FromScreenToCellCoordinates( sNewScreenX, sNewScreenY , &sTempPosX_W, &sTempPosY_W ); sTempRenderCenterX = sTempPosX_W; sTempRenderCenterY = sTempPosY_W; fScrollGood = TRUE; } if ( fOutLeft ) { CorrectRenderCenter( (INT16)( gsTLX + sX_S ) , sScreenCenterY , &sNewScreenX, &sNewScreenY ); FromScreenToCellCoordinates( sNewScreenX, sNewScreenY , &sTempPosX_W, &sTempPosY_W ); sTempRenderCenterX = sTempPosX_W; sTempRenderCenterY = sTempPosY_W; fScrollGood = TRUE; } if ( fOutRight ) { CorrectRenderCenter( (INT16)( gsTRX - sX_S ) , sScreenCenterY , &sNewScreenX, &sNewScreenY ); FromScreenToCellCoordinates( sNewScreenX, sNewScreenY , &sTempPosX_W, &sTempPosY_W ); sTempRenderCenterX = sTempPosX_W; sTempRenderCenterY = sTempPosY_W; fScrollGood = TRUE; } } else { if ( fOutRight ) { // Check where our cursor is! if ( gusMouseXPos >= SCREEN_WIDTH - 1 ) { gfUIShowExitEast = TRUE; } } if ( fOutLeft ) { // Check where our cursor is! if ( gusMouseXPos == 0 ) { gfUIShowExitWest = TRUE; } } if ( fOutTop ) { // Check where our cursor is! if ( gusMouseYPos == 0 ) { gfUIShowExitNorth = TRUE; } } if ( fOutBottom ) { // Check where our cursor is! if ( gusMouseYPos >= SCREEN_HEIGHT - 1 ) { gfUIShowExitSouth = TRUE; } } } } if ( fScrollGood ) { if ( !fCheckOnly ) { sprintf( gDebugStr, "Center: %d %d ", (int)gsRenderCenterX, (int)gsRenderCenterY ); //Makesure it's a multiple of 5 sMult = sTempRenderCenterX / CELL_X_SIZE; gsRenderCenterX = ( sMult * CELL_X_SIZE ) + ( CELL_X_SIZE / 2 ); //Makesure it's a multiple of 5 sMult = sTempRenderCenterY / CELL_Y_SIZE; gsRenderCenterY = ( sMult * CELL_Y_SIZE ) + ( CELL_Y_SIZE / 2 ); //gsRenderCenterX = sTempRenderCenterX; //gsRenderCenterY = sTempRenderCenterY; gsTopLeftWorldX = sTopLeftWorldX - gsTLX; gsTopRightWorldX = sTopRightWorldX - gsTLX; gsBottomLeftWorldX = sBottomLeftWorldX - gsTLX; gsBottomRightWorldX = sBottomRightWorldX - gsTLX; gsTopLeftWorldY = sTopLeftWorldY - gsTLY; gsTopRightWorldY = sTopRightWorldY - gsTLY; gsBottomLeftWorldY = sBottomLeftWorldY - gsTLY; gsBottomRightWorldY = sBottomRightWorldY - gsTLY; SetPositionSndsVolumeAndPanning( ); } return( TRUE ); } return( FALSE ); //} //return ( FALSE ); } void ClearMarkedTiles(void) { INT32 uiCount; for(uiCount=0; uiCount < WORLD_MAX; uiCount++) gpWorldLevelData[uiCount].uiFlags&=(~MAPELEMENT_REDRAW); } // @@ATECLIP TO WORLD! void InvalidateWorldRedundencyRadius(INT16 sX, INT16 sY, INT16 sRadius) { INT16 sCountX, sCountY; UINT32 uiTile; SetRenderFlags( RENDER_FLAG_CHECKZ ); for(sCountY=sY-sRadius; sCountY < (sY+sRadius+2); sCountY++) { for(sCountX=sX-sRadius; sCountX < (sX+sRadius+2); sCountX++) { uiTile=FASTMAPROWCOLTOPOS(sCountY, sCountX); gpWorldLevelData[uiTile].uiFlags |= MAPELEMENT_REEVALUATE_REDUNDENCY; } } } void InvalidateWorldRedundency( ) { INT32 uiCount; SetRenderFlags( RENDER_FLAG_CHECKZ ); for(uiCount=0; uiCount < WORLD_MAX; uiCount++) gpWorldLevelData[uiCount].uiFlags |= MAPELEMENT_REEVALUATE_REDUNDENCY; } #define Z_STRIP_DELTA_Y ( Z_SUBLAYERS * 10 ) /********************************************************************************************** Blt8BPPDataTo16BPPBufferTransZIncClip Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the pixel's Z level is below that of the current pixel, it is written on, and the Z value is updated to the current value, for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same dimensions (including Pitch) as the destination. **********************************************************************************************/ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) { UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; INT32 ClipX1, ClipY1, ClipX2, ClipY2; UINT16 usZLevel, usZStartLevel, usZColsToGo, usZStartIndex, usCount, usZIndex, usZStartCols; INT8 *pZArray; ZStripInfo *pZInfo; // Assertions Assert( hSrcVObject != NULL ); Assert( pBuffer != NULL ); // Get Offsets from Index into structure pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); usHeight = (UINT32)pTrav->usHeight; usWidth = (UINT32)pTrav->usWidth; uiOffset = pTrav->uiDataOffset; // Add to start position of dest buffer iTempX = iX + pTrav->sOffsetX; iTempY = iY + pTrav->sOffsetY; if(clipregion==NULL) { ClipX1=ClippingRect.iLeft; ClipY1=ClippingRect.iTop; ClipX2=ClippingRect.iRight; ClipY2=ClippingRect.iBottom; } else { ClipX1=clipregion->iLeft; ClipY1=clipregion->iTop; ClipX2=clipregion->iRight; ClipY2=clipregion->iBottom; } // Calculate rows hanging off each side of the screen LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); // calculate the remaining rows and columns to blit BlitLength=((INT32)usWidth-LeftSkip-RightSkip); BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); // check if whole thing is clipped if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) return(TRUE); // check if whole thing is clipped if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) return(TRUE); SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); p16BPPPalette = hSrcVObject->pShadeCurrent; LineSkip=(uiDestPitchBYTES-(BlitLength*2)); if(hSrcVObject->ppZStripInfo==NULL) { DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } // setup for the z-column blitting stuff pZInfo=hSrcVObject->ppZStripInfo[usIndex]; if(pZInfo==NULL) { DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } usZStartLevel=(UINT16)((INT16)usZValue+((INT16)pZInfo->bInitialZChange*Z_STRIP_DELTA_Y)); // set to odd number of pixels for first column if(LeftSkip > pZInfo->ubFirstZStripWidth) { usZStartCols=(LeftSkip - pZInfo->ubFirstZStripWidth); usZStartCols=20-(usZStartCols%20); } else if(LeftSkip < pZInfo->ubFirstZStripWidth) usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); else usZStartCols=20; usZColsToGo=usZStartCols; pZArray=pZInfo->pbZChange; if(LeftSkip >= pZInfo->ubFirstZStripWidth) { // Index into array after doing left clipping usZStartIndex=1 + ((LeftSkip-pZInfo->ubFirstZStripWidth)/20); //calculates the Z-value after left-side clipping if(usZStartIndex) { for(usCount=0; usCount < usZStartIndex; usCount++) { switch(pZArray[usCount]) { case -1: usZStartLevel-=Z_STRIP_DELTA_Y; break; case 0: //no change break; case 1: usZStartLevel+=Z_STRIP_DELTA_Y; break; } } } } else usZStartIndex=0; usZLevel=usZStartLevel; usZIndex=usZStartIndex; __asm { mov esi, SrcPtr mov edi, DestPtr mov edx, p16BPPPalette xor eax, eax mov ebx, ZPtr xor ecx, ecx cmp TopSkip, 0 // check for nothing clipped on top je LeftSkipSetup // Skips the number of lines clipped at the top TopSkipLoop: mov cl, [esi] inc esi or cl, cl js TopSkipLoop jz TSEndLine add esi, ecx jmp TopSkipLoop TSEndLine: dec TopSkip jnz TopSkipLoop // Start of line loop // Skips the pixels hanging outside the left-side boundry LeftSkipSetup: mov Unblitted, 0 // Unblitted counts any pixels left from a run mov eax, LeftSkip // after we have skipped enough left-side pixels mov LSCount, eax // LSCount counts how many pixels skipped so far or eax, eax jz BlitLineSetup // check for nothing to skip LeftSkipLoop: mov cl, [esi] inc esi or cl, cl js LSTrans cmp ecx, LSCount je LSSkip2 // if equal, skip whole, and start blit with new run jb LSSkip1 // if less, skip whole thing add esi, LSCount // skip partial run, jump into normal loop for rest sub ecx, LSCount mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 jmp BlitNTL1 // *** jumps into non-transparent blit loop LSSkip2: add esi, ecx // skip whole run, and start blit with new run jmp BlitLineSetup LSSkip1: add esi, ecx // skip whole run, continue skipping sub LSCount, ecx jmp LeftSkipLoop LSTrans: and ecx, 07fH cmp ecx, LSCount je BlitLineSetup // if equal, skip whole, and start blit with new run jb LSTrans1 // if less, skip whole thing sub ecx, LSCount // skip partial run, jump into normal loop for rest mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 jmp BlitTransparent // *** jumps into transparent blit loop LSTrans1: sub LSCount, ecx // skip whole run, continue skipping jmp LeftSkipLoop //------------------------------------------------- // setup for beginning of line BlitLineSetup: mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 BlitDispatch: cmp LSCount, 0 // Check to see if we're done blitting je RightSkipLoop mov cl, [esi] inc esi or cl, cl js BlitTransparent jz RSLoop2 //-------------------------------- // blitting non-transparent pixels and ecx, 07fH BlitNTL1: mov ax, [ebx] // check z-level of pixel cmp ax, usZLevel jae BlitNTL2 mov ax, usZLevel // update z-level of pixel mov [ebx], ax xor eax, eax mov al, [esi] // copy pixel mov ax, [edx+eax*2] mov [edi], ax BlitNTL2: inc esi add edi, 2 add ebx, 2 dec usZColsToGo jnz BlitNTL6 // update the z-level according to the z-table push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index add edx, eax inc eax // increment it mov usZIndex, ax // store incremented value mov al, [edx] // get direction instruction mov dx, usZLevel // get current z-level or al, al jz BlitNTL5 // dir = 0 no change js BlitNTL4 // dir < 0 z-level down // dir > 0 z-level up (default) add dx, Z_STRIP_DELTA_Y jmp BlitNTL5 BlitNTL4: sub dx, Z_STRIP_DELTA_Y BlitNTL5: mov usZLevel, dx // store the now-modified z-level mov usZColsToGo, 20 // reset the next z-level change to 20 cols pop edx BlitNTL6: dec LSCount // decrement pixel length to blit jz RightSkipLoop // done blitting the visible line dec ecx jnz BlitNTL1 // continue current run jmp BlitDispatch // done current run, go for another //---------------------------- // skipping transparent pixels BlitTransparent: // skip transparent pixels and ecx, 07fH BlitTrans2: add edi, 2 // move up the destination pointer add ebx, 2 dec usZColsToGo jnz BlitTrans1 // update the z-level according to the z-table push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index add edx, eax inc eax // increment it mov usZIndex, ax // store incremented value mov al, [edx] // get direction instruction mov dx, usZLevel // get current z-level or al, al jz BlitTrans5 // dir = 0 no change js BlitTrans4 // dir < 0 z-level down // dir > 0 z-level up (default) add dx, Z_STRIP_DELTA_Y jmp BlitTrans5 BlitTrans4: sub dx, Z_STRIP_DELTA_Y BlitTrans5: mov usZLevel, dx // store the now-modified z-level mov usZColsToGo, 20 // reset the next z-level change to 20 cols pop edx BlitTrans1: dec LSCount // decrement the pixels to blit jz RightSkipLoop // done the line dec ecx jnz BlitTrans2 jmp BlitDispatch //--------------------------------------------- // Scans the ETRLE until it finds an EOL marker RightSkipLoop: RSLoop1: mov al, [esi] inc esi or al, al jnz RSLoop1 RSLoop2: dec BlitHeight jz BlitDone add edi, LineSkip add ebx, LineSkip // reset all the z-level stuff for a new line mov ax, usZStartLevel mov usZLevel, ax mov ax, usZStartIndex mov usZIndex, ax mov ax, usZStartCols mov usZColsToGo, ax jmp LeftSkipSetup BlitDone: } return(TRUE); } /********************************************************************************************** Blt8BPPDataTo16BPPBufferTransZIncClipSaveZBurnsThrough Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the pixel's Z level is below that of the current pixel, it is written on, and the Z value is updated to the current value, for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same dimensions (including Pitch) as the destination. **********************************************************************************************/ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncClipZSameZBurnsThrough( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, INT16 usZStripIndex ) { UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; INT32 ClipX1, ClipY1, ClipX2, ClipY2; UINT16 usZLevel, usZStartLevel, usZColsToGo, usZStartIndex, usCount, usZIndex, usZStartCols; INT8 *pZArray; ZStripInfo *pZInfo; // Assertions Assert( hSrcVObject != NULL ); Assert( pBuffer != NULL ); // Get Offsets from Index into structure pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); usHeight = (UINT32)pTrav->usHeight; usWidth = (UINT32)pTrav->usWidth; uiOffset = pTrav->uiDataOffset; // Add to start position of dest buffer iTempX = iX + pTrav->sOffsetX; iTempY = iY + pTrav->sOffsetY; if(clipregion==NULL) { ClipX1=ClippingRect.iLeft; ClipY1=ClippingRect.iTop; ClipX2=ClippingRect.iRight; ClipY2=ClippingRect.iBottom; } else { ClipX1=clipregion->iLeft; ClipY1=clipregion->iTop; ClipX2=clipregion->iRight; ClipY2=clipregion->iBottom; } // Calculate rows hanging off each side of the screen LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); // calculate the remaining rows and columns to blit BlitLength=((INT32)usWidth-LeftSkip-RightSkip); BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); // check if whole thing is clipped if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) return(TRUE); // check if whole thing is clipped if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) return(TRUE); SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); p16BPPPalette = hSrcVObject->pShadeCurrent; LineSkip=(uiDestPitchBYTES-(BlitLength*2)); if(hSrcVObject->ppZStripInfo==NULL) { DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } // setup for the z-column blitting stuff pZInfo=hSrcVObject->ppZStripInfo[ usZStripIndex ]; if(pZInfo==NULL) { DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } usZStartLevel=(UINT16)((INT16)usZValue+((INT16)pZInfo->bInitialZChange*Z_STRIP_DELTA_Y)); // set to odd number of pixels for first column if(LeftSkip > pZInfo->ubFirstZStripWidth) { usZStartCols=(LeftSkip - pZInfo->ubFirstZStripWidth); usZStartCols=20-(usZStartCols%20); } else if(LeftSkip < pZInfo->ubFirstZStripWidth) usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); else usZStartCols=20; usZColsToGo=usZStartCols; pZArray=pZInfo->pbZChange; if(LeftSkip >= pZInfo->ubFirstZStripWidth) { // Index into array after doing left clipping usZStartIndex=1 + ((LeftSkip-pZInfo->ubFirstZStripWidth)/20); //calculates the Z-value after left-side clipping if(usZStartIndex) { for(usCount=0; usCount < usZStartIndex; usCount++) { switch(pZArray[usCount]) { case -1: usZStartLevel-=Z_STRIP_DELTA_Y; break; case 0: //no change break; case 1: usZStartLevel+=Z_STRIP_DELTA_Y; break; } } } } else usZStartIndex=0; usZLevel=usZStartLevel; usZIndex=usZStartIndex; __asm { mov esi, SrcPtr mov edi, DestPtr mov edx, p16BPPPalette xor eax, eax mov ebx, ZPtr xor ecx, ecx cmp TopSkip, 0 // check for nothing clipped on top je LeftSkipSetup // Skips the number of lines clipped at the top TopSkipLoop: mov cl, [esi] inc esi or cl, cl js TopSkipLoop jz TSEndLine add esi, ecx jmp TopSkipLoop TSEndLine: dec TopSkip jnz TopSkipLoop // Start of line loop // Skips the pixels hanging outside the left-side boundry LeftSkipSetup: mov Unblitted, 0 // Unblitted counts any pixels left from a run mov eax, LeftSkip // after we have skipped enough left-side pixels mov LSCount, eax // LSCount counts how many pixels skipped so far or eax, eax jz BlitLineSetup // check for nothing to skip LeftSkipLoop: mov cl, [esi] inc esi or cl, cl js LSTrans cmp ecx, LSCount je LSSkip2 // if equal, skip whole, and start blit with new run jb LSSkip1 // if less, skip whole thing add esi, LSCount // skip partial run, jump into normal loop for rest sub ecx, LSCount mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 jmp BlitNTL1 // *** jumps into non-transparent blit loop LSSkip2: add esi, ecx // skip whole run, and start blit with new run jmp BlitLineSetup LSSkip1: add esi, ecx // skip whole run, continue skipping sub LSCount, ecx jmp LeftSkipLoop LSTrans: and ecx, 07fH cmp ecx, LSCount je BlitLineSetup // if equal, skip whole, and start blit with new run jb LSTrans1 // if less, skip whole thing sub ecx, LSCount // skip partial run, jump into normal loop for rest mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 jmp BlitTransparent // *** jumps into transparent blit loop LSTrans1: sub LSCount, ecx // skip whole run, continue skipping jmp LeftSkipLoop //------------------------------------------------- // setup for beginning of line BlitLineSetup: mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 BlitDispatch: cmp LSCount, 0 // Check to see if we're done blitting je RightSkipLoop mov cl, [esi] inc esi or cl, cl js BlitTransparent jz RSLoop2 //-------------------------------- // blitting non-transparent pixels and ecx, 07fH BlitNTL1: mov ax, [ebx] // check z-level of pixel cmp ax, usZLevel ja BlitNTL2 mov ax, usZLevel // update z-level of pixel mov [ebx], ax xor eax, eax mov al, [esi] // copy pixel mov ax, [edx+eax*2] mov [edi], ax BlitNTL2: inc esi add edi, 2 add ebx, 2 dec usZColsToGo jnz BlitNTL6 // update the z-level according to the z-table push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index add edx, eax inc eax // increment it mov usZIndex, ax // store incremented value mov al, [edx] // get direction instruction mov dx, usZLevel // get current z-level or al, al jz BlitNTL5 // dir = 0 no change js BlitNTL4 // dir < 0 z-level down // dir > 0 z-level up (default) add dx, Z_STRIP_DELTA_Y jmp BlitNTL5 BlitNTL4: sub dx, Z_STRIP_DELTA_Y BlitNTL5: mov usZLevel, dx // store the now-modified z-level mov usZColsToGo, 20 // reset the next z-level change to 20 cols pop edx BlitNTL6: dec LSCount // decrement pixel length to blit jz RightSkipLoop // done blitting the visible line dec ecx jnz BlitNTL1 // continue current run jmp BlitDispatch // done current run, go for another //---------------------------- // skipping transparent pixels BlitTransparent: // skip transparent pixels and ecx, 07fH BlitTrans2: add edi, 2 // move up the destination pointer add ebx, 2 dec usZColsToGo jnz BlitTrans1 // update the z-level according to the z-table push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index add edx, eax inc eax // increment it mov usZIndex, ax // store incremented value mov al, [edx] // get direction instruction mov dx, usZLevel // get current z-level or al, al jz BlitTrans5 // dir = 0 no change js BlitTrans4 // dir < 0 z-level down // dir > 0 z-level up (default) add dx, Z_STRIP_DELTA_Y jmp BlitTrans5 BlitTrans4: sub dx, Z_STRIP_DELTA_Y BlitTrans5: mov usZLevel, dx // store the now-modified z-level mov usZColsToGo, 20 // reset the next z-level change to 20 cols pop edx BlitTrans1: dec LSCount // decrement the pixels to blit jz RightSkipLoop // done the line dec ecx jnz BlitTrans2 jmp BlitDispatch //--------------------------------------------- // Scans the ETRLE until it finds an EOL marker RightSkipLoop: RSLoop1: mov al, [esi] inc esi or al, al jnz RSLoop1 RSLoop2: dec BlitHeight jz BlitDone add edi, LineSkip add ebx, LineSkip // reset all the z-level stuff for a new line mov ax, usZStartLevel mov usZLevel, ax mov ax, usZStartIndex mov usZIndex, ax mov ax, usZStartCols mov usZColsToGo, ax jmp LeftSkipSetup BlitDone: } return(TRUE); } /********************************************************************************************** Blt8BPPDataTo16BPPBufferTransZIncObscureClip Blits an image into the destination buffer, using an ETRLE brush as a source, and a 16-bit buffer as a destination. As it is blitting, it checks the Z value of the ZBuffer, and if the pixel's Z level is below that of the current pixel, it is written on, and the Z value is updated to the current value, for any non-transparent pixels. The Z-buffer is 16 bit, and must be the same dimensions (including Pitch) as the destination. //ATE: This blitter makes the values that are =< z value pixellate rather than not // render at all **********************************************************************************************/ BOOLEAN Blt8BPPDataTo16BPPBufferTransZIncObscureClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion) { UINT16 *p16BPPPalette; UINT32 uiOffset, uiLineFlag; UINT32 usHeight, usWidth, Unblitted; UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; INT32 ClipX1, ClipY1, ClipX2, ClipY2; UINT16 usZLevel, usZStartLevel, usZColsToGo, usZStartIndex, usCount, usZIndex, usZStartCols; INT8 *pZArray; ZStripInfo *pZInfo; // Assertions Assert( hSrcVObject != NULL ); Assert( pBuffer != NULL ); // Get Offsets from Index into structure pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); usHeight = (UINT32)pTrav->usHeight; usWidth = (UINT32)pTrav->usWidth; uiOffset = pTrav->uiDataOffset; // Add to start position of dest buffer iTempX = iX + pTrav->sOffsetX; iTempY = iY + pTrav->sOffsetY; if(clipregion==NULL) { ClipX1=ClippingRect.iLeft; ClipY1=ClippingRect.iTop; ClipX2=ClippingRect.iRight; ClipY2=ClippingRect.iBottom; } else { ClipX1=clipregion->iLeft; ClipY1=clipregion->iTop; ClipX2=clipregion->iRight; ClipY2=clipregion->iBottom; } // Calculate rows hanging off each side of the screen LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); uiLineFlag=(iTempY&1); // calculate the remaining rows and columns to blit BlitLength=((INT32)usWidth-LeftSkip-RightSkip); BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); // check if whole thing is clipped if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) return(TRUE); // check if whole thing is clipped if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) return(TRUE); SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); p16BPPPalette = hSrcVObject->pShadeCurrent; LineSkip=(uiDestPitchBYTES-(BlitLength*2)); if(hSrcVObject->ppZStripInfo==NULL) { DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } // setup for the z-column blitting stuff pZInfo=hSrcVObject->ppZStripInfo[usIndex]; if(pZInfo==NULL) { DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } usZStartLevel=(UINT16)((INT16)usZValue+((INT16)pZInfo->bInitialZChange*Z_STRIP_DELTA_Y)); // set to odd number of pixels for first column if(LeftSkip > pZInfo->ubFirstZStripWidth) { usZStartCols=(LeftSkip - pZInfo->ubFirstZStripWidth); usZStartCols=20-(usZStartCols%20); } else if(LeftSkip < pZInfo->ubFirstZStripWidth) usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); else usZStartCols=20; usZColsToGo=usZStartCols; pZArray=pZInfo->pbZChange; if(LeftSkip >= pZInfo->ubFirstZStripWidth) { // Index into array after doing left clipping usZStartIndex=1 + ((LeftSkip-pZInfo->ubFirstZStripWidth)/20); //calculates the Z-value after left-side clipping if(usZStartIndex) { for(usCount=0; usCount < usZStartIndex; usCount++) { switch(pZArray[usCount]) { case -1: usZStartLevel-=Z_STRIP_DELTA_Y; break; case 0: //no change break; case 1: usZStartLevel+=Z_STRIP_DELTA_Y; break; } } } } else usZStartIndex=0; usZLevel=usZStartLevel; usZIndex=usZStartIndex; __asm { mov esi, SrcPtr mov edi, DestPtr mov edx, p16BPPPalette xor eax, eax mov ebx, ZPtr xor ecx, ecx cmp TopSkip, 0 // check for nothing clipped on top je LeftSkipSetup // Skips the number of lines clipped at the top TopSkipLoop: mov cl, [esi] inc esi or cl, cl js TopSkipLoop jz TSEndLine add esi, ecx jmp TopSkipLoop TSEndLine: xor uiLineFlag, 1 dec TopSkip jnz TopSkipLoop // Start of line loop // Skips the pixels hanging outside the left-side boundry LeftSkipSetup: mov Unblitted, 0 // Unblitted counts any pixels left from a run mov eax, LeftSkip // after we have skipped enough left-side pixels mov LSCount, eax // LSCount counts how many pixels skipped so far or eax, eax jz BlitLineSetup // check for nothing to skip LeftSkipLoop: mov cl, [esi] inc esi or cl, cl js LSTrans cmp ecx, LSCount je LSSkip2 // if equal, skip whole, and start blit with new run jb LSSkip1 // if less, skip whole thing add esi, LSCount // skip partial run, jump into normal loop for rest sub ecx, LSCount mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 jmp BlitNTL1 // *** jumps into non-transparent blit loop LSSkip2: add esi, ecx // skip whole run, and start blit with new run jmp BlitLineSetup LSSkip1: add esi, ecx // skip whole run, continue skipping sub LSCount, ecx jmp LeftSkipLoop LSTrans: and ecx, 07fH cmp ecx, LSCount je BlitLineSetup // if equal, skip whole, and start blit with new run jb LSTrans1 // if less, skip whole thing sub ecx, LSCount // skip partial run, jump into normal loop for rest mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 jmp BlitTransparent // *** jumps into transparent blit loop LSTrans1: sub LSCount, ecx // skip whole run, continue skipping jmp LeftSkipLoop //------------------------------------------------- // setup for beginning of line BlitLineSetup: mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 BlitDispatch: cmp LSCount, 0 // Check to see if we're done blitting je RightSkipLoop mov cl, [esi] inc esi or cl, cl js BlitTransparent jz RSLoop2 //-------------------------------- // blitting non-transparent pixels and ecx, 07fH BlitNTL1: mov ax, [ebx] // check z-level of pixel cmp ax, usZLevel jae BlitPixellate1 jmp BlitPixel1 BlitPixellate1: // OK, DO PIXELLATE SCHEME HERE! test uiLineFlag, 1 jz BlitSkip1 test edi, 2 jz BlitNTL2 jmp BlitPixel1 BlitSkip1: test edi, 2 jnz BlitNTL2 BlitPixel1: mov ax, usZLevel // update z-level of pixel mov [ebx], ax xor eax, eax mov al, [esi] // copy pixel mov ax, [edx+eax*2] mov [edi], ax BlitNTL2: inc esi add edi, 2 add ebx, 2 dec usZColsToGo jnz BlitNTL6 // update the z-level according to the z-table push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index add edx, eax inc eax // increment it mov usZIndex, ax // store incremented value mov al, [edx] // get direction instruction mov dx, usZLevel // get current z-level or al, al jz BlitNTL5 // dir = 0 no change js BlitNTL4 // dir < 0 z-level down // dir > 0 z-level up (default) add dx, Z_STRIP_DELTA_Y jmp BlitNTL5 BlitNTL4: sub dx, Z_STRIP_DELTA_Y BlitNTL5: mov usZLevel, dx // store the now-modified z-level mov usZColsToGo, 20 // reset the next z-level change to 20 cols pop edx BlitNTL6: dec LSCount // decrement pixel length to blit jz RightSkipLoop // done blitting the visible line dec ecx jnz BlitNTL1 // continue current run jmp BlitDispatch // done current run, go for another //---------------------------- // skipping transparent pixels BlitTransparent: // skip transparent pixels and ecx, 07fH BlitTrans2: add edi, 2 // move up the destination pointer add ebx, 2 dec usZColsToGo jnz BlitTrans1 // update the z-level according to the z-table push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index add edx, eax inc eax // increment it mov usZIndex, ax // store incremented value mov al, [edx] // get direction instruction mov dx, usZLevel // get current z-level or al, al jz BlitTrans5 // dir = 0 no change js BlitTrans4 // dir < 0 z-level down // dir > 0 z-level up (default) add dx, Z_STRIP_DELTA_Y jmp BlitTrans5 BlitTrans4: sub dx, Z_STRIP_DELTA_Y BlitTrans5: mov usZLevel, dx // store the now-modified z-level mov usZColsToGo, 20 // reset the next z-level change to 20 cols pop edx BlitTrans1: dec LSCount // decrement the pixels to blit jz RightSkipLoop // done the line dec ecx jnz BlitTrans2 jmp BlitDispatch //--------------------------------------------- // Scans the ETRLE until it finds an EOL marker RightSkipLoop: RSLoop1: mov al, [esi] inc esi or al, al jnz RSLoop1 RSLoop2: xor uiLineFlag, 1 dec BlitHeight jz BlitDone add edi, LineSkip add ebx, LineSkip // reset all the z-level stuff for a new line mov ax, usZStartLevel mov usZLevel, ax mov ax, usZStartIndex mov usZIndex, ax mov ax, usZStartCols mov usZColsToGo, ax jmp LeftSkipSetup BlitDone: } return(TRUE); } // Blitter Specs // 1 ) 8 to 16 bpp // 2 ) strip z-blitter // 3 ) clipped // 4 ) trans shadow - if value is 254, makes a shadow // BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncObscureClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, INT16 sZIndex, UINT16 *p16BPPPalette ) { UINT32 uiOffset, uiLineFlag; UINT32 usHeight, usWidth, Unblitted; UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; INT32 ClipX1, ClipY1, ClipX2, ClipY2; UINT16 usZLevel, usZStartLevel, usZColsToGo, usZStartIndex, usCount, usZIndex, usZStartCols; INT8 *pZArray; ZStripInfo *pZInfo; // Assertions Assert( hSrcVObject != NULL ); Assert( pBuffer != NULL ); // Get Offsets from Index into structure pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); usHeight = (UINT32)pTrav->usHeight; usWidth = (UINT32)pTrav->usWidth; uiOffset = pTrav->uiDataOffset; // Add to start position of dest buffer iTempX = iX + pTrav->sOffsetX; iTempY = iY + pTrav->sOffsetY; if(clipregion==NULL) { ClipX1=ClippingRect.iLeft; ClipY1=ClippingRect.iTop; ClipX2=ClippingRect.iRight; ClipY2=ClippingRect.iBottom; } else { ClipX1=clipregion->iLeft; ClipY1=clipregion->iTop; ClipX2=clipregion->iRight; ClipY2=clipregion->iBottom; } // Calculate rows hanging off each side of the screen LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); uiLineFlag=(iTempY&1); // calculate the remaining rows and columns to blit BlitLength=((INT32)usWidth-LeftSkip-RightSkip); BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); // check if whole thing is clipped if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) return(TRUE); // check if whole thing is clipped if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) return(TRUE); SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); LineSkip=(uiDestPitchBYTES-(BlitLength*2)); if(hSrcVObject->ppZStripInfo==NULL) { DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } // setup for the z-column blitting stuff pZInfo=hSrcVObject->ppZStripInfo[sZIndex]; if(pZInfo==NULL) { DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } usZStartLevel=(UINT16)((INT16)usZValue+((INT16)pZInfo->bInitialZChange*Z_SUBLAYERS*10)); if(LeftSkip > pZInfo->ubFirstZStripWidth) { usZStartCols=(LeftSkip - pZInfo->ubFirstZStripWidth); usZStartCols=20-(usZStartCols%20); } else if(LeftSkip < pZInfo->ubFirstZStripWidth) usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); else usZStartCols=20; // set to odd number of pixels for first column usZColsToGo=usZStartCols; pZArray=pZInfo->pbZChange; if(LeftSkip >= usZColsToGo) { // Index into array after doing left clipping usZStartIndex=1 + ((LeftSkip-pZInfo->ubFirstZStripWidth)/20); //calculates the Z-value after left-side clipping if(usZStartIndex) { for(usCount=0; usCount < usZStartIndex; usCount++) { switch(pZArray[usCount]) { case -1: usZStartLevel-=Z_SUBLAYERS; break; case 0: //no change break; case 1: usZStartLevel+=Z_SUBLAYERS; break; } } } } else usZStartIndex=0; usZLevel=usZStartLevel; usZIndex=usZStartIndex; __asm { mov esi, SrcPtr mov edi, DestPtr mov edx, p16BPPPalette xor eax, eax mov ebx, ZPtr xor ecx, ecx cmp TopSkip, 0 // check for nothing clipped on top je LeftSkipSetup // Skips the number of lines clipped at the top TopSkipLoop: mov cl, [esi] inc esi or cl, cl js TopSkipLoop jz TSEndLine add esi, ecx jmp TopSkipLoop TSEndLine: xor uiLineFlag, 1 dec TopSkip jnz TopSkipLoop // Start of line loop // Skips the pixels hanging outside the left-side boundry LeftSkipSetup: mov Unblitted, 0 // Unblitted counts any pixels left from a run mov eax, LeftSkip // after we have skipped enough left-side pixels mov LSCount, eax // LSCount counts how many pixels skipped so far or eax, eax jz BlitLineSetup // check for nothing to skip LeftSkipLoop: mov cl, [esi] inc esi or cl, cl js LSTrans cmp ecx, LSCount je LSSkip2 // if equal, skip whole, and start blit with new run jb LSSkip1 // if less, skip whole thing add esi, LSCount // skip partial run, jump into normal loop for rest sub ecx, LSCount mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 jmp BlitNTL1 // *** jumps into non-transparent blit loop LSSkip2: add esi, ecx // skip whole run, and start blit with new run jmp BlitLineSetup LSSkip1: add esi, ecx // skip whole run, continue skipping sub LSCount, ecx jmp LeftSkipLoop LSTrans: and ecx, 07fH cmp ecx, LSCount je BlitLineSetup // if equal, skip whole, and start blit with new run jb LSTrans1 // if less, skip whole thing sub ecx, LSCount // skip partial run, jump into normal loop for rest mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 jmp BlitTransparent // *** jumps into transparent blit loop LSTrans1: sub LSCount, ecx // skip whole run, continue skipping jmp LeftSkipLoop //------------------------------------------------- // setup for beginning of line BlitLineSetup: mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 BlitDispatch: cmp LSCount, 0 // Check to see if we're done blitting je RightSkipLoop mov cl, [esi] inc esi or cl, cl js BlitTransparent jz RSLoop2 //-------------------------------- // blitting non-transparent pixels and ecx, 07fH BlitNTL1: mov ax, [ebx] // check z-level of pixel cmp ax, usZLevel jae BlitPixellate1 jmp BlitPixel1 BlitPixellate1: // OK, DO PIXELLATE SCHEME HERE! test uiLineFlag, 1 jz BlitSkip1 test edi, 2 jz BlitNTL2 jmp BlitPixel1 BlitSkip1: test edi, 2 jnz BlitNTL2 BlitPixel1: mov ax, usZLevel // update z-level of pixel mov [ebx], ax // Check for shadow... xor eax, eax mov al, [esi] cmp al, 254 jne BlitNTL66 mov ax, [edi] mov ax, ShadeTable[eax*2] mov [edi], ax jmp BlitNTL2 BlitNTL66: mov ax, [edx+eax*2] // Copy pixel mov [edi], ax BlitNTL2: inc esi add edi, 2 add ebx, 2 dec usZColsToGo jnz BlitNTL6 // update the z-level according to the z-table push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index add edx, eax inc eax // increment it mov usZIndex, ax // store incremented value mov al, [edx] // get direction instruction mov dx, usZLevel // get current z-level or al, al jz BlitNTL5 // dir = 0 no change js BlitNTL4 // dir < 0 z-level down // dir > 0 z-level up (default) add dx, Z_SUBLAYERS jmp BlitNTL5 BlitNTL4: sub dx, Z_SUBLAYERS BlitNTL5: mov usZLevel, dx // store the now-modified z-level mov usZColsToGo, 20 // reset the next z-level change to 20 cols pop edx BlitNTL6: dec LSCount // decrement pixel length to blit jz RightSkipLoop // done blitting the visible line dec ecx jnz BlitNTL1 // continue current run jmp BlitDispatch // done current run, go for another //---------------------------- // skipping transparent pixels BlitTransparent: // skip transparent pixels and ecx, 07fH BlitTrans2: add edi, 2 // move up the destination pointer add ebx, 2 dec usZColsToGo jnz BlitTrans1 // update the z-level according to the z-table push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index add edx, eax inc eax // increment it mov usZIndex, ax // store incremented value mov al, [edx] // get direction instruction mov dx, usZLevel // get current z-level or al, al jz BlitTrans5 // dir = 0 no change js BlitTrans4 // dir < 0 z-level down // dir > 0 z-level up (default) add dx, Z_SUBLAYERS jmp BlitTrans5 BlitTrans4: sub dx, Z_SUBLAYERS BlitTrans5: mov usZLevel, dx // store the now-modified z-level mov usZColsToGo, 20 // reset the next z-level change to 20 cols pop edx BlitTrans1: dec LSCount // decrement the pixels to blit jz RightSkipLoop // done the line dec ecx jnz BlitTrans2 jmp BlitDispatch //--------------------------------------------- // Scans the ETRLE until it finds an EOL marker RightSkipLoop: RSLoop1: mov al, [esi] inc esi or al, al jnz RSLoop1 RSLoop2: xor uiLineFlag, 1 dec BlitHeight jz BlitDone add edi, LineSkip add ebx, LineSkip // reset all the z-level stuff for a new line mov ax, usZStartLevel mov usZLevel, ax mov ax, usZStartIndex mov usZIndex, ax mov ax, usZStartCols mov usZColsToGo, ax jmp LeftSkipSetup BlitDone: } return(TRUE); } void CorrectRenderCenter( INT16 sRenderX, INT16 sRenderY, INT16 *pSNewX, INT16 *pSNewY ) { INT16 sScreenX, sScreenY; INT16 sNumXSteps, sNumYSteps; // Use radar scale values to get screen values, then convert ot map values, rounding to nearest middle tile sScreenX = (INT16) sRenderX; sScreenY = (INT16) sRenderY; // Adjust for offsets! sScreenX += 0; sScreenY += 10; // Adjust to viewport start! sScreenX -= ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ); sScreenY -= ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ); //Make sure these coordinates are multiples of scroll steps sNumXSteps = sScreenX / gubNewScrollXSpeeds[ gfDoVideoScroll ][ gubCurScrollSpeedID ]; sNumYSteps = sScreenY / gubNewScrollYSpeeds[ gfDoVideoScroll ][ gubCurScrollSpeedID ]; sScreenX = ( sNumXSteps * gubNewScrollXSpeeds[ gfDoVideoScroll ][ gubCurScrollSpeedID ] ); sScreenY = ( sNumYSteps * gubNewScrollYSpeeds[ gfDoVideoScroll ][ gubCurScrollSpeedID ]); // Adjust back sScreenX += ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ); sScreenY += ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ); *pSNewX = sScreenX; *pSNewY = sScreenY; } // Blitter Specs // 1 ) 8 to 16 bpp // 2 ) strip z-blitter // 3 ) clipped // 4 ) trans shadow - if value is 254, makes a shadow // BOOLEAN Blt8BPPDataTo16BPPBufferTransZTransShadowIncClip( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex, SGPRect *clipregion, INT16 sZIndex, UINT16 *p16BPPPalette ) { UINT32 uiOffset; UINT32 usHeight, usWidth, Unblitted; UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; INT32 iTempX, iTempY, LeftSkip, RightSkip, TopSkip, BottomSkip, BlitLength, BlitHeight, LSCount; INT32 ClipX1, ClipY1, ClipX2, ClipY2; UINT16 usZLevel, usZStartLevel, usZColsToGo, usZStartIndex, usCount, usZIndex, usZStartCols; INT8 *pZArray; ZStripInfo *pZInfo; // Assertions Assert( hSrcVObject != NULL ); Assert( pBuffer != NULL ); // Get Offsets from Index into structure pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); usHeight = (UINT32)pTrav->usHeight; usWidth = (UINT32)pTrav->usWidth; uiOffset = pTrav->uiDataOffset; // Add to start position of dest buffer iTempX = iX + pTrav->sOffsetX; iTempY = iY + pTrav->sOffsetY; if(clipregion==NULL) { ClipX1=ClippingRect.iLeft; ClipY1=ClippingRect.iTop; ClipX2=ClippingRect.iRight; ClipY2=ClippingRect.iBottom; } else { ClipX1=clipregion->iLeft; ClipY1=clipregion->iTop; ClipX2=clipregion->iRight; ClipY2=clipregion->iBottom; } // Calculate rows hanging off each side of the screen LeftSkip=__min(ClipX1 - min(ClipX1, iTempX), (INT32)usWidth); RightSkip=__min(max(ClipX2, (iTempX+(INT32)usWidth)) - ClipX2, (INT32)usWidth); TopSkip=__min(ClipY1 - __min(ClipY1, iTempY), (INT32)usHeight); BottomSkip=__min(__max(ClipY2, (iTempY+(INT32)usHeight)) - ClipY2, (INT32)usHeight); // calculate the remaining rows and columns to blit BlitLength=((INT32)usWidth-LeftSkip-RightSkip); BlitHeight=((INT32)usHeight-TopSkip-BottomSkip); // check if whole thing is clipped if((LeftSkip >=(INT32)usWidth) || (RightSkip >=(INT32)usWidth)) return(TRUE); // check if whole thing is clipped if((TopSkip >=(INT32)usHeight) || (BottomSkip >=(INT32)usHeight)) return(TRUE); SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*(iTempY+TopSkip)) + ((iTempX+LeftSkip)*2); LineSkip=(uiDestPitchBYTES-(BlitLength*2)); if(hSrcVObject->ppZStripInfo==NULL) { DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } // setup for the z-column blitting stuff pZInfo=hSrcVObject->ppZStripInfo[sZIndex]; if(pZInfo==NULL) { DebugMsg(TOPIC_VIDEOOBJECT, DBG_LEVEL_0, String("Missing Z-Strip info on multi-Z object")); return(FALSE); } usZStartLevel=(UINT16)((INT16)usZValue+((INT16)pZInfo->bInitialZChange*Z_SUBLAYERS*10)); if(LeftSkip > pZInfo->ubFirstZStripWidth) { usZStartCols=(LeftSkip - pZInfo->ubFirstZStripWidth); usZStartCols=20-(usZStartCols%20); } else if(LeftSkip < pZInfo->ubFirstZStripWidth) usZStartCols=(UINT16)(pZInfo->ubFirstZStripWidth - LeftSkip); else usZStartCols=20; // set to odd number of pixels for first column usZColsToGo=usZStartCols; pZArray=pZInfo->pbZChange; if(LeftSkip >= usZColsToGo) { // Index into array after doing left clipping usZStartIndex=1 + ((LeftSkip-pZInfo->ubFirstZStripWidth)/20); //calculates the Z-value after left-side clipping if(usZStartIndex) { for(usCount=0; usCount < usZStartIndex; usCount++) { switch(pZArray[usCount]) { case -1: usZStartLevel-=Z_SUBLAYERS; break; case 0: //no change break; case 1: usZStartLevel+=Z_SUBLAYERS; break; } } } } else usZStartIndex=0; usZLevel=usZStartLevel; usZIndex=usZStartIndex; __asm { mov esi, SrcPtr mov edi, DestPtr mov edx, p16BPPPalette xor eax, eax mov ebx, ZPtr xor ecx, ecx cmp TopSkip, 0 // check for nothing clipped on top je LeftSkipSetup // Skips the number of lines clipped at the top TopSkipLoop: mov cl, [esi] inc esi or cl, cl js TopSkipLoop jz TSEndLine add esi, ecx jmp TopSkipLoop TSEndLine: dec TopSkip jnz TopSkipLoop // Start of line loop // Skips the pixels hanging outside the left-side boundry LeftSkipSetup: mov Unblitted, 0 // Unblitted counts any pixels left from a run mov eax, LeftSkip // after we have skipped enough left-side pixels mov LSCount, eax // LSCount counts how many pixels skipped so far or eax, eax jz BlitLineSetup // check for nothing to skip LeftSkipLoop: mov cl, [esi] inc esi or cl, cl js LSTrans cmp ecx, LSCount je LSSkip2 // if equal, skip whole, and start blit with new run jb LSSkip1 // if less, skip whole thing add esi, LSCount // skip partial run, jump into normal loop for rest sub ecx, LSCount mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 jmp BlitNTL1 // *** jumps into non-transparent blit loop LSSkip2: add esi, ecx // skip whole run, and start blit with new run jmp BlitLineSetup LSSkip1: add esi, ecx // skip whole run, continue skipping sub LSCount, ecx jmp LeftSkipLoop LSTrans: and ecx, 07fH cmp ecx, LSCount je BlitLineSetup // if equal, skip whole, and start blit with new run jb LSTrans1 // if less, skip whole thing sub ecx, LSCount // skip partial run, jump into normal loop for rest mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 jmp BlitTransparent // *** jumps into transparent blit loop LSTrans1: sub LSCount, ecx // skip whole run, continue skipping jmp LeftSkipLoop //------------------------------------------------- // setup for beginning of line BlitLineSetup: mov eax, BlitLength mov LSCount, eax mov Unblitted, 0 BlitDispatch: cmp LSCount, 0 // Check to see if we're done blitting je RightSkipLoop mov cl, [esi] inc esi or cl, cl js BlitTransparent jz RSLoop2 //-------------------------------- // blitting non-transparent pixels and ecx, 07fH BlitNTL1: mov ax, [ebx] // check z-level of pixel cmp ax, usZLevel ja BlitNTL2 mov ax, usZLevel // update z-level of pixel mov [ebx], ax // Check for shadow... xor eax, eax mov al, [esi] cmp al, 254 jne BlitNTL66 mov ax, [edi] mov ax, ShadeTable[eax*2] mov [edi], ax jmp BlitNTL2 BlitNTL66: mov ax, [edx+eax*2] // Copy pixel mov [edi], ax BlitNTL2: inc esi add edi, 2 add ebx, 2 dec usZColsToGo jnz BlitNTL6 // update the z-level according to the z-table push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index add edx, eax inc eax // increment it mov usZIndex, ax // store incremented value mov al, [edx] // get direction instruction mov dx, usZLevel // get current z-level or al, al jz BlitNTL5 // dir = 0 no change js BlitNTL4 // dir < 0 z-level down // dir > 0 z-level up (default) add dx, Z_SUBLAYERS jmp BlitNTL5 BlitNTL4: sub dx, Z_SUBLAYERS BlitNTL5: mov usZLevel, dx // store the now-modified z-level mov usZColsToGo, 20 // reset the next z-level change to 20 cols pop edx BlitNTL6: dec LSCount // decrement pixel length to blit jz RightSkipLoop // done blitting the visible line dec ecx jnz BlitNTL1 // continue current run jmp BlitDispatch // done current run, go for another //---------------------------- // skipping transparent pixels BlitTransparent: // skip transparent pixels and ecx, 07fH BlitTrans2: add edi, 2 // move up the destination pointer add ebx, 2 dec usZColsToGo jnz BlitTrans1 // update the z-level according to the z-table push edx mov edx, pZArray // get pointer to array xor eax, eax mov ax, usZIndex // pick up the current array index add edx, eax inc eax // increment it mov usZIndex, ax // store incremented value mov al, [edx] // get direction instruction mov dx, usZLevel // get current z-level or al, al jz BlitTrans5 // dir = 0 no change js BlitTrans4 // dir < 0 z-level down // dir > 0 z-level up (default) add dx, Z_SUBLAYERS jmp BlitTrans5 BlitTrans4: sub dx, Z_SUBLAYERS BlitTrans5: mov usZLevel, dx // store the now-modified z-level mov usZColsToGo, 20 // reset the next z-level change to 20 cols pop edx BlitTrans1: dec LSCount // decrement the pixels to blit jz RightSkipLoop // done the line dec ecx jnz BlitTrans2 jmp BlitDispatch //--------------------------------------------- // Scans the ETRLE until it finds an EOL marker RightSkipLoop: RSLoop1: mov al, [esi] inc esi or al, al jnz RSLoop1 RSLoop2: dec BlitHeight jz BlitDone add edi, LineSkip add ebx, LineSkip // reset all the z-level stuff for a new line mov ax, usZStartLevel mov usZLevel, ax mov ax, usZStartIndex mov usZIndex, ax mov ax, usZStartCols mov usZColsToGo, ax jmp LeftSkipSetup BlitDone: } return(TRUE); } void RenderRoomInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS ) { INT8 bXOddFlag = 0; INT16 sAnchorPosX_M, sAnchorPosY_M; INT16 sAnchorPosX_S, sAnchorPosY_S; INT16 sTempPosX_M, sTempPosY_M; INT16 sTempPosX_S, sTempPosY_S; BOOLEAN fEndRenderRow = FALSE, fEndRenderCol = FALSE; INT16 sX, sY; INT32 usTileIndex;//dnl ch56 141009 UINT32 uiDestPitchBYTES; UINT8 *pDestBuf; // Begin Render Loop sAnchorPosX_M = sStartPointX_M; sAnchorPosY_M = sStartPointY_M; sAnchorPosX_S = sStartPointX_S; sAnchorPosY_S = sStartPointY_S; pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); do { fEndRenderRow = FALSE; sTempPosX_M = sAnchorPosX_M; sTempPosY_M = sAnchorPosY_M; sTempPosX_S = sAnchorPosX_S; sTempPosY_S = sAnchorPosY_S; if(bXOddFlag > 0) sTempPosX_S += 20; do { usTileIndex=FASTMAPROWCOLTOPOS( sTempPosY_M, sTempPosX_M ); if ( usTileIndex < GRIDSIZE ) { sX = sTempPosX_S + ( WORLD_TILE_X / 2 ) - 5; sY = sTempPosY_S + ( WORLD_TILE_Y / 2 ) - 5; // THIS ROOM STUFF IS ONLY DONE IN THE EDITOR... // ADJUST BY SHEIGHT sY -= gpWorldLevelData[ usTileIndex ].sHeight; //sY += gsRenderHeight; if ( gubWorldRoomInfo[ usTileIndex ] != NO_ROOM ) { SetFont( SMALLCOMPFONT ); SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, gsVIEWPORT_END_Y, FALSE ); switch( gubWorldRoomInfo[ usTileIndex ] % 5 ) { case 0: SetFontForeground( FONT_GRAY3 ); break; case 1: SetFontForeground( FONT_YELLOW ); break; case 2: SetFontForeground( FONT_LTRED ); break; case 3: SetFontForeground( FONT_LTBLUE ); break; case 4: SetFontForeground( FONT_LTGREEN );break; } mprintf_buffer( pDestBuf, uiDestPitchBYTES, TINYFONT1, sX, sY , L"%d", gubWorldRoomInfo[ usTileIndex ] ); SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); } } sTempPosX_S += 40; sTempPosX_M ++; sTempPosY_M --; if ( sTempPosX_S >= sEndXS ) { fEndRenderRow = TRUE; } } while( !fEndRenderRow ); if ( bXOddFlag > 0 ) { sAnchorPosY_M ++; } else { sAnchorPosX_M ++; } bXOddFlag = !bXOddFlag; sAnchorPosY_S += 10; if ( sAnchorPosY_S >= sEndYS ) { fEndRenderCol = TRUE; } } while( !fEndRenderCol ); UnLockVideoSurface( FRAME_BUFFER ); } #ifdef _DEBUG void RenderFOVDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS ) { INT8 bXOddFlag = 0; INT16 sAnchorPosX_M, sAnchorPosY_M; INT16 sAnchorPosX_S, sAnchorPosY_S; INT16 sTempPosX_M, sTempPosY_M; INT16 sTempPosX_S, sTempPosY_S; BOOLEAN fEndRenderRow = FALSE, fEndRenderCol = FALSE; UINT16 usTileIndex; INT16 sX, sY; UINT32 uiDestPitchBYTES; UINT8 *pDestBuf; // Begin Render Loop sAnchorPosX_M = sStartPointX_M; sAnchorPosY_M = sStartPointY_M; sAnchorPosX_S = sStartPointX_S; sAnchorPosY_S = sStartPointY_S; pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); do { fEndRenderRow = FALSE; sTempPosX_M = sAnchorPosX_M; sTempPosY_M = sAnchorPosY_M; sTempPosX_S = sAnchorPosX_S; sTempPosY_S = sAnchorPosY_S; if(bXOddFlag > 0) sTempPosX_S += 20; do { usTileIndex=FASTMAPROWCOLTOPOS( sTempPosY_M, sTempPosX_M ); if ( usTileIndex < GRIDSIZE ) { sX = sTempPosX_S + ( WORLD_TILE_X / 2 ) - 5; sY = sTempPosY_S + ( WORLD_TILE_Y / 2 ) - 5; // Adjust for interface level sY -= gpWorldLevelData[ usTileIndex ].sHeight; sY += gsRenderHeight; if ( gubFOVDebugInfoInfo[ usTileIndex ] != 0 ) { SetFont( SMALLCOMPFONT ); SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, gsVIEWPORT_END_Y, FALSE ); SetFontForeground( FONT_GRAY3 ); mprintf_buffer( pDestBuf, uiDestPitchBYTES, TINYFONT1, sX, sY , L"%d", gubFOVDebugInfoInfo[ usTileIndex ] ); SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); Blt8BPPDataTo16BPPBufferTransparentClip((UINT16*)pDestBuf, uiDestPitchBYTES, gTileDatabase[0].hTileSurface, sTempPosX_S, sTempPosY_S, 0, &gClippingRect ); } if ( gubGridNoMarkers[ usTileIndex ] == gubGridNoValue ) { SetFont( SMALLCOMPFONT ); SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, gsVIEWPORT_END_Y, FALSE ); SetFontForeground( FONT_FCOLOR_YELLOW ); mprintf_buffer( pDestBuf, uiDestPitchBYTES, TINYFONT1, sX, sY + 4 , L"x" ); SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); } } sTempPosX_S += 40; sTempPosX_M ++; sTempPosY_M --; if ( sTempPosX_S >= sEndXS ) { fEndRenderRow = TRUE; } } while( !fEndRenderRow ); if ( bXOddFlag > 0 ) { sAnchorPosY_M ++; } else { sAnchorPosX_M ++; } bXOddFlag = !bXOddFlag; sAnchorPosY_S += 10; if ( sAnchorPosY_S >= sEndYS ) { fEndRenderCol = TRUE; } } while( !fEndRenderCol ); UnLockVideoSurface( FRAME_BUFFER ); } void RenderCoverDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS ) { INT8 bXOddFlag = 0; INT16 sAnchorPosX_M, sAnchorPosY_M; INT16 sAnchorPosX_S, sAnchorPosY_S; INT16 sTempPosX_M, sTempPosY_M; INT16 sTempPosX_S, sTempPosY_S; BOOLEAN fEndRenderRow = FALSE, fEndRenderCol = FALSE; UINT16 usTileIndex; INT16 sX, sY; UINT32 uiDestPitchBYTES; UINT8 *pDestBuf; // Begin Render Loop sAnchorPosX_M = sStartPointX_M; sAnchorPosY_M = sStartPointY_M; sAnchorPosX_S = sStartPointX_S; sAnchorPosY_S = sStartPointY_S; pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); do { fEndRenderRow = FALSE; sTempPosX_M = sAnchorPosX_M; sTempPosY_M = sAnchorPosY_M; sTempPosX_S = sAnchorPosX_S; sTempPosY_S = sAnchorPosY_S; if(bXOddFlag > 0) sTempPosX_S += 20; do { usTileIndex=FASTMAPROWCOLTOPOS( sTempPosY_M, sTempPosX_M ); if ( usTileIndex < GRIDSIZE ) { sX = sTempPosX_S + ( WORLD_TILE_X / 2 ) - 5; sY = sTempPosY_S + ( WORLD_TILE_Y / 2 ) - 5; // Adjust for interface level sY -= gpWorldLevelData[ usTileIndex ].sHeight; sY += gsRenderHeight; if (gsCoverValue[ usTileIndex] != 0x7F7F) { SetFont( SMALLCOMPFONT ); SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, gsVIEWPORT_END_Y, FALSE ); if (usTileIndex == gsBestCover) { SetFontForeground( FONT_MCOLOR_RED ); } else if (gsCoverValue[ usTileIndex ] < 0) { SetFontForeground( FONT_MCOLOR_WHITE ); } else { SetFontForeground( FONT_GRAY3 ); } mprintf_buffer( pDestBuf, uiDestPitchBYTES, TINYFONT1, sX, sY , L"%d", gsCoverValue[ usTileIndex ] ); SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); } } sTempPosX_S += 40; sTempPosX_M ++; sTempPosY_M --; if ( sTempPosX_S >= sEndXS ) { fEndRenderRow = TRUE; } } while( !fEndRenderRow ); if ( bXOddFlag > 0 ) { sAnchorPosY_M ++; } else { sAnchorPosX_M ++; } bXOddFlag = !bXOddFlag; sAnchorPosY_S += 10; if ( sAnchorPosY_S >= sEndYS ) { fEndRenderCol = TRUE; } } while( !fEndRenderCol ); UnLockVideoSurface( FRAME_BUFFER ); } void RenderGridNoVisibleDebugInfo( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS ) { INT8 bXOddFlag = 0; INT16 sAnchorPosX_M, sAnchorPosY_M; INT16 sAnchorPosX_S, sAnchorPosY_S; INT16 sTempPosX_M, sTempPosY_M; INT16 sTempPosX_S, sTempPosY_S; BOOLEAN fEndRenderRow = FALSE, fEndRenderCol = FALSE; INT16 sX, sY; INT32 usTileIndex;//dnl ch56 141009 UINT32 uiDestPitchBYTES; UINT8 *pDestBuf; // Begin Render Loop sAnchorPosX_M = sStartPointX_M; sAnchorPosY_M = sStartPointY_M; sAnchorPosX_S = sStartPointX_S; sAnchorPosY_S = sStartPointY_S; pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); do { fEndRenderRow = FALSE; sTempPosX_M = sAnchorPosX_M; sTempPosY_M = sAnchorPosY_M; sTempPosX_S = sAnchorPosX_S; sTempPosY_S = sAnchorPosY_S; if(bXOddFlag > 0) sTempPosX_S += 20; do { usTileIndex=FASTMAPROWCOLTOPOS( sTempPosY_M, sTempPosX_M ); if ( usTileIndex < GRIDSIZE ) { sX = sTempPosX_S + ( WORLD_TILE_X / 2 ) - 5; sY = sTempPosY_S + ( WORLD_TILE_Y / 2 ) - 5; // Adjust for interface level sY -= gpWorldLevelData[ usTileIndex ].sHeight; sY += gsRenderHeight; SetFont( SMALLCOMPFONT ); SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, gsVIEWPORT_END_Y, FALSE ); if ( !GridNoOnVisibleWorldTile( usTileIndex ) ) { SetFontForeground( FONT_MCOLOR_RED ); } else { SetFontForeground( FONT_GRAY3 ); } mprintf_buffer( pDestBuf, uiDestPitchBYTES, TINYFONT1, sX, sY , L"%d", usTileIndex ); SetFontDestBuffer( FRAME_BUFFER , 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, FALSE ); } sTempPosX_S += 40; sTempPosX_M ++; sTempPosY_M --; if ( sTempPosX_S >= sEndXS ) { fEndRenderRow = TRUE; } } while( !fEndRenderRow ); if ( bXOddFlag > 0 ) { sAnchorPosY_M ++; } else { sAnchorPosX_M ++; } bXOddFlag = !bXOddFlag; sAnchorPosY_S += 10; if ( sAnchorPosY_S >= sEndYS ) { fEndRenderCol = TRUE; } } while( !fEndRenderCol ); UnLockVideoSurface( FRAME_BUFFER ); } #endif void ExamineZBufferRect( INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom) { CalcRenderParameters( sLeft, sTop, sRight, sBottom ); ExamineZBufferForHiddenTiles( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS ); } void ExamineZBufferForHiddenTiles( INT16 sStartPointX_M, INT16 sStartPointY_M, INT16 sStartPointX_S, INT16 sStartPointY_S, INT16 sEndXS, INT16 sEndYS ) { INT8 bXOddFlag = 0; INT16 sAnchorPosX_M, sAnchorPosY_M; INT16 sAnchorPosX_S, sAnchorPosY_S; INT16 sTempPosX_M, sTempPosY_M; INT16 sTempPosX_S, sTempPosY_S; BOOLEAN fEndRenderRow = FALSE, fEndRenderCol = FALSE; UINT16 usTileIndex; INT16 sX, sY, sWorldX, sZLevel; UINT32 uiDestPitchBYTES; UINT8 *pDestBuf; TILE_ELEMENT *TileElem; INT8 bBlitClipVal; LEVELNODE *pObject; // Begin Render Loop sAnchorPosX_M = sStartPointX_M; sAnchorPosY_M = sStartPointY_M; sAnchorPosX_S = sStartPointX_S; sAnchorPosY_S = sStartPointY_S; pDestBuf = LockVideoSurface( FRAME_BUFFER, &uiDestPitchBYTES ); // Get VObject for first land peice! TileElem = &(gTileDatabase[ FIRSTTEXTURE1 ] ); do { fEndRenderRow = FALSE; sTempPosX_M = sAnchorPosX_M; sTempPosY_M = sAnchorPosY_M; sTempPosX_S = sAnchorPosX_S; sTempPosY_S = sAnchorPosY_S; if(bXOddFlag > 0) sTempPosX_S += 20; do { usTileIndex=FASTMAPROWCOLTOPOS( sTempPosY_M, sTempPosX_M ); if ( usTileIndex < GRIDSIZE ) { // ATE: Don;t let any vehicle sit here.... if ( FindStructure( usTileIndex, ( STRUCTURE_MOBILE ) ) ) { // Continue... goto ENDOFLOOP; } sX = sTempPosX_S; sY = sTempPosY_S - gpWorldLevelData[usTileIndex].sHeight; // Adjust for interface level sY += gsRenderHeight; // Caluluate zvalue // Look for anything less than struct layer! GetWorldXYAbsoluteScreenXY( sTempPosX_M, sTempPosY_M, &sWorldX, &sZLevel); sZLevel += gsRenderHeight; sZLevel=(sZLevel*Z_SUBLAYERS)+STRUCT_Z_LEVEL; if ( gpWorldLevelData[usTileIndex].uiFlags & MAPELEMENT_REEVALUATE_REDUNDENCY ) { bBlitClipVal = BltIsClippedOrOffScreen(TileElem->hTileSurface, sX, sY, TileElem->usRegionIndex, &gClippingRect); if ( bBlitClipVal == FALSE ) { // Set flag to not evaluate again! gpWorldLevelData[usTileIndex].uiFlags &= (~MAPELEMENT_REEVALUATE_REDUNDENCY ); // OK, first do some rules with exceptions // Don't let this happen for roads! pObject = gpWorldLevelData[usTileIndex ].pObjectHead; if ( IsTileRedundent( uiDestPitchBYTES, gpZBuffer, sZLevel, TileElem->hTileSurface, sX, sY, TileElem->usRegionIndex ) ) { // Mark in the world! gpWorldLevelData[ usTileIndex ].uiFlags |= MAPELEMENT_REDUNDENT; } else { // Un Mark in the world! gpWorldLevelData[ usTileIndex ].uiFlags &= (~MAPELEMENT_REDUNDENT); } } } } ENDOFLOOP: sTempPosX_S += 40; sTempPosX_M ++; sTempPosY_M --; if ( sTempPosX_S >= sEndXS ) { fEndRenderRow = TRUE; } } while( !fEndRenderRow ); if ( bXOddFlag > 0 ) { sAnchorPosY_M ++; } else { sAnchorPosX_M ++; } bXOddFlag = !bXOddFlag; sAnchorPosY_S += 10; if ( sAnchorPosY_S >= sEndYS ) { fEndRenderCol = TRUE; } } while( !fEndRenderCol ); UnLockVideoSurface( FRAME_BUFFER ); } void CalcRenderParameters(INT16 sLeft, INT16 sTop, INT16 sRight, INT16 sBottom ) { INT16 sTempPosX_W, sTempPosY_W; INT16 sRenderCenterX_W, sRenderCenterY_W; INT16 sOffsetX_W, sOffsetY_W, sOffsetX_S, sOffsetY_S; gOldClipRect = gClippingRect; // Set new clipped rect gClippingRect.iLeft = __max( gsVIEWPORT_START_X, sLeft); gClippingRect.iRight = __min( gsVIEWPORT_END_X, sRight); gClippingRect.iTop = __max( gsVIEWPORT_WINDOW_START_Y, sTop); gClippingRect.iBottom = __min(gsVIEWPORT_WINDOW_END_Y, sBottom); gsEndXS = sRight + VIEWPORT_XOFFSET_S; gsEndYS = sBottom + VIEWPORT_YOFFSET_S; sRenderCenterX_W = gsRenderCenterX; sRenderCenterY_W = gsRenderCenterY; // STEP THREE - determine starting point in world coords // a) Determine where in screen coords to start rendering gsStartPointX_S = ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ) - (sLeft - VIEWPORT_XOFFSET_S); gsStartPointY_S = ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ) - (sTop - VIEWPORT_YOFFSET_S); // b) Convert these distances into world distances FromScreenToCellCoordinates( gsStartPointX_S, gsStartPointY_S, &sTempPosX_W, &sTempPosY_W ); // c) World start point is Render center minus this distance gsStartPointX_W = sRenderCenterX_W - sTempPosX_W; gsStartPointY_W = sRenderCenterY_W - sTempPosY_W; // NOTE: Increase X map value by 1 tile to offset where on screen we are... if ( gsStartPointX_W > 0 ) gsStartPointX_W += CELL_X_SIZE; // d) screen start point is screen distances minus screen center gsStartPointX_S = sLeft - VIEWPORT_XOFFSET_S; gsStartPointY_S = sTop - VIEWPORT_YOFFSET_S; // STEP FOUR - Determine Start block // a) Find start block gsStartPointX_M = ( gsStartPointX_W ) / CELL_X_SIZE; gsStartPointY_M = ( gsStartPointY_W ) / CELL_Y_SIZE; // STEP 5 - Determine Deltas for center and find screen values //Make sure these coordinates are multiples of scroll steps sOffsetX_W = abs( gsStartPointX_W ) - ( abs( ( gsStartPointX_M * CELL_X_SIZE ) ) ); sOffsetY_W = abs( gsStartPointY_W ) - ( abs( ( gsStartPointY_M * CELL_Y_SIZE ) ) ); FromCellToScreenCoordinates( sOffsetX_W, sOffsetY_W, &sOffsetX_S, &sOffsetY_S ); if ( gsStartPointY_W < 0 ) { gsStartPointY_S += 0;//(sOffsetY_S/2); } else { gsStartPointY_S -= sOffsetY_S; } gsStartPointX_S -= sOffsetX_S; // Set globals for render offset if ( gsRenderWorldOffsetX == -1 ) { gsRenderWorldOffsetX = sOffsetX_S; } if ( gsRenderWorldOffsetY == -1 ) { gsRenderWorldOffsetY = sOffsetY_S; } ///////////////////////////////////////// //ATE: CALCULATE LARGER OFFSET VALUES gsLEndXS = sRight + LARGER_VIEWPORT_XOFFSET_S; gsLEndYS = sBottom + LARGER_VIEWPORT_YOFFSET_S; // STEP THREE - determine starting point in world coords // a) Determine where in screen coords to start rendering gsLStartPointX_S = ( ( gsVIEWPORT_END_X - gsVIEWPORT_START_X ) /2 ) - (sLeft - LARGER_VIEWPORT_XOFFSET_S); gsLStartPointY_S = ( ( gsVIEWPORT_END_Y - gsVIEWPORT_START_Y ) /2 ) - (sTop - LARGER_VIEWPORT_YOFFSET_S); // b) Convert these distances into world distances FromScreenToCellCoordinates( gsLStartPointX_S, gsLStartPointY_S, &sTempPosX_W, &sTempPosY_W ); // c) World start point is Render center minus this distance gsLStartPointX_W = sRenderCenterX_W - sTempPosX_W; gsLStartPointY_W = sRenderCenterY_W - sTempPosY_W; // NOTE: Increase X map value by 1 tile to offset where on screen we are... if ( gsLStartPointX_W > 0 ) gsLStartPointX_W += CELL_X_SIZE; // d) screen start point is screen distances minus screen center gsLStartPointX_S = sLeft - LARGER_VIEWPORT_XOFFSET_S; gsLStartPointY_S = sTop - LARGER_VIEWPORT_YOFFSET_S; // STEP FOUR - Determine Start block // a) Find start block gsLStartPointX_M = ( gsLStartPointX_W ) / CELL_X_SIZE; gsLStartPointY_M = ( gsLStartPointY_W ) / CELL_Y_SIZE; // Adjust starting screen coordinates gsLStartPointX_S -= sOffsetX_S; if ( gsLStartPointY_W < 0 ) { gsLStartPointY_S += 0; gsLStartPointX_S -= 20; } else { gsLStartPointY_S -= sOffsetY_S; } } void ResetRenderParameters( ) { // Restore clipping rect gClippingRect = gOldClipRect; } BOOLEAN Zero8BPPDataTo16BPPBufferTransparent( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) { UINT32 uiOffset; UINT32 usHeight, usWidth; UINT8 *SrcPtr, *DestPtr; UINT32 LineSkip; ETRLEObject *pTrav; INT32 iTempX, iTempY; // Assertions Assert( hSrcVObject != NULL ); Assert( pBuffer != NULL ); // Get Offsets from Index into structure pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); usHeight = (UINT32)pTrav->usHeight; usWidth = (UINT32)pTrav->usWidth; uiOffset = pTrav->uiDataOffset; // Add to start position of dest buffer iTempX = iX + pTrav->sOffsetX; iTempY = iY + pTrav->sOffsetY; // Validations CHECKF( iTempX >= 0 ); CHECKF( iTempY >= 0 ); SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX*2); LineSkip=(uiDestPitchBYTES-(usWidth*2)); __asm { mov esi, SrcPtr mov edi, DestPtr xor eax, eax xor ebx, ebx xor ecx, ecx BlitDispatch: mov cl, [esi] inc esi or cl, cl js BlitTransparent jz BlitDoneLine //BlitNonTransLoop: clc rcr cl, 1 jnc BlitNTL2 mov [edi], ax inc esi add edi, 2 BlitNTL2: clc rcr cl, 1 jnc BlitNTL3 mov [edi], ax mov [edi+2], ax add esi, 2 add edi, 4 BlitNTL3: or cl, cl jz BlitDispatch xor ebx, ebx BlitNTL4: mov [edi], ax mov [edi+2], ax mov [edi+4], ax mov [edi+6], ax add esi, 4 add edi, 8 dec cl jnz BlitNTL4 jmp BlitDispatch BlitTransparent: and ecx, 07fH // shl ecx, 1 add ecx, ecx add edi, ecx jmp BlitDispatch BlitDoneLine: dec usHeight jz BlitDone add edi, LineSkip jmp BlitDispatch BlitDone: } return(TRUE); } BOOLEAN Blt8BPPDataTo16BPPBufferTransInvZ( UINT16 *pBuffer, UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) { UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; UINT8 *SrcPtr, *DestPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; INT32 iTempX, iTempY; // Assertions Assert( hSrcVObject != NULL ); Assert( pBuffer != NULL ); // Get Offsets from Index into structure pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); usHeight = (UINT32)pTrav->usHeight; usWidth = (UINT32)pTrav->usWidth; uiOffset = pTrav->uiDataOffset; // Add to start position of dest buffer iTempX = iX + pTrav->sOffsetX; iTempY = iY + pTrav->sOffsetY; // Validations CHECKF( iTempX >= 0 ); CHECKF( iTempY >= 0 ); SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; DestPtr = (UINT8 *)pBuffer + (uiDestPitchBYTES*iTempY) + (iTempX*2); ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*iTempY) + (iTempX*2); p16BPPPalette = hSrcVObject->pShadeCurrent; LineSkip=(uiDestPitchBYTES-(usWidth*2)); __asm { mov esi, SrcPtr mov edi, DestPtr mov edx, p16BPPPalette xor eax, eax mov ebx, ZPtr xor ecx, ecx BlitDispatch: mov cl, [esi] inc esi or cl, cl js BlitTransparent jz BlitDoneLine //BlitNonTransLoop: xor eax, eax BlitNTL4: mov ax, usZValue cmp ax, [ebx] jne BlitNTL5 //mov [ebx], ax xor ah, ah mov al, [esi] mov ax, [edx+eax*2] mov [edi], ax BlitNTL5: inc esi inc edi inc ebx inc edi inc ebx dec cl jnz BlitNTL4 jmp BlitDispatch BlitTransparent: and ecx, 07fH // shl ecx, 1 add ecx, ecx add edi, ecx add ebx, ecx jmp BlitDispatch BlitDoneLine: dec usHeight jz BlitDone add edi, LineSkip add ebx, LineSkip jmp BlitDispatch BlitDone: } return(TRUE); } BOOLEAN IsTileRedundent( UINT32 uiDestPitchBYTES, UINT16 *pZBuffer, UINT16 usZValue, HVOBJECT hSrcVObject, INT32 iX, INT32 iY, UINT16 usIndex ) { UINT16 *p16BPPPalette; UINT32 uiOffset; UINT32 usHeight, usWidth; UINT8 *SrcPtr, *ZPtr; UINT32 LineSkip; ETRLEObject *pTrav; INT32 iTempX, iTempY; BOOLEAN fHidden = TRUE; // Assertions Assert( hSrcVObject != NULL ); // Get Offsets from Index into structure pTrav = &(hSrcVObject->pETRLEObject[ usIndex ] ); usHeight = (UINT32)pTrav->usHeight; usWidth = (UINT32)pTrav->usWidth; uiOffset = pTrav->uiDataOffset; // Add to start position of dest buffer iTempX = iX + pTrav->sOffsetX; iTempY = iY + pTrav->sOffsetY; // Validations CHECKF( iTempX >= 0 ); CHECKF( iTempY >= 0 ); SrcPtr= (UINT8 *)hSrcVObject->pPixData + uiOffset; ZPtr = (UINT8 *)pZBuffer + (uiDestPitchBYTES*iTempY) + (iTempX*2); p16BPPPalette = hSrcVObject->pShadeCurrent; LineSkip=(uiDestPitchBYTES-(usWidth*2)); __asm { mov esi, SrcPtr mov edx, p16BPPPalette xor eax, eax mov ebx, ZPtr xor ecx, ecx BlitDispatch: mov cl, [esi] inc esi or cl, cl js BlitTransparent jz BlitDoneLine //BlitNonTransLoop: xor eax, eax BlitNTL4: mov ax, usZValue cmp ax, [ebx] jle BlitNTL5 // Set false, flag mov fHidden, 0 jmp BlitDone BlitNTL5: inc esi inc ebx inc ebx dec cl jnz BlitNTL4 jmp BlitDispatch BlitTransparent: and ecx, 07fH // shl ecx, 1 add ecx, ecx add ebx, ecx jmp BlitDispatch BlitDoneLine: dec usHeight jz BlitDone add ebx, LineSkip jmp BlitDispatch BlitDone: } return(fHidden); } void SetMercGlowFast( ) { //gpGlowFramePointer = gsFastGlowFrames; } void SetMercGlowNormal( ) { gpGlowFramePointer = gsGlowFrames; } #if 0 if ( gAnimControl[ pSoldier->usAnimState ].uiFlags & ANIM_MOVING ) { if ( sZOffsetY > 0 ) { sZOffsetY++; } if ( sZOffsetX > 0 ) { sZOffsetX++; } } sZOffsetX = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetX;\ sZOffsetY = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetY;\ if ( ( pSoldier->flags.uiStatusFlags & SOLDIER_MULTITILE ) )\ {\ sZOffsetX = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetX;\ sZOffsetY = pNode->pStructureData->pDBStructureRef->pDBStructure->bZTileOffsetY;\ \ sWorldY = GetMapXYWorldY( sMapX + sZOffsetX, sMapY + sZOffsetY );\ }\ else #endif void SetRenderCenter( INT16 sNewX, INT16 sNewY ) { if ( gfIgnoreScrolling == 1 ) { return; } // Apply these new coordinates to the renderer! ApplyScrolling( sNewX, sNewY, TRUE , FALSE ); // Set flag to ignore scrolling this frame gfIgnoreScrollDueToCenterAdjust = TRUE; // Set full render flag! // DIRTY THE WORLD! SetRenderFlags(RENDER_FLAG_FULL); gfPlotNewMovement = TRUE; if ( gfScrollPending == TRUE ) { // Do a complete rebuild! gfScrollPending = FALSE; // Restore Interface! RestoreInterface( ); // Delete Topmost blitters saved areas DeleteVideoOverlaysArea( ); } gfScrollInertia = FALSE; } #ifdef _DEBUG void RenderFOVDebug( ) { RenderFOVDebugInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS ); } void RenderCoverDebug( ) { RenderCoverDebugInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS ); } void RenderGridNoVisibleDebug( ) { RenderGridNoVisibleDebugInfo( gsStartPointX_M, gsStartPointY_M, gsStartPointX_S, gsStartPointY_S, gsEndXS, gsEndYS ); } #endif
[ "jazz_ja@b41f55df-6250-4c49-8e33-4aa727ad62a1" ]
[ [ [ 1, 7564 ] ] ]
d9c5a653ed9da788ea4125a90c7959854055f607
88f4b257863d50044212e6036dd09a25ec65a1ff
/src/jingxian/networks/buffer/PacketBufferHandler.h
47d40a120f256ad4f3f0d4f869876ab63936eb59
[]
no_license
mei-rune/jx-proxy
bb1ee92f6b76fb21fdf2f4d8a907823efd05e17b
d24117ab62b10410f2ad05769165130a9f591bfb
refs/heads/master
2022-08-20T08:56:54.222821
2009-11-14T07:01:08
2009-11-14T07:01:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,537
h
#ifndef _PacketBufferHandler_H_ #define _PacketBufferHandler_H_ #include "jingxian/config.h" #if !defined (JINGXIAN_LACKS_PRAGMA_ONCE) # pragma once #endif /* JINGXIAN_LACKS_PRAGMA_ONCE */ // Include files # include "jingxian/networks/buffer/buffer-internal.h" _jingxian_begin class PacketBufferHandler : public IBufferHandler { public: virtual bool isMemory(const buffer_chain_t* chain) { return false; } virtual char* wd_ptr(buffer_chain_t* chain) { ThrowException(NotImplementedException); } virtual void wd_ptr(buffer_chain_t* chain, size_t len) { ThrowException(NotImplementedException); } virtual int wd_length(const buffer_chain_t* chain) { ThrowException(NotImplementedException); } virtual char* rd_ptr(buffer_chain_t* chain) { ThrowException(NotImplementedException); } virtual void rd_ptr(buffer_chain_t* chain, size_t len) { ThrowException(NotImplementedException); } virtual int rd_length(const buffer_chain_t* chain) { ThrowException(NotImplementedException); } virtual ICommand* makeCommand(buffer_chain_t* chain, bool isRead) { ThrowException(NotImplementedException); } virtual bool releaseCommand(buffer_chain_t* chain, ICommand* command, size_t len) { ThrowException(NotImplementedException); } }; _jingxian_end #endif //_PacketBufferHandler_H_
[ "[email protected]@53e742d2-d0ea-11de-97bf-6350044336de" ]
[ [ [ 1, 66 ] ] ]
e2ba60ba196d6d2a13f5f36960a9c1d6b8f58e68
10c14a95421b63a71c7c99adf73e305608c391bf
/gui/image/qpixmapcache.h
c21a41fe828341e15d1f6f22c57f4d1b0743ba92
[]
no_license
eaglezzb/wtlcontrols
73fccea541c6ef1f6db5600f5f7349f5c5236daa
61b7fce28df1efe4a1d90c0678ec863b1fd7c81c
refs/heads/master
2021-01-22T13:47:19.456110
2009-05-19T10:58:42
2009-05-19T10:58:42
33,811,815
0
0
null
null
null
null
UTF-8
C++
false
false
2,592
h
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information ([email protected]) ** ** This file is part of the QtGui 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 QPIXMAPCACHE_H #define QPIXMAPCACHE_H #include <QtGui/qpixmap.h> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Gui) class Q_GUI_EXPORT QPixmapCache { public: static int cacheLimit() {return 0;} static void setCacheLimit(int) {} // static QPixmap *find(const QString &key) {return 0;} // static bool find(const QString &key, QPixmap&) {return false;} // static bool insert(const QString &key, const QPixmap&) {return false;} // static void remove(const QString &key) {} static void clear() {} }; QT_END_NAMESPACE QT_END_HEADER #endif // QPIXMAPCACHE_H
[ "zhangyinquan@0feb242a-2539-11de-a0d7-251e5865a1c7" ]
[ [ [ 1, 69 ] ] ]
725cb2a9c8776cfa65b58c3f152c37895c82fca8
aca65a1eb785ebe6d6e0e862f3b49931923da90b
/DTI Visualization/glwidget.cpp
3c872dd1df317665a9700dd659fe63e44a9eda9c
[]
no_license
vcpudding/DTI-Visualization-Hypergraph
d5126a0123707a2b1399a73751aa9bec88c1e25c
23da494ba4291450cdece4bda421853ec2beedfc
refs/heads/master
2020-06-05T09:47:30.924373
2011-12-29T13:13:44
2011-12-29T13:13:44
3,026,931
0
0
null
null
null
null
UTF-8
C++
false
false
8,835
cpp
#include <QtGui> #include <QtOpenGL> #include <QFileDialog> #include <math.h> #include <sstream> #include <GL/glut.h> #include "glwidget.h" #include "track ball/trackball.h" GLWidget::GLWidget(QWidget *parent) : QGLWidget(parent) { _zoom = -100.0; _translateX = 0; _translateY = 0; _volumeData = NULL; //_volumes = vector<VolumeData*>(0); _viewpoint = VP_FREE; _aSlicePos = _pSlicePos = _cSlicePos = 0; _bShowSagittal = _bShowCoronal = _bShowAxial = true; _planeWidth = 0; _bShowSliceIdx = true; _pressX = _pressY = 0; } GLWidget::~GLWidget() { } QSize GLWidget::minimumSizeHint() const { return QSize(50, 50); } QSize GLWidget::sizeHint() const { return QSize(400, 400); } void GLWidget::initializeGL() { glClearColor(0.0, 0.0, 0.0, 1.0); glEnable(GL_LINE_SMOOTH); glDepthFunc(GL_LEQUAL); gltbInit(GLUT_LEFT_BUTTON); gltbAnimate(false); } void GLWidget::paintGL() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); int anchorWidth = 200, anchorHeight = 200; glViewport(0,0,_widgetWidth-_planeWidth, _widgetHeight); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0, (_widgetWidth-_planeWidth)*1.0/_widgetHeight, 0.1, 10000); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glPushMatrix(); glTranslatef(_translateX, _translateY, _zoom); setRotationMatrix(); glEnable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); if (_volumeData) { if (_bShowSagittal) { _volumeData->drawSagittalSlice(); } if (_bShowCoronal) { _volumeData->drawCoronalSlice(); } if (_bShowAxial) { _volumeData->drawAxialSlice(); } } glPopMatrix(); //glViewport(_widgetWidth-_planeWidth-anchorWidth, 0, anchorWidth, anchorHeight); drawAnchor(); drawImageInfo(); drawPlanes(_widgetWidth-_planeWidth, _planeWidth, _widgetHeight); } void GLWidget::resizeGL(int width, int height) { if ( height == 0 ) { height = 1; } _widgetWidth = width; _widgetHeight = height; gltbReshape(width, height); } void GLWidget::drawImageInfo() { if (!_volumeData) { return; } glDisable(GL_DEPTH_TEST); GLint oldViewport [4]; glGetIntegerv(GL_VIEWPORT,oldViewport); glViewport(0, 0, _widgetWidth, _widgetHeight); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluOrtho2D(0, _widgetWidth, 0, _widgetHeight); glMatrixMode(GL_MODELVIEW); glColor3f(1.0, 1.0, 1.0); const QStringList & infoList = _volumeData->getInfoStr(); for (int i=0; i<infoList.count(); ++i) { drawString(infoList[i].toStdString().c_str(), 10, _widgetHeight-7*i, 12); } glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glViewport(oldViewport[0], oldViewport[1], oldViewport[2], oldViewport[3]); } void GLWidget::drawString(const char * s, float x, float y, float lineHeight) { glRasterPos2f(x, y); const char *p = s; int lines = 1; for(; *p; ++p) { if (*p == '\n') { lines++; glRasterPos2f(x, y-(lines*lineHeight)); } glutBitmapCharacter(GLUT_BITMAP_HELVETICA_10, *p); } } void GLWidget::wheelEvent ( QWheelEvent * event ) { if (!_volumeData) { return; } int hoverWin = 0; if (event->x()<_widgetWidth-_planeWidth) { return; } else { hoverWin = floor(event->y()*1.0 / (_widgetHeight/3.0)); } int numDegrees = event->delta() / 8; int numSteps = numDegrees / 15; if (event->orientation() == Qt::Vertical) { switch (hoverWin) { case 2: //Sagittal _pSlicePos += numSteps; _pSlicePos = _volumeData->setPSlicePrime(_pSlicePos); break; case 1: //Coronal _cSlicePos += numSteps; _aSlicePos = _volumeData->setCSlicePrime(_cSlicePos); break; case 0: //Axial _aSlicePos += numSteps; _aSlicePos = _volumeData->setASlicePrime(_aSlicePos); break; } } _pressX = event->x(); _pressY = event->y(); gltbMouse(GLUT_LEFT_BUTTON, GLUT_DOWN, _pressX, _pressY); gltbMotion(_pressX, _pressY); repaint(); } void GLWidget::mousePressEvent(QMouseEvent *e) { _posX = e->x(); _posY = e->y(); gltbMouse(GLUT_LEFT_BUTTON, GLUT_DOWN, e->x(), e->y()); _pressX = e->x(); _pressY = e->y(); } void GLWidget::mouseMoveEvent(QMouseEvent *e) { if (e->buttons() == Qt::LeftButton) { if (_pressX<_widgetWidth-_planeWidth) { if (_viewpoint!=VP_FREE) { emit viewpointChanged(); } gltbMotion(e->x(), e->y()); } else { //int delta = (e->y()-_posY)*8; /*QWheelEvent * e = new QWheelEvent(QPoint(e->x(), e->y()), e->y()-_posY, Qt::LeftButton, Qt::NoModifier); wheelEvent(e);*/ } } else if (e->buttons()==Qt::RightButton) { _zoom -= e->y() - _posY; if (_zoom > 0) _zoom = 0; if (_zoom < -2000) _zoom = -2000; gltbMotion(_pressX, _pressY); } else if (e->buttons()==Qt::LeftButton|Qt::RightButton && _volumeData) { _volumeData->setWindow((e->x()-_posX)/10, (e->y()-_posY)/10); gltbMotion(_pressX, _pressY); } _posX = e->x(); _posY = e->y(); repaint(); } void GLWidget::mouseReleaseEvent(QMouseEvent *e) { gltbMouse(GLUT_LEFT_BUTTON, GLUT_UP, e->x(), e->y()); } void GLWidget::drawAnchor() { int anchorWidth = 100; int anchorHeight = 100; GLint oldViewport [4]; glGetIntegerv(GL_VIEWPORT,oldViewport); glViewport(_widgetWidth-anchorWidth, 0, anchorWidth, anchorHeight); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluPerspective(30, anchorWidth*1.0/anchorHeight, 0.5, 50); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glPushMatrix(); glTranslatef(0, 0, -10); setRotationMatrix(); glScalef(2, 2, 2); glLineWidth(3.0); glBegin(GL_LINES); //left glColor3f(1, 0, 0); glVertex3f(_xDir, 0, 0); glVertex3f(0, 0, 0); //front glColor3f(0, 1, 0); glVertex3f(0, _yDir, 0); glVertex3f(0, 0, 0); //top glColor3f(0, 0, 1); glVertex3f(0, 0, _zDir); glVertex3f(0, 0, 0); glEnd(); glPopMatrix(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glViewport(oldViewport[0], oldViewport[1], oldViewport[2], oldViewport[3]); } void GLWidget::drawPlanes(int left, int width, int height) { int heightPerPlane = height/3; glLineWidth(1); glEnable(GL_DEPTH_TEST); char str [256]; int slicePos; for (int i=0; i<3; ++i) { glViewport(left, i*heightPerPlane, width, heightPerPlane); if (_volumeData) { switch (i) { case 0: //Sagittal _volumeData->drawSagittalPlane(width, heightPerPlane, _bShowSliceIdx); break; case 1: //Coronal _volumeData->drawCoronalPlane(width, heightPerPlane, _bShowSliceIdx); break; case 2: //Axial _volumeData->drawAxialPlane(width, heightPerPlane, _bShowSliceIdx); break; } } glDisable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0, width, 0, heightPerPlane); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glColor3f(1,1,1); glBegin(GL_LINE_STRIP); glVertex2f(1,1); glVertex2f(width-1,1); glVertex2f(width-1,heightPerPlane-1); glVertex2f(1,heightPerPlane-1); glVertex2f(1,1); glEnd(); switch (i) { case 0: slicePos = _volumeData?_volumeData->_pSliceIdx:0; drawString("Front", 5, heightPerPlane-5, 12); sprintf(str, "Slice #: %i", slicePos); break; case 1: slicePos = _volumeData?_volumeData->_cSliceIdx:0; drawString("Left", 5, heightPerPlane-5, 12); sprintf(str, "Slice #: %i", slicePos); break; case 2: slicePos = _volumeData?_volumeData->_aSliceIdx:0; drawString("Left", 5, heightPerPlane-5, 12); sprintf(str, "Slice #: %i", slicePos); break; } drawString(str, width-50, heightPerPlane-5, 12); glEnable(GL_DEPTH_TEST); } } void GLWidget::setVolumeData(VolumeData * volData) { _volumeData = volData; _aSlicePos = volData->setASlicePrime(0); _pSlicePos = volData->setPSlicePrime(0); _cSlicePos = volData->setCSlicePrime(0); } void GLWidget::setDisplayMode(int m) { if (_volumeData) { _volumeData->setDisplayMode(m); repaint(); } } void GLWidget::setRotationMatrix () { gltbMatrix(); } void GLWidget::setViewpoint(int v) { _viewpoint = (Viewpoint)v; if (v!=VP_FREE) { gltbInitRotation (v); } repaint(); } void GLWidget::setAxialSlice(int slice) { _volumeData->setASlice(slice); //_aSlicePos = slice; repaint(); } void GLWidget::setCoronalSlice(int slice) { _volumeData->setCSlice(slice); //_cSlicePos = slice; repaint(); } void GLWidget::setSagittalSlice(int slice) { _volumeData->setPSlice(slice); //_pSlicePos = slice; repaint(); }
[ [ [ 1, 421 ] ] ]
c14aca6bd4a1a30361e91f263e4f203cd4b11ca8
ed6f03c2780226a28113ba535d3e438ee5d70266
/src/eljwizard.cpp
fbd04789cf5d9c6c695678506c7a3f5fcbf28598
[]
no_license
snmsts/wxc
f06c0306d0ff55f0634e5a372b3a71f56325c647
19663c56e4ae2c79ccf647d687a9a1d42ca8cb61
refs/heads/master
2021-01-01T05:41:20.607789
2009-04-08T09:12:08
2009-04-08T09:12:08
170,876
4
1
null
null
null
null
UTF-8
C++
false
false
1,950
cpp
#include "wrapper.h" extern "C" { EWXWEXPORT(void*,wxWizard_Create)(wxWindow* _prt,int _id,wxString* _txt,wxBitmap* _bmp,int _lft,int _top,int _wdt,int _hgt) { wxBitmap bmp = wxNullBitmap; if (_bmp) bmp = *_bmp; #if wxVERSION_NUMBER >= 2400 return (void*)new wxWizard (_prt, _id,*_txt, bmp, wxPoint(_lft, _top)); #else return (void*)wxWizard::Create (_prt, _id,*_txt, bmp, wxPoint(_lft, _top), wxSize(_wdt, _hgt)); #endif } EWXWEXPORT(bool,wxWizard_RunWizard)(wxWizard* self,wxWizardPage* firstPage) { return self->RunWizard(firstPage); } EWXWEXPORT(void*,wxWizard_GetCurrentPage)(void* self) { return (void*)((wxWizard*)self)->GetCurrentPage(); } EWXWEXPORT(void,wxWizard_Chain)(void* f,void* s) { wxWizardPageSimple::Chain((wxWizardPageSimple*)f, (wxWizardPageSimple*)s); } EWXWEXPORT(void,wxWizard_SetPageSize)(void* self,int w,int h) { ((wxWizard*)self)->SetPageSize(wxSize(w, h)); } EWXWEXPORT(wxSize*,wxWizard_GetPageSize)(void* self) { return new wxSize(((wxWizard*)self)->GetPageSize()); } EWXWEXPORT(void*,wxWizardPageSimple_Create)(void* _prt) { return (void*)new wxWizardPageSimple ((wxWizard*)_prt); } EWXWEXPORT(void*,wxWizardPageSimple_GetPrev)(void* self) { return (void*)((wxWizardPageSimple*)self)->GetPrev(); } EWXWEXPORT(void*,wxWizardPageSimple_GetNext)(void* self) { return (void*)((wxWizardPageSimple*)self)->GetNext(); } EWXWEXPORT(void,wxWizardPageSimple_GetBitmap)(void* self,wxBitmap* _ref) { *_ref = ((wxWizardPageSimple*)self)->GetBitmap(); } EWXWEXPORT(void,wxWizardPageSimple_SetPrev)(void* self,void* prev) { ((wxWizardPageSimple*)self)->SetPrev((wxWizardPage*)prev); } EWXWEXPORT(void,wxWizardPageSimple_SetNext)(void* self,void* next) { ((wxWizardPageSimple*)self)->SetNext((wxWizardPage*)next); } EWXWEXPORT(bool,wxWizardEvent_GetDirection)(wxWizardEvent* self) { return self->GetDirection(); } }
[ [ [ 1, 77 ] ] ]
4325a6c725acbe05f7feca03b7fb5427ef3a8180
3de9e77565881674bf6b785326e85ab6e702715f
/src/math/Vec4.hpp
5ce1ec2f8cdf4226944faa8de6a7c6170866eab2
[]
no_license
adbrown85/gloop-old
1b7f6deccf16eb4326603a7558660d8875b0b745
8857b528c97cfc1fd57c02f055b94cbde6781aa1
refs/heads/master
2021-01-19T18:07:39.112088
2011-02-27T07:17:14
2011-02-27T07:17:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,894
hpp
/* * Vec4.hpp * * Author * Andrew Brown <[email protected]> */ #ifndef GLOOP_VEC4_HPP #define GLOOP_VEC4_HPP #include "gloop_common.h" #include <cmath> #include <iomanip> #include <edo/BasicException.hpp> using namespace std; /** @brief Four-component vector with dot and cross product capabilities. * @ingroup system */ class Vec4 { public: int size; float x, y, z, w; public: Vec4(); Vec4(float value); Vec4(float x, float y); Vec4(float x, float y, float z); Vec4(float x, float y, float z, float w); Vec4& operator=(const Vec4 &B); Vec4& operator+=(const Vec4 &B); Vec4& operator-=(const Vec4 &B); Vec4& operator*=(const Vec4 &B); Vec4& operator/=(const Vec4 &B); Vec4& operator+=(float b); Vec4& operator-=(float b); Vec4& operator*=(float b); Vec4& operator/=(float b); float& operator[](int i); float operator[](int i) const; float length() const; float get(int i) const; void set(float x, float y); void set(float x, float y, float z); void set(float x, float y, float z, float w); void toArray(float array[4]); public: friend bool operator==(const Vec4 &A, const Vec4 &B); friend Vec4 operator+(const Vec4 &A, const Vec4 &B); friend Vec4 operator-(const Vec4 &A, const Vec4 &B); friend Vec4 operator*(const Vec4 &A, const Vec4 &B); friend Vec4 operator/(const Vec4 &A, const Vec4 &B); friend Vec4 operator+(const Vec4 &A, float b); friend Vec4 operator-(const Vec4 &A, float b); friend Vec4 operator*(const Vec4 &A, float b); friend Vec4 operator/(const Vec4 &A, float b); friend ostream& operator<<(ostream& out, const Vec4& A); friend Vec4 cross(const Vec4& A, const Vec4& B); friend float dot(const Vec4& A, const Vec4 &B); friend Vec4 min(const Vec4 &A, const Vec4 &B); friend Vec4 max(const Vec4 &A, const Vec4 &B); friend Vec4 normalize(Vec4 vector); }; #endif
[ [ [ 1, 65 ] ] ]
c55277b121c40e4b26aebd55ef54c8e0350006dd
10c14a95421b63a71c7c99adf73e305608c391bf
/gui/core/qiterator.h
0482a658856a270dfc1cf7aec7797244e0bf32f1
[]
no_license
eaglezzb/wtlcontrols
73fccea541c6ef1f6db5600f5f7349f5c5236daa
61b7fce28df1efe4a1d90c0678ec863b1fd7c81c
refs/heads/master
2021-01-22T13:47:19.456110
2009-05-19T10:58:42
2009-05-19T10:58:42
33,811,815
0
0
null
null
null
null
UTF-8
C++
false
false
9,192
h
/**************************************************************************** ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Qt Software Information ([email protected]) ** ** This file is part of the QtCore 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 QITERATOR_H #define QITERATOR_H // #include <QtCore/qglobal.h> #include "core/qglobal.h" QT_BEGIN_HEADER namespace std { struct bidirectional_iterator_tag; struct random_access_iterator_tag; } QT_BEGIN_NAMESPACE QT_MODULE(Gui) #define Q_DECLARE_SEQUENTIAL_ITERATOR(C) \ \ template <class T> \ class Q##C##Iterator \ { \ typedef typename Q##C<T>::const_iterator const_iterator; \ Q##C<T> c; \ const_iterator i; \ public: \ inline Q##C##Iterator(const Q##C<T> &container) \ : c(container), i(c.constBegin()) {} \ inline Q##C##Iterator &operator=(const Q##C<T> &container) \ { c = container; i = c.constBegin(); return *this; } \ inline void toFront() { i = c.constBegin(); } \ inline void toBack() { i = c.constEnd(); } \ inline bool hasNext() const { return i != c.constEnd(); } \ inline const T &next() { return *i++; } \ inline const T &peekNext() const { return *i; } \ inline bool hasPrevious() const { return i != c.constBegin(); } \ inline const T &previous() { return *--i; } \ inline const T &peekPrevious() const { const_iterator p = i; return *--p; } \ inline bool findNext(const T &t) \ { while (i != c.constEnd()) if (*i++ == t) return true; return false; } \ inline bool findPrevious(const T &t) \ { while (i != c.constBegin()) if (*(--i) == t) return true; \ return false; } \ }; #define Q_DECLARE_MUTABLE_SEQUENTIAL_ITERATOR(C) \ \ template <class T> \ class QMutable##C##Iterator \ { \ typedef typename Q##C<T>::iterator iterator; \ typedef typename Q##C<T>::const_iterator const_iterator; \ Q##C<T> *c; \ iterator i, n; \ inline bool item_exists() const { return const_iterator(n) != c->constEnd(); } \ public: \ inline QMutable##C##Iterator(Q##C<T> &container) \ : c(&container) \ { c->setSharable(false); i = c->begin(); n = c->end(); } \ inline ~QMutable##C##Iterator() \ { c->setSharable(true); } \ inline QMutable##C##Iterator &operator=(Q##C<T> &container) \ { c->setSharable(true); c = &container; c->setSharable(false); \ i = c->begin(); n = c->end(); return *this; } \ inline void toFront() { i = c->begin(); n = c->end(); } \ inline void toBack() { i = c->end(); n = i; } \ inline bool hasNext() const { return c->constEnd() != const_iterator(i); } \ inline T &next() { n = i++; return *n; } \ inline T &peekNext() const { return *i; } \ inline bool hasPrevious() const { return c->constBegin() != const_iterator(i); } \ inline T &previous() { n = --i; return *n; } \ inline T &peekPrevious() const { iterator p = i; return *--p; } \ inline void remove() \ { if (c->constEnd() != const_iterator(n)) { i = c->erase(n); n = c->end(); } } \ inline void setValue(const T &t) const { if (c->constEnd() != const_iterator(n)) *n = t; } \ inline T &value() { Q_ASSERT(item_exists()); return *n; } \ inline const T &value() const { Q_ASSERT(item_exists()); return *n; } \ inline void insert(const T &t) { n = i = c->insert(i, t); ++i; } \ inline bool findNext(const T &t) \ { while (c->constEnd() != const_iterator(n = i)) if (*i++ == t) return true; return false; } \ inline bool findPrevious(const T &t) \ { while (c->constBegin() != const_iterator(i)) if (*(n = --i) == t) return true; \ n = c->end(); return false; } \ }; #define Q_DECLARE_ASSOCIATIVE_ITERATOR(C) \ \ template <class Key, class T> \ class Q##C##Iterator \ { \ typedef typename Q##C<Key,T>::const_iterator const_iterator; \ typedef const_iterator Item; \ Q##C<Key,T> c; \ const_iterator i, n; \ inline bool item_exists() const { return n != c.constEnd(); } \ public: \ inline Q##C##Iterator(const Q##C<Key,T> &container) \ : c(container), i(c.constBegin()), n(c.constEnd()) {} \ inline Q##C##Iterator &operator=(const Q##C<Key,T> &container) \ { c = container; i = c.constBegin(); n = c.constEnd(); return *this; } \ inline void toFront() { i = c.constBegin(); n = c.constEnd(); } \ inline void toBack() { i = c.constEnd(); n = c.constEnd(); } \ inline bool hasNext() const { return i != c.constEnd(); } \ inline Item next() { n = i++; return n; } \ inline Item peekNext() const { return i; } \ inline bool hasPrevious() const { return i != c.constBegin(); } \ inline Item previous() { n = --i; return n; } \ inline Item peekPrevious() const { const_iterator p = i; return --p; } \ inline const T &value() const { Q_ASSERT(item_exists()); return *n; } \ inline const Key &key() const { Q_ASSERT(item_exists()); return n.key(); } \ inline bool findNext(const T &t) \ { while ((n = i) != c.constEnd()) if (*i++ == t) return true; return false; } \ inline bool findPrevious(const T &t) \ { while (i != c.constBegin()) if (*(n = --i) == t) return true; \ n = c.constEnd(); return false; } \ }; #define Q_DECLARE_MUTABLE_ASSOCIATIVE_ITERATOR(C) \ \ template <class Key, class T> \ class QMutable##C##Iterator \ { \ typedef typename Q##C<Key,T>::iterator iterator; \ typedef typename Q##C<Key,T>::const_iterator const_iterator; \ typedef iterator Item; \ Q##C<Key,T> *c; \ iterator i, n; \ inline bool item_exists() const { return const_iterator(n) != c->constEnd(); } \ public: \ inline QMutable##C##Iterator(Q##C<Key,T> &container) \ : c(&container) \ { c->setSharable(false); i = c->begin(); n = c->end(); } \ inline ~QMutable##C##Iterator() \ { c->setSharable(true); } \ inline QMutable##C##Iterator &operator=(Q##C<Key,T> &container) \ { c->setSharable(true); c = &container; c->setSharable(false); i = c->begin(); n = c->end(); return *this; } \ inline void toFront() { i = c->begin(); n = c->end(); } \ inline void toBack() { i = c->end(); n = c->end(); } \ inline bool hasNext() const { return const_iterator(i) != c->constEnd(); } \ inline Item next() { n = i++; return n; } \ inline Item peekNext() const { return i; } \ inline bool hasPrevious() const { return const_iterator(i) != c->constBegin(); } \ inline Item previous() { n = --i; return n; } \ inline Item peekPrevious() const { iterator p = i; return --p; } \ inline void remove() \ { if (const_iterator(n) != c->constEnd()) { i = c->erase(n); n = c->end(); } } \ inline void setValue(const T &t) { if (const_iterator(n) != c->constEnd()) *n = t; } \ inline T &value() { Q_ASSERT(item_exists()); return *n; } \ inline const T &value() const { Q_ASSERT(item_exists()); return *n; } \ inline const Key &key() const { Q_ASSERT(item_exists()); return n.key(); } \ inline bool findNext(const T &t) \ { while (const_iterator(n = i) != c->constEnd()) if (*i++ == t) return true; return false; } \ inline bool findPrevious(const T &t) \ { while (const_iterator(i) != c->constBegin()) if (*(n = --i) == t) return true; \ n = c->end(); return false; } \ }; QT_END_NAMESPACE QT_END_HEADER #endif // QITERATOR_H
[ "zhangyinquan@0feb242a-2539-11de-a0d7-251e5865a1c7" ]
[ [ [ 1, 203 ] ] ]
367d7d59b02103f551e350615c4ff1fcb07b4a4e
6188f1aaaf5508e046cde6da16b56feb3d5914bc
/CamFighter/AppFramework/Input/InputMgr.cpp
eccf3100a623508c5db71a4049728dfd4ab0068b
[]
no_license
dogtwelve/fighter3d
7bb099f0dc396e8224c573743ee28c54cdd3d5a2
c073194989bc1589e4aa665714c5511f001e6400
refs/heads/master
2021-04-30T15:58:11.300681
2011-06-27T18:51:30
2011-06-27T18:51:30
33,675,635
1
0
null
null
null
null
UTF-8
C++
false
false
4,483
cpp
#include <fstream> #include "InputMgr.h" void InputMgr :: Key2InputCode_Set(byte kCode, int iCode) { int kIndex = KeyCode2Index(kCode); int iIndex = InputCode2Index(iCode); // replace existing key mapping if (kIndex) { if (iIndex == kIndex) return; InputMap->KeyCode2Index[kCode] = 0; // remove this kCode from search results byte kIndexOld = Index2FirstKeyCode(kIndex); // were there more mappings for this old Input Code? //int iCodeOld = Index2InputCode(kIndex); // get old mapped Input Code assert (/*iCodeOld*/Index2InputCode(kIndex) && iCode != /*iCodeOld*/Index2InputCode(kIndex)); // it was the only keyCode->oldInputCode mapping if (!kIndexOld) { // so we may reuse its index if (!iIndex) { InputMap->KeyCode2Index[kCode] = kIndex; InputMap->InputCode2Index[iCode] = kIndex; FL_IndexState[kIndex] = 0; return; } // we already have our own index, we must free the unused one if (iIndex) { InputMap->KeyCode2Index[kCode] = iIndex; int lastIndex = InputMap->LastIndex; --InputMap->LastIndex; FL_IndexState[kIndex] = FL_IndexState[lastIndex]; InputMap->InputCode2Index[ Index2InputCode(lastIndex) ] = kIndex; for (int kCode = 0; kCode < NUM_KEYS; ++kCode) if (KeyCode2Index(kCode) == lastIndex) InputMap->KeyCode2Index[kCode] = kIndex; } } // the index is still occupied, we may zero kIndex and proceed normal path kIndex = 0; } if (!iIndex) { ++InputMap->LastIndex; InputMap->KeyCode2Index[kCode] = InputMap->LastIndex; InputMap->InputCode2Index[iCode] = InputMap->LastIndex; FL_IndexState[InputMap->LastIndex] = 0; return; } InputMap->KeyCode2Index[kCode] = iIndex; } void InputMgr :: LoadMap(const char *fileName) { assert(I_CodeCount); std::ifstream in; in.open(fileName); if (in.is_open()) { ClearMappings(); char buff[255]; while (in.good()) { in.getline(buff, 255); if (buff[0] == 0 || buff[0] == '#') continue; size_t len = strlen(buff); if (buff[len - 1] == '\r') buff[len - 1] = 0; if (buff[0] == '[') { InputMap = &ScenesMap[buff]; if (!InputMap->InputCode2Index) InputMap->Create(I_CodeCount); } else { if (InputMap) { const char *params = buff; int kCode = GetKeyCode(ReadSubstring(buff, params)); if (!kCode) continue; int iCode; sscanf(params, "%d", &iCode); Key2InputCode_Set(kCode, iCode); } } } in.close(); } } void InputMgr :: SaveMap(const char *fileName) { std::ofstream out; out.open(fileName); if (out.is_open()) { TScenesMap::iterator iter; for (iter = ScenesMap.begin(); iter != ScenesMap.end(); ++iter) { out << iter->first << '\n'; InputMap = &iter->second; for (int kCode = 0; kCode < NUM_KEYS; ++kCode) { int index = KeyCode2Index(kCode); if (index) { int iCode = Index2InputCode(index); out << GetKeyName(kCode) << '\t' << iCode << '\n'; } } } out.close(); } } void InputMgr :: LoadKeyCodeMap(const char *fileName) { std::ifstream in; in.open(fileName); if (in.is_open()) { KeyCodeNameMap.clear(); char buff[255]; int keyCode; char keyName[255]; while (in.good()) { in.getline(buff, 255); if (buff[0] == '\0' || buff[0] == '#') continue; sscanf(buff, "%d %s", &keyCode, keyName); KeyCodeNameMap[keyCode] = keyName; } in.close(); } }
[ "dmaciej1@f75eed02-8a0f-11dd-b20b-83d96e936561", "darekmac@f75eed02-8a0f-11dd-b20b-83d96e936561" ]
[ [ [ 1, 14 ], [ 16, 16 ], [ 19, 153 ] ], [ [ 15, 15 ], [ 17, 18 ] ] ]
9254c9b4dd017b8d5b830026343a074e71641998
f7b5d803225fa1fdbcc22b69d8cc083691c68f01
/cvaddon_util/cvaddon_draw.h
369ca9a826fefee7e1f4c50a56486b85890e7a63
[]
no_license
a40712344/cvaddon
1b3e4b8295eaea3b819598bb7982aa1ba786cb57
e7ebbef09b864b98cce14f0151cef643d2e6bf9d
refs/heads/master
2020-05-20T07:18:49.379088
2008-12-09T03:40:11
2008-12-09T03:40:11
35,675,249
0
0
null
null
null
null
UTF-8
C++
false
false
5,220
h
#ifndef _CVADDON_DRAW_H #define _CVADDON_DRAW_H //////////////////////////////////////////////////////////// // CvAddon Draw Functions //////////////////////////////////////////////////////////// // By Wai Ho Li //////////////////////////////////////////////////////////// // Functions that draw onto IplImages. //////////////////////////////////////////////////////////// // Usage: // --- // See individual functions for detailed usage instructions. //////////////////////////////////////////////////////////// // TODO: // --- // - Make all functions handle ROI //////////////////////////////////////////////////////////// #include <cv.h> #include "cvaddon_math.h" // OpenCv doesnt have a function to draw Rectangles. Go figure... inline void cvAddonDrawRectangle(CvArr *dst, const CvRect& rect , const CvScalar& colour, const int& thickness=1 , const int& linetype=8) { cvRectangle(dst , cvPoint(rect.x, rect.y) , cvPoint(rect.x + rect.width - 1, rect.y + rect.height - 1) , colour , thickness , linetype); } // Draws pixels on an image using <color>. template <typename T> inline void cvAddonDrawPixels(IplImage *dst, CvPoint *pixels , const int& numPixels, const CvScalar &color) { int i, j; int x,y; int x0, x1, y0, y1; CvRect rect; unsigned int widthStep; unsigned int channels; CV_FUNCNAME("cvAddonDrawPixels"); __BEGIN__; if(dst == NULL) CV_ERROR( CV_StsBadArg, "Null Pointer Destination <dst>" ); if(pixels == NULL) CV_ERROR( CV_StsBadArg, "Null Pointer Pixels Data <pixels>" ); rect = cvGetImageROI(dst); widthStep = dst->widthStep; channels = dst->nChannels; x0 = rect.x; x1 = rect.x + rect.width; y0 = rect.y; y1 = rect.y + rect.height; for(i = 0; i < numPixels; ++i) { x = pixels[i].x; y = pixels[i].y; if(x >= x0 && x < x1 && y >= y0 && y < y1) { T *val = (T*)(dst->imageData + widthStep*y) + x*channels; for(j = 0; j < channels; ++j) { val[j] = (T)color.val[j]; } } } __END__; } // Draws a straight line defined in polar form relative to the // center of the image <dst> inline void cvAddonDrawPolarLine(IplImage *dst, const float &r, const float &theta , const CvScalar &color, const int &thickness = 1, const int& lineType = 8) { CvPoint2D32f xrPt, p0, p1; CV_FUNCNAME("cvAddonDrawPolarLine"); __BEGIN__; if(dst == NULL) CV_ERROR( CV_StsBadArg, "Null Pointer Destination <dst>" ); cvAddonFindPolarLineEndPoints(cvGetSize(dst), r, theta, xrPt, p0, p1); cvLine(dst, cvPointFrom32f(xrPt), cvPointFrom32f(p0), color, thickness, lineType); cvLine(dst, cvPointFrom32f(xrPt), cvPointFrom32f(p1), color, thickness, lineType); //#ifdef _DEBUG // // Draw end points // cvLine(dst, cvPointFrom32f(p0), cvPointFrom32f(p0), color, thickness*3, lineType); // cvLine(dst, cvPointFrom32f(p1), cvPointFrom32f(p1), color, thickness*3, lineType); // // // Draw pivot point (perpendicular to line, connecting line to image center) // cvLine(dst, cvPointFrom32f(xrPt), cvPointFrom32f(xrPt), color, thickness*3, CV_AA, lineType); //#endif __END__; } // Fills a fixed-width border around an image with a constant color. Useful for zeroing // edge noise generated by noisy camera input. inline void cvAddonFillBorder(IplImage *dst, const int &width, const CvScalar &color) { int bw; int w,h; //Image dimensions CV_FUNCNAME("cvAddonFillBorder"); __BEGIN__; if(dst == NULL) CV_ERROR( CV_StsBadArg, "Null Pointer Destination <dst>" ); if(width <= 0) bw = 10; else bw = width; w = dst->width; h = dst->height; cvRectangle(dst, cvPoint(0,0), cvPoint(bw-1, h-1), color, CV_FILLED); // Left border cvRectangle(dst, cvPoint(w-bw,0), cvPoint(w-1, h-1), color, CV_FILLED); // Right Border cvRectangle(dst, cvPoint(bw,0), cvPoint(w-bw-1, bw-1), color, CV_FILLED); // "Top" border (y ~= 0) cvRectangle(dst, cvPoint(bw,h-bw), cvPoint(w-bw-1, h-1), color, CV_FILLED); // "Bottom" border __END__; } // Draws an arrow from start to end, with the arrow head sized based on // <arrowLenRatio>, which should be between 0 and 1.0f inline void cvAddonDrawArrow(IplImage *dst , const CvPoint& start, const CvPoint& end, const CvScalar colour , const float& arrowLenRatio = 0.2f) { // Marking start and end locations with circles cvCircle(dst, start, 3, colour, CV_FILLED, CV_AA); // Drawing arrow CvPoint2D32f vec0 = cvPoint2D32f(end.x-start.x, end.y-start.y); CvPoint2D32f vec1 = cvPoint2D32f(-vec0.y, vec0.x); CvPoint2D32f vec2 = cvPoint2D32f(vec0.y, -vec0.x); CvPoint poly[3]; CvPoint mid = cvPoint( start.x + cvRound( (float)(end.x - start.x)*(1.0f - arrowLenRatio) ) , start.y + cvRound( (float)(end.y - start.y)*(1.0f - arrowLenRatio) ) ); poly[0] = cvPoint( cvRound((float)mid.x + vec1.x * arrowLenRatio), cvRound((float)mid.y + vec1.y * arrowLenRatio)); poly[1] = cvPoint( cvRound((float)mid.x + vec2.x * arrowLenRatio), cvRound((float)mid.y + vec2.y * arrowLenRatio)); poly[2] = end; cvFillConvexPoly( dst, poly, 3, colour, CV_AA); // Arrowhead cvLine(dst, start, mid, colour, 2, CV_AA); // Arrowline } #endif
[ "waiho@66626562-0408-11df-adb7-1be7f7e3f636" ]
[ [ [ 1, 164 ] ] ]
5a6f3c02d7392cf23a0c318a252bdf3f192b754a
1c4a1cd805be8bc6f32b0a616de751ad75509e8d
/jacknero/src/itk/itkReadITKImageShowVTK/itkReadITKImageShowVTK.cxx
87e52400f88d66e73b343e68e5d6298fb75f6900
[]
no_license
jacknero/mycode
30313261d7e059832613f26fa453abf7fcde88a0
44783a744bb5a78cee403d50eb6b4a384daccf57
refs/heads/master
2016-09-06T18:47:12.947474
2010-05-02T10:16:30
2010-05-02T10:16:30
180,950
1
0
null
null
null
null
UTF-8
C++
false
false
7,800
cxx
/*========================================================================= Program: Insight Segmentation & Registration Toolkit Module: $RCSfile: itkReadITKImageShowVTK.cxx,v $ Language: C++ Date: $Date: 2006-06-16 18:29:01 $ Version: $Revision: 1.5 $ Copyright (c) 2002 Insight Consortium. All rights reserved. See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #include "itkCommand.h" #include "itkImage.h" #include "itkVTKImageExport.h" #include "itkVTKImageImport.h" #include "itkCurvatureFlowImageFilter.h" #include "itkCastImageFilter.h" #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "vtkImageData.h" #include "vtkImageImport.h" #include "vtkImageExport.h" #include "vtkImageActor.h" #include "vtkRenderer.h" #include "vtkRenderWindow.h" #include "vtkRenderWindowInteractor.h" #include "vtkInteractorStyleImage.h" /** * This will be setup as a callback for a progress event on an ITK * filter. */ struct ProgressDisplay { ProgressDisplay(itk::ProcessObject* process): m_Process(process) {} void Display() { float progress = m_Process->GetProgress()*100.0; std::cout << "Progress " << progress << " percent." << std::endl; } itk::ProcessObject::Pointer m_Process; }; /** * This function will connect the given itk::VTKImageExport filter to * the given vtkImageImport filter. */ template <typename ITK_Exporter, typename VTK_Importer> void ConnectPipelines(ITK_Exporter exporter, VTK_Importer* importer) { importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback()); importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback()); importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback()); importer->SetSpacingCallback(exporter->GetSpacingCallback()); importer->SetOriginCallback(exporter->GetOriginCallback()); importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback()); importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback()); importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback()); importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback()); importer->SetDataExtentCallback(exporter->GetDataExtentCallback()); importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback()); importer->SetCallbackUserData(exporter->GetCallbackUserData()); } /** * This function will connect the given vtkImageExport filter to * the given itk::VTKImageImport filter. */ template <typename VTK_Exporter, typename ITK_Importer> void ConnectPipelines(VTK_Exporter* exporter, ITK_Importer importer) { importer->SetUpdateInformationCallback(exporter->GetUpdateInformationCallback()); importer->SetPipelineModifiedCallback(exporter->GetPipelineModifiedCallback()); importer->SetWholeExtentCallback(exporter->GetWholeExtentCallback()); importer->SetSpacingCallback(exporter->GetSpacingCallback()); importer->SetOriginCallback(exporter->GetOriginCallback()); importer->SetScalarTypeCallback(exporter->GetScalarTypeCallback()); importer->SetNumberOfComponentsCallback(exporter->GetNumberOfComponentsCallback()); importer->SetPropagateUpdateExtentCallback(exporter->GetPropagateUpdateExtentCallback()); importer->SetUpdateDataCallback(exporter->GetUpdateDataCallback()); importer->SetDataExtentCallback(exporter->GetDataExtentCallback()); importer->SetBufferPointerCallback(exporter->GetBufferPointerCallback()); importer->SetCallbackUserData(exporter->GetCallbackUserData()); } /** * This program implements an example connection between ITK and VTK * pipelines. The combined pipeline flows as follows: * * itkImageFileReader ==> itkVTKImageExport ==> * vtkImageImport ==> vtkImageActor * * The resulting vtkImageActor is displayed in a vtkRenderWindow. * Whenever the VTK pipeline executes, information is propagated * through the ITK pipeline. If the ITK pipeline is out of date, it * will re-execute and cause the VTK pipeline to update properly as * well. */ int main(int argc, char * argv [] ) { // Load a color image using ITK and display it with VTK if( argc < 2 ) { std::cerr << "Missing parameters" << std::endl; std::cerr << "Usage: " << argv[0] << " inputImageFilename " << std::endl; return 1; } try { typedef itk::RGBPixel< unsigned char > PixelType; typedef itk::Image< PixelType, 2 > ImageType; typedef itk::ImageFileReader< ImageType > ReaderType; ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName( argv[1] ); reader->Update(); typedef itk::VTKImageExport< ImageType > ExportFilterType; ExportFilterType::Pointer itkExporter = ExportFilterType::New(); itkExporter->SetInput( reader->GetOutput() ); // Create the vtkImageImport and connect it to the // itk::VTKImageExport instance. vtkImageImport* vtkImporter = vtkImageImport::New(); ConnectPipelines(itkExporter, vtkImporter); // Just for double checking export it from VTK back into ITK // and save it into a file. typedef itk::VTKImageImport< ImageType > ImportFilterType; ImportFilterType::Pointer itkImporter = ImportFilterType::New(); vtkImageExport* vtkExporter = vtkImageExport::New(); ConnectPipelines(vtkExporter, itkImporter); vtkExporter->SetInput( vtkImporter->GetOutput() ); typedef itk::ImageFileWriter< ImageType > WriterType; WriterType::Pointer itkWriter = WriterType::New(); itkWriter->SetInput( itkImporter->GetOutput() ); if( argc > 2 ) { const char * filename = argv[2]; std::cout << "Writing file " << filename << std::endl; itkWriter->SetFileName( filename ); itkWriter->Update(); } //------------------------------------------------------------------------ // VTK pipeline. //------------------------------------------------------------------------ // Create a vtkImageActor to help render the image. Connect it to // the vtkImporter instance. vtkImageActor* actor = vtkImageActor::New(); actor->SetInput(vtkImporter->GetOutput()); vtkInteractorStyleImage * interactorStyle = vtkInteractorStyleImage::New(); // Create a renderer, render window, and render window interactor to // display the results. vtkRenderer* renderer = vtkRenderer::New(); vtkRenderWindow* renWin = vtkRenderWindow::New(); vtkRenderWindowInteractor* iren = vtkRenderWindowInteractor::New(); renWin->SetSize(500, 500); renWin->AddRenderer(renderer); iren->SetRenderWindow(renWin); iren->SetInteractorStyle( interactorStyle ); // Add the vtkImageActor to the renderer for display. renderer->AddActor(actor); renderer->SetBackground(0.4392, 0.5020, 0.5647); // Bring up the render window and begin interaction. renWin->Render(); iren->Start(); // Release all VTK components actor->Delete(); interactorStyle->Delete(); vtkImporter->Delete(); vtkExporter->Delete(); renWin->Delete(); renderer->Delete(); iren->Delete(); } catch( itk::ExceptionObject & e ) { std::cerr << "Exception catched !! " << e << std::endl; } return 0; }
[ [ [ 1, 215 ] ] ]
f4e2fa982064eb21b529016a2ff0855ae1c42cd8
c0bd82eb640d8594f2d2b76262566288676b8395
/src/game/WorldSession.h
46c8f3464d638d300c0b8b72f41ada1cb3ba9477
[ "FSFUL" ]
permissive
vata/solution
4c6551b9253d8f23ad5e72f4a96fc80e55e583c9
774fca057d12a906128f9231831ae2e10a947da6
refs/heads/master
2021-01-10T02:08:50.032837
2007-11-13T22:01:17
2007-11-13T22:01:17
45,352,930
0
1
null
null
null
null
UTF-8
C++
false
false
23,319
h
// Copyright (C) 2004 WoW Daemon // // 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. // // WorldSession.h // #ifndef __WORLDSESSION_H #define __WORLDSESSION_H class Player; class WorldPacket; class WorldSocket; class WorldSession; class MapMgr; class Creature; class MovementInfo; struct TrainerSpell; struct OpcodeHandler { uint16 status; void (WorldSession::*handler)(WorldPacket& recvPacket); }; enum SessionStatus { STATUS_AUTHED = 0, STATUS_LOGGEDIN }; struct AccountDataEntry { char * data; uint32 sz; bool bIsDirty; }; typedef struct Cords { float x,y,z; }Cords; #define NOTIFICATION_MESSAGE_NO_PERMISSION "You do not have permission to perform that function." //#define CHECK_PACKET_SIZE(x, y) if(y > 0 && x.size() < y) { _socket->Disconnect(); return; } void EncodeHex(const char* source, char* dest, uint32 size); void DecodeHex(const char* source, char* dest, uint32 size); extern OpcodeHandler WorldPacketHandlers[NUM_MSG_TYPES]; class WOWD_SERVER_DECL WorldSession { friend class WorldSocket; public: WorldSession(uint32 id, string Name, WorldSocket *sock); ~WorldSession(); inline void SendPacket(WorldPacket* packet) { if(_socket && _socket->IsConnected()) _socket->SendPacket(packet); } inline void OutPacket(uint16 opcode) { if(_socket && _socket->IsConnected()) _socket->OutPacket(opcode, 0, NULL); } uint32 m_currMsTime; uint32 m_lastPing; int32 m_MapId; inline uint32 GetAccountId() const { return _accountId; } inline Player* GetPlayer() { return _player; } /* Acct flags */ void SetAccountFlags(uint32 flags) { _accountFlags = flags; } bool HasFlag(uint32 flag) { return (_accountFlags & flag) != 0; } uint32 GetSide() { return _side; } void SetSide(uint32 side) { _side = side; }; /* GM Permission System */ void LoadSecurity(std::string securitystring); void SetSecurity(std::string securitystring); inline char* GetPermissions() { return permissions; } inline int GetPermissionCount() { return permissioncount; } inline bool HasPermissions() { return (permissioncount > 0) ? true : false; } bool CanUseCommand(char cmdstr); inline void SetSocket(WorldSocket *sock) { _socket = sock; } inline void SetPlayer(Player *plr) { _player = plr; } inline void SetAccountData(uint32 index, char* data, bool initial,uint32 sz) { ASSERT(index < 8); if(sAccountData[index].data) delete [] sAccountData[index].data; sAccountData[index].data = data; sAccountData[index].sz = sz; if(!initial && !sAccountData[index].bIsDirty) // Mark as "changed" or "dirty" sAccountData[index].bIsDirty = true; else if(initial) sAccountData[index].bIsDirty = false; } inline AccountDataEntry* GetAccountData(uint32 index) { ASSERT(index < 8); return &sAccountData[index]; } void SetLogoutTimer(uint32 ms) { if(ms) _logoutTime = m_currMsTime+ms; else _logoutTime = 0; } void LogoutPlayer(bool Save); inline void QueuePacket(WorldPacket* packet) { _recvQueue.add(packet); } void OutPacket(uint16 opcode, uint16 len, const void* data) { if(_socket && _socket->IsConnected()) _socket->OutPacket(opcode, len, data); } inline WorldSocket* GetSocket() { return _socket; } void Disconnect() { if(_socket && _socket->IsConnected()) _socket->Disconnect(); } int __fastcall Update(uint32 diff, int32 mapId); void BuildItemPushResult(WorldPacket *data, uint64 guid, uint32 type, uint32 count, uint32 itemid, uint32 randomprop, uint8 unk = 0xFF, uint32 unk2 = 0, uint32 unk3 = 1, uint32 unk4 = 0); void SendBuyFailed(uint64 guid, uint32 itemid, uint8 error); void SendSellItem(uint64 vendorguid, uint64 itemid, uint8 error); void SendNotification(const char *message, ...); void __fastcall Relocate(MapMgr* source, MapMgr* dest); inline uint32 GetLatency() { return _latency; } inline string GetAccountName() { return _accountName; } inline uint32 GetClientBuild() { return client_build; } inline void SetClientBuild(uint32 build) { client_build = build; } protected: /// Login screen opcodes (PlayerHandler.cpp): void HandleCharEnumOpcode(WorldPacket& recvPacket); void HandleCharDeleteOpcode(WorldPacket& recvPacket); void HandleCharCreateOpcode(WorldPacket& recvPacket); void HandlePlayerLoginOpcode(WorldPacket& recvPacket); /// Authentification and misc opcodes (MiscHandler.cpp): void HandlePingOpcode(WorldPacket& recvPacket); void HandleAuthSessionOpcode(WorldPacket& recvPacket); void HandleRepopRequestOpcode(WorldPacket& recvPacket); void HandleAutostoreLootItemOpcode(WorldPacket& recvPacket); void HandleLootMoneyOpcode(WorldPacket& recvPacket); void HandleLootOpcode(WorldPacket& recvPacket); void HandleLootReleaseOpcode(WorldPacket& recvPacket); void HandleLootMasterGiveOpcode(WorldPacket& recv_data); void HandleLootRollOpcode(WorldPacket& recv_data); void HandleWhoOpcode(WorldPacket& recvPacket); void HandleLogoutRequestOpcode(WorldPacket& recvPacket); void HandlePlayerLogoutOpcode(WorldPacket& recvPacket); void HandleLogoutCancelOpcode(WorldPacket& recvPacket); void HandleZoneUpdateOpcode(WorldPacket& recvPacket); void HandleSetTargetOpcode(WorldPacket& recvPacket); void HandleSetSelectionOpcode(WorldPacket& recvPacket); void HandleStandStateChangeOpcode(WorldPacket& recvPacket); void HandleFriendListOpcode(WorldPacket& recvPacket); void HandleAddFriendOpcode(WorldPacket& recvPacket); void HandleDelFriendOpcode(WorldPacket& recvPacket); void HandleAddIgnoreOpcode(WorldPacket& recvPacket); void HandleDelIgnoreOpcode(WorldPacket& recvPacket); void HandleBugOpcode(WorldPacket& recvPacket); void HandleAreaTriggerOpcode(WorldPacket& recvPacket); void HandleUpdateAccountData(WorldPacket& recvPacket); void HandleRequestAccountData(WorldPacket& recvPacket); void HandleSetActionButtonOpcode(WorldPacket& recvPacket); void HandleSetAtWarOpcode(WorldPacket& recvPacket); void HandleSetWatchedFactionIndexOpcode(WorldPacket& recvPacket); void HandleTogglePVPOpcode(WorldPacket& recvPacket); void HandleAmmoSetOpcode(WorldPacket& recvPacket); void HandleGameObjectUse(WorldPacket& recvPacket); //void HandleJoinChannelOpcode(WorldPacket& recvPacket); //void HandleLeaveChannelOpcode(WorldPacket& recvPacket); void HandlePlayedTimeOpcode(WorldPacket & recv_data); void HandleSetSheathedOpcode(WorldPacket & recv_data); void HandleCompleteCinematic(WorldPacket & recv_data); /// Gm Ticket System in GMTicket.cpp: void HandleGMTicketCreateOpcode(WorldPacket& recvPacket); void HandleGMTicketUpdateOpcode(WorldPacket& recvPacket); void HandleGMTicketDeleteOpcode(WorldPacket& recvPacket); void HandleGMTicketGetTicketOpcode(WorldPacket& recvPacket); void HandleGMTicketSystemStatusOpcode(WorldPacket& recvPacket); void HandleGMTicketToggleSystemStatusOpcode(WorldPacket& recvPacket); /// Opcodes implemented in QueryHandler.cpp: void HandleNameQueryOpcode(WorldPacket& recvPacket); void HandleQueryTimeOpcode(WorldPacket& recvPacket); void HandleCreatureQueryOpcode(WorldPacket& recvPacket); void HandleGameObjectQueryOpcode(WorldPacket& recvPacket); void HandleItemNameQueryOpcode( WorldPacket & recv_data ); void HandlePageTextQueryOpcode( WorldPacket & recv_data ); /// Opcodes implemented in MovementHandler.cpp void HandleMoveHeartbeatOpcode( WorldPacket& recvPacket ); void HandleMoveWorldportAckOpcode( WorldPacket& recvPacket ); void HandleMoveStopOpcode( WorldPacket& recvPacket ); void HandleMovementOpcodes( WorldPacket& recvPacket ); void HandleFallOpcode( WorldPacket & recv_data ); void HandleMoveTimeSkippedOpcode( WorldPacket & recv_data ); void HandleMoveNotActiveMoverOpcode( WorldPacket & recv_data ); void HandleSetActiveMoverOpcode( WorldPacket & recv_data ); void HandleMoveTeleportAckOpcode( WorldPacket & recv_data ); void HandleBasicMovementOpcodes( WorldPacket& recvPacket ); /// Opcodes implemented in GroupHandler.cpp: void HandleGroupInviteOpcode(WorldPacket& recvPacket); void HandleGroupCancelOpcode(WorldPacket& recvPacket); void HandleGroupAcceptOpcode(WorldPacket& recvPacket); void HandleGroupDeclineOpcode(WorldPacket& recvPacket); void HandleGroupUninviteOpcode(WorldPacket& recvPacket); void HandleGroupUninviteGuildOpcode(WorldPacket& recvPacket); void HandleGroupSetLeaderOpcode(WorldPacket& recvPacket); void HandleGroupDisbandOpcode(WorldPacket& recvPacket); void HandleLootMethodOpcode(WorldPacket& recvPacket); void HandleMinimapPingOpcode(WorldPacket& recvPacket); void HandleSetPlayerIconOpcode(WorldPacket& recv_data); void SendPartyCommandResult(Player *pPlayer, uint32 p1, std::string name, uint32 err); // Raid void HandleConvertGroupToRaidOpcode(WorldPacket& recvPacket); void HandleGroupChangeSubGroup(WorldPacket& recvPacket); void HandleGroupAssistantLeader(WorldPacket& recvPacket); void HandleRequestRaidInfoOpcode(WorldPacket& recvPacket); void HandleReadyCheckOpcode(WorldPacket& recv_data); // LFG opcodes void HandleEnableAutoJoin(WorldPacket& recvPacket); void HandleDisableAutoJoin(WorldPacket& recvPacket); void HandleEnableAutoAddMembers(WorldPacket& recvPacket); void HandleDisableAutoAddMembers(WorldPacket& recvPacket); void HandleSetLookingForGroupComment(WorldPacket& recvPacket); void HandleMsgLookingForGroup(WorldPacket& recvPacket); void HandleSetLookingForGroup(WorldPacket& recvPacket); /// Taxi opcodes (TaxiHandler.cpp) void HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvPacket); void HandleTaxiQueryAvaibleNodesOpcode(WorldPacket& recvPacket); void HandleActivateTaxiOpcode(WorldPacket& recvPacket); /// NPC opcodes (NPCHandler.cpp) void HandleTabardVendorActivateOpcode(WorldPacket& recvPacket); void HandleBankerActivateOpcode(WorldPacket& recvPacket); void HandleBuyBankSlotOpcode(WorldPacket& recvPacket); void HandleTrainerListOpcode(WorldPacket& recvPacket); void HandleTrainerBuySpellOpcode(WorldPacket& recvPacket); void HandleCharterShowListOpcode(WorldPacket& recvPacket); void HandleGossipHelloOpcode(WorldPacket& recvPacket); void HandleGossipSelectOptionOpcode(WorldPacket& recvPacket); void HandleSpiritHealerActivateOpcode(WorldPacket& recvPacket); void HandleNpcTextQueryOpcode(WorldPacket& recvPacket); void HandleBinderActivateOpcode(WorldPacket& recvPacket); // Auction House opcodes void HandleAuctionHelloOpcode(WorldPacket& recvPacket); void HandleAuctionListItems( WorldPacket & recv_data ); void HandleAuctionListBidderItems( WorldPacket & recv_data ); void HandleAuctionSellItem( WorldPacket & recv_data ); void HandleAuctionListOwnerItems( WorldPacket & recv_data ); void HandleAuctionPlaceBid( WorldPacket & recv_data ); void HandleCancelAuction( WorldPacket & recv_data); // Mail opcodes void HandleGetMail( WorldPacket & recv_data ); void HandleSendMail( WorldPacket & recv_data ); void HandleTakeMoney( WorldPacket & recv_data ); void HandleTakeItem( WorldPacket & recv_data ); void HandleMarkAsRead( WorldPacket & recv_data ); void HandleReturnToSender( WorldPacket & recv_data ); void HandleMailDelete( WorldPacket & recv_data ); void HandleItemTextQuery( WorldPacket & recv_data); void HandleMailTime(WorldPacket & recv_data); void HandleMailCreateTextItem(WorldPacket & recv_data ); /// Item opcodes (ItemHandler.cpp) void HandleSwapInvItemOpcode(WorldPacket& recvPacket); void HandleSwapItemOpcode(WorldPacket& recvPacket); void HandleDestroyItemOpcode(WorldPacket& recvPacket); void HandleAutoEquipItemOpcode(WorldPacket& recvPacket); void HandleItemQuerySingleOpcode(WorldPacket& recvPacket); void HandleSellItemOpcode(WorldPacket& recvPacket); void HandleBuyItemInSlotOpcode(WorldPacket& recvPacket); void HandleBuyItemOpcode(WorldPacket& recvPacket); void HandleListInventoryOpcode(WorldPacket& recvPacket); void HandleAutoStoreBagItemOpcode(WorldPacket& recvPacket); void HandleBuyBackOpcode(WorldPacket& recvPacket); void HandleSplitOpcode(WorldPacket& recvPacket); void HandleReadItemOpcode(WorldPacket& recvPacket); void HandleRepairItemOpcode(WorldPacket &recvPacket); void HandleAutoBankItemOpcode(WorldPacket &recvPacket); void HandleAutoStoreBankItemOpcode(WorldPacket &recvPacket); void HandleCancelTemporaryEnchantmentOpcode(WorldPacket &recvPacket); /// Combat opcodes (CombatHandler.cpp) void HandleAttackSwingOpcode(WorldPacket& recvPacket); void HandleAttackStopOpcode(WorldPacket& recvPacket); /// Spell opcodes (SpellHandler.cpp) void HandleUseItemOpcode(WorldPacket& recvPacket); void HandleCastSpellOpcode(WorldPacket& recvPacket); void HandleCancelCastOpcode(WorldPacket& recvPacket); void HandleCancelAuraOpcode(WorldPacket& recvPacket); void HandleCancelChannellingOpcode(WorldPacket& recvPacket); void HandleCancelAutoRepeatSpellOpcode(WorldPacket& recv_data); /// Skill opcodes (SkillHandler.spp) //void HandleSkillLevelUpOpcode(WorldPacket& recvPacket); void HandleLearnTalentOpcode(WorldPacket& recvPacket); void HandleUnlearnTalents( WorldPacket & recv_data ); /// Quest opcodes (QuestHandler.cpp) void HandleQuestgiverStatusQueryOpcode(WorldPacket& recvPacket); void HandleQuestgiverHelloOpcode(WorldPacket& recvPacket); void HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvPacket); void HandleQuestgiverCancelOpcode(WorldPacket& recvPacket); void HandleQuestgiverChooseRewardOpcode(WorldPacket& recvPacket); void HandleQuestgiverRequestRewardOpcode(WorldPacket& recvPacket); void HandleQuestGiverQueryQuestOpcode( WorldPacket& recvPacket ); void HandleQuestQueryOpcode(WorldPacket& recvPacket); void HandleQuestgiverCompleteQuestOpcode( WorldPacket & recvPacket ); void HandleQuestlogRemoveQuestOpcode(WorldPacket& recvPacket); /// Chat opcodes (Chat.cpp) void HandleMessagechatOpcode(WorldPacket& recvPacket); void HandleTextEmoteOpcode(WorldPacket& recvPacket); /// Corpse opcodes (Corpse.cpp) void HandleCorpseReclaimOpcode( WorldPacket& recvPacket ); void HandleCorpseQueryOpcode( WorldPacket& recvPacket ); void HandleResurrectResponseOpcode(WorldPacket& recvPacket); /// Channel Opcodes (ChannelHandler.cpp) void HandleChannelJoin(WorldPacket& recvPacket); void HandleChannelLeave(WorldPacket& recvPacket); void HandleChannelList(WorldPacket& recvPacket); void HandleChannelPassword(WorldPacket& recvPacket); void HandleChannelSetOwner(WorldPacket& recvPacket); void HandleChannelOwner(WorldPacket& recvPacket); void HandleChannelModerator(WorldPacket& recvPacket); void HandleChannelUnmoderator(WorldPacket& recvPacket); void HandleChannelMute(WorldPacket& recvPacket); void HandleChannelUnmute(WorldPacket& recvPacket); void HandleChannelInvite(WorldPacket& recvPacket); void HandleChannelKick(WorldPacket& recvPacket); void HandleChannelBan(WorldPacket& recvPacket); void HandleChannelUnban(WorldPacket& recvPacket); void HandleChannelAnnounce(WorldPacket& recvPacket); void HandleChannelModerate(WorldPacket& recvPacket); // Duel void HandleDuelAccepted(WorldPacket & recv_data); void HandleDuelCancelled(WorldPacket & recv_data); // Trade void HandleInitiateTrade(WorldPacket & recv_data); void HandleBeginTrade(WorldPacket & recv_data); void HandleBusyTrade(WorldPacket & recv_data); void HandleIgnoreTrade(WorldPacket & recv_data); void HandleAcceptTrade(WorldPacket & recv_data); void HandleUnacceptTrade(WorldPacket & recv_data); void HandleCancelTrade(WorldPacket & recv_data); void HandleSetTradeItem(WorldPacket & recv_data); void HandleClearTradeItem(WorldPacket & recv_data); void HandleSetTradeGold(WorldPacket & recv_data); // Guild void HandleGuildQuery(WorldPacket & recv_data); void HandleCreateGuild(WorldPacket & recv_data); void HandleInviteToGuild(WorldPacket & recv_data); void HandleGuildAccept(WorldPacket & recv_data); void HandleGuildDecline(WorldPacket & recv_data); void HandleGuildInfo(WorldPacket & recv_data); void HandleGuildRoster(WorldPacket & recv_data); void HandleGuildPromote(WorldPacket & recv_data); void HandleGuildDemote(WorldPacket & recv_data); void HandleGuildLeave(WorldPacket & recv_data); void HandleGuildRemove(WorldPacket & recv_data); void HandleGuildDisband(WorldPacket & recv_data); void HandleGuildLeader(WorldPacket & recv_data); void HandleGuildMotd(WorldPacket & recv_data); void HandleGuildRank(WorldPacket & recv_data); void HandleGuildAddRank(WorldPacket & recv_data); void HandleGuildDelRank(WorldPacket & recv_data); void HandleGuildSetPublicNote(WorldPacket & recv_data); void HandleGuildSetOfficerNote(WorldPacket & recv_data); void HandleSaveGuildEmblem(WorldPacket & recv_data); void HandleCharterBuy(WorldPacket & recv_data); void HandleCharterShowSignatures(WorldPacket & recv_data); void HandleCharterTurnInCharter(WorldPacket & recv_data); void HandleCharterQuery(WorldPacket & recv_data); void HandleCharterOffer(WorldPacket & recv_data); void HandleCharterSign(WorldPacket &recv_data); void HandleCharterRename(WorldPacket & recv_data); void HandleSetGuildInformation(WorldPacket & recv_data); void SendGuildCommandResult(uint32 typecmd,const char * str,uint32 cmdresult); // Pet void HandlePetAction(WorldPacket & recv_data); void HandlePetInfo(WorldPacket & recv_data); void HandlePetNameQuery(WorldPacket & recv_data); void HandleBuyStableSlot(WorldPacket & recv_data); void HandleStablePet(WorldPacket & recv_data); void HandleUnstablePet(WorldPacket & recv_data); void HandleStabledPetList(WorldPacket & recv_data); // Battleground void HandleBattlefieldPortOpcode(WorldPacket &recv_data); void HandleBattlefieldStatusOpcode(WorldPacket &recv_data); void HandleBattleMasterHelloOpcode(WorldPacket &recv_data); void HandleLeaveBattlefieldOpcode(WorldPacket &recv_data); void HandleAreaSpiritHealerQueryOpcode(WorldPacket &recv_data); void HandleAreaSpiritHealerQueueOpcode(WorldPacket &recv_data); void HandleBattlegroundPlayerPositionsOpcode(WorldPacket &recv_data); void HandleArenaJoinOpcode(WorldPacket &recv_data); void HandleBattleMasterJoinOpcode(WorldPacket &recv_data); void HandleInspectHonorStatsOpcode(WorldPacket &recv_data); void HandlePVPLogDataOpcode(WorldPacket &recv_data); void HandleBattlefieldListOpcode(WorldPacket &recv_data); void HandlePushQuestToPartyOpcode(WorldPacket &recv_data); void HandleSetActionBarTogglesOpcode(WorldPacket &recvPacket); void HandleMoveSplineCompleteOpcode(WorldPacket &recvPacket); /// Helper functions void SetNpcFlagsForTalkToQuest(const uint64& guid, const uint64& targetGuid); //Tutorials void HandleTutorialFlag ( WorldPacket & recv_data ); void HandleTutorialClear( WorldPacket & recv_data ); void HandleTutorialReset( WorldPacket & recv_data ); //Acknowledgements void HandleAcknowledgementOpcodes( WorldPacket & recv_data ); void HandleMeetingStoneInfoOpcode(WorldPacket& recv_data); void HandleMeetingStoneJoinOpcode(WorldPacket& recv_data); void HandleMeetingStoneLeaveOpcode(WorldPacket& recv_data); void HandleMountSpecialAnimOpcode(WorldPacket& recv_data); void HandleSelfResurrectOpcode(WorldPacket& recv_data); void HandleUnlearnSkillOpcode(WorldPacket &recv_data); void HandleRandomRollOpcode(WorldPacket &recv_data); void HandleOpenItemOpcode(WorldPacket &recv_data); void HandleToggleHelmOpcode(WorldPacket &recv_data); void HandleToggleCloakOpcode(WorldPacket &recv_data); void HandleSetVisibleRankOpcode(WorldPacket& recv_data); void HandlePetSetActionOpcode(WorldPacket& recv_data); void _Relocate(); void _HandleBreathing(WorldPacket &recv_data, MovementInfo &mi); void _SpeedCheck(MovementInfo &mi); //instances void HandleResetInstanceOpcode(WorldPacket& recv_data); uint8 TrainerGetSpellStatus(TrainerSpell* pSpell); void __fastcall CHECK_PACKET_SIZE(WorldPacket& data, uint32 size); void SendMailError(uint32 error); public: void SendInventoryList(Creature* pCreature); void SendTrainerList(Creature* pCreature); void SendCharterRequest(Creature* pCreature); void SendTaxiList(Creature* pCreature); void SendInnkeeperBind(Creature* pCreature); void SendBattlegroundList(Creature* pCreature, uint32 mapid); void SendBankerList(Creature* pCreature); void SendTabardHelp(Creature* pCreature); void SendAuctionList(Creature* pCreature); void SendSpiritHealerRequest(Creature* pCreature); private: Player *_player; WorldSocket *_socket; uint32 _accountId; uint32 _accountFlags; string _accountName; uint32 _side; WoWGuid m_MoverWoWGuid; uint32 _logoutTime; // time we received a logout request -- wait 20 seconds, and quit AccountDataEntry sAccountData[8]; LockedQueue<WorldPacket*> _recvQueue; char *permissions; int permissioncount; bool _loggingOut; MapMgr *_source, *_dest; uint32 _latency; uint32 client_build; public: static void InitPacketHandlerTable(); }; #endif
[ [ [ 1, 542 ] ] ]
db6feccf0c19454c3bde1f31fc8971edd7977fd9
5bd189ea897b10ece778fbf9c7a0891bf76ef371
/BasicEngine/BasicEngine/Input/InputAction.h
8e876e594b491315eca01a47ffcf2a94efb04345
[]
no_license
boriel/masterullgrupo
c323bdf91f5e1e62c4c44a739daaedf095029710
81b3d81e831eb4d55ede181f875f57c715aa18e3
refs/heads/master
2021-01-02T08:19:54.413488
2011-12-14T22:42:23
2011-12-14T22:42:23
32,330,054
0
0
null
null
null
null
ISO-8859-1
C++
false
false
1,301
h
/* Clase InputAction.h. Esta clase representa el estado de las acciones lógicas (Saltar, Aceptar, Salir, ...). */ #ifndef InputAction_H #define InputAction_H class cInputAction { private: float mfValue; float mfTimePressed; bool mbIsPressed; bool mbWasPressed; bool mbBecomeReleased; bool mbBecomePressed; public: void Init (void); void Deinit(); void Update (float lfTimestep, float lfValue); inline bool GetIsPressed(void) const { return mbIsPressed; } //Indica si la acción esta activa o pulsada inline bool GetIsReleased(void) const { return !mbIsPressed; } //Indica si la acción no está activa o no pulsada inline bool GetBecomePressed(void) const { return mbBecomePressed; } //Indica si la acción ha pasado de inactiva a activa. Solo devuelve true en el primer frame que la acción este activa. inline bool GetBecomeReleased(void) const { return mbBecomeReleased; } //Indica si la acción ha pasado de activa a inactiva. Solo devuelve true en el primer frame que la acción este inactiva. inline float GetPressedTime(void) const { return mfTimePressed; } //Devuelve el tiempo que la accion lleva activa inline float GetValue(void) const { return mfValue; } }; #endif
[ "yormanh@f2da8aa9-0175-0678-5dcd-d323193514b7" ]
[ [ [ 1, 38 ] ] ]
646795c60ad2f59264f2ee61da2309753cb781dc
5095bbe94f3af8dc3b14a331519cfee887f4c07e
/Shared/Components/Data/TProbability_analysis_form.cpp
07744773bc367f01472cb9a3c6bcc52e07d36ee1
[]
no_license
sativa/apsim_development
efc2b584459b43c89e841abf93830db8d523b07a
a90ffef3b4ed8a7d0cce1c169c65364be6e93797
refs/heads/master
2020-12-24T06:53:59.364336
2008-09-17T05:31:07
2008-09-17T05:31:07
64,154,433
0
0
null
null
null
null
UTF-8
C++
false
false
1,689
cpp
//--------------------------------------------------------------------------- #include <general\pch.h> #include <vcl.h> #pragma hdrstop #include "TProbability_analysis_form.h" #include "TProbability_analysis.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "TAnalysis_form" #pragma link "paramtreeview" #pragma resource "*.dfm" TProbability_analysis_form *Probability_analysis_form; //--------------------------------------------------------------------------- __fastcall TProbability_analysis_form::TProbability_analysis_form(TComponent* Owner) : TAnalysis_form(Owner) { } //--------------------------------------------------------------------------- void __fastcall TProbability_analysis_form::FormShow(TObject *Sender) { TAnalysis_form::FormShow(Sender); TProbability_analysis* Prob_analysis_ptr = dynamic_cast<TProbability_analysis*> (Analysis_ptr); if (Prob_analysis_ptr != NULL) Probability_exceedence_radio->Checked = Prob_analysis_ptr->Prob_exceedence; } //--------------------------------------------------------------------------- void __fastcall TProbability_analysis_form::FormClose(TObject *Sender, TCloseAction &Action) { TAnalysis_form::FormClose(Sender, Action); if (ModalResult == mrOk) { TProbability_analysis* Prob_analysis_ptr = dynamic_cast<TProbability_analysis*> (Analysis_ptr); if (Prob_analysis_ptr != NULL) Prob_analysis_ptr->Prob_exceedence = Probability_exceedence_radio->Checked; } } //---------------------------------------------------------------------------
[ "devoilp@8bb03f63-af10-0410-889a-a89e84ef1bc8" ]
[ [ [ 1, 41 ] ] ]
28a55218fea3b7d0d400387cb577f86292d39f89
1e976ee65d326c2d9ed11c3235a9f4e2693557cf
/MediaPlayers/MediaVisualization.h
783e5487aa1664cc42bd5693d3a72808c5ec5790
[]
no_license
outcast1000/Jaangle
062c7d8d06e058186cb65bdade68a2ad8d5e7e65
18feb537068f1f3be6ecaa8a4b663b917c429e3d
refs/heads/master
2020-04-08T20:04:56.875651
2010-12-25T10:44:38
2010-12-25T10:44:38
19,334,292
3
0
null
null
null
null
UTF-8
C++
false
false
1,520
h
// /* // * // * Copyright (C) 2003-2010 Alexandros Economou // * // * This file is part of Jaangle (http://www.jaangle.com) // * // * 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, 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 GNU Make; see the file COPYING. If not, write to // * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. // * http://www.gnu.org/copyleft/gpl.html // * // */ #ifndef _MediaVisualization_h_ #define _MediaVisualization_h_ class MediaPlayerEngine; class MediaVisualization { public: MediaVisualization() {} virtual ~MediaVisualization() {} virtual void SetMediaPlayerEngine(MediaPlayerEngine* mpe) = 0; virtual void SetContainerHWND(HWND hwnd) = 0; virtual HWND GetContainerHWND() = 0; virtual void Start() = 0; virtual void Stop() = 0; virtual BOOL IsActive() = 0; virtual void SetPosition(int x, int y, int cx, int cy) = 0; }; #endif
[ "outcast1000@dc1b949e-fa36-4f9e-8e5c-de004ec35678" ]
[ [ [ 1, 48 ] ] ]
eefab50144610c1b55a43a17ce85d3f0fd7a7d83
38926bfe477f933a307f51376dd3c356e7893ffc
/Source/GameDLL/HUD/HUDTextChat.h
88913fd90fcf52127526018d892fcdc03fc5afc6
[]
no_license
richmondx/dead6
b0e9dd94a0ebb297c0c6e9c4f24c6482ef4d5161
955f76f35d94ed5f991871407f3d3ad83f06a530
refs/heads/master
2021-12-05T14:32:01.782047
2008-01-01T13:13:39
2008-01-01T13:13:39
null
0
0
null
null
null
null
ISO-8859-3
C++
false
false
3,447
h
/************************************************************************* Crytek Source File. Copyright (C), Crytek Studios, 2001-2006. ------------------------------------------------------------------------- $Id$ $DateTime$ Description: HUD text chat - receives text input and broadcasts it to other players ------------------------------------------------------------------------- History: - 07:03:2006: Created by Jan Müller *************************************************************************/ #ifndef __HUDTEXTCHAT_H__ #define __HUDTEXTCHAT_H__ //----------------------------------------------------------------------------------------------------- #include "HUDObject.h" #include <IInput.h> #include "IFlashPlayer.h" #include "IActionMapManager.h" class CGameFlashAnimation; static const int CHAT_LENGTH = 6; class CHUDTextChat : public CHUDObject,public IInputEventListener, public IFSCommandHandler { typedef bool (CHUDTextChat::*OpFuncPtr) (const char*, const char*); public: CHUDTextChat(); ~CHUDTextChat(); void Init(CGameFlashAnimation *pFlashChat); // IFSCommandHandler virtual void HandleFSCommand(const char* pCommand, const char* pArgs); // ~IFSCommandHandler virtual void Update(float deltaTime); void GetMemoryStatistics(ICrySizer * s); // IInputEventListener virtual bool OnInputEvent(const SInputEvent &event ); virtual bool OnInputEventUI(const SInputEvent &event ); // ~IInputEventListener //add arriving multiplayer chat messages here virtual void AddChatMessage(EntityId sourceId, const wchar_t* msg, int teamFaction, bool teamChat); virtual void AddChatMessage(EntityId sourceId, const char* msg, int teamFaction, bool teamChat); virtual void AddChatMessage(const char* nick, const wchar_t* msg, int teamFaction, bool teamChat); virtual void AddChatMessage(const char* nick, const char* msg, int teamFaction, bool teamChat); void ShowVirtualKeyboard(bool active); ILINE virtual void ShutDown() {Flush();}; //open chat void OpenChat(int type); private: virtual void Flush(bool close=true); virtual void ProcessInput(const SInputEvent &event); virtual void Delete(); virtual void Backspace(); virtual void Left(); virtual void Right(); virtual void Insert(const char *key); virtual void VirtualKeyboardInput(const char* direction); virtual bool ProcessCommands(const string& text); virtual bool Vote(const char* type=NULL, const char* kickuser=NULL); virtual bool VoteYes(const char* param1=NULL, const char* param2=NULL); virtual bool VoteNo(const char* param1=NULL, const char* param2=NULL); virtual bool Lowtec(const char* param1=NULL, const char* param2=NULL); virtual bool Quarantine(const char* param1=NULL, const char* param2=NULL); //option-function mapper typedef std::map<string, OpFuncPtr> TOpFuncMap; TOpFuncMap m_opFuncMap; typedef TOpFuncMap::iterator TOpFuncMapIt; CGameFlashAnimation *m_flashChat; string m_inputText; string m_lastInputText; int m_cursor; bool m_isListening; bool m_teamChat; string m_chatStrings[CHAT_LENGTH]; float m_chatSpawnTime[CHAT_LENGTH]; int m_chatHead; bool m_textInputActive; bool m_showVirtualKeyboard; bool m_anyCurrentText; /*bool m_showing; float m_lastUpdate;*/ float m_repeatTimer; SInputEvent m_repeatEvent; }; #endif
[ "[email protected]", "kkirst@c5e09591-5635-0410-80e3-0b71df3ecc31" ]
[ [ [ 1, 30 ], [ 34, 44 ], [ 46, 48 ], [ 50, 50 ], [ 53, 54 ], [ 59, 60 ], [ 63, 73 ], [ 86, 109 ] ], [ [ 31, 33 ], [ 45, 45 ], [ 49, 49 ], [ 51, 52 ], [ 55, 58 ], [ 61, 62 ], [ 74, 85 ] ] ]
9979d7edfd2b6ee8b7d4ceb6248a1457fbafc2c2
36d0ddb69764f39c440089ecebd10d7df14f75f3
/プログラム/Game/Manager/Object/ObjectFactory.cpp
22368caf8b7cda2b76522f3816c6d0b7db61d43f
[]
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
3,194
cpp
/*******************************************************************************/ /* * @file ObjectFactory.cpp. * * @brief ゲームシーンのオブジェクト生成クラス定義. * * @date 2008/11/25. * * @version 1.00. * * @author Kenji Iwata. */ /*******************************************************************************/ /*===== インクルード ==========================================================*/ #include "Manager/Object/ObjectFactory.h" #include "Object/GameScene/Player.h" #include "Object/GameScene/Block.h" #include "Object/GameScene/BackGround.h" #include "Object/GameScene/Result.h" #include "Object/GameScene/ReadyGo.h" #include "Manager/Object/ObjectManager.h" /*=============================================================================*/ /** * @brief コンストラクタ. * * @param[in] device ゲームデバイス. * @param[in] ObjectManager オブジェクトマネージャメディエータ. * @param[in] option ゲームオプション. * @param[in] State ゲームシーンステート. */ ObjectFactory::ObjectFactory(IGameDevice &device, ObjectManager &ObjectManager, Option &option) : m_device(device), m_objectManager(ObjectManager), m_option(option) { } /*=============================================================================*/ /** * @brief デストラクタ. * */ ObjectFactory::~ObjectFactory() { } /*=============================================================================*/ /** * @brief オブジェクトの生成. * * @param[in] objectID 生成するオブジェクトのID. * @return 生成したオブジェクトのポインタ. */ Player* ObjectFactory::CreatePlayer(GameSceneState& gameSceneState, float x, float y, int maxHp, int hp, int skillpoint[], int maxPlayerTime,int playerTime, int characterID, int score, int playerID, int playerLV, int playerAttack, int playerDefence, int playerType) { Player* object; object = new Player(m_device, m_objectManager, m_option, gameSceneState, x, y, hp,skillpoint,maxPlayerTime,playerTime,characterID,score,playerID,playerLV,playerAttack,playerDefence,playerType,maxHp); //m_objectManager.AddObject(object); //gameSceneState.AddPlayer(object); return object; } Block* ObjectFactory::CreateBlock(GameSceneState& gameSceneState, Player& player, int blockCID, int blockMID) { Block* object; object = new Block(m_device, m_objectManager, m_option, gameSceneState, player, blockCID, blockMID); //m_objectManager.AddObject(object); return object; } BackGround* ObjectFactory::CreateBackGround(GameSceneState& gameSceneState) { BackGround* object; object = new BackGround(m_device, gameSceneState); return object; } Result* ObjectFactory::CreateResult(GameSceneState &gameSceneState) { Result* object; object = new Result(m_device, gameSceneState); return object; } ReadyGo* ObjectFactory::CreateReadyGo(GameSceneState& gameSceneState) { ReadyGo* readyGo; readyGo = new ReadyGo(m_device, gameSceneState); return readyGo; } /*===== EOF ===================================================================*/
[ "rs.drip@aa49b5b2-a402-11dd-98aa-2b35b7097d33" ]
[ [ [ 1, 103 ] ] ]
2f32238ccd75cea08878f67dcfdc395273499121
61fb1bf48c8eeeda8ecb2c40fcec1d3277ba6935
/patoBase/testfilefactory.h
fd34e0fecaa3e957f64bda03e75c9b64707e65ca
[]
no_license
matherthal/pato-scm
172497f3e5c6d71a2cbbd2db132282fb36ba4871
ba573dad95afa0c0440f1ae7d5b52a2736459b10
refs/heads/master
2020-05-20T08:48:12.286498
2011-11-25T11:05:23
2011-11-25T11:05:23
33,139,075
0
0
null
null
null
null
UTF-8
C++
false
false
248
h
#ifndef TESTFILEFACTORY_H #define TESTFILEFACTORY_H #include "filefactory.h" class TestFileFactory : public FileFactory { public: TestFileFactory(); public: IFile* createFile(QString name); }; #endif // TESTFILEFACTORY_H
[ "rafael@Micro-Mariana" ]
[ [ [ 1, 15 ] ] ]
072cf056c3817d5951e4bae04a74395eb0fa4195
ce262ae496ab3eeebfcbb337da86d34eb689c07b
/SEFoundation/SEIntersection/SEIntrSegment3Box3.cpp
ff8f39f534d83be6b6993377f0e8c8048f49e106
[]
no_license
pizibing/swingengine
d8d9208c00ec2944817e1aab51287a3c38103bea
e7109d7b3e28c4421c173712eaf872771550669e
refs/heads/master
2021-01-16T18:29:10.689858
2011-06-23T04:27:46
2011-06-23T04:27:46
33,969,301
0
0
null
null
null
null
UTF-8
C++
false
false
4,301
cpp
// Swing Engine Version 1 Source Code // Most of techniques in the engine are mainly based on David Eberly's // Wild Magic 4 open-source code.The author of Swing Engine learned a lot // from Eberly's experience of architecture and algorithm. // Several sub-systems are totally new,and others are re-implimented or // re-organized based on Wild Magic 4's sub-systems. // Copyright (c) 2007-2010. All Rights Reserved // // Eberly's permission: // Geometric Tools, Inc. // http://www.geometrictools.com // Copyright (c) 1998-2006. All Rights Reserved // // 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. The license is available for reading at // the location: // http://www.gnu.org/copyleft/lgpl.html #include "SEFoundationPCH.h" #include "SEIntrSegment3Box3.h" #include "SEIntrLine3Box3.h" using namespace Swing; //---------------------------------------------------------------------------- SEIntrSegment3Box3f::SEIntrSegment3Box3f(const SESegment3f& rSegment, const SEBox3f& rBox, bool bSolid) : m_pSegment(&rSegment), m_pBox(&rBox) { m_bSolid = bSolid; } //---------------------------------------------------------------------------- const SESegment3f& SEIntrSegment3Box3f::GetSegment() const { return *m_pSegment; } //---------------------------------------------------------------------------- const SEBox3f& SEIntrSegment3Box3f::GetBox() const { return *m_pBox; } //---------------------------------------------------------------------------- bool SEIntrSegment3Box3f::Test() { float afAWdU[3], afADdU[3], afAWxDdU[3], fRhs; SEVector3f vec3fDiff = m_pSegment->Origin - m_pBox->Center; afAWdU[0] = SEMath<float>::FAbs(m_pSegment->Direction.Dot( m_pBox->Axis[0])); afADdU[0] = SEMath<float>::FAbs(vec3fDiff.Dot(m_pBox->Axis[0])); fRhs = m_pBox->Extent[0] + m_pSegment->Extent*afAWdU[0]; if( afADdU[0] > fRhs ) { return false; } afAWdU[1] = SEMath<float>::FAbs(m_pSegment->Direction.Dot( m_pBox->Axis[1])); afADdU[1] = SEMath<float>::FAbs(vec3fDiff.Dot(m_pBox->Axis[1])); fRhs = m_pBox->Extent[1] + m_pSegment->Extent*afAWdU[1]; if( afADdU[1] > fRhs ) { return false; } afAWdU[2] = SEMath<float>::FAbs(m_pSegment->Direction.Dot( m_pBox->Axis[2])); afADdU[2] = SEMath<float>::FAbs(vec3fDiff.Dot(m_pBox->Axis[2])); fRhs = m_pBox->Extent[2] + m_pSegment->Extent*afAWdU[2]; if( afADdU[2] > fRhs ) { return false; } SEVector3f vec3fWxD = m_pSegment->Direction.Cross(vec3fDiff); afAWxDdU[0] = SEMath<float>::FAbs(vec3fWxD.Dot(m_pBox->Axis[0])); fRhs = m_pBox->Extent[1]*afAWdU[2] + m_pBox->Extent[2]*afAWdU[1]; if( afAWxDdU[0] > fRhs ) { return false; } afAWxDdU[1] = SEMath<float>::FAbs(vec3fWxD.Dot(m_pBox->Axis[1])); fRhs = m_pBox->Extent[0]*afAWdU[2] + m_pBox->Extent[2]*afAWdU[0]; if( afAWxDdU[1] > fRhs ) { return false; } afAWxDdU[2] = SEMath<float>::FAbs(vec3fWxD.Dot(m_pBox->Axis[2])); fRhs = m_pBox->Extent[0]*afAWdU[1] + m_pBox->Extent[1]*afAWdU[0]; if( afAWxDdU[2] > fRhs ) { return false; } return true; } //---------------------------------------------------------------------------- bool SEIntrSegment3Box3f::Find() { float fT0 = -m_pSegment->Extent, fT1 = m_pSegment->Extent; return SEIntrLine3Box3f::DoClipping(fT0, fT1, m_pSegment->Origin, m_pSegment->Direction, *m_pBox, m_bSolid, m_iCount, m_aPoint, m_iIntersectionType); } //---------------------------------------------------------------------------- int SEIntrSegment3Box3f::GetCount() const { return m_iCount; } //---------------------------------------------------------------------------- const SEVector3f& SEIntrSegment3Box3f::GetPoint(int i) const { SE_ASSERT( 0 <= i && i < m_iCount ); return m_aPoint[i]; } //----------------------------------------------------------------------------
[ "[email protected]@876e9856-8d94-11de-b760-4d83c623b0ac" ]
[ [ [ 1, 126 ] ] ]
51c3a6993d7ca9afb308133fe9da7d27531efd0e
2e86c8ff6c58b8d307fed7441dfbc2ce8e5e1160
/src/gdx-cpp/files/FileHandle.cpp
3d8dce37ea1c8f6f2c9f911bc81ce4355907a2fd
[ "Apache-2.0" ]
permissive
NoiSek/libgdx-cpp
dbe9448983ff84090e62e5b59b4cb48076d6aac3
d7f5fd5e690659f381d3945a128eaf93dab35d79
refs/heads/master
2021-01-16T21:02:59.297514
2011-11-02T01:39:24
2011-11-02T01:39:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,116
cpp
/* Copyright 2011 Aevum Software aevum @ aevumlab.com 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. @author Victor Vicente de Carvalho [email protected] @author Ozires Bortolon de Faria [email protected] */ #include "FileHandle.hpp" #include <iostream> #include <stdexcept> #include <stdlib.h> #include <cassert> using namespace gdx_cpp::files; FileHandle::FileHandle (){} FileHandle::FileHandle (const std::string &fileName) : file(fileName), type(gdx_cpp::Files::Absolute) { } FileHandle::FileHandle (File const& file) : file(file), type(gdx_cpp::Files::Absolute) { } FileHandle::FileHandle (const std::string &fileName, gdx_cpp::Files::FileType type) : type(type), file(fileName) { } FileHandle::FileHandle (const gdx_cpp::files::File &file, gdx_cpp::Files::FileType type) : file(file), type(type) { } const std::string& FileHandle::path () const { return file.getPath(); } std::string FileHandle::name () const { return file.getName(); } std::string FileHandle::extension () const { std::string name = file.getName(); int dotIndex = name.rfind('.'); if (dotIndex == std::string::npos) return ""; return name.substr(dotIndex + 1); } std::string FileHandle::nameWithoutExtension () const { std::string name = file.getName(); int dotIndex = name.rfind('.'); if (dotIndex == std::string::npos) return name; return name.substr(0, dotIndex); } std::string FileHandle::typetoString () { if(type == gdx_cpp::Files::Absolute) return "Absolute"; if (type == gdx_cpp::Files::External) return "External"; if (type == gdx_cpp::Files::Internal) return "Internal"; return "Classpath"; } gdx_cpp::Files::FileType& FileHandle::getType () { return type; } File FileHandle::getFile () { if (type == gdx_cpp::Files::External) return File( gdx_cpp::Gdx::files->getExternalStoragePath(), file.getPath()); return file; } FileHandle::ifstream_ptr FileHandle::read () { ifstream_ptr input; if (type == gdx_cpp::Files::Internal && !file.exists()) { int found; std::string s = "/" + file.getPath(); while((found = s.find("//")) != s.npos) s.replace(found, 2, "/"); input = ifstream_ptr (new std::ifstream( s.c_str(), std::ios::in | std::ios::binary)); if(!input->is_open()) throw std::runtime_error("File not found: " + file.getPath() + " (" + typetoString() + ")"); return input; } input = ifstream_ptr (new std::ifstream(file.getPath().c_str(), std::ios::in | std::ios::binary)); if(!input->is_open()) { if(file.isDirectory()) throw std::runtime_error("Cannot open a stream to a directory: " + file.getPath() + " (" + typetoString() + ")"); else throw std::runtime_error("Error reading file: " + file.getPath() + " (" + typetoString() + ")"); } return input; } std::string FileHandle::readString () { return readString(""); } std::string FileHandle::readString (const std::string& charset) { std::string output = ""; ifstream_ptr reader; if (charset == "") reader = read(); //else TODO TEM QUE CRIAR CHARSET AQUI // reader = new InputStreamReader(read(), charset); try { char buffer[257]; std::streampos earlypos; buffer[256] = '\0'; while (true) { earlypos = reader->tellg(); if(!reader->read(buffer, 256)) break; output += std::string(buffer); } reader->clear(); reader->seekg (earlypos); reader->seekg (0, std::ios::end); buffer[((int) reader->tellg()-earlypos)] = '\0'; output += std::string(buffer); } catch(std::runtime_error e) { if (reader->is_open()) reader->close(); throw std::runtime_error("Error reading file: " + this->toString()); } if (reader->is_open()) reader->close(); return output; } int FileHandle::readBytes (char_ptr &c) { int Length = (int) length(); if (Length == 0) Length = 512; int bufferlength = Length; char* buf = (char*) malloc(bufferlength); int position = 0; ifstream_ptr input = read(); try { while (true) { int count = 0; input->read( buf + position, Length - position); count = input->gcount(); position += count; if(input->eof() || !count || input->peek() == EOF) { break; } if (position == bufferlength) { // Grow buffer. buf = (char * ) realloc(buf, bufferlength * 2); assert(buf); bufferlength *= 2; } } } catch(std::runtime_error e) { if(input->is_open()) input->close(); throw std::runtime_error("Error reading file: " + this->toString()); } if(input->is_open()) { input->close(); } if(position < bufferlength) { buf = (char *) realloc(buf, position); assert(buf); } char_ptr new_ptr = char_ptr(buf, shared_ptr_free_deleter()); c.swap(new_ptr); return position; } FileHandle::ofstream_ptr FileHandle::write (bool append) { if (type == gdx_cpp::Files::Internal) throw std::runtime_error("Cannot write to an internal file: " + file.getPath()); ofstream_ptr output; try { if(append) output = ofstream_ptr (new std::ofstream(file.getPath().c_str(), std::fstream::out | std::ios::app)); else output = ofstream_ptr (new std::ofstream(file.getPath().c_str(), std::ios::out | std::ios::trunc)); } catch(std::runtime_error e) { if(getFile().isDirectory()) throw std::runtime_error("Cannot open a stream to a directory: " + file.getPath() + " (" + typetoString() + ")"); else throw std::runtime_error("Error writing file: " + file.getPath() + " (" + typetoString() + ")"); } return output; } void FileHandle::list(std::vector<FileHandle> &handles) { std::vector<std::string> relativePaths; getFile().list(relativePaths); handles.resize(relativePaths.size()); for (int i = 0, n = relativePaths.size(); i < n; i++) handles[i] = child(relativePaths[i]); return; } void FileHandle::list (const std::string& suffix, std::vector<FileHandle> &handles) { std::vector<std::string> relativePaths; getFile().list(relativePaths); handles.resize(relativePaths.size()); unsigned int count = 0, found; for (int i = 0, n = relativePaths.size(); i < n; i++) { found = relativePaths[i].rfind(suffix); if(found == relativePaths[i].npos || found != (relativePaths[i].length() - suffix.length() ) ) continue; handles[count++] = child(relativePaths[i]); } if (count < relativePaths.size()) handles.resize(count); return; } bool FileHandle::isDirectory () { return getFile().isDirectory(); } FileHandle FileHandle::child (const std::string &name) { if (file.getPath().length() == 0) return FileHandle(File(name), type); return FileHandle(File(file, name), type); } FileHandle FileHandle::parent () { File parent; parent = file.getParentFile(); if(parent.getPath() == "") { if (type == gdx_cpp::Files::Absolute) parent = File("/"); else parent = File(""); } return FileHandle(parent, type); } void FileHandle::mkdirs () { if (type == gdx_cpp::Files::Internal) throw std::runtime_error("Cannot mkdirs with an internal file: " + file.getPath()); getFile().mkdirs(); } bool FileHandle::exists () { switch (type) { case gdx_cpp::Files::Internal: if (file.exists()) return true; break; default: break; } return getFile().exists(); } bool FileHandle::deleteFile () { if (type == gdx_cpp::Files::Internal) throw std::runtime_error("Cannot delete an internal file: " + file.getPath()); return getFile().deleteFile(); } bool FileHandle::deleteDirectory () { if (type == gdx_cpp::Files::Internal) throw std::runtime_error("Cannot delete an internal file: " + file.getPath()); File target = getFile(); return deleteDirectory(target); } void FileHandle::copyTo (FileHandle& dest) { ifstream_ptr input; ofstream_ptr output; try { input = read(); output = dest.write(false); char buffer[4096]; while (true) { input->read(buffer, 4096); output->write(buffer, input->gcount()); if(input->eof() || input->peek() == EOF) break; } } catch(std::runtime_error ex) { if(input->is_open()) input->close(); if(output->is_open()) output->close(); throw std::runtime_error("Error copying source file: " + path() + " (" + typetoString() + ")\n" + "To destination: " + dest.path() + " (" + dest.typetoString() + ")"); } if(input->is_open()) input->close(); if(output->is_open()) output->close(); } void FileHandle::moveTo (FileHandle& dest) { if (type == gdx_cpp::Files::Internal) throw std::runtime_error("Cannot move an internal file: " + file.getPath()); copyTo(dest); deleteFile(); } int64_t FileHandle::length () { if ((type == gdx_cpp::Files::Internal && !file.exists())) { int64_t length = 0; ifstream_ptr input = read(); try { if(input != NULL) { input->seekg (0, std::ios::end); length = (int64_t) input->tellg(); input->close(); } } catch(std::runtime_error ignored) { if(input->is_open()) input->close(); } return length; } return getFile().length(); } std::string FileHandle::toString () { return getFile().getPath(); } bool FileHandle::deleteDirectory (File& file) { if (file.exists()) { std::vector<File> files; file.listFiles(files); for (int i = 0, n = files.size(); i < n; i++) { if (files[i].isDirectory()) deleteDirectory(files[i]); else files[i].deleteFile(); } } return file.deleteFile(); }
[ [ [ 1, 21 ], [ 24, 28 ], [ 32, 32 ], [ 45, 45 ], [ 56, 58 ], [ 60, 62 ], [ 75, 76 ], [ 82, 83 ], [ 85, 87 ], [ 90, 92 ], [ 104, 105 ], [ 113, 113 ], [ 115, 116 ], [ 119, 120 ], [ 133, 133 ], [ 137, 137 ], [ 143, 143 ], [ 148, 148 ], [ 151, 152 ], [ 157, 160 ], [ 167, 167 ], [ 176, 179 ], [ 181, 181 ], [ 188, 192 ], [ 195, 200 ], [ 202, 203 ], [ 216, 216 ], [ 218, 219 ], [ 225, 225 ], [ 227, 228 ], [ 233, 233 ], [ 238, 238 ], [ 241, 243 ], [ 245, 247 ], [ 251, 252 ], [ 261, 261 ], [ 263, 263 ], [ 265, 267 ], [ 270, 273 ], [ 275, 279 ], [ 281, 282 ], [ 287, 289 ], [ 293, 294 ], [ 299, 300 ], [ 302, 302 ], [ 306, 306 ], [ 311, 311 ], [ 314, 315 ], [ 318, 318 ], [ 320, 321 ], [ 340, 340 ], [ 343, 344 ], [ 347, 348 ], [ 355, 357 ], [ 359, 360 ], [ 362, 362 ] ], [ [ 22, 23 ], [ 29, 31 ], [ 33, 44 ], [ 46, 55 ], [ 59, 59 ], [ 63, 74 ], [ 77, 81 ], [ 84, 84 ], [ 88, 89 ], [ 93, 103 ], [ 106, 112 ], [ 114, 114 ], [ 117, 118 ], [ 121, 132 ], [ 134, 136 ], [ 138, 142 ], [ 144, 147 ], [ 149, 150 ], [ 153, 156 ], [ 161, 166 ], [ 168, 175 ], [ 180, 180 ], [ 182, 187 ], [ 193, 194 ], [ 201, 201 ], [ 204, 215 ], [ 217, 217 ], [ 220, 224 ], [ 226, 226 ], [ 229, 232 ], [ 234, 237 ], [ 239, 240 ], [ 244, 244 ], [ 248, 250 ], [ 253, 260 ], [ 262, 262 ], [ 264, 264 ], [ 268, 269 ], [ 274, 274 ], [ 280, 280 ], [ 283, 286 ], [ 290, 292 ], [ 295, 298 ], [ 301, 301 ], [ 303, 305 ], [ 307, 310 ], [ 312, 313 ], [ 316, 317 ], [ 319, 319 ], [ 322, 339 ], [ 341, 342 ], [ 345, 346 ], [ 349, 354 ], [ 358, 358 ], [ 361, 361 ] ] ]
1913ccbc7d6d53e551899c842dd27a83f5d9de27
d621c758880f0d78337d1bf6b2badd8466f3d365
/chainbowduino/build/local/Rainbow.h
cd0cf6655323c7b1ec6c873cad88076cfecbf5e4
[]
no_license
brettviren/chainbowduino
304c9fcecb9dae626eca34f8e62310b34fc956e5
e65769151c4ad199e2e34ec6fe9da9a077f8f9ac
refs/heads/master
2020-12-24T17:26:45.142421
2011-11-20T23:38:13
2011-11-20T23:38:13
2,768,813
0
0
null
null
null
null
UTF-8
C++
false
false
4,927
h
#ifndef Rainbow_h #define Rainbow_h //============================================= //MBI5168 #define SH_DIR_OE DDRC #define SH_DIR_SDI DDRC #define SH_DIR_CLK DDRC #define SH_DIR_LE DDRC #define SH_BIT_OE 0x08 #define SH_BIT_SDI 0x01 #define SH_BIT_CLK 0x02 #define SH_BIT_LE 0x04 #define SH_PORT_OE PORTC #define SH_PORT_SDI PORTC #define SH_PORT_CLK PORTC #define SH_PORT_LE PORTC //============================================ #define clk_rising {SH_PORT_CLK&=~SH_BIT_CLK;SH_PORT_CLK|=SH_BIT_CLK;} #define le_high {SH_PORT_LE|=SH_BIT_LE;} #define le_low {SH_PORT_LE&=~SH_BIT_LE;} #define enable_oe {SH_PORT_OE&=~SH_BIT_OE;} #define disable_oe {SH_PORT_OE|=SH_BIT_OE;} #define shift_data_1 {SH_PORT_SDI|=SH_BIT_SDI;} #define shift_data_0 {SH_PORT_SDI&=~SH_BIT_SDI;} //============================================ #define open_line0 {PORTB=0x04;} #define open_line1 {PORTB=0x02;} #define open_line2 {PORTB=0x01;} #define open_line3 {PORTD=0x80;} #define open_line4 {PORTD=0x40;} #define open_line5 {PORTD=0x20;} #define open_line6 {PORTD=0x10;} #define open_line7 {PORTD=0x08;} #define close_all_line {PORTD&=~0xf8;PORTB&=~0x07;} //============================================ //shift 1 bit to the rgb data driver MBI5168 void shift_1_bit(unsigned char LS); //sweep the specific line,used in the Timer1 ISR void flash_line(unsigned char line,unsigned char level); //one line with 8 rgb data,so totally 8x3=24 bits void shift_24_bit(unsigned char line,unsigned char level); //open the specific line void open_line(unsigned char line); //=============================================== //0x0bgr #define RED 0x000f #define GREEN 0x00f0 #define BLUE 0x0f00 #define BLACK 0x0000 #define WHITE 0x0fff #define VIOLET 0x0f0f #define YELLOW 0x00ff #define AQUA 0x0ff0 #define RANDOM 0x5e3 //diagonal type #define LEFT_BOTTOM_TO_RIGHT_TOP 0 #define LEFT_TOP_TO_RIGHT_BOTTOM 1 //when change leds,other led state #define OTHERS_ON 1 #define OTHERS_OFF 0 //shift direction #define LEFT 0 #define RIGHT 1 #define UP 2 #define DOWN 3 class Rainbow { public: //used for receiving color data from serial port,they can be unsigned short receiveBuffer[8][8]; public: Rainbow(void); void init(void);//invoke initIO and initTimer1 void initIO(void);//initialize IO for controlling the leds void initTimer1(void);//initialize Timer1 to 100us overflow void closeAll();//close all leds void closeOneLine(unsigned char line);//close one line void closeOneColumn(unsigned char column);//close one column void closeOneDot(unsigned char line, unsigned char column);//close specific dot void closeOneDiagonal(unsigned char line, unsigned char type);//close one diagonal line void lightAll(unsigned short colorData);//light all with one color void lightAll(unsigned short colorData[8][8]);//light all with matrix data void lightAll(void);//light all with receiveBuffer void lightOneLine(unsigned char line, unsigned short color,unsigned char othersState);//only light one line with one color void lightOneLine(unsigned char line, unsigned short color[8],unsigned char othersState);//only light one line with 8 colors void lightOneColumn(unsigned char column, unsigned short color,unsigned char othersState);//only light one column with one color void lightOneColumn(unsigned char column, unsigned short color[8],unsigned char othersState);//only light one column with 8 colors void lightOneColumn(unsigned char column, unsigned short color[8][8],unsigned char othersState);//only light one column with receiveBuffer 8 colors void lightOneDot(unsigned char line, unsigned char column, unsigned short color,unsigned char othersState);//only light one dot at specific position void lightOneDiagonal(unsigned char line, unsigned char type, unsigned short color,unsigned char othersState);//only light one diagonal line with one color void lightOneDiagonal(unsigned char line, unsigned char type, unsigned short *color,unsigned char othersState);//only light one diagonal line with a number of colors void lightOneDiagonal(unsigned char line, unsigned char type, unsigned short color[8][8],unsigned char othersState);//only light one diagonal line with receiveBuffer colors void shiftPic(unsigned char shift,unsigned short colorData[8][8]);//shift pic void dispPresetPic(unsigned char shift,unsigned char index);//disp picture preset in the flash with specific index and shift position void dispChar(unsigned char ASCII,unsigned short color,unsigned char shift);//disp character with specific shift position void dispColor(unsigned short color);//disp specific color void fillColorBuffer(unsigned char color);//fullfill one color(16bits) with conitues color data(8bits) void fillColorBuffer(unsigned short colorMatrix[8][8]);//fullfill the whole color buffer }; #endif
[ [ [ 1, 127 ] ] ]
c094756ca248e39ef7d9c19fbd33faba80a56274
1d2705c9be9ee0f974c224eb794f2f8a9e9a3d50
/bumblebee_gui/tgasave.cpp
bc7ab9b6b7eb4f434ce2b28a18f45b6fe51e692c
[]
no_license
llvllrbreeze/alcorapp
dfe2551f36d346d73d998f59d602c5de46ef60f7
3ad24edd52c19f0896228f55539aa8bbbb011aac
refs/heads/master
2021-01-10T07:36:01.058011
2008-12-16T12:51:50
2008-12-16T12:51:50
47,865,136
0
0
null
null
null
null
UTF-8
C++
false
false
3,065
cpp
//------------------------------------------------------------- /// \file tgasave.cpp /// \date 9-feb-2005 /// \author Rob Bateman /// \brief writes a 24 or 32 bit tga file to the disk. //------------------------------------------------------------- #include "tgasave.h" #include <stdlib.h> #include <stdio.h> #include <iostream> /// the tga header #pragma pack(push,1) struct TGAHeader { // sometimes the tga file has a field with some custom info in. This // just identifies the size of that field. If it is anything other // than zero, forget it. unsigned char m_iIdentificationFieldSize; // This field specifies if a colour map is present, 0-no, 1 yes... unsigned char m_iColourMapType; // only going to support RGB/RGBA/8bit - 2, colour mapped - 1 unsigned char m_iImageTypeCode; // ignore this field....0 unsigned short m_iColorMapOrigin; // size of the colour map unsigned short m_iColorMapLength; // bits per pixel of the colour map entries... unsigned char m_iColourMapEntrySize; // ignore this field..... 0 unsigned short m_iX_Origin; // ignore this field..... 0 unsigned short m_iY_Origin; // the image width.... unsigned short m_iWidth; // the image height.... unsigned short m_iHeight; // the bits per pixel of the image, 8,16,24 or 32 unsigned char m_iBPP; // ignore this field.... 0 unsigned char m_ImageDescriptorByte; }; #pragma pack(pop) bool WriteTga(const char* filename, const unsigned w, const unsigned h, const unsigned bpp, const unsigned char* pixels) { // a flag to see if writing 32 bit image bool rgba=false; // make sure format is valid (allows bits or bytes per pixel) switch(bpp) { case 4: case 32: rgba = true; break; case 3: case 24: rgba = false; break; default: std::cerr << "[ERROR] Unsupported bit depth requested" << std::endl; return false; } FILE* fp = fopen(filename,"wb"); if(!fp) { std::cerr << "[ERROR] could not save file \"" << filename << "\"" << std::endl; return false; } // fill the file header with correct info.... TGAHeader header; // wipe to 0 memset(&header,0,sizeof(TGAHeader)); // rgb or rgba image header.m_iImageTypeCode = 2; // set image size header.m_iWidth = w; header.m_iHeight = h; // set bits per pixel header.m_iBPP = rgba ? 32 : 24; // write header as first 18 bytes of output file fwrite(&header,sizeof(TGAHeader),1,fp); // get num pixels unsigned int total_size = w * h * (3 + (rgba?1:0)); unsigned int this_pixel_start = 0; // loop through each pixel for( ; this_pixel_start != total_size; this_pixel_start += 3 ) { // get address of pixel data const unsigned char* pixel = pixels + this_pixel_start; // write as BGR fputc(pixel[2],fp); fputc(pixel[1],fp); fputc(pixel[0],fp); // if RGBA also write alpha value if (rgba) { fputc(pixel[3],fp); ++this_pixel_start; } } fclose(fp); return true; }
[ "andrea.carbone@1ffd000b-a628-0410-9a29-793f135cad17" ]
[ [ [ 1, 134 ] ] ]
9621562bf45592283d8fb5716e2e96ca74c475d9
1c4a1cd805be8bc6f32b0a616de751ad75509e8d
/jacknero/src/pku_src/2369/3573411_AC_0MS_296K.cpp
fc68d206ee62e4ad9f7e9a65bb180c5c61663e21
[]
no_license
jacknero/mycode
30313261d7e059832613f26fa453abf7fcde88a0
44783a744bb5a78cee403d50eb6b4a384daccf57
refs/heads/master
2016-09-06T18:47:12.947474
2010-05-02T10:16:30
2010-05-02T10:16:30
180,950
1
0
null
null
null
null
UTF-8
C++
false
false
604
cpp
#include <iostream> #include <algorithm> using namespace std; int gcd(int a, int b) { if(a<b) swap(a,b); while(b) { a%=b; swap(a,b); } return a; } int lcm(int a, int b) { return (int)((a*(long long)b)/gcd(a,b)); } int main() { int N,res,i,cnt,t; int a[1002]; cin >> N; for(i=1;i<=N;i++) cin >> a[i]; res = 1; for(i=1;i<=N;i++) { for(cnt=1,t=a[i];t!=i;cnt++,t=a[t]); res = lcm(res,cnt); } cout << res << endl; return 0; }
[ [ [ 1, 34 ] ] ]
be14b1e09596648ea4b83b3392c1dd1ed099c8d8
9aedcc9da750a80a8d12238f24d5825e5f0469e6
/woodHarvestStatCountry.cpp
0de4afef0897167d802f2ef73fa291992081721a
[]
no_license
andriybun/g4m-parallel
87c2304bbcee089f603739068bfa5054d5556481
62746076660c9ecff25079b4961c15f521ea9a4d
refs/heads/master
2021-01-25T12:20:36.616586
2009-10-18T19:20:25
2009-10-18T19:20:25
32,204,814
0
0
null
null
null
null
UTF-8
C++
false
false
2,229
cpp
void woodHarvestStatCountry(void) { for (int i=0; i<=208; i++) {woodHarvestStat[i]=0.;} // wood harvest statistics for 1990 (FRA 2005). Total removals from forest, m3 /* woodHarvestStat[11-1]=17318000.; // Austria woodHarvestStat[25-1]=368706000.; // Brasil woodHarvestStat[33-1]=195869000.; // Canada woodHarvestStat[38-1]=159081000.; //China woodHarvestStat[61-1]=47203000.; // Finland woodHarvestStat[62-1]=55621000.; // France woodHarvestStat[69-1]=42177000.; // Germany woodHarvestStat[156-1]=336527000.; //Russia woodHarvestStat[165-1]=5545000.; //Slovakia woodHarvestStat[179-1]=58140000.; //Sweden woodHarvestStat[197-1]=596920000.; //US */ // wood harvest statistics for 1990 (FRA 2005). Total removals from forest, m3. Annex-1 countries woodHarvestStat [ 9 ]= 20331000 ; woodHarvestStat [ 10 ]= 17318000 ; woodHarvestStat [ 16 ]= 4352000 ; woodHarvestStat [ 24 ]= 368706000.; // Brasil woodHarvestStat [ 26 ]= 3400000 ; woodHarvestStat [ 29 ]= 7367000 ; woodHarvestStat [ 32 ]= 195869000 ; woodHarvestStat [ 42 ]= 2287000 ; woodHarvestStat [ 45 ]= 13030000 ; woodHarvestStat [ 46 ]= 2023000 ; woodHarvestStat [ 55 ]= 3206000 ; woodHarvestStat [ 60 ]= 47203000 ; woodHarvestStat [ 61 ]= 55621000 ; woodHarvestStat [ 68 ]= 42177000 ; woodHarvestStat [ 70 ]= 2979000 ; woodHarvestStat [ 81 ]= 5945000 ; woodHarvestStat [ 88 ]= 1789000 ; woodHarvestStat [ 91 ]= 9877000 ; woodHarvestStat [ 95 ]= 3113000 ; woodHarvestStat [ 106 ]= 4820000 ; woodHarvestStat [ 111 ]= 21000 ; woodHarvestStat [ 112 ]= 3651000 ; woodHarvestStat [ 113 ]= 230000 ; woodHarvestStat [ 127 ]= 0 ; woodHarvestStat [ 134 ]= 1518000 ; woodHarvestStat [ 136 ]= 13841000 ; woodHarvestStat [ 141 ]= 12475000 ; woodHarvestStat [ 149 ]= 23617000 ; woodHarvestStat [ 150 ]= 11922000 ; woodHarvestStat [ 154 ]= 17218000 ; woodHarvestStat [ 155 ]= 336527000 ; woodHarvestStat [ 164 ]= 5545000 ; woodHarvestStat [ 165 ]= 2978000 ; woodHarvestStat [ 169 ]= 18517000 ; woodHarvestStat [ 178 ]= 58140000 ; woodHarvestStat [ 179 ]= 5345000 ; woodHarvestStat [ 189 ]= 36104000 ; woodHarvestStat [ 193 ]= 13590000 ; woodHarvestStat [ 195 ]= 7152000 ; woodHarvestStat [ 196 ]= 596920000 ; }
[ "Andr.Bun@efe78254-b83b-11de-a71d-8f2b2e058ad8" ]
[ [ [ 1, 63 ] ] ]
3e5326cde1038e8680d57a7748ae3de7519a5bd7
cb318077a36ea2885b66ebdfb61cb37f9096b27d
/MT4ODBCBridge/cppodbc.h
852928d0cd3e9d9cb5cd101a462f8eacf8f1e490
[]
no_license
danmi1258/mt4-odbc-bridge
aede37e60959d60e0b524c0d25f7c4e24164113e
422d2ae4137886babdbf6dff17e594f8d729049f
refs/heads/master
2021-05-26T13:54:46.648670
2011-08-29T10:48:51
2011-08-29T10:48:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
12,749
h
#include <Windows.h> #include <tchar.h> #include <sqlext.h> #include <time.h> #include <vector> #define EX_SQLSTATE_LEN 6 #define EX_ERRMESG_LEN SQL_MAX_MESSAGE_LENGTH /** * CPPODBC: a plain object-oriented C++ wrapper for ODBC API. * * This provides read/write access for the most basic primitive data types; * integer, floating point number, string, and timestamp. * Stream types such as CLOB and BLOB are not and will not be supported. * * Parameter binding and prepared statements, and column binding and row * fetching are also suppored. * Those parameters and columns are bound to C variables through their * pointers. * * Classes in this namespace basically don't hide original SQL types, * included by sql.h and sqlext.h. * Those just reconstruct the original C API into an object-oriented way, * using constructor/destructor, inheritance, exception handling, etc. * A user is intended to rewrap those classes to suit your domain. * * You should consult the original ODBC API for any details. * http://msdn.microsoft.com/en-us/library/ms714562(v=vs.85).aspx * * ODBC Appendixes, which includes like the C-SQL type mapping, are also * helpful. * http://msdn.microsoft.com/en-us/library/ms710927(v=VS.85).aspx * * [Converting Data from C to SQL Data Types] * http://msdn.microsoft.com/en-us/library/ms716298(v=VS.85).aspx */ namespace cppodbc { /** * Exception class that contains SQL error message. */ class ODBCException { int nativeError; TCHAR sqlState[EX_SQLSTATE_LEN]; TCHAR errorMesg[EX_ERRMESG_LEN]; public: ODBCException(int nativeError, const TCHAR *sqlState, const TCHAR *errorMesg); ~ODBCException(); inline int getNativeError() { return nativeError; }; inline TCHAR* getSQLState() { return sqlState; }; inline TCHAR* getErrorMesg() { return errorMesg; }; }; /* * Just declares in the following use. */ class Environment; class Connection; class Statement; /** * This represents the common resource used in ODBC API. * Allocated in the constructor and be freed in the destructor. * * It also manages exception handling process because the handler * plays a central role in ODBC API. */ class Handler { friend class Environment; friend class Connection; friend class Statement; SQLRETURN retcode; SQLSMALLINT hType; SQLHANDLE handle; protected: Handler(SQLSMALLINT hType, SQLHANDLE parent); ~Handler(); SQLRETURN process(SQLRETURN rc); ODBCException* makeException(); //TODO: extract [get|set]Attribute methods into this super class }; /** * Environment handle which generates a Connection handle. */ class Environment : public Handler { public: Environment(); ~Environment(); void setAttribute(int aType, int value); int getAttribute(int aType); }; /** * Connection handle which generates a Statement handle. */ class Connection : public Handler { public: Connection(Environment *env); ~Connection(); void setAttribute(int aType, int value); int getAttribute(int aType); void connect(const TCHAR *dsn, const TCHAR *username, const TCHAR *password); void disconnect(); int isDead(); void commit(); void rollback(); int getAutoCommit(); void setAutoCommit(int autoCommit); }; /* * Just declares in the following use. */ class DataPointer; class UIntTimetPointer; /** * Statement handle which represents a SQL statement. * This also holds bound parameters for the prepared statement, * and bound columns for SELECT statement. * Those paramters and columns are represented by DataPointer class. * The lifetime of a DataPointer instance is the same with the * statement it belongs to. * This means paramters and columns are supposed to bound once per * statement, otherwise they leak. */ class Statement : public Handler { //TODO: rewrite to use parameterHolder and columnHolder DataPointer* parameters; int paramNum; DataPointer* columns; int colNum; //TODO: there may be better way to roll out, like a stop condition void (*rowHandler)(int rowCnt, DataPointer *dps, int size, void *anyPointer); void* anyPointer; std::vector<DataPointer*> parameterHolder; std::vector<DataPointer*> columnHolder; std::vector<UIntTimetPointer*> indirectDataPointers; //TODO: use polymorphism! public: Statement(Connection *dbc); ~Statement(); void setAttribute(int aType, int value); int getAttribute(int aType); void free(); int execute(const TCHAR *sql); void prepare(const TCHAR *sql); void bindIntParameter(int slot, int *intp); void bindDoubleParameter(int slot, double *dblp); void bindStringParameter(int slot, TCHAR *strp); void bindTimestampParameter(int slot, SQL_TIMESTAMP_STRUCT *tsp); //void bindTimetParameter(int slot, time_t *tp); void bindUIntTimetParameter(int slot, unsigned int *tp); void bindParameter(int slot, DataPointer *dp); void bindParameters(DataPointer *dps, int size); void bindIntColumn(int slot, int *intp); void bindDoubleColumn(int slot, double *dblp); void bindStringColumn(int slot, TCHAR *strp); void bindTimestampColumn(int slot, SQL_TIMESTAMP_STRUCT *tsp); //void bindTimetColumn(int slot, time_t *tp); void bindUIntTimetColumn(int slot, unsigned int *tp); void bindColumn(int slot, DataPointer *dp); void bindColumns(DataPointer *dps, int size); void setRowHandler(void (*rowHandler)(int rowCnt, DataPointer *dps, int size, void *anyPointer), void *anyPointer); int execute(); int execute(bool fetchImmediatly); int fetch(); void fetchedAll(); private: int afterExecution(); }; /** * This represents a general data to be processed. * It is used in parameter binding and column binding too. * This is subclassed to each specific type. * Each subclass hides the tedious setting of the original API, * such as SQLBindParameter and SQLBindCol. */ class DataPointer { SQLSMALLINT cType; SQLSMALLINT sqlType; SQLULEN columnSize; SQLSMALLINT scale; SQLPOINTER dataPointer; SQLLEN dataSize; SQLLEN* lenOrInd; public: DataPointer(SQLSMALLINT cType, SQLSMALLINT sqlType, SQLULEN columnSize, SQLSMALLINT scale, SQLPOINTER dataPointer, SQLLEN dataSize); ~DataPointer(); inline SQLSMALLINT getCType() { return cType; }; inline SQLSMALLINT getSQLType() { return sqlType; }; inline SQLULEN getColumnSize() { return columnSize; }; inline SQLSMALLINT getScale() { return scale; }; inline SQLPOINTER getDataPointer() { return dataPointer; } inline SQLLEN getDataSize() { return dataSize; }; inline SQLLEN* getLenOrInd() { return lenOrInd; }; void setNull(); int isNull(); int length(); //TODO: extract more methods like value() from subclasses protected: /** * DataPointer contains 2 pointers. * One is dataPointer and another is lenOrInd. * The former points the data you want to process. * The latter points the auxiliary information about the data, * such as the length of the data for array types, or whether * the data is null or not. * The latter can be omitted in typical use. * So this field is provided by this class, not by user. * Note that pointed space is needed to exist for all time you * process. */ SQLLEN lengthOrIndicator; }; /** * DataPointer for integers. */ class IntPointer : public DataPointer { public: IntPointer(int *intp); ~IntPointer(); inline int value() { return *((int *) getDataPointer()); }; }; /** * DataPointer for floating point numbers. */ class DoublePointer : public DataPointer { public: DoublePointer(double *doublep); ~DoublePointer(); inline double value() { return *((double *) getDataPointer()); }; }; /** * DataPointer for strings. */ class StringPointer : public DataPointer { public: StringPointer(TCHAR *stringp, int size); ~StringPointer(); inline TCHAR* value() { return (TCHAR *) getDataPointer(); }; }; /** * DataPointer for timestamps. * SQL_TIMESTAMP_STRUCT is declared in sql.h. * fractionScale represents milli or micro or nano second, but most * implementation like MySQL and PostgreSQL seem to ignore it. * Maybe recompilation with specific flag is needed to use it. */ class TimestampPointer : public DataPointer { public: TimestampPointer(SQL_TIMESTAMP_STRUCT *timestamp); TimestampPointer(SQL_TIMESTAMP_STRUCT *timestamp, int fractionScale); ~TimestampPointer(); inline SQL_TIMESTAMP_STRUCT *value() { return (SQL_TIMESTAMP_STRUCT *) getDataPointer(); }; // converting methods static void structtm2timestamp(struct tm *in, SQL_TIMESTAMP_STRUCT *out); static void timestamp2structtm(SQL_TIMESTAMP_STRUCT *in, struct tm *out); static void timet2timestamp(time_t *in, SQL_TIMESTAMP_STRUCT *out); static void timestamp2timet(SQL_TIMESTAMP_STRUCT *in, time_t *out); }; /** * Another DataPointer for timestamp type, using time_t type. * ODBC API recognizes only SQL_TIMESTAMP_STRUCT. * So if you reflect the newly binded or newly fetched value, * call the corresponding helper method. * Statement class does so through indirectDataPointers field. */ class TimetPointer : public TimestampPointer { time_t* timeType; SQL_TIMESTAMP_STRUCT timestamp; public: TimetPointer(time_t *timet); ~TimetPointer(); inline time_t *value() { return timeType; }; void rebind(); void refetch(); }; /** * For time_t which is actually a unsigned int. */ class UIntTimetPointer : public TimetPointer { unsigned int* uintp; time_t timet; public: UIntTimetPointer(unsigned int *uintTimet); ~UIntTimetPointer(); inline unsigned int *value() { return uintp; }; void rebind(); void refetch(); }; /** * DataPointer for dates. */ class DatePointer : public DataPointer { public: DatePointer(SQL_DATE_STRUCT *datep); ~DatePointer(); inline SQL_DATE_STRUCT *value() { return (SQL_DATE_STRUCT *) getDataPointer(); }; }; /** * DataPointer for times. */ class TimePointer : public DataPointer { public: TimePointer(SQL_TIME_STRUCT *timep); ~TimePointer(); inline SQL_TIME_STRUCT *value() { return (SQL_TIME_STRUCT *) getDataPointer(); }; }; /** * DataPointer for generic numbers. * This uses SQL_NUMERIC_STRUCT declared in sql.h. * This is for text representations of numbers, especially fixed point * numbers and very large numbers int or double cannot handle. */ class NumericPointer : public DataPointer { public: NumericPointer(SQL_NUMERIC_STRUCT *numericp, int precision, int scale); ~NumericPointer(); inline SQL_NUMERIC_STRUCT *value() { return (SQL_NUMERIC_STRUCT *) getDataPointer(); }; // helper methods static void numstruct2double(SQL_NUMERIC_STRUCT *nums, double *dbl); double doubleValue(); }; }
[ "onagano" ]
[ [ [ 1, 355 ] ] ]
63a2a00f048ddc065d92e9def07353c0c4885242
b22c254d7670522ec2caa61c998f8741b1da9388
/dependencies/OsgAl/include/openalpp/AudioEnvironment
de8a4244b1a0ee4313bca4fb08f14d3134f65cb6
[]
no_license
ldaehler/lbanet
341ddc4b62ef2df0a167caff46c2075fdfc85f5c
ecb54fc6fd691f1be3bae03681e355a225f92418
refs/heads/master
2021-01-23T13:17:19.963262
2011-03-22T21:49:52
2011-03-22T21:49:52
39,529,945
0
1
null
null
null
null
IBM852
C++
false
false
5,207
/* -*-c++-*- */ /** * OsgAL - OpenSceneGraph Audio Library * Copyright (C) 2004 VRlab, Umeň University * * 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. */ #ifndef AUDIOENVIROMENT_H_INCLUDED_C4211030 #define AUDIOENVIROMENT_H_INCLUDED_C4211030 #include "openalpp/AudioBase" namespace openalpp { /** * Enum for setting/getting the current distance model. * None means no model is in use, i.e. no attenuation.\n * InverseDistance:\n * - \f$G=GAIN-20*log_{10}*(1+ROLLOFF*\frac{dist-REFERENCE\_DISTANCE}{REFERENCE\_DISTANCE})\f$ * - \f$G=min (G,MAX\_GAIN)\f$ * - \f$G=max (G,MIN\_GAIN)\f$ * * InverseDistanceClamped:\n * - \f$dist=max (dist,REFERENCE\_DISTANCE)\f$ * - \f$dist=min (dist,MAX\_DISTANCE)\f$ * - And then the calculations in InverseDistance... This is equivalent to the * <a href="http://www.iasig.org>IASIG</a> I3DL2 distance model.\n * * In the above calculations, the variables have the following meanings:\n * - dist is the distance from the listener to the source.\n * - REFERENCE_DISTANCE are the distance at which the listener will experience * GAIN. Both are set per source.\n * - ROLLOFF is a source specific factor of attenuation. If it's set to one, * the InverseDistance model will describe a "physically correct" inverse * square behaviour.\n * - MIN_GAIN, MAX_GAIN and MAX_DISTANCE are values used for clamping gain * and distance, respectively. */ #include "openalpp/Export" #ifdef None #undef None // Defined in X-headers #endif enum DistanceModel {None,InverseDistance,InverseDistanceClamped}; /** * Class for setting global parameters. * This doesn't have to be instantiated if one does not need to set global * parameters. */ class OPENALPP_API AudioEnvironment : public AudioBase { public: /** * Constructor. */ AudioEnvironment() throw (InitError); /** * Constructor. * The parameters are ignored if this isn't the first object to be * instantiated of the AudioBase descendants. * @param frequency is the playing frequency of the environment (in Hz) * @param refresh is the refresh rate of the environment (in Hz) * @param synchronous is true if the environment is synchronous */ AudioEnvironment(int frequency,int refresh,bool synchronous) throw (InitError); /** * Constructor. * The parameters are ignored if this isn't the first object to be * instantiated of the AudioBase descendants. * @param frequency is the playing frequency of the environment (in Hz) * @param refresh is the refresh rate of the environment (in Hz) */ AudioEnvironment(int frequency,int refresh=-1) throw (InitError); /** * Sets the speed of sound in the environment. * This is used in Doppler calculations. * @param speed is the speed of sound in length units per second. */ void setSoundVelocity(float speed) throw (ValueError,FatalError); /** * Get the speed of sound in the environment. * @return speed of sound in length units per second. */ float getSoundVelocity() throw (FatalError); /** * Sets the Doppler factor. * This can be used to exaggerate, deemphasize or completely turn off the * Doppler effect. * @param factor has a default value of one. */ void setDopplerFactor(float factor) throw (ValueError,FatalError); /** * Gets the Doppler factor. * @return Doppler factor. */ float getDopplerFactor() throw (FatalError); /** * Sets global gain (volume). * The volume a source will be played at will be multiplied by this _after_ * the attenuation calculations. * Note: In today's implementation on Linux, gain is clamped to [0.0,1.0]. * This will be changed in future releases of OpenAL. * @param gain is the gain [0.0,... */ void setGain(float gain); /** * Gets the global gain * @return global gain */ float getGain() throw (FatalError); /** * Sets the distance model used in attenuation calculations. * @param model is one of: None, InverseDistance, InverseDistanceClamped. */ void setDistanceModel(DistanceModel model) throw (FatalError); /** * Gets the distance model used in attenuation calculations. * @return the model. */ DistanceModel getDistanceModel() throw (FatalError); /** * Initiates Loki's reverb implementation. */ void initiateReverb() throw (InitError); }; } #endif /* AUDIOENVIROMENT_H_INCLUDED_C4211030 */
[ "vdelage@3806491c-8dad-11de-9a8c-6d5b7d1e4d13" ]
[ [ [ 1, 157 ] ] ]
04820b26f185053198ee34c09fb50696d3b66d38
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/app/location/landmarks_ui_selector_api/BcAppLmkSelector/inc/BCAppLmkSelectorEngine.h
2b84dafbd6882f5ec6af8181eb2ca430b468b41f
[]
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
2,143
h
/* * Copyright (c) 2003 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: * */ #ifndef BCAPPLMKSELECTORENGINE_H #define BCAPPLMKSELECTORENGINE_H // INCLUDES //#include "BCAppLmkSelectorContainer.h" #include <coecntrl.h> #include <coeccntx.h> #include <eikenv.h> #include <CSatelliteInfoUi.h> #include <EPos_CPosLandmarkDatabase.h> #include <CLmkEditorDlg.h> #include <coemop.h> #include <CLmkLandmarkSelectorDlg.h> #include <CLmkCategorySelectorDlg.h> #include <TLmkItemIdDbCombiInfo.h> // FORWARD DECLARATIONS // CLASS DECLARATION /* CBCAppLmkSelectorEngine */ class CBCAppLmkSelectorEngine : public CBase, public MObjectProvider { public: static CBCAppLmkSelectorEngine* NewL(); /*~CBCAppLmkSelectorEngine(); void RunL(); void DoCancel(); void Init(); void IssueTest(); void ExecuteTestCase(); void SetTestCaseNumber(const TDesC8 &aNumber); public: TBuf<15> iText;*/ protected: TTypeUid::Ptr MopSupplyObject(TTypeUid aId); MObjectProvider* MopNext(); private: CBCAppLmkSelectorEngine(); /* void ConstructL(CBCAppLmkSelectorContainer* aContainer); void ExecuteTestL(); void SetTestCase(const TDesC& aHeaderName, const TDesC& aFunctionName); void Print(const TDesC& aDes); void Print(const TDesC8& aDes); void Print(TInt aInt); void CreateNewLandmark(); private: RTimer iTimer; CEikonEnv* iEnv; CBCAppLmkSelectorContainer* iContainer; TInt iCurrentTest; TBool iWarningIssued; TBool iExecuteAllTests; TBool iAllTestsDone; TBuf<64> iCurrentHeaderName; TBuf<128> iCurrentFunctionName; RWsSession iWs; CActiveSchedulerWait iWait;*/ }; #endif // End of File
[ "none@none" ]
[ [ [ 1, 96 ] ] ]
8b1ca794f17b46db4a00be5e8a7130f272067593
b8c3d2d67e983bd996b76825f174bae1ba5741f2
/RTMP/utils/zipstream_demo/zip_stream_test/bzip2_stream_test.hpp
4108cc532397d330ae567768c156846c8ea465ff
[]
no_license
wangscript007/rtmp-cpp
02172f7a209790afec4c00b8855d7a66b7834f23
3ec35590675560ac4fa9557ca7a5917c617d9999
refs/heads/master
2021-05-30T04:43:19.321113
2008-12-24T20:16:15
2008-12-24T20:16:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,189
hpp
/* zipstream Library License: -------------------------- The zlib/libpng License Copyright (c) 2003 Jonathan de Halleux. This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution Author: Jonathan de Halleux, [email protected], 2003 */ namespace bzip2_stream{ void test_buffer_to_buffer(); void test_wbuffer_to_wbuffer(); void test_string_string(); void test_wstring_wstring(); void test_file_file(); };
[ "fpelliccioni@71ea4c15-5055-0410-b3ce-cda77bae7b57" ]
[ [ [ 1, 28 ] ] ]
55de7df85c52fbc821fb2bc171ac7132ddf32ada
9a5db9951432056bb5cd4cf3c32362a4e17008b7
/FacesCapture/branches/FaceCompare/FaceSelDll/FaceSel.cpp
08b64f99d415923ab406540638d2f74dfa9f991a
[]
no_license
miaozhendaoren/appcollection
65b0ede264e74e60b68ca74cf70fb24222543278
f8b85af93f787fa897af90e8361569a36ff65d35
refs/heads/master
2021-05-30T19:27:21.142158
2011-06-27T03:49:22
2011-06-27T03:49:22
null
0
0
null
null
null
null
UTF-8
C++
false
false
384
cpp
#include "FaceSelect.h" #include "FaceSel.h" void ReleaseImageArray( ImageArray &images ) { int i = 0; for( i = 0; i < images.nImageCount; i++ ) { cvReleaseImage( &images.imageArr[i] ); } images.nImageCount = 0; delete[] images.imageArr; images.imageArr = 0; } //////////////////////////End -- 20090929 Added for Face Recognition///////////////////////////
[ "shenbinsc@cbf8b9f2-3a65-11de-be05-5f7a86268029" ]
[ [ [ 1, 17 ] ] ]
2d015700a00229ea523c20408ab9f1e742272a12
2b32433353652d705e5558e7c2d5de8b9fbf8fc3
/Dm_new_idz/Mlita/AdjacencyList.cpp
d45b1f577585b15ba4d1011cc2e5a2efff6f7f70
[]
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
579
cpp
// AdjacencyList.cpp: implementation of the CAdjacencyList class. // ////////////////////////////////////////////////////////////////////// #include "stdafx.h" #include "Mlita.h" #include "AdjacencyList.h" #ifdef _DEBUG #undef THIS_FILE static char THIS_FILE[]=__FILE__; #define new DEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// CAdjacencyList::CAdjacencyList() { } CAdjacencyList::~CAdjacencyList() { }
[ [ [ 1, 27 ] ] ]
e9a38c3f6bc909b243ca4c55a8c0fb4236b2f9ba
024dd2ce08c491bfe8441b0633ccd5f09a787a73
/particle_system.h
2bdd302db6d1d8a3d9df7ae8d522038faa19092c
[]
no_license
Alyanorno/particle_system
838ac983d89853337d37b7d2509913731d2e952e
9135297e00abea29b6c063d097362838c1ac75ba
refs/heads/master
2016-09-05T18:09:38.014344
2011-02-02T20:03:04
2011-02-02T20:03:04
1,257,590
0
0
null
null
null
null
UTF-8
C++
false
false
1,431
h
#pragma once #include <windows.h> #include <gl/GL.h> #include <gl/GLU.h> #include "vector.h" template < int size, class Policy > class ParticleSystem : private Policy { typedef typename Policy::Particle Particle; typedef typename linear_math::Vector<3> Vector; public: ParticleSystem() : Policy(), _size(0) {} void Initialize() { Policy::Initialize(); } void Clear() { _size = 0 } void Emit( int amount, Vector direction = Vector( 0, 0, 0 ) ) { if( _size + amount > size ) amount = size - _size; for( int i(0); i < amount; i++ ) _particles[i+_size] = Policy::Create( direction ); _size += amount; } void SetPosition( float x, float y, float z ) { Policy::startPosition[0] = x; Policy::startPosition[1] = y; Policy::startPosition[2] = z; } void Update() { for( int i(0); i < _size; i++ ) if( !Policy::Remove( _particles[i] ) ) Policy::Update( _particles[i] ); else _particles[i] = _particles[--_size]; } void Draw() { glPushMatrix(); float view[16]; glGetFloatv(GL_MODELVIEW_MATRIX , view); for( int i(0); i<3; i++ ) for( int j(0); j<3; j++ ) if ( i==j ) view[i*4+j] = 1.0; else view[i*4+j] = 0.0; glLoadMatrixf(view); Policy::Prepare(); for( int i(0); i < _size; i++ ) Policy::Draw( _particles[i] ); glPopMatrix(); } private: Particle _particles[size]; int _size; };
[ [ [ 1, 64 ] ] ]
00c9ef7cf28390d795be4c6a0d5b31657c95a857
0f457762985248f4f6f06e29429955b3fd2c969a
/irrlicht/src/proto_SA/AIPlayer.h
f8aca53d982d3eddeb03f2bfef17c4169d810148
[]
no_license
tk8812/ukgtut
f19e14449c7e75a0aca89d194caedb9a6769bb2e
3146ac405794777e779c2bbb0b735b0acd9a3f1e
refs/heads/master
2021-01-01T16:55:07.417628
2010-11-15T16:02:53
2010-11-15T16:02:53
37,515,002
0
0
null
null
null
null
UHC
C++
false
false
420
h
#pragma once class CAIPlayer : public CPlayer { irr::scene::CBulletChracterAnimator *m_pChracterAnimator; irr::core::vector3df m_vTargetDir; irr::f32 m_accTick; //누적 시간계산용 public: CAIPlayer(void); virtual ~CAIPlayer(void); virtual void Signal(std::string strSignal,void *pParam); virtual void Update(irr::f32 fDelta); virtual bool Init(irr::scene::ISceneNode *pNode); };
[ "gbox3d@58f0f68e-7603-11de-abb5-1d1887d8974b" ]
[ [ [ 1, 20 ] ] ]
ab1ff806ec6454660e8b0ff3fa36cc45b44d6d69
0cf09d7cc26a513d0b93d3f8ef6158a9c5aaf5bc
/twittle/include/login_panel.h
f2c07491915f22c890d0ccb3a901262794dae3c0
[]
no_license
shenhuashan/Twittle
0e276c1391c177e7586d71c607e6ca7bf17e04db
03d3d388d5ba9d56ffcd03482ee50e0a2a5f47a1
refs/heads/master
2023-03-18T07:53:25.305468
2009-08-11T05:55:07
2009-08-11T05:55:07
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,312
h
#pragma once #include <wx/wx.h> DECLARE_EVENT_TYPE(wxEVT_LOGIN_SUCCESS, -1) DECLARE_EVENT_TYPE(wxEVT_LOGIN_FAILED, -2) /** * Implements a login window whereby the user can * enter account information and have it remembered. */ class LoginPanel : public wxPanel { wxTextCtrl username; wxTextCtrl password; wxButton loginButton; wxStaticText errorLabel; wxCheckBox rememberCheck; // For remembering login user, used by events wxString s_user; wxString s_pass; bool s_saveUserPass; bool loggedIn; /// Control identifiers enum ControlIdentifiers { ID_USERNAME, ID_PASSWORD, ID_BUTTON }; /** Initializes window components */ void InitializeComponents(); protected: /** * Performs a verification of the login credentials * using the account settings set in the text boxes. * Sets the #loggedIn status to true if the authorization succeeds. * * @warning This code runs in a thread via a ThreadCallback and * should therefore not attempt to directly interact with the GUI. */ void Login(); public: /** * Creates the login panel. * * @param parent the owning frame (most likely MainWindow) * @param autoLogin if set to true, will attempt to automatically * login using any saved account settings */ LoginPanel(wxWindow *parent, bool autoLogin = false); /// /// @name Window Events /// // @{ /** * Catch the paint event to draw the logo. This is done because * wxStaticBitmap does not support images larger than 64x64. */ void OnPaint(wxPaintEvent& evt); /** * Activated when the login button is pressed. Initiates a * ThreadCallback to #Login and waits for #loggedIn to be filled. * Times out after 10 seconds. */ void OnLogin(wxCommandEvent& evt); /** * Activated when Login succeeds. * Saves account settings if "remember me" is checked. * Shows the main panel */ void OnLoginSuccess(wxCommandEvent& evt); /** * Displays an error message if authorization fails */ void OnLoginFailed(wxCommandEvent& evt); /** * Handle the text event in the password box so that the * ENTER key will act as if the user clicked the login button. */ void OnText(wxCommandEvent& evt); DECLARE_EVENT_TABLE(); // @} };
[ [ [ 1, 94 ] ] ]
47a10c0506014dbf430ee3ca18d96bd2fb3c2ebd
4b30b09448549ffbe73c2346447e249713c1a463
/Sources/ccontainer/ccontainer.h
878ea1aa01d8dd5c9cde145c9e3e2c2604643918
[]
no_license
dblock/agnes
551fba6af6fcccfe863a1a36aad9fb066a2eaeae
3b3608eba8e7ee6a731f0d5a3191eceb0c012dd5
refs/heads/master
2023-09-05T22:32:10.661399
2009-10-29T11:23:28
2009-10-29T11:23:28
1,998,777
1
1
null
null
null
null
UTF-8
C++
false
false
2,607
h
#ifndef ccontainer_h #define ccontainer_h #include <platform/platform.h> #include <fcntl.h> #include <platform/cgi_aid.h> #include <cvector/cvector.h> #include <cstring/cstring.h> #include "centrymultiple.h" #include <chashtable/chashtable.h> class entry_manager { friend ostream& operator<<(ostream& out, const entry_manager&); public: CStringHashTable Singles; CHashTable<CEntryMultiple> Multiples; inline void add_value(const CString& name, const CString& value) { Singles.Add(name, value); } CString make_equiv_path(const CString& structure); CString Root; entry_manager(void); entry_manager(entry_manager&); ~entry_manager(void); inline void set_value(const CString& name, const CString& value) { set_value(name, value, 0, 0); } inline void set_value(const CString& name, const CString& value, int fail, int warning) { Singles.Set(name, value, fail, warning); } inline CString get_value(const CString& name) const { return Singles.Search(name); } inline CString get_value(int index) const { return Singles.Get(index); } inline CString get_name(int index) const { return Singles.GetKey(index); } void add_value(const CString& class_name, const CString& name, const CString& value); void set_value(const CString& class_name, const CString& name, const CString& value, int fail, int warning); inline void set_value(const CString& class_name, const CString& name, const CString& value) { set_value(class_name, name, value, 0, 0); } CString get_value(const CString& class_name, const CString& name) const; CString get_value(const CString& class_name, int index) const; inline CString get_name(int class_index, int index) const { return Multiples[class_index].Entries.GetKey(index); } CString get_name(const CString& class_name, int index) const; inline CString get_value(int class_index, int index) const { return Multiples[class_index].Entries.Get(index); } inline CString get_class(int index) const { return Multiples[index].Name; } inline int class_count(void) const { return Multiples.Count(); } inline int class_count(int class_index) const { return Multiples[class_index].Entries.Count(); } int class_count(const CString& class_name); inline int find_single(const CString& class_name) const { return Singles.Contains(class_name); } inline int find_multiple(const CString& class_name) const { return Multiples.Contains(class_name); } inline int entries_count(void) { return Singles.Count(); } void clear(void); void del_value(const CString& class_name); }; #endif
[ [ [ 1, 56 ] ] ]
6d5baf5201afd36b3015639b83d3dc0fbb5bf6b8
3ecc6321b39e2aedb14cb1834693feea24e0896f
/src/mathlib.cpp
3448c73b5600b3e224e042bd0c012b3d7b1a4b61
[]
no_license
weimingtom/forget3d
8c1d03aa60ffd87910e340816d167c6eb537586c
27894f5cf519ff597853c24c311d67c7ce0aaebb
refs/heads/master
2021-01-10T02:14:36.699870
2011-06-24T06:21:14
2011-06-24T06:21:14
43,621,966
1
1
null
null
null
null
UTF-8
C++
false
false
11,237
cpp
/***************************************************************************** * Copyright (C) 2009 The Forget3D Project by Martin Foo ([email protected]) * ALL RIGHTS RESERVED * * License I * Permission to use, copy, modify, and distribute this software for * any purpose and WITHOUT a fee is granted under following requirements: * - You make no money using this software. * - The authors and/or this software is credited in your software or any * work based on this software. * * Licence II * Permission to use, copy, modify, and distribute this software for * any purpose and WITH a fee is granted under following requirements: * - As soon as you make money using this software, you have to pay a * licence fee. Until this point of time, you can use this software * without a fee. * Please contact Martin Foo ([email protected]) for further details. * - The authors and/or this software is credited in your software or any * work based on this software. * * THE MATERIAL EMBODIED ON THIS SOFTWARE IS PROVIDED TO YOU "AS-IS" * AND WITHOUT WARRANTY OF ANY KIND, EXPRESS, IMPLIED OR OTHERWISE, * INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY OR * FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHORS * BE LIABLE TO YOU OR ANYONE ELSE FOR ANY DIRECT, SPECIAL, INCIDENTAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, * INCLUDING WITHOUT LIMITATION, LOSS OF PROFIT, LOSS OF USE, SAVINGS OR * REVENUE, OR THE CLAIMS OF THIRD PARTIES, WHETHER OR NOT THE AUTHORS HAVE * BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS, HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE * POSSESSION, USE OR PERFORMANCE OF THIS SOFTWARE. *****************************************************************************/ #include "mathlib.h" namespace F3D { /** * Quaternion class for all games using F3D, from rsn: * Author: Brett Porter * Email: [email protected] * Website: http://rsn.gamedev.net/pl3d */ void Quaternion::fromAngles( const float *angles ) { float angle; double sr, sp, sy, cr, cp, cy; angle = angles[2]*0.5f; sy = sin( angle ); cy = cos( angle ); angle = angles[1]*0.5f; sp = sin( angle ); cp = cos( angle ); angle = angles[0]*0.5f; sr = sin( angle ); cr = cos( angle ); double crcp = cr*cp; double srsp = sr*sp; m_quat[0] = ( float )( sr*cp*cy-cr*sp*sy ); m_quat[1] = ( float )( cr*sp*cy+sr*cp*sy ); m_quat[2] = ( float )( crcp*sy-srsp*cy ); m_quat[3] = ( float )( crcp*cy+srsp*sy ); } void Quaternion::slerp( const Quaternion& q1, Quaternion& q2, float interp ) { // Decide if one of the quaternions is backwards int i; float a = 0, b = 0; for ( i = 0; i < 4; i++ ) { a += ( q1[i]-q2[i] )*( q1[i]-q2[i] ); b += ( q1[i]+q2[i] )*( q1[i]+q2[i] ); } if ( a > b ) q2.inverse(); float cosom = q1[0]*q2[0]+q1[1]*q2[1]+q1[2]*q2[2]+q1[3]*q2[3]; double sclq1, sclq2; if (( 1.0+cosom ) > 0.00000001 ) { if (( 1.0-cosom ) > 0.00000001 ) { double omega = acos( cosom ); double sinom = sin( omega ); sclq1 = sin(( 1.0-interp )*omega )/sinom; sclq2 = sin( interp*omega )/sinom; } else { sclq1 = 1.0-interp; sclq2 = interp; } for ( i = 0; i < 4; i++ ) m_quat[i] = ( float )( sclq1*q1[i]+sclq2*q2[i] ); } else { m_quat[0] = -q1[1]; m_quat[1] = q1[0]; m_quat[2] = -q1[3]; m_quat[3] = q1[2]; sclq1 = sin(( 1.0-interp ) * 0.5 * M_PI ); sclq2 = sin( interp * 0.5 * M_PI ); for ( i = 0; i < 3; i++ ) m_quat[i] = ( float )( sclq1*q1[i]+sclq2*m_quat[i] ); } } /** * Matrix class for all games using F3D, from rsn: * Author: Brett Porter * Email: [email protected] * Website: http://rsn.gamedev.net/pl3d */ Matrix::Matrix() { #if (defined(DEBUG) && defined(MATH_DEBUG)) printf("Matrix constructor...\n"); #endif loadIdentity(); } Matrix::~Matrix() { #if (defined(DEBUG) && defined(MATH_DEBUG)) printf("Matrix destructor...\n"); #endif } void Matrix::postMultiply( const float *m2 ) { float newMatrix[16]; const float *m1 = m_matrix;//, *m2 = matrix.m_matrix; newMatrix[0] = m1[0]*m2[0] + m1[4]*m2[1] + m1[8]*m2[2]; newMatrix[1] = m1[1]*m2[0] + m1[5]*m2[1] + m1[9]*m2[2]; newMatrix[2] = m1[2]*m2[0] + m1[6]*m2[1] + m1[10]*m2[2]; newMatrix[3] = 0; newMatrix[4] = m1[0]*m2[4] + m1[4]*m2[5] + m1[8]*m2[6]; newMatrix[5] = m1[1]*m2[4] + m1[5]*m2[5] + m1[9]*m2[6]; newMatrix[6] = m1[2]*m2[4] + m1[6]*m2[5] + m1[10]*m2[6]; newMatrix[7] = 0; newMatrix[8] = m1[0]*m2[8] + m1[4]*m2[9] + m1[8]*m2[10]; newMatrix[9] = m1[1]*m2[8] + m1[5]*m2[9] + m1[9]*m2[10]; newMatrix[10] = m1[2]*m2[8] + m1[6]*m2[9] + m1[10]*m2[10]; newMatrix[11] = 0; newMatrix[12] = m1[0]*m2[12] + m1[4]*m2[13] + m1[8]*m2[14] + m1[12]; newMatrix[13] = m1[1]*m2[12] + m1[5]*m2[13] + m1[9]*m2[14] + m1[13]; newMatrix[14] = m1[2]*m2[12] + m1[6]*m2[13] + m1[10]*m2[14] + m1[14]; newMatrix[15] = 1; set( newMatrix ); } void Matrix::setTranslation( float trans_x, float trans_y, float trans_z ) { m_matrix[12] = trans_x; m_matrix[13] = trans_y; m_matrix[14] = trans_z; } void Matrix::setInverseTranslation( const float *translation ) { m_matrix[12] = -translation[0]; m_matrix[13] = -translation[1]; m_matrix[14] = -translation[2]; } void Matrix::setRotationDegrees( const float *angles ) { float vec[3]; vec[0] = ( float )( angles[0]*180.0/M_PI ); vec[1] = ( float )( angles[1]*180.0/M_PI ); vec[2] = ( float )( angles[2]*180.0/M_PI ); setRotationRadians( vec[0], vec[1], vec[2] ); } void Matrix::setInverseRotationDegrees( const float *angles ) { float vec[3]; vec[0] = ( float )( angles[0]*180.0/M_PI ); vec[1] = ( float )( angles[1]*180.0/M_PI ); vec[2] = ( float )( angles[2]*180.0/M_PI ); setInverseRotationRadians( vec[0], vec[1], vec[2] ); } void Matrix::setRotationRadians( float angle_x, float angle_y, float angle_z ) { double cr = cos( angle_x ); double sr = sin( angle_x ); double cp = cos( angle_y ); double sp = sin( angle_y ); double cy = cos( angle_z ); double sy = sin( angle_z ); m_matrix[0] = ( float )( cp*cy ); m_matrix[1] = ( float )( cp*sy ); m_matrix[2] = ( float )( -sp ); double srsp = sr*sp; double crsp = cr*sp; m_matrix[4] = ( float )( srsp*cy-cr*sy ); m_matrix[5] = ( float )( srsp*sy+cr*cy ); m_matrix[6] = ( float )( sr*cp ); m_matrix[8] = ( float )( crsp*cy+sr*sy ); m_matrix[9] = ( float )( crsp*sy-sr*cy ); m_matrix[10] = ( float )( cr*cp ); } void Matrix::setInverseRotationRadians( float anglex, float angley, float anglez ) { double cr = cos( anglex ); double sr = sin( anglex ); double cp = cos( angley ); double sp = sin( angley ); double cy = cos( anglez ); double sy = sin( anglez ); m_matrix[0] = ( float )( cp*cy ); m_matrix[4] = ( float )( cp*sy ); m_matrix[8] = ( float )( -sp ); double srsp = sr*sp; double crsp = cr*sp; m_matrix[1] = ( float )( srsp*cy-cr*sy ); m_matrix[5] = ( float )( srsp*sy+cr*cy ); m_matrix[9] = ( float )( sr*cp ); m_matrix[2] = ( float )( crsp*cy+sr*sy ); m_matrix[6] = ( float )( crsp*sy-sr*cy ); m_matrix[10] = ( float )( cr*cp ); } void Matrix::setRotationQuaternion( const Quaternion& quat ) { m_matrix[0] = ( float )( 1.0 - 2.0*quat[1]*quat[1] - 2.0*quat[2]*quat[2] ); m_matrix[1] = ( float )( 2.0*quat[0]*quat[1] + 2.0*quat[3]*quat[2] ); m_matrix[2] = ( float )( 2.0*quat[0]*quat[2] - 2.0*quat[3]*quat[1] ); m_matrix[4] = ( float )( 2.0*quat[0]*quat[1] - 2.0*quat[3]*quat[2] ); m_matrix[5] = ( float )( 1.0 - 2.0*quat[0]*quat[0] - 2.0*quat[2]*quat[2] ); m_matrix[6] = ( float )( 2.0*quat[1]*quat[2] + 2.0*quat[3]*quat[0] ); m_matrix[8] = ( float )( 2.0*quat[0]*quat[2] + 2.0*quat[3]*quat[1] ); m_matrix[9] = ( float )( 2.0*quat[1]*quat[2] - 2.0*quat[3]*quat[0] ); m_matrix[10] = ( float )( 1.0 - 2.0*quat[0]*quat[0] - 2.0*quat[1]*quat[1] ); } /** * Vector class for all games using F3D, from rsn: * Author: Brett Porter * Email: [email protected] * Website: http://rsn.gamedev.net/pl3d */ Vector::Vector() { #if (defined(DEBUG) && defined(MATH_DEBUG)) printf("Vector constructor...\n"); #endif reset(); } Vector::Vector( float vec_x, float vec_y, float vec_z ) { #if (defined(DEBUG) && defined(MATH_DEBUG)) printf("Vector constructor with values[vec_x, vec_y, vec_z]...\n"); #endif set( vec_x, vec_y, vec_z ); m_vector[3] = 1; } Vector::~Vector() { #if (defined(DEBUG) && defined(MATH_DEBUG)) printf("Vector destructor...\n"); #endif } void Vector::transform(const Matrix *m ) { double vector[4]; const float *matrix = m->getMatrix(); vector[0] = m_vector[0]*matrix[0]+m_vector[1]*matrix[4]+m_vector[2]*matrix[8]+matrix[12]; vector[1] = m_vector[0]*matrix[1]+m_vector[1]*matrix[5]+m_vector[2]*matrix[9]+matrix[13]; vector[2] = m_vector[0]*matrix[2]+m_vector[1]*matrix[6]+m_vector[2]*matrix[10]+matrix[14]; vector[3] = m_vector[0]*matrix[3]+m_vector[1]*matrix[7]+m_vector[2]*matrix[11]+matrix[15]; m_vector[0] = ( float )( vector[0] ); m_vector[1] = ( float )( vector[1] ); m_vector[2] = ( float )( vector[2] ); m_vector[3] = ( float )( vector[3] ); } void Vector::transform3(const Matrix *m ) { double vector[3]; const float *matrix = m->getMatrix(); vector[0] = m_vector[0]*matrix[0]+m_vector[1]*matrix[4]+m_vector[2]*matrix[8]; vector[1] = m_vector[0]*matrix[1]+m_vector[1]*matrix[5]+m_vector[2]*matrix[9]; vector[2] = m_vector[0]*matrix[2]+m_vector[1]*matrix[6]+m_vector[2]*matrix[10]; m_vector[0] = ( float )( vector[0] ); m_vector[1] = ( float )( vector[1] ); m_vector[2] = ( float )( vector[2] ); m_vector[3] = 1; } }
[ "i25ffz@8907dee8-4f14-11de-b25e-a75f7371a613" ]
[ [ [ 1, 302 ] ] ]
6a5cac16796965ad38af1c2fe14e7313e69cf4a9
17ea7be91c874bf1171c977b260590b7e18cab18
/Forks/LocalizationRC/Localize/Localization/src/MonteCarlo.h
10b513eb1627468f82e68656f7aa1b67c5190535
[]
no_license
Arkainium/RobotController
15546b7fb1027d0f41c6e8ce7d3c252864d129a9
3b75083ce06883e19192fb8509ca40598253ad9c
refs/heads/master
2020-05-18T05:29:34.841560
2010-07-22T19:09:23
2010-07-22T19:09:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,042
h
/* * MonteCarlo.h * * This is the main class for the MonteCarlo localization. * It should be initialized with a map containing markers and their positions. * Then should be continuously updated with the robot moves and marker observations. * * The getPosition() and getConfidence() methods are giving the approximate position * of the robot. */ #ifndef MONTECARLO_H_ #define MONTECARLO_H_ #include "vector" #include "Utils.h" #include "Map.h" #include "Particle.h" #include "Move.h" #include "MonteCarloDebugger.h" using namespace std; #define PARTICLE_NUM 1000 class MonteCarlo { public: MonteCarlo(Map * map); Position getPosition(); void updateFilter(Move delta, vector<Observation>& obs); double getConfidence() const { return confidence; } vector<Particle> getParticles() { return particles; } void setDebugger(MonteCarloDebugger * debugger) { this->debugger = debugger; } void setRandomCoefficients(double thetaConfident, double xyConfident, double theta, double xy); private: vector<Particle> particles; Map *map; int particlesToReseed; double confidence; Position position; MonteCarloDebugger * debugger; double DELTA_RANDOM_THETA_CONFIDENT; double DELTA_RANDOM_XY_CONFIDENT; double DELTA_RANDOM_THETA; double DELTA_RANDOM_XY; double TRACKING_RANDOM_X; double TRACKING_RANDOM_Y; double TRACKING_RANDOM_THETA; void updateParticleProbabilities(const vector<Observation>& obs); void applyMoveToParticles(Move delta); void resample(); Particle seedParticle(); double induceRandomness(double x, double percentRandom, double maxRandom, double probability); bool isInsideMap(Particle particle); vector<double> normalizeParticleProbabilities(); double addParticleProbabilities(); vector<double> divideProbabilitiesBy(double probabilitySum); void testAllParticlesInsideMap(char * message); void debug(vector<Observation>& obs); friend class MonteCarloTest; }; #endif /* MONTECARLO_H_ */
[ [ [ 1, 82 ] ] ]
f2b4c1ef7b69c4f6d88515026cc314c841cf4445
478570cde911b8e8e39046de62d3b5966b850384
/apicompatanamdw/bcdrivers/os/ossrv/stdcpp/apps/widecharclassapiBCTest/inc/widecharclassapiBCTest.h
19c64e829e56aeb6d694dd6993acede4dbfc8ee2
[]
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
11,342
h
/* * Copyright (c) 2008-2009 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: * */ #ifndef WIDECHARCLASSAPIBCTEST_H #define WIDECHARCLASSAPIBCTEST_H // INCLUDES #include "StifTestModule.h" #include <StifLogger.h> #include <stl\_cwchar.h> // CONSTANTS //const ?type ?constant_var = ?constant; // MACROS //#define ?macro ?macro_def #define TEST_MODULE_VERSION_MAJOR 50 #define TEST_MODULE_VERSION_MINOR 9 #define TEST_MODULE_VERSION_BUILD 38 // Logging path _LIT( KwidecharclassapiBCTestLogPath, "\\logs\\testframework\\widecharclassapiBCTest\\" ); // Log file _LIT( KwidecharclassapiBCTestLogFile, "widecharclassapiBCTest.txt" ); _LIT( KwidecharclassapiBCTestLogFileWithTitle, "widecharclassapiBCTest_[%S].txt" ); #define GETPTR & #define ENTRY(str,func) {_S(str), GETPTR func,0,0,0} #define FUNCENTRY(func) {_S(#func), GETPTR func,0,0,0} #define OOM_ENTRY(str,func,a,b,c) {_S(str), GETPTR func,a,b,c} #define OOM_FUNCENTRY(func,a,b,c) {_S(#func), GETPTR func,a,b,c} // FUNCTION PROTOTYPES //?type ?function_name(?arg_list); // FORWARD DECLARATIONS //class ?FORWARD_CLASSNAME; class CwidecharclassapiBCTest; // DATA TYPES //enum ?declaration //typedef ?declaration //extern ?data_type; // A typedef for function that does the actual testing, // function is a type // TInt CwidecharclassapiBCTest::<NameOfFunction> ( TTestResult& aResult ) typedef TInt (CwidecharclassapiBCTest::* TestFunction)(TTestResult&); // CLASS DECLARATION /** * An internal structure containing a test case name and * the pointer to function doing the test * * @lib ?library * @since ?Series60_version */ class TCaseInfoInternal { public: const TText* iCaseName; TestFunction iMethod; TBool iIsOOMTest; TInt iFirstMemoryAllocation; TInt iLastMemoryAllocation; }; // CLASS DECLARATION /** * A structure containing a test case name and * the pointer to function doing the test * * @lib ?library * @since ?Series60_version */ class TCaseInfo { public: TPtrC iCaseName; TestFunction iMethod; TBool iIsOOMTest; TInt iFirstMemoryAllocation; TInt iLastMemoryAllocation; TCaseInfo( const TText* a ) : iCaseName( (TText*) a ) { }; }; // CLASS DECLARATION /** * This a widecharclassapiBCTest class. * ?other_description_lines * * @lib ?library * @since ?Series60_version */ NONSHARABLE_CLASS(CwidecharclassapiBCTest) : public CTestModuleBase { public: // Constructors and destructor /** * Two-phased constructor. */ static CwidecharclassapiBCTest* NewL(); /** * Destructor. */ virtual ~CwidecharclassapiBCTest(); public: // New functions /** * ?member_description. * @since ?Series60_version * @param ?arg1 ?description * @return ?description */ //?type ?member_function( ?type ?arg1 ); public: // Functions from base classes /** * From CTestModuleBase InitL is used to initialize the * widecharclassapiBCTest. It is called once for every instance of * TestModulewidecharclassapiBCTest after its creation. * @since ?Series60_version * @param aIniFile Initialization file for the test module (optional) * @param aFirstTime Flag is true when InitL is executed for first * created instance of widecharclassapiBCTest. * @return Symbian OS error code */ TInt InitL( TFileName& aIniFile, TBool aFirstTime ); /** * From CTestModuleBase GetTestCasesL is used to inquiry test cases * from widecharclassapiBCTest. * @since ?Series60_version * @param aTestCaseFile Test case file (optional) * @param aTestCases Array of TestCases returned to test framework * @return Symbian OS error code */ TInt GetTestCasesL( const TFileName& aTestCaseFile, RPointerArray<TTestCaseInfo>& aTestCases ); /** * From CTestModuleBase RunTestCaseL is used to run an individual * test case. * @since ?Series60_version * @param aCaseNumber Test case number * @param aTestCaseFile Test case file (optional) * @param aResult Test case result returned to test framework (PASS/FAIL) * @return Symbian OS error code (test case execution error, which is * not reported in aResult parameter as test case failure). */ TInt RunTestCaseL( const TInt aCaseNumber, const TFileName& aTestCaseFile, TTestResult& aResult ); /** * From CTestModuleBase; OOMTestQueryL is used to specify is particular * test case going to be executed using OOM conditions * @param aTestCaseFile Test case file (optional) * @param aCaseNumber Test case number (optional) * @param aFailureType OOM failure type (optional) * @param aFirstMemFailure The first heap memory allocation failure value (optional) * @param aLastMemFailure The last heap memory allocation failure value (optional) * @return TBool */ virtual TBool OOMTestQueryL( const TFileName& /* aTestCaseFile */, const TInt /* aCaseNumber */, TOOMFailureType& aFailureType, TInt& /* aFirstMemFailure */, TInt& /* aLastMemFailure */ ); /** * From CTestModuleBase; OOMTestInitializeL may be used to initialize OOM * test environment * @param aTestCaseFile Test case file (optional) * @param aCaseNumber Test case number (optional) * @return None */ virtual void OOMTestInitializeL( const TFileName& /* aTestCaseFile */, const TInt /* aCaseNumber */ ); /** * From CTestModuleBase; OOMHandleWarningL * @param aTestCaseFile Test case file (optional) * @param aCaseNumber Test case number (optional) * @param aFailNextValue FailNextValue for OOM test execution (optional) * @return None * * User may add implementation for OOM test warning handling. Usually no * implementation is required. */ virtual void OOMHandleWarningL( const TFileName& /* aTestCaseFile */, const TInt /* aCaseNumber */, TInt& /* aFailNextValue */); /** * From CTestModuleBase; OOMTestFinalizeL may be used to finalize OOM * test environment * @param aTestCaseFile Test case file (optional) * @param aCaseNumber Test case number (optional) * @return None * */ virtual void OOMTestFinalizeL( const TFileName& /* aTestCaseFile */, const TInt /* aCaseNumber */ ); /** * Method used to log version of test module */ void SendTestModuleVersion(); protected: // New functions /** * ?member_description. * @since ?Series60_version * @param ?arg1 ?description * @return ?description */ //?type ?member_function( ?type ?arg1 ); protected: // Functions from base classes /** * From ?base_class ?member_description */ //?type ?member_function(); private: /** * C++ default constructor. */ CwidecharclassapiBCTest(); /** * By default Symbian 2nd phase constructor is private. */ void ConstructL(); // Prohibit copy constructor if not deriving from CBase. // ?classname( const ?classname& ); // Prohibit assigment operator if not deriving from CBase. // ?classname& operator=( const ?classname& ); /** * Function returning test case name and pointer to test case function. * @since ?Series60_version * @param aCaseNumber test case number * @return TCaseInfo */ const TCaseInfo Case ( const TInt aCaseNumber ) const; /** * [test case declarations] - do not remove */ //ADD NEW METHOD DEC HERE" /** * Printing test case. * @since ?Series60_version * @param aResult Test case result (PASS/FAIL) * @return Symbian OS error code (test case execution error * that is not returned as test case result in aResult) */ TInt PrintTest( TTestResult& aResult ); /** * Printing loop test case. * @since ?Series60_version * @param aResult Test case result (PASS/FAIL) * @return Symbian OS error code (test case execution error * that is not returned as test case result in aResult) */ TInt LoopTest( TTestResult& aResult ); TInt ArithmeticTest( TTestResult& aResult ); TInt FileManipulationTest( TTestResult& aResult ); TInt ConsoleOperationsTest( TTestResult& aResult ); TInt StringOperationsTest( TTestResult& aResult ); TInt ConversionOperationsTest( TTestResult& aResult ); public: // Data // ?one_line_short_description_of_data //?data_declaration; protected: // Data // ?one_line_short_description_of_data //?data_declaration; private: // Data // Pointer to test (function) to be executed TestFunction iMethod; // Pointer to logger CStifLogger * iLog; // Normal logger CStifLogger* iStdLog; // Test case logger CStifLogger* iTCLog; // Flag saying if test case title should be added to log file name TBool iAddTestCaseTitleToLogName; // Flag saying if version of test module was already sent TBool iVersionLogged; // ?one_line_short_description_of_data //?data_declaration; // Reserved pointer for future extension //TAny* iReserved; public: // Friend classes //?friend_class_declaration; protected: // Friend classes //?friend_class_declaration; private: // Friend classes //?friend_class_declaration; }; #endif // WIDECHARCLASSAPIBCTEST_H // End of File
[ "none@none" ]
[ [ [ 1, 351 ] ] ]
e70befa54a3a01190682b47e60891e27f8b4fcb5
2ca3ad74c1b5416b2748353d23710eed63539bb0
/Src/Lokapala/Operator/ConnectedHostsDTO.h
59a62da65c3982e7016b5854497753df6573c80c
[]
no_license
sjp38/lokapala
5ced19e534bd7067aeace0b38ee80b87dfc7faed
dfa51d28845815cfccd39941c802faaec9233a6e
refs/heads/master
2021-01-15T16:10:23.884841
2009-06-03T14:56:50
2009-06-03T14:56:50
32,124,140
0
0
null
null
null
null
UTF-8
C++
false
false
629
h
/**@file ConnectedHostsDTO.h * @brief CConnectedHostsDTO 클래스를 정의한다. * @author siva */ #ifndef CONNECTED_HOSTS_DTO_H #define CONNECTED_HOSTS_DTO_H #include "ConnectedHostDTO.h" /**@ingroup GroupDAM * @class CConnectedHostsDTO * @brief 연결된 유저 전체에 대한 데이터를 관리한다. */ class CConnectedHostsDTO { public : CArray<CConnectedHostDTO> m_connected; void RegistConnected(CConnectedHostDTO *a_connected); void RemoveConnected(CString *a_connected); void *GetConnected(CString *a_key); private : int FindConnected(CString *a_key); }; #endif
[ "nilakantha38@b9e76448-5c52-0410-ae0e-a5aea8c5d16c" ]
[ [ [ 1, 29 ] ] ]
72721836e950a651d7be645299ef29877c14f6bd
7209e143b701bf83b10f09f334ea7bf7b08d790b
/src/gwproduction.cpp
6a2d7838b665f19a581066cb9c96978235c6ba8a
[]
no_license
sebhd/zod
755356b11efb2c7cd861b04e09ccf5ba1ec7ac2e
396e2231334af7eada1b41af5aaff065b6235e94
refs/heads/master
2018-12-28T09:04:04.762895
2011-09-30T08:48:16
2011-09-30T08:48:16
2,469,497
5
0
null
null
null
null
UTF-8
C++
false
false
18,628
cpp
#include "gwproduction.h" #include "zfont_engine.h" //#include "zbuilding.h" #include "cgatling.h" #include "cgun.h" #include "chowitzer.h" #include "cmissilecannon.h" #include "vjeep.h" #include "vlight.h" #include "vmedium.h" #include "vheavy.h" #include "vapc.h" #include "vmissilelauncher.h" #include "vcrane.h" #include "rgrunt.h" #include "rpsycho.h" #include "rsniper.h" #include "rtough.h" #include "rpyro.h" #include "rlaser.h" #include <iostream> ZSDL_Surface GWProduction::base_img; ZSDL_Surface GWProduction::base_expanded_img; ZSDL_Surface GWProduction::name_label[GWPROD_TYPES_MAX]; ZSDL_Surface GWProduction::state_label[MAX_BUILDING_STATES][2]; ZSDL_Surface GWProduction::p_bar; ZSDL_Surface GWProduction::p_bar_yellow; //int GWProduction::is_expanded = false; GWProduction::GWProduction(ZTime *ztime_) : ZGuiWindow(ztime_) { double &the_time = ztime->ztime; ref_id = -1; building_obj = NULL; state_i = 0; show_time = 0; show_time_img = NULL; health_percent = -1; health_percent_img = NULL; is_expanded = false; //for defaults sake SetType(GWPROD_FORT); state = -1; SetState(BUILDING_SELECT); place_button.SetType(PLACE_GUI_BUTTON); ok_button.SetType(OK_GUI_BUTTON); cancel_button.SetType(CANCEL_GUI_BUTTON); small_plus_button.SetType(SMALL_PLUS_BUTTON); small_minus_button.SetType(SMALL_MINUS_BUTTON); queue_button.SetType(QUEUE_BUTTON); unit_selector.SetZTime(ztime); queue_selector.SetZTime(ztime); full_selector.SetZTime(ztime); unit_selector.SetCoords(3, 19); queue_selector.SetCoords(111, 19); unit_selector.SetIsOnlySelector(false); queue_selector.SetIsOnlySelector(true); ProcessSetExpanded(); next_state_time = the_time + 0.3; } void GWProduction::Init() { base_img.LoadBaseImage("assets/other/production_gui/base_image.png"); base_expanded_img.LoadBaseImage("assets/other/production_gui/base_image_expanded.png"); name_label[GWPROD_ROBOT].LoadBaseImage("assets/other/production_gui/robot_factory_label.png"); name_label[GWPROD_FORT].LoadBaseImage("assets/other/production_gui/fort_factory_label.png"); name_label[GWPROD_VEHICLE].LoadBaseImage("assets/other/production_gui/vehicle_factory_label.png"); p_bar.LoadBaseImage("assets/other/production_gui/percentage_bar.png"); p_bar_yellow.LoadBaseImage("assets/other/production_gui/percentage_bar_yellow.png"); state_label[BUILDING_PLACE][0].LoadBaseImage("assets/other/production_gui/place_label.png"); state_label[BUILDING_PLACE][1].LoadBaseImage("assets/other/production_gui/placeless_label.png"); state_label[BUILDING_SELECT][0].LoadBaseImage("assets/other/production_gui/select_label.png"); state_label[BUILDING_SELECT][1].LoadBaseImage("assets/other/production_gui/selectless_label.png"); state_label[BUILDING_BUILDING][0].LoadBaseImage("assets/other/production_gui/building_label.png"); state_label[BUILDING_BUILDING][1].LoadBaseImage("assets/other/production_gui/buildingless_label.png"); state_label[BUILDING_PAUSED][0].LoadBaseImage("assets/other/production_gui/paused_label.png"); state_label[BUILDING_PAUSED][1].LoadBaseImage("assets/other/production_gui/pausedless_label.png"); //these classes are personal to GWProduction GWPUnitSelector::Init(); GWPFullUnitSelector::Init(); } void GWProduction::Process() { double &the_time = ztime->ztime; if (killme) return; //do not process if we are not attached to a building object if (!building_obj) { killme = true; return; } //reset queue button list? CheckQueueButtonList(); // recheck building state if (building_obj) { SetState(building_obj->GetBuildState()); } //selectors unit_selector.Process(); queue_selector.Process(); full_selector.Process(); //set show time RecalcShowTime(); if (the_time >= next_state_time) { state_i++; if (state_i >= 2) state_i = 0; next_state_time = the_time + 0.3; } //health percent int new_percent = 0; if (building_obj->GetMaxHealth()) new_percent = 100 * building_obj->GetHealth() / building_obj->GetMaxHealth(); if (new_percent < 0) new_percent = 0; if (new_percent > 100) new_percent = 100; if (new_percent != health_percent) { char message[50]; health_percent = new_percent; //ZSDL_FreeSurface(health_percent_img); sprintf(message, "%d%c", health_percent, '%'); //printf("%s\n", message); //health_percent_img = ZFontEngine::GetFont(SMALL_WHITE_FONT).Render(message); health_percent_img.LoadBaseImage(ZFontEngine::GetFont(SMALL_WHITE_FONT).Render(message)); } } void GWProduction::CheckQueueButtonList() { if (!building_obj) return; //sizes different? if (queue_button_list.size() != building_obj->GetQueueList().size()) { MakeQueueButtonList(); return; } //items different? { vector<ZBProductionUnit> &bqlist = building_obj->GetQueueList(); vector<ZBProductionUnit>::iterator bqi = bqlist.begin(); vector<GWPQueueItem>::iterator gqi = queue_button_list.begin(); for (; gqi != queue_button_list.end() && bqi != bqlist.end(); ++bqi, ++gqi) { if (gqi->ot != bqi->ot || gqi->oid != bqi->oid) { MakeQueueButtonList(); return; } } } } void GWProduction::MakeQueueButtonList() { const int button_h = 13; const int button_margin = 1; int lx, ly; lx = 177; ly = 22; //check if (!building_obj) return; //speed things up vector<ZBProductionUnit> &bqlist = building_obj->GetQueueList(); //clear queue_button_list.clear(); //create for (vector<ZBProductionUnit>::iterator bqi = bqlist.begin(); bqi != bqlist.end(); ++bqi) { queue_button_list.push_back(GWPQueueItem(lx, ly, bqi->ot, bqi->oid)); ly += button_h + button_margin; } } void GWProduction::ProcessSetExpanded() { if (is_expanded) { width = 228; height = 96; small_plus_button.SetActive(false); small_minus_button.SetActive(true); queue_button.SetActive(true); queue_selector.SetActive(true); } else { width = 112; height = 80; small_plus_button.SetActive(true); small_minus_button.SetActive(false); queue_button.SetActive(false); queue_selector.SetActive(false); } } void GWProduction::RecalcShowTime() { double &the_time = ztime->ztime; double new_time = -1; //setup ticker if (state == BUILDING_SELECT) { if (!building_obj) return; if (!buildlist) return; unsigned char ot, oid; if (unit_selector.GetSelectedID(ot, oid)) new_time = building_obj->BuildTimeModified(buildlist->UnitBuildTime(ot, oid)); } else { new_time = building_obj->ProductionTimeLeft(the_time); } if (show_time != (int) new_time) ResetShowTime((int) new_time); } void GWProduction::ResetShowTime(int new_time) { int minutes, seconds; char message[50]; //if(show_time_img) //{ // SDL_FreeSurface(show_time_img); // show_time_img = NULL; //} show_time = new_time; //setup these numbers seconds = new_time % 60; new_time /= 60; minutes = new_time % 60; sprintf(message, "%d:%02d", minutes, seconds); //show_time_img = ZFontEngine::GetFont(SMALL_WHITE_FONT).Render(message); show_time_img.LoadBaseImage(ZFontEngine::GetFont(SMALL_WHITE_FONT).Render(message)); } void GWProduction::DoRender(ZMap &the_map, SDL_Surface *dest) { int lx, ly; SDL_Rect from_rect, to_rect; if (killme) return; if (!building_obj) { killme = true; return; } if (!is_expanded) the_map.RenderZSurface(&base_img, x, y); else the_map.RenderZSurface(&base_expanded_img, x, y); lx = x + 9; ly = y + 6; the_map.RenderZSurface(&name_label[type], lx, ly); //if(the_map.GetBlitInfo(name_label[type], x + lx, y + ly, from_rect, to_rect)) // SDL_BlitSurface( name_label[type], &from_rect, dest, &to_rect); lx = x + 64; ly = y + 19; the_map.RenderZSurface(&state_label[state][state_i], lx, ly); //if(the_map.GetBlitInfo( state_label[state][state_i], x + lx, y + ly, from_rect, to_rect)) // SDL_BlitSurface( state_label[state][state_i], &from_rect, dest, &to_rect); //buttons ok_button.DoRender(the_map, dest, x, y); cancel_button.DoRender(the_map, dest, x, y); place_button.DoRender(the_map, dest, x, y); small_plus_button.DoRender(the_map, dest, x, y); small_minus_button.DoRender(the_map, dest, x, y); queue_button.DoRender(the_map, dest, x, y); //queue_list buttons RenderQueueButtonList(the_map, dest); lx = x + 90; ly = y + 35; the_map.RenderZSurface(&show_time_img, lx, ly); //if(show_time_img) // if(the_map.GetBlitInfo( show_time_img, x + 90, y + 35, from_rect, to_rect)) // SDL_BlitSurface( show_time_img, &from_rect, dest, &to_rect); if (health_percent_img.GetBaseSurface()) { lx = x + 86 - (health_percent_img.GetBaseSurface()->w >> 1); ly = y + 6; the_map.RenderZSurface(&health_percent_img, lx, ly); } //if(the_map.GetBlitInfo( health_percent_img, x + 97 - (health_percent_img->w/2), y + 7, from_rect, to_rect)) // SDL_BlitSurface( health_percent_img, &from_rect, dest, &to_rect); //selectors unit_selector.DoRender(the_map, dest, x, y); queue_selector.DoRender(the_map, dest, x, y); //full selector goes over everything full_selector.DoRender(the_map, dest); } void GWProduction::RenderQueueButtonList(ZMap &the_map, SDL_Surface *dest) { if (!is_expanded) return; for (vector<GWPQueueItem>::iterator qb = queue_button_list.begin(); qb != queue_button_list.end(); ++qb) { ZSDL_Surface *name_render; qb->obj_name_button.DoRender(the_map, dest, x, y); name_render = &ZObject::GetHoverNameImgStatic(qb->ot, qb->oid); if (name_render && name_render->GetBaseSurface()) the_map.RenderZSurface(name_render, (qb->x_off + x + 23) - (name_render->GetBaseSurface()->w >> 1), qb->y_off + y + 2); } } void GWProduction::SetBuildList(ZBuildList *buildlist_) { buildlist = buildlist_; unit_selector.SetBuildList(buildlist_); queue_selector.SetBuildList(buildlist_); full_selector.SetBuildList(buildlist_); } void GWProduction::SetState(int state_) { if (building_obj && building_obj->GetBuiltCannonList().size()) state_ = BUILDING_PLACE; if (building_obj && building_obj->IsDestroyed()) state_ = BUILDING_PAUSED; if (state == state_) return; state = state_; switch (state) { case BUILDING_PLACE: ok_button.SetActive(false); cancel_button.SetActive(true); place_button.SetActive(true); break; case BUILDING_SELECT: ok_button.SetActive(true); cancel_button.SetActive(true); place_button.SetActive(false); break; case BUILDING_BUILDING: ok_button.SetActive(true); cancel_button.SetActive(true); place_button.SetActive(false); break; case BUILDING_PAUSED: ok_button.SetActive(true); cancel_button.SetActive(true); place_button.SetActive(false); break; } } void GWProduction::SetCords(int center_x, int center_y) { //x = center_x - (width >> 1); //y = center_y - (height >> 1); //initial placement based on unexpanded x = center_x - (112 >> 1); y = center_y - (80 >> 1); if (zmap) { int map_w, map_h; map_w = zmap->GetMapBasics().width * 16; map_h = zmap->GetMapBasics().height * 16; //if(x + width + 16 > view_w) x = view_w - (width + 16); //if(y + height + 16 > view_h) y = view_h - (height + 16); //check if fits on map based on expanded size if (x + 228 + 16 > map_w) x = map_w - (228 + 16); if (y + 96 + 16 > map_h) y = map_h - (96 + 16); } if (x < 16) x = 16; if (y < 16) y = 16; full_selector.SetCenterCoords(center_x, center_y); } void GWProduction::SetType(int type_) { type = type_; switch (type) { case GWPROD_FORT: building_type = FORT_FRONT; break; case GWPROD_VEHICLE: building_type = VEHICLE_FACTORY; break; case GWPROD_ROBOT: building_type = ROBOT_FACTORY; break; } unit_selector.SetBuildingType(building_type); queue_selector.SetBuildingType(building_type); full_selector.SetBuildingType(building_type); } void GWProduction::SetBuildingObj(ZBuilding *building_obj_) { building_obj = building_obj_; unit_selector.SetBuildingObj(building_obj); queue_selector.SetBuildingObj(building_obj); full_selector.SetBuildingObj(building_obj); } void GWProduction::DoOkButton() { switch (state) { case BUILDING_PLACE: // The ok button doesn't show during the place state, so there's nothing to do here. break; case BUILDING_SELECT: { unsigned char ot, oid; if (unit_selector.GetSelectedID(ot, oid)) { gflags.send_new_production = true; gflags.pot = ot; gflags.poid = oid; gflags.pref_id = building_obj->GetRefID(); } } break; case BUILDING_PAUSED: case BUILDING_BUILDING: killme = true; break; } } void GWProduction::DoCancelButton() { switch (state) { case BUILDING_PAUSED: case BUILDING_PLACE: case BUILDING_SELECT: killme = true; break; case BUILDING_BUILDING: //tell server to cancel this production: gflags.send_stop_production = true; gflags.pref_id = building_obj->GetRefID(); break; } } void GWProduction::DoPlaceButton() { if (!building_obj) return; if (!building_obj->GetBuiltCannonList().size()) return; if (!building_obj->GetConnectedZone()) return; gflags.place_cannon = true; gflags.coid = building_obj->GetBuiltCannonList()[0]; gflags.cref_id = building_obj->GetRefID(); gflags.cleft = building_obj->GetConnectedZone()->x; gflags.cright = gflags.cleft + building_obj->GetConnectedZone()->w; gflags.ctop = building_obj->GetConnectedZone()->y; gflags.cbottom = gflags.ctop + building_obj->GetConnectedZone()->h; //also good bye killme = true; } void GWProduction::DoQueueButton() { unsigned char ot, oid; if (queue_selector.GetSelectedID(ot, oid)) { gflags.send_new_queue_item = true; gflags.qot = ot; gflags.qoid = oid; gflags.qref_id = building_obj->GetRefID(); } } void GWProduction::DoCancelQueueItem(int i) { if (i < 0 || i >= queue_button_list.size()) { return; } gflags.send_cancel_queue_item = true; gflags.qcref_id = building_obj->GetRefID(); gflags.qc_i = i; gflags.qcot = queue_button_list[i].ot; gflags.qcoid = queue_button_list[i].oid; } void GWProduction::LoadFullSelector(int us_ref_id) { int fus_cx, fus_cy; full_selector.SetActive(true); full_selector.SetUnitSelectorRefID(us_ref_id); full_selector.ClearSelected(); if (us_ref_id == unit_selector.GetRefID()) { unit_selector.GetCoords(fus_cx, fus_cy); } else if (us_ref_id == queue_selector.GetRefID()) { queue_selector.GetCoords(fus_cx, fus_cy); } else { fus_cx = width >> 1; fus_cy = height >> 1; } full_selector.SetCenterCoords(x + fus_cx + GWP_SELECTOR_CENTER_X, y + fus_cy + GWP_SELECTOR_CENTER_Y); } bool GWProduction::Click(int x_, int y_) { //full selector uses map coords if (full_selector.Click(x_, y_)) { return true; } int x_local = x_ - x; int y_local = y_ - y; //buttons ok_button.Click(x_local, y_local); cancel_button.Click(x_local, y_local); place_button.Click(x_local, y_local); small_plus_button.Click(x_local, y_local); small_minus_button.Click(x_local, y_local); queue_button.Click(x_local, y_local); //queue_list buttons if (is_expanded) { for (vector<GWPQueueItem>::iterator qb = queue_button_list.begin(); qb != queue_button_list.end(); ++qb) { qb->obj_name_button.Click(x_local, y_local); } } //selectors unit_selector.Click(x_local, y_local); queue_selector.Click(x_local, y_local); if (x_ < x) return false; if (y_ < y) return false; if (x_ >= x + width) return false; if (y_ >= y + height) return false; return true; } bool GWProduction::UnClick(int x_, int y_) { gflags.Clear(); // full selector uses map coords if (full_selector.IsActive()) { // TODO 4: Only cancel and re-start production if new selected production is different from old if (full_selector.UnClick(x_, y_)) { unsigned char ot, oid; //it took a click but do we have a selection? if (full_selector.GetSelected(ot, oid)) { full_selector.SetActive(false); // has a selection so load it into the unit selector: if (unit_selector.GetRefID() == full_selector.GetUnitSelectorRefID()) { unit_selector.SetSelection(ot, oid); gflags.send_replace_production = true; gflags.rot = ot; gflags.roid = oid; gflags.rref_id = building_obj->GetRefID(); } if (queue_selector.GetRefID() == full_selector.GetUnitSelectorRefID()) { queue_selector.SetSelection(ot, oid); DoQueueButton(); } } //took the click but no selection //so do not allow any other gwprod //gui to process return true; } else { //it was clicked outside so kill it full_selector.SetActive(false); } } int x_local = x_ - x; int y_local = y_ - y; //buttons if (ok_button.UnClick(x_local, y_local)) DoOkButton(); else if (cancel_button.UnClick(x_local, y_local)) DoCancelButton(); else if (place_button.UnClick(x_local, y_local)) DoPlaceButton(); else if (small_plus_button.UnClick(x_local, y_local)) DoPlusButton(); else if (small_minus_button.UnClick(x_local, y_local)) DoMinusButton(); else if (queue_button.UnClick(x_local, y_local)) DoQueueButton(); //queue_list buttons if (is_expanded) { for (int i = 0; i < queue_button_list.size(); i++) { if (queue_button_list[i].obj_name_button.UnClick(x_local, y_local)) { DoCancelQueueItem(i); } } } // Open full selector if single-unit build selector has been clicked: if (unit_selector.UnClick(x_local, y_local) && unit_selector.LoadFullSelector()) { LoadFullSelector(unit_selector.GetRefID()); } // Open full selector if build queue selector has been clicked: if (queue_selector.UnClick(x_local, y_local) && queue_selector.LoadFullSelector()) { LoadFullSelector(queue_selector.GetRefID()); } // Return false if click was outside of the window: if ((x_ < x) || (y_ < y) || (x_ >= x + width) || (y_ >= y + height)) { return false; } return true; } bool GWProduction::WheelUpButton() { if (!unit_selector.WheelUpButton()) { return queue_selector.WheelUpButton(); } return true; } bool GWProduction::WheelDownButton() { if (!unit_selector.WheelDownButton()) { return queue_selector.WheelDownButton(); } return true; }
[ "sebastian@T61p" ]
[ [ [ 1, 712 ] ] ]
e53056e70bf21ee9386db0862ea20e33a7f2f1b6
7b379862f58f587d9327db829ae4c6493b745bb1
/JuceLibraryCode/modules/juce_events/interprocess/juce_InterprocessConnectionServer.cpp
411d7e57e2ba9dc1551d6fdfa0b8a136eb77d9cc
[]
no_license
owenvallis/Nomestate
75e844e8ab68933d481640c12019f0d734c62065
7fe7c06c2893421a3c77b5180e5f27ab61dd0ffd
refs/heads/master
2021-01-19T07:35:14.301832
2011-12-28T07:42:50
2011-12-28T07:42:50
2,950,072
2
0
null
null
null
null
UTF-8
C++
false
false
2,504
cpp
/* ============================================================================== This file is part of the JUCE library - "Jules' Utility Class Extensions" Copyright 2004-11 by Raw Material Software Ltd. ------------------------------------------------------------------------------ JUCE can be redistributed and/or modified under the terms of the GNU General Public License (Version 2), as published by the Free Software Foundation. A copy of the license is included in the JUCE distribution, or can be found online at www.gnu.org/licenses. JUCE 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. ------------------------------------------------------------------------------ To release a closed-source product which uses JUCE, commercial licenses are available: visit www.rawmaterialsoftware.com/juce for more information. ============================================================================== */ BEGIN_JUCE_NAMESPACE //============================================================================== InterprocessConnectionServer::InterprocessConnectionServer() : Thread ("Juce IPC server") { } InterprocessConnectionServer::~InterprocessConnectionServer() { stop(); } //============================================================================== bool InterprocessConnectionServer::beginWaitingForSocket (const int portNumber) { stop(); socket = new StreamingSocket(); if (socket->createListener (portNumber)) { startThread(); return true; } socket = nullptr; return false; } void InterprocessConnectionServer::stop() { signalThreadShouldExit(); if (socket != nullptr) socket->close(); stopThread (4000); socket = nullptr; } void InterprocessConnectionServer::run() { while ((! threadShouldExit()) && socket != nullptr) { ScopedPointer <StreamingSocket> clientSocket (socket->waitForNextConnection()); if (clientSocket != nullptr) { InterprocessConnection* newConnection = createConnectionObject(); if (newConnection != nullptr) newConnection->initialiseWithSocket (clientSocket.release()); } } } END_JUCE_NAMESPACE
[ "ow3nskip" ]
[ [ [ 1, 84 ] ] ]
784c8da50bd42020ee444e8820d2cd161e846ed1
5d36f6102c8cadcf1a124b366ae189d6a2609c59
/src/gpuAPI/newGPU/newGPU.cpp
4b2b6f6e178f39d087e453a3f59b19220f1a83f2
[]
no_license
Devil084/psx4all
336f2861246367c8d397ef5acfc0b7972085c21b
04c02bf8840007792d23d15ca42a572035a1d703
refs/heads/master
2020-02-26T15:18:04.554046
2010-08-11T13:49:24
2010-08-11T13:49:24
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,189
cpp
/////////////////////////////////////////////////////////////////////////////// // NEWGPU main file #include "newGPU.h" /////////////////////////////////////////////////////////////////////////////// // Tweaks and Hacks int skipCount = 0; int skipRate = 1; bool enableFrameLimit = false; bool enableAbbeyHack = false; bool displayFrameInfo = true; bool displayGpuStats = false; bool displayVideoMemory = false; bool primitiveDebugMode = false; bool activeNullGPU = false; bool activeGPULog = false; /////////////////////////////////////////////////////////////////////////////// // interlaced rendering int linesInterlace = 0; // 0, 1, 3, 7 int linesInterlace_user = linesInterlace; /////////////////////////////////////////////////////////////////////////////// // GPU internal inits bool gpuInnerInit(); /////////////////////////////////////////////////////////////////////////////// // GPU registering function bool register_NEWGPU() { // GPU inicialization/deinicialization functions GPU_init = NEWGPU_init; GPU_done = NEWGPU_done; GPU_freeze = NEWGPU_freeze; // GPU Vsinc Notification GPU_vSinc = NEWGPU_vSinc; // GPU DMA comunication GPU_dmaChain = NEWGPU_dmaChain; GPU_writeDataMem = NEWGPU_writeDataMem; GPU_readDataMem = NEWGPU_readDataMem; // GPU Memory comunication GPU_writeData = NEWGPU_writeData; GPU_writeStatus = NEWGPU_writeStatus; GPU_readData = NEWGPU_readData; return gpuInnerInit(); } /////////////////////////////////////////////////////////////////////////////// // GPU Global data /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// // Dma Transfers info s32 px,py; s32 x_start,y_start,x_end,y_end; u16* pvram; s32 FrameToRead; s32 FrameToWrite; s32 FrameCount; s32 FrameIndex; u32 GP0; u32 OtherEnv[16]; s32 PacketCount; s32 PacketIndex; /////////////////////////////////////////////////////////////////////////////// // Stadistic and Timming u32 systime; u32 isSkip; u32 skipFrame = 0; s32 vsincRateCounter = 0; s32 frameRateCounter = 0; s32 frameRealCounter = 0; s32 vsincRate = 60; s32 frameRate = 60; s32 realRate = 60; u32 framesTotal = 0; u32 statF3 = 0; u32 statFT3 = 0; u32 statG3 = 0; u32 statGT3 = 0; u32 statLF = 0; u32 statLG = 0; u32 statS = 0; u32 statT = 0; u32 gpuPolyTime = 0; u32 gpuPolyCount = 0; u32 gpuRasterTime = 0; u32 gpuRasterCount = 0; u32 gpuPixelTime = 0; u32 gpuPixelCount = 0; u32 dmaChainTime = 0; u32 dmaChainCount = 0; u32 dmaMemTime = 0; u32 dmaMemCount = 0; u32 dmaPacketTime [256]= {0}; u32 dmaPacketCount[256]= {0}; /////////////////////////////////////////////////////////////////////////////// // Display status s32 isPAL; u32 isDisplaySet; u32 DisplayArea [8]; u32 DirtyArea [4]; u32 LastDirtyArea [4]; u32 CheckArea [4]; /////////////////////////////////////////////////////////////////////////////// // Rasterizer status u32 TextureWindow [4]; u32 DrawingArea [4]; u32 DrawingOffset [2]; u32 MaskU; u32 MaskV; /////////////////////////////////////////////////////////////////////////////// // Rasterizer status u8 Masking; u16 PixelMSB; u16* TBA; u16* CBA; u8* TA; u32 BLEND_MODE; u32 TEXT_MODE; /////////////////////////////////////////////////////////////////////////////// // Inner Loops u16* Pixel; u16* PixelEnd; s32 u4, du4; s32 v4, dv4; s32 r4, dr4; s32 g4, dg4; s32 b4, db4; u32 lInc; u32 tInc, tMsk; u32 PixelData; //u32 TextureU,TextureV; //u8 LightR,LightG,LightB; long skipNum = 1; long SkipReset = 0; bool isNewDisplay = false;
[ "jars@jars-desktop.(none)" ]
[ [ [ 1, 158 ] ] ]
1512164573f419f0d963c72794268ca677771b4a
4b64b7bd6cf8d7ff1336ab709850dc3ec3a1afd3
/code/game/g_public.h
ed94fedb87287fbb44a4398d70b875b3b387132f
[]
no_license
TheVoxyn/japhys
31a632548bf8bc45a99e6aec4b333a38d9d27074
36522c6c324ffda460276d71c71a0b35624be8ff
refs/heads/master
2016-09-06T09:26:46.802334
2011-02-03T16:22:07
2011-02-03T16:22:07
40,972,233
0
0
null
null
null
null
UTF-8
C++
false
false
27,423
h
// Copyright (C) 1999-2000 Id Software, Inc. // #ifndef G_PUBLIC_H // g_public.h -- game module information visible to server #define G_PUBLIC_H #define Q3_INFINITE 16777216 #define GAME_API_VERSION 8 // entity->svFlags // the server does not know how to interpret most of the values // in entityStates (level eType), so the game must explicitly flag // special server behaviors #define SVF_NOCLIENT 0x00000001 // don't send entity to clients, even if it has effects #define SVF_BOT 0x00000008 // set if the entity is a bot #define SVF_PLAYER_USABLE 0x00000010 // player can use this with the use button #define SVF_BROADCAST 0x00000020 // send to all connected clients #define SVF_PORTAL 0x00000040 // merge a second pvs at origin2 into snapshots #define SVF_USE_CURRENT_ORIGIN 0x00000080 // entity->r.currentOrigin instead of entity->s.origin // for link position (missiles and movers) #define SVF_SINGLECLIENT 0x00000100 // only send to a single client (entityShared_t->singleClient) #define SVF_NOSERVERINFO 0x00000200 // don't send CS_SERVERINFO updates to this client // so that it can be updated for ping tools without // lagging clients #define SVF_CAPSULE 0x00000400 // use capsule for collision detection instead of bbox #define SVF_NOTSINGLECLIENT 0x00000800 // send entity to everyone but one client // (entityShared_t->singleClient) #define SVF_OWNERNOTSHARED 0x00001000 // If it's owned by something and another thing owned by that something // hits it, it will still touch #define SVF_ICARUS_FREEZE 0x00008000 // NPCs are frozen, ents don't execute ICARUS commands #define SVF_GLASS_BRUSH 0x08000000 // Ent is a glass brush #define SVF_NO_BASIC_SOUNDS 0x10000000 // No basic sounds #define SVF_NO_COMBAT_SOUNDS 0x20000000 // No combat sounds #define SVF_NO_EXTRA_SOUNDS 0x40000000 // No extra or jedi sounds //rww - ghoul2 trace flags #define G2TRFLAG_DOGHOULTRACE 0x00000001 //do the ghoul2 trace #define G2TRFLAG_HITCORPSES 0x00000002 //will try g2 collision on the ent even if it's EF_DEAD #define G2TRFLAG_GETSURFINDEX 0x00000004 //will replace surfaceFlags with the ghoul2 surface index that was hit, if any. #define G2TRFLAG_THICK 0x00000008 //assures that the trace radius will be significantly large regardless of the trace box size. //=============================================================== //this structure is shared by gameside and in-engine NPC nav routines. typedef struct failedEdge_e { int startID; int endID; int checkTime; int entID; } failedEdge_t; typedef struct { qboolean linked; // qfalse if not in any good cluster int linkcount; int svFlags; // SVF_NOCLIENT, SVF_BROADCAST, etc int singleClient; // only send to this client when SVF_SINGLECLIENT is set qboolean bmodel; // if false, assume an explicit mins / maxs bounding box // only set by trap_SetBrushModel vec3_t mins, maxs; int contents; // CONTENTS_TRIGGER, CONTENTS_SOLID, CONTENTS_BODY, etc // a non-solid entity should set to 0 vec3_t absmin, absmax; // derived from mins/maxs and origin + rotation // currentOrigin will be used for all collision detection and world linking. // it will not necessarily be the same as the trajectory evaluation for the current // time, because each entity must be moved one at a time after time is advanced // to avoid simultanious collision issues vec3_t currentOrigin; vec3_t currentAngles; qboolean mIsRoffing; // set to qtrue when the entity is being roffed // when a trace call is made and passEntityNum != ENTITYNUM_NONE, // an ent will be excluded from testing if: // ent->s.number == passEntityNum (don't interact with self) // ent->s.ownerNum = passEntityNum (don't interact with your own missiles) // entity[ent->s.ownerNum].ownerNum = passEntityNum (don't interact with other missiles from owner) int ownerNum; // mask of clients that this entity should be broadcast too. The first 32 clients // are represented by the first array index and the latter 32 clients are represented // by the second array index. int broadcastClients[2]; } entityShared_t; //=============================================================== // // system traps provided by the main engine // typedef enum { //============== general Quake services ================== G_PRINT, // ( const char *string ); // print message on the local console G_ERROR, // ( const char *string ); // abort the game G_MILLISECONDS, // ( void ); // get current time for profiling reasons // this should NOT be used for any game related tasks, // because it is not journaled //Also for profiling.. do not use for game related tasks. G_PRECISIONTIMER_START, G_PRECISIONTIMER_END, // console variable interaction G_CVAR_REGISTER, // ( vmCvar_t *vmCvar, const char *varName, const char *defaultValue, int flags ); G_CVAR_UPDATE, // ( vmCvar_t *vmCvar ); G_CVAR_SET, // ( const char *var_name, const char *value ); G_CVAR_VARIABLE_INTEGER_VALUE, // ( const char *var_name ); G_CVAR_VARIABLE_STRING_BUFFER, // ( const char *var_name, char *buffer, int bufsize ); G_ARGC, // ( void ); // ClientCommand and ServerCommand parameter access G_ARGV, // ( int n, char *buffer, int bufferLength ); G_FS_FOPEN_FILE, // ( const char *qpath, fileHandle_t *file, fsMode_t mode ); G_FS_READ, // ( void *buffer, int len, fileHandle_t f ); G_FS_WRITE, // ( const void *buffer, int len, fileHandle_t f ); G_FS_FCLOSE_FILE, // ( fileHandle_t f ); G_SEND_CONSOLE_COMMAND, // ( const char *text ); // add commands to the console as if they were typed in // for map changing, etc //=========== server specific functionality ============= G_LOCATE_GAME_DATA, // ( gentity_t *gEnts, int numGEntities, int sizeofGEntity_t, // playerState_t *clients, int sizeofGameClient ); // the game needs to let the server system know where and how big the gentities // are, so it can look at them directly without going through an interface G_DROP_CLIENT, // ( int clientNum, const char *reason ); // kick a client off the server with a message G_SEND_SERVER_COMMAND, // ( int clientNum, const char *fmt, ... ); // reliably sends a command string to be interpreted by the given // client. If clientNum is -1, it will be sent to all clients G_SET_CONFIGSTRING, // ( int num, const char *string ); // config strings hold all the index strings, and various other information // that is reliably communicated to all clients // All of the current configstrings are sent to clients when // they connect, and changes are sent to all connected clients. // All confgstrings are cleared at each level start. G_GET_CONFIGSTRING, // ( int num, char *buffer, int bufferSize ); G_GET_USERINFO, // ( int num, char *buffer, int bufferSize ); // userinfo strings are maintained by the server system, so they // are persistant across level loads, while all other game visible // data is completely reset G_SET_USERINFO, // ( int num, const char *buffer ); G_GET_SERVERINFO, // ( char *buffer, int bufferSize ); // the serverinfo info string has all the cvars visible to server browsers G_SET_SERVER_CULL, //server culling to reduce traffic on open maps -rww G_SET_BRUSH_MODEL, // ( gentity_t *ent, const char *name ); // sets mins and maxs based on the brushmodel name G_TRACE, // ( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask ); // collision detection against all linked entities G_G2TRACE, // ( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask ); // collision detection against all linked entities with ghoul2 check G_POINT_CONTENTS, // ( const vec3_t point, int passEntityNum ); // point contents against all linked entities G_IN_PVS, // ( const vec3_t p1, const vec3_t p2 ); G_IN_PVS_IGNORE_PORTALS, // ( const vec3_t p1, const vec3_t p2 ); G_ADJUST_AREA_PORTAL_STATE, // ( gentity_t *ent, qboolean open ); G_AREAS_CONNECTED, // ( int area1, int area2 ); G_LINKENTITY, // ( gentity_t *ent ); // an entity will never be sent to a client or used for collision // if it is not passed to linkentity. If the size, position, or // solidity changes, it must be relinked. G_UNLINKENTITY, // ( gentity_t *ent ); // call before removing an interactive entity G_ENTITIES_IN_BOX, // ( const vec3_t mins, const vec3_t maxs, gentity_t **list, int maxcount ); // EntitiesInBox will return brush models based on their bounding box, // so exact determination must still be done with EntityContact G_ENTITY_CONTACT, // ( const vec3_t mins, const vec3_t maxs, const gentity_t *ent ); // perform an exact check against inline brush models of non-square shape // access for bots to get and free a server client (FIXME?) G_BOT_ALLOCATE_CLIENT, // ( void ); G_BOT_FREE_CLIENT, // ( int clientNum ); G_GET_USERCMD, // ( int clientNum, usercmd_t *cmd ) G_GET_ENTITY_TOKEN, // qboolean ( char *buffer, int bufferSize ) // Retrieves the next string token from the entity spawn text, returning // false when all tokens have been parsed. // This should only be done at GAME_INIT time. G_SIEGEPERSSET, G_SIEGEPERSGET, G_FS_GETFILELIST, G_DEBUG_POLYGON_CREATE, G_DEBUG_POLYGON_DELETE, G_REAL_TIME, G_SNAPVECTOR, G_TRACECAPSULE, // ( trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentmask ); G_ENTITY_CONTACTCAPSULE, // ( const vec3_t mins, const vec3_t maxs, const gentity_t *ent ); // SP_REGISTER_SERVER_CMD, SP_GETSTRINGTEXTSTRING, G_ROFF_CLEAN, // qboolean ROFF_Clean(void); G_ROFF_UPDATE_ENTITIES, // void ROFF_UpdateEntities(void); G_ROFF_CACHE, // int ROFF_Cache(char *file); G_ROFF_PLAY, // qboolean ROFF_Play(int entID, int roffID, qboolean doTranslation); G_ROFF_PURGE_ENT, // qboolean ROFF_PurgeEnt( int entID ) //rww - dynamic vm memory allocation! G_TRUEMALLOC, G_TRUEFREE, //rww - icarus traps G_ICARUS_RUNSCRIPT, G_ICARUS_REGISTERSCRIPT, G_ICARUS_INIT, G_ICARUS_VALIDENT, G_ICARUS_ISINITIALIZED, G_ICARUS_MAINTAINTASKMANAGER, G_ICARUS_ISRUNNING, G_ICARUS_TASKIDPENDING, G_ICARUS_INITENT, G_ICARUS_FREEENT, G_ICARUS_ASSOCIATEENT, G_ICARUS_SHUTDOWN, G_ICARUS_TASKIDSET, G_ICARUS_TASKIDCOMPLETE, G_ICARUS_SETVAR, G_ICARUS_VARIABLEDECLARED, G_ICARUS_GETFLOATVARIABLE, G_ICARUS_GETSTRINGVARIABLE, G_ICARUS_GETVECTORVARIABLE, G_SET_SHARED_BUFFER, //BEGIN VM STUFF G_MEMSET = 100, G_MEMCPY, G_STRNCPY, G_SIN, G_COS, G_ATAN2, G_SQRT, G_MATRIXMULTIPLY, G_ANGLEVECTORS, G_PERPENDICULARVECTOR, G_FLOOR, G_CEIL, G_TESTPRINTINT, G_TESTPRINTFLOAT, G_ACOS, G_ASIN, //END VM STUFF //rww - BEGIN NPC NAV TRAPS G_NAV_INIT = 200, G_NAV_FREE, G_NAV_LOAD, G_NAV_SAVE, G_NAV_ADDRAWPOINT, G_NAV_CALCULATEPATHS, G_NAV_HARDCONNECT, G_NAV_SHOWNODES, G_NAV_SHOWEDGES, G_NAV_SHOWPATH, G_NAV_GETNEARESTNODE, G_NAV_GETBESTNODE, G_NAV_GETNODEPOSITION, G_NAV_GETNODENUMEDGES, G_NAV_GETNODEEDGE, G_NAV_GETNUMNODES, G_NAV_CONNECTED, G_NAV_GETPATHCOST, G_NAV_GETEDGECOST, G_NAV_GETPROJECTEDNODE, G_NAV_CHECKFAILEDNODES, G_NAV_ADDFAILEDNODE, G_NAV_NODEFAILED, G_NAV_NODESARENEIGHBORS, G_NAV_CLEARFAILEDEDGE, G_NAV_CLEARALLFAILEDEDGES, G_NAV_EDGEFAILED, G_NAV_ADDFAILEDEDGE, G_NAV_CHECKFAILEDEDGE, G_NAV_CHECKALLFAILEDEDGES, G_NAV_ROUTEBLOCKED, G_NAV_GETBESTNODEALTROUTE, G_NAV_GETBESTNODEALT2, G_NAV_GETBESTPATHBETWEENENTS, G_NAV_GETNODERADIUS, G_NAV_CHECKBLOCKEDEDGES, G_NAV_CLEARCHECKEDNODES, G_NAV_CHECKEDNODE, G_NAV_SETCHECKEDNODE, G_NAV_FLAGALLNODES, G_NAV_GETPATHSCALCULATED, G_NAV_SETPATHSCALCULATED, //rww - END NPC NAV TRAPS BOTLIB_SETUP = 250, // ( void ); BOTLIB_SHUTDOWN, // ( void ); BOTLIB_LIBVAR_SET, BOTLIB_LIBVAR_GET, BOTLIB_PC_ADD_GLOBAL_DEFINE, BOTLIB_START_FRAME, BOTLIB_LOAD_MAP, BOTLIB_UPDATENTITY, BOTLIB_TEST, BOTLIB_GET_SNAPSHOT_ENTITY, // ( int client, int ent ); BOTLIB_GET_CONSOLE_MESSAGE, // ( int client, char *message, int size ); BOTLIB_USER_COMMAND, // ( int client, usercmd_t *ucmd ); BOTLIB_AAS_ENABLE_ROUTING_AREA = 300, BOTLIB_AAS_BBOX_AREAS, BOTLIB_AAS_AREA_INFO, BOTLIB_AAS_ENTITY_INFO, BOTLIB_AAS_INITIALIZED, BOTLIB_AAS_PRESENCE_TYPE_BOUNDING_BOX, BOTLIB_AAS_TIME, BOTLIB_AAS_POINT_AREA_NUM, BOTLIB_AAS_TRACE_AREAS, BOTLIB_AAS_POINT_CONTENTS, BOTLIB_AAS_NEXT_BSP_ENTITY, BOTLIB_AAS_VALUE_FOR_BSP_EPAIR_KEY, BOTLIB_AAS_VECTOR_FOR_BSP_EPAIR_KEY, BOTLIB_AAS_FLOAT_FOR_BSP_EPAIR_KEY, BOTLIB_AAS_INT_FOR_BSP_EPAIR_KEY, BOTLIB_AAS_AREA_REACHABILITY, BOTLIB_AAS_AREA_TRAVEL_TIME_TO_GOAL_AREA, BOTLIB_AAS_SWIMMING, BOTLIB_AAS_PREDICT_CLIENT_MOVEMENT, BOTLIB_EA_SAY = 400, BOTLIB_EA_SAY_TEAM, BOTLIB_EA_COMMAND, BOTLIB_EA_ACTION, BOTLIB_EA_GESTURE, BOTLIB_EA_TALK, BOTLIB_EA_ATTACK, BOTLIB_EA_ALT_ATTACK, BOTLIB_EA_FORCEPOWER, BOTLIB_EA_USE, BOTLIB_EA_RESPAWN, BOTLIB_EA_CROUCH, BOTLIB_EA_MOVE_UP, BOTLIB_EA_MOVE_DOWN, BOTLIB_EA_MOVE_FORWARD, BOTLIB_EA_MOVE_BACK, BOTLIB_EA_MOVE_LEFT, BOTLIB_EA_MOVE_RIGHT, BOTLIB_EA_SELECT_WEAPON, BOTLIB_EA_JUMP, BOTLIB_EA_DELAYED_JUMP, BOTLIB_EA_MOVE, BOTLIB_EA_VIEW, BOTLIB_EA_END_REGULAR, BOTLIB_EA_GET_INPUT, BOTLIB_EA_RESET_INPUT, BOTLIB_AI_LOAD_CHARACTER = 500, BOTLIB_AI_FREE_CHARACTER, BOTLIB_AI_CHARACTERISTIC_FLOAT, BOTLIB_AI_CHARACTERISTIC_BFLOAT, BOTLIB_AI_CHARACTERISTIC_INTEGER, BOTLIB_AI_CHARACTERISTIC_BINTEGER, BOTLIB_AI_CHARACTERISTIC_STRING, BOTLIB_AI_ALLOC_CHAT_STATE, BOTLIB_AI_FREE_CHAT_STATE, BOTLIB_AI_QUEUE_CONSOLE_MESSAGE, BOTLIB_AI_REMOVE_CONSOLE_MESSAGE, BOTLIB_AI_NEXT_CONSOLE_MESSAGE, BOTLIB_AI_NUM_CONSOLE_MESSAGE, BOTLIB_AI_INITIAL_CHAT, BOTLIB_AI_REPLY_CHAT, BOTLIB_AI_CHAT_LENGTH, BOTLIB_AI_ENTER_CHAT, BOTLIB_AI_STRING_CONTAINS, BOTLIB_AI_FIND_MATCH, BOTLIB_AI_MATCH_VARIABLE, BOTLIB_AI_UNIFY_WHITE_SPACES, BOTLIB_AI_REPLACE_SYNONYMS, BOTLIB_AI_LOAD_CHAT_FILE, BOTLIB_AI_SET_CHAT_GENDER, BOTLIB_AI_SET_CHAT_NAME, BOTLIB_AI_RESET_GOAL_STATE, BOTLIB_AI_RESET_AVOID_GOALS, BOTLIB_AI_PUSH_GOAL, BOTLIB_AI_POP_GOAL, BOTLIB_AI_EMPTY_GOAL_STACK, BOTLIB_AI_DUMP_AVOID_GOALS, BOTLIB_AI_DUMP_GOAL_STACK, BOTLIB_AI_GOAL_NAME, BOTLIB_AI_GET_TOP_GOAL, BOTLIB_AI_GET_SECOND_GOAL, BOTLIB_AI_CHOOSE_LTG_ITEM, BOTLIB_AI_CHOOSE_NBG_ITEM, BOTLIB_AI_TOUCHING_GOAL, BOTLIB_AI_ITEM_GOAL_IN_VIS_BUT_NOT_VISIBLE, BOTLIB_AI_GET_LEVEL_ITEM_GOAL, BOTLIB_AI_AVOID_GOAL_TIME, BOTLIB_AI_INIT_LEVEL_ITEMS, BOTLIB_AI_UPDATE_ENTITY_ITEMS, BOTLIB_AI_LOAD_ITEM_WEIGHTS, BOTLIB_AI_FREE_ITEM_WEIGHTS, BOTLIB_AI_SAVE_GOAL_FUZZY_LOGIC, BOTLIB_AI_ALLOC_GOAL_STATE, BOTLIB_AI_FREE_GOAL_STATE, BOTLIB_AI_RESET_MOVE_STATE, BOTLIB_AI_MOVE_TO_GOAL, BOTLIB_AI_MOVE_IN_DIRECTION, BOTLIB_AI_RESET_AVOID_REACH, BOTLIB_AI_RESET_LAST_AVOID_REACH, BOTLIB_AI_REACHABILITY_AREA, BOTLIB_AI_MOVEMENT_VIEW_TARGET, BOTLIB_AI_ALLOC_MOVE_STATE, BOTLIB_AI_FREE_MOVE_STATE, BOTLIB_AI_INIT_MOVE_STATE, BOTLIB_AI_CHOOSE_BEST_FIGHT_WEAPON, BOTLIB_AI_GET_WEAPON_INFO, BOTLIB_AI_LOAD_WEAPON_WEIGHTS, BOTLIB_AI_ALLOC_WEAPON_STATE, BOTLIB_AI_FREE_WEAPON_STATE, BOTLIB_AI_RESET_WEAPON_STATE, BOTLIB_AI_GENETIC_PARENTS_AND_CHILD_SELECTION, BOTLIB_AI_INTERBREED_GOAL_FUZZY_LOGIC, BOTLIB_AI_MUTATE_GOAL_FUZZY_LOGIC, BOTLIB_AI_GET_NEXT_CAMP_SPOT_GOAL, BOTLIB_AI_GET_MAP_LOCATION_GOAL, BOTLIB_AI_NUM_INITIAL_CHATS, BOTLIB_AI_GET_CHAT_MESSAGE, BOTLIB_AI_REMOVE_FROM_AVOID_GOALS, BOTLIB_AI_PREDICT_VISIBLE_POSITION, BOTLIB_AI_SET_AVOID_GOAL_TIME, BOTLIB_AI_ADD_AVOID_SPOT, BOTLIB_AAS_ALTERNATIVE_ROUTE_GOAL, BOTLIB_AAS_PREDICT_ROUTE, BOTLIB_AAS_POINT_REACHABILITY_AREA_INDEX, BOTLIB_PC_LOAD_SOURCE, BOTLIB_PC_FREE_SOURCE, BOTLIB_PC_READ_TOKEN, BOTLIB_PC_SOURCE_FILE_AND_LINE, /* Ghoul2 Insert Start */ G_R_REGISTERSKIN, G_G2_LISTBONES, G_G2_LISTSURFACES, G_G2_HAVEWEGHOULMODELS, G_G2_SETMODELS, G_G2_GETBOLT, G_G2_GETBOLT_NOREC, G_G2_GETBOLT_NOREC_NOROT, G_G2_INITGHOUL2MODEL, G_G2_SETSKIN, G_G2_SIZE, G_G2_ADDBOLT, G_G2_SETBOLTINFO, G_G2_ANGLEOVERRIDE, G_G2_PLAYANIM, G_G2_GETBONEANIM, G_G2_GETGLANAME, G_G2_COPYGHOUL2INSTANCE, G_G2_COPYSPECIFICGHOUL2MODEL, G_G2_DUPLICATEGHOUL2INSTANCE, G_G2_HASGHOUL2MODELONINDEX, G_G2_REMOVEGHOUL2MODEL, G_G2_REMOVEGHOUL2MODELS, G_G2_CLEANMODELS, G_G2_COLLISIONDETECT, G_G2_COLLISIONDETECTCACHE, G_G2_SETROOTSURFACE, G_G2_SETSURFACEONOFF, G_G2_SETNEWORIGIN, G_G2_DOESBONEEXIST, G_G2_GETSURFACERENDERSTATUS, G_G2_ABSURDSMOOTHING, /* //rww - RAGDOLL_BEGIN */ G_G2_SETRAGDOLL, G_G2_ANIMATEG2MODELS, /* //rww - RAGDOLL_END */ //additional ragdoll options -rww G_G2_RAGPCJCONSTRAINT, G_G2_RAGPCJGRADIENTSPEED, G_G2_RAGEFFECTORGOAL, G_G2_GETRAGBONEPOS, G_G2_RAGEFFECTORKICK, G_G2_RAGFORCESOLVE, //rww - ik move method, allows you to specify a bone and move it to a world point (within joint constraints) //by using the majority of gil's existing bone angling stuff from the ragdoll code. G_G2_SETBONEIKSTATE, G_G2_IKMOVE, G_G2_REMOVEBONE, G_G2_ATTACHINSTANCETOENTNUM, G_G2_CLEARATTACHEDINSTANCE, G_G2_CLEANENTATTACHMENTS, G_G2_OVERRIDESERVER, G_G2_GETSURFACENAME, G_SET_ACTIVE_SUBBSP, G_CM_REGISTER_TERRAIN, G_RMG_INIT, G_BOT_UPDATEWAYPOINTS, G_BOT_CALCULATEPATHS /* Ghoul2 Insert End */ } gameImport_t; //bstate.h typedef enum //# bState_e {//These take over only if script allows them to be autonomous BS_DEFAULT = 0,//# default behavior for that NPC BS_ADVANCE_FIGHT,//# Advance to captureGoal and shoot enemies if you can BS_SLEEP,//# Play awake script when startled by sound BS_FOLLOW_LEADER,//# Follow your leader and shoot any enemies you come across BS_JUMP,//# Face navgoal and jump to it. BS_SEARCH,//# Using current waypoint as a base, search the immediate branches of waypoints for enemies BS_WANDER,//# Wander down random waypoint paths BS_NOCLIP,//# Moves through walls, etc. BS_REMOVE,//# Waits for player to leave PVS then removes itself BS_CINEMATIC,//# Does nothing but face it's angles and move to a goal if it has one //# #eol //internal bStates only BS_WAIT,//# Does nothing but face it's angles BS_STAND_GUARD, BS_PATROL, BS_INVESTIGATE,//# head towards temp goal and look for enemies and listen for sounds BS_STAND_AND_SHOOT, BS_HUNT_AND_KILL, BS_FLEE,//# Run away! NUM_BSTATES } bState_t; enum { EDGE_NORMAL, EDGE_PATH, EDGE_BLOCKED, EDGE_FAILED, EDGE_MOVEDIR }; enum { NODE_NORMAL, NODE_START, NODE_GOAL, NODE_NAVGOAL, }; typedef enum //# taskID_e { TID_CHAN_VOICE = 0, // Waiting for a voice sound to complete TID_ANIM_UPPER, // Waiting to finish a lower anim holdtime TID_ANIM_LOWER, // Waiting to finish a lower anim holdtime TID_ANIM_BOTH, // Waiting to finish lower and upper anim holdtimes or normal md3 animating TID_MOVE_NAV, // Trying to get to a navgoal or For ET_MOVERS TID_ANGLE_FACE, // Turning to an angle or facing TID_BSTATE, // Waiting for a certain bState to finish TID_LOCATION, // Waiting for ent to enter a specific trigger_location // TID_MISSIONSTATUS, // Waiting for player to finish reading MISSION STATUS SCREEN TID_RESIZE, // Waiting for clear bbox to inflate size TID_SHOOT, // Waiting for fire event NUM_TIDS, // for def of taskID array } taskID_t; typedef enum //# bSet_e {//This should check to matching a behavior state name first, then look for a script BSET_INVALID = -1, BSET_FIRST = 0, BSET_SPAWN = 0,//# script to use when first spawned BSET_USE,//# script to use when used BSET_AWAKE,//# script to use when awoken/startled BSET_ANGER,//# script to use when aquire an enemy BSET_ATTACK,//# script to run when you attack BSET_VICTORY,//# script to run when you kill someone BSET_LOSTENEMY,//# script to run when you can't find your enemy BSET_PAIN,//# script to use when take pain BSET_FLEE,//# script to use when take pain below 50% of health BSET_DEATH,//# script to use when killed BSET_DELAYED,//# script to run when self->delayScriptTime is reached BSET_BLOCKED,//# script to run when blocked by a friendly NPC or player BSET_BUMPED,//# script to run when bumped into a friendly NPC or player (can set bumpRadius) BSET_STUCK,//# script to run when blocked by a wall BSET_FFIRE,//# script to run when player shoots their own teammates BSET_FFDEATH,//# script to run when player kills a teammate BSET_MINDTRICK,//# script to run when player does a mind trick on this NPC NUM_BSETS } bSet_t; #define MAX_PARMS 16 #define MAX_PARM_STRING_LENGTH MAX_QPATH//was 16, had to lengthen it so they could take a valid file path typedef struct { char parm[MAX_PARMS][MAX_PARM_STRING_LENGTH]; } parms_t; #define MAX_FAILED_NODES 8 typedef struct Vehicle_s Vehicle_t; // the server looks at a sharedEntity, which is the start of the game's gentity_t structure //mod authors should not touch this struct typedef struct { entityState_t s; // communicated by server to clients playerState_t *playerState; //needs to be in the gentity for bg entity access //if you want to actually see the contents I guess //you will have to be sure to VMA it first. Vehicle_t *m_pVehicle; //vehicle data void *ghoul2; //g2 instance int localAnimIndex; //index locally (game/cgame) to anim data for this skel vec3_t modelScale; //needed for g2 collision //from here up must also be unified with bgEntity/centity entityShared_t r; // shared by both the server system and game //Script/ICARUS-related fields int taskID[NUM_TIDS]; parms_t *parms; char *behaviorSet[NUM_BSETS]; char *script_targetname; int delayScriptTime; char *fullName; //rww - targetname and classname are now shared as well. ICARUS needs access to them. char *targetname; char *classname; // set in QuakeEd //rww - and yet more things to share. This is because the nav code is in the exe because it's all C++. int waypoint; //Set once per frame, if you've moved, and if someone asks int lastWaypoint; //To make sure you don't double-back int lastValidWaypoint; //ALWAYS valid -used for tracking someone you lost int noWaypointTime; //Debouncer - so don't keep checking every waypoint in existance every frame that you can't find one int combatPoint; int failedWaypoints[MAX_FAILED_NODES]; int failedWaypointCheckTime; int next_roff_time; //rww - npc's need to know when they're getting roff'd } sharedEntity_t; /*#ifdef __cplusplus class CSequencer; class CTaskManager; //I suppose this could be in another in-engine header or something. But we never want to //include an icarus file before sharedentity_t is declared. extern CSequencer *gSequencers[MAX_GENTITIES]; extern CTaskManager *gTaskManagers[MAX_GENTITIES]; #include "../icarus/icarus.h" #include "../icarus/sequencer.h" #include "../icarus/taskmanager.h" #endif*/ // // functions exported by the game subsystem // typedef enum { GAME_INIT, // ( int levelTime, int randomSeed, int restart ); // init and shutdown will be called every single level // The game should call G_GET_ENTITY_TOKEN to parse through all the // entity configuration text and spawn gentities. GAME_SHUTDOWN, // (void); GAME_CLIENT_CONNECT, // ( int clientNum, qboolean firstTime, qboolean isBot ); // return NULL if the client is allowed to connect, otherwise return // a text string with the reason for denial GAME_CLIENT_BEGIN, // ( int clientNum ); GAME_CLIENT_USERINFO_CHANGED, // ( int clientNum ); GAME_CLIENT_DISCONNECT, // ( int clientNum ); GAME_CLIENT_COMMAND, // ( int clientNum ); GAME_CLIENT_THINK, // ( int clientNum ); GAME_RUN_FRAME, // ( int levelTime ); GAME_CONSOLE_COMMAND, // ( void ); // ConsoleCommand will be called when a command has been issued // that is not recognized as a builtin function. // The game can issue trap_argc() / trap_argv() commands to get the command // and parameters. Return qfalse if the game doesn't recognize it as a command. BOTAI_START_FRAME, // ( int time ); GAME_ROFF_NOTETRACK_CALLBACK, // int entnum, char *notetrack GAME_SPAWN_RMG_ENTITY, //rwwRMG - added //rww - icarus callbacks GAME_ICARUS_PLAYSOUND, GAME_ICARUS_SET, GAME_ICARUS_LERP2POS, GAME_ICARUS_LERP2ORIGIN, GAME_ICARUS_LERP2ANGLES, GAME_ICARUS_GETTAG, GAME_ICARUS_LERP2START, GAME_ICARUS_LERP2END, GAME_ICARUS_USE, GAME_ICARUS_KILL, GAME_ICARUS_REMOVE, GAME_ICARUS_PLAY, GAME_ICARUS_GETFLOAT, GAME_ICARUS_GETVECTOR, GAME_ICARUS_GETSTRING, GAME_ICARUS_SOUNDINDEX, GAME_ICARUS_GETSETIDFORSTRING, GAME_NAV_CLEARPATHTOPOINT, GAME_NAV_CLEARLOS, GAME_NAV_CLEARPATHBETWEENPOINTS, GAME_NAV_CHECKNODEFAILEDFORENT, GAME_NAV_ENTISUNLOCKEDDOOR, GAME_NAV_ENTISDOOR, GAME_NAV_ENTISBREAKABLE, GAME_NAV_ENTISREMOVABLEUSABLE, GAME_NAV_FINDCOMBATPOINTWAYPOINTS, GAME_GETITEMINDEXBYTAG } gameExport_t; typedef struct { int taskID; int entID; char name[2048]; char channel[2048]; } T_G_ICARUS_PLAYSOUND; typedef struct { int taskID; int entID; char type_name[2048]; char data[2048]; } T_G_ICARUS_SET; typedef struct { int taskID; int entID; vec3_t origin; vec3_t angles; float duration; qboolean nullAngles; //special case } T_G_ICARUS_LERP2POS; typedef struct { int taskID; int entID; vec3_t origin; float duration; } T_G_ICARUS_LERP2ORIGIN; typedef struct { int taskID; int entID; vec3_t angles; float duration; } T_G_ICARUS_LERP2ANGLES; typedef struct { int entID; char name[2048]; int lookup; vec3_t info; } T_G_ICARUS_GETTAG; typedef struct { int entID; int taskID; float duration; } T_G_ICARUS_LERP2START; typedef struct { int entID; int taskID; float duration; } T_G_ICARUS_LERP2END; typedef struct { int entID; char target[2048]; } T_G_ICARUS_USE; typedef struct { int entID; char name[2048]; } T_G_ICARUS_KILL; typedef struct { int entID; char name[2048]; } T_G_ICARUS_REMOVE; typedef struct { int taskID; int entID; char type[2048]; char name[2048]; } T_G_ICARUS_PLAY; typedef struct { int entID; int type; char name[2048]; float value; } T_G_ICARUS_GETFLOAT; typedef struct { int entID; int type; char name[2048]; vec3_t value; } T_G_ICARUS_GETVECTOR; typedef struct { int entID; int type; char name[2048]; char value[2048]; } T_G_ICARUS_GETSTRING; typedef struct { char filename[2048]; } T_G_ICARUS_SOUNDINDEX; typedef struct { char string[2048]; } T_G_ICARUS_GETSETIDFORSTRING; #endif //G_PUBLIC_H
[ "xycaleth@b0a17542-b272-11de-a2d3-9dcf383ffee4" ]
[ [ [ 1, 925 ] ] ]
5b7a9b457d38519639681831a9a6f20db9bdda61
457cfb51e6b1053c852602f57acc9087629e966d
/source/BLUE/AppWindow.h
1b68d74daad2f3aa775431c144a9ca5cdfb826d2
[]
no_license
bluespeck/BLUE
b05eeff4958b2bf30adb0aeb2432f1c2f6c21d96
430d9dc0e64837007f35ce98fbface014be93678
refs/heads/master
2021-01-13T01:50:57.300012
2010-11-15T16:37:10
2010-11-15T16:37:10
null
0
0
null
null
null
null
UTF-8
C++
false
false
710
h
#pragma once #include "WindowInput.h" #include <windows.h> namespace BLUE { class CAppWindow { public: ~CAppWindow( void ); static CAppWindow *GetInstance(){ return &sAppWindow; } BOOL CreateAppWindow( HINSTANCE hInstance, const TCHAR *szTitle, unsigned int nWidth = 1024, unsigned int nHeight = 768 ); void ShowAppWindow( int nCmdShow = 1 ); LRESULT MessageHandler( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ); CWindowInput *GetWindowInput(); HWND GetWindowHandle(); void Bind3DEngine(class CEngine *pEngine); private: static CAppWindow sAppWindow; HWND m_hWnd; CWindowInput m_input; class CEngine *m_pEngine; CAppWindow( void ); }; }
[ [ [ 1, 35 ] ] ]
3112e3e4129ab773195faa5ee5d692f98f50d4b3
fcf03ead74f6dc103ec3b07ffe3bce81c820660d
/Base/DLLs/UsingDLLs/UsingDLLs.cpp
896bf7a3cf581a94a01b1ac4250b54938037eae6
[]
no_license
huellif/symbian-example
72097c9aec6d45d555a79a30d576dddc04a65a16
56f6c5e67a3d37961408fc51188d46d49bddcfdc
refs/heads/master
2016-09-06T12:49:32.021854
2010-10-14T06:31:20
2010-10-14T06:31:20
38,062,421
2
0
null
null
null
null
UTF-8
C++
false
false
1,955
cpp
// UsingDLLs.cpp // // Copyright (C) Symbian Software Ltd 2000-2005. All rights reserved. // A program which uses dynamically linked DLLs. // standard example header #include "CommonFramework.h" // f32 header needed for loading dlls. #include <f32file.h> #include "UsingDLLs.h" _LIT(KTxtHarry,"Harry"); _LIT(KTxtSally,"Sally"); _LIT(KTxtDr1,"PolymorphicDLL1.DLL"); _LIT(KTxtDr2,"PolymorphicDLL2.DLL"); _LIT(KTxt1,"dynamically linked DLL example \n\n"); _LIT(KTxt2,"checking UID\n"); _LIT(KTxt3,"DLL has incorrect UID... \n"); void UseDllL(const TFileName& aDllName, const TDesC& aName); LOCAL_C void doExampleL() { // open file server session. RFs fs; User::LeaveIfError(fs.Connect()); console->Printf(KTxt1); // use each DLL in turn TFileName dll; dll = KTxtDr1; UseDllL(dll, KTxtHarry); dll = KTxtDr2; UseDllL(dll, KTxtSally); // close the file server session. fs.Close(); } // how to use a DLL void UseDllL(const TFileName& aLibraryName, const TDesC& aName) { // Use RLibrary object to interface to the DLL RLibrary library; // Dynamically load DLL User::LeaveIfError(library.Load(aLibraryName)); // Check second UID is as expected; leave if not console->Printf(KTxt2); if (library.Type()[1] != KMessengerUid) { console->Printf(KTxt3); User::Leave(KErrGeneral); } // Function at ordinal 1 creates new CMessenger TLibraryFunction entry=library.Lookup(1); // Call the function to create new CMessenger CMessenger* messenger=(CMessenger*) entry(); // Push pointer to CMessenger onto the cleanup stack CleanupStack::PushL(messenger); // Second-phase constructor for CMessenger messenger->ConstructL(console, aName); // Use CMessenger object to issue greeting messenger->ShowMessage(); // Pop CMessenger object off cleanup stack and destroy CleanupStack::PopAndDestroy(); // Finished with the DLL library.Close(); }
[ "liuxk99@bdc341c6-17c0-11de-ac9f-1d9250355bca" ]
[ [ [ 1, 70 ] ] ]
3fb55a0393e7f7c4b6d325a1a9396c6897a167b8
c1a2953285f2a6ac7d903059b7ea6480a7e2228e
/deitel/ch23/Pong/Pong/Pong.h
3fd5f8a3a59e52e000439edbe9f01d6377425a2e
[]
no_license
tecmilenio/computacion2
728ac47299c1a4066b6140cebc9668bf1121053a
a1387e0f7f11c767574fcba608d94e5d61b7f36c
refs/heads/master
2016-09-06T19:17:29.842053
2008-09-28T04:27:56
2008-09-28T04:27:56
50,540
4
3
null
null
null
null
UTF-8
C++
false
false
3,396
h
// Pong.h // Pong class definition (represents a game of Pong). #ifndef PONG_H #define PONG_H #include <Ogre.h> // Ogre class definition using namespace Ogre; // use the Ogre namespace #include <OIS\OISEvents.h> // OISEvents class definition #include <OIS\OISInputManager.h> // OISInputManager class definition #include <OIS\OISKeyboard.h> // OISKeyboard class definition class Ball; // forward declaration of class Ball class Paddle; // forward declaration of class Paddle enum Players { PLAYER1, PLAYER2 }; class Pong : public FrameListener, public OIS::KeyListener { public: Pong(); // constructor ~Pong(); // destructor void run(); // run a game of Pong // handle keyPressed and keyReleased events bool keyPressed( const OIS::KeyEvent &keyEventRef ); bool keyReleased( const OIS::KeyEvent &keyEventRef ); // move the game objects and control interactions between frames virtual bool frameStarted( const FrameEvent &frameEvent ); virtual bool frameEnded( const FrameEvent &frameEvent ); static void updateScore( Players player); // update the score private: void createScene(); // create the scene to be rendered static void updateScoreText(); // update the score on the screen // Ogre objects Root *rootPtr; // pointer to Ogre's Root object SceneManager *sceneManagerPtr; // pointer to the SceneManager RenderWindow *windowPtr; // pointer to RenderWindow to render scene in Viewport *viewportPtr; // pointer to Viewport, area that a camera sees Camera *cameraPtr; // pointer to a Camera in the scene // OIS input objects OIS::InputManager *inputManagerPtr; // pointer to the InputManager OIS::Keyboard *keyboardPtr; // pointer to the Keyboard // game objects Ball *ballPtr; // pointer to the Ball Paddle *leftPaddlePtr; // pointer to player 1's Paddle Paddle *rightPaddlePtr; // pointer to player 2's Paddle // variables to control game states bool quit, pause; // did user quit or pause the game? Real time; // used to delay the motion of a new Ball static bool wait; // should the Ball's movement be delayed? static int player1Score; // player 1's score static int player2Score; // player 2's score }; // end class Pong #endif // PONG_H /************************************************************************** * (C) Copyright 1992-2008 by Deitel & Associates, Inc. and * * Pearson Education, Inc. All Rights Reserved. * * * * DISCLAIMER: The authors and publisher of this book have used their * * best efforts in preparing the book. These efforts include the * * development, research, and testing of the theories and programs * * to determine their effectiveness. The authors and publisher make * * no warranty of any kind, expressed or implied, with regard to these * * programs or to the documentation contained in these books. The authors * * and publisher shall not be liable in any event for incidental or * * consequential damages in connection with, or arising out of, the * * furnishing, performance, or use of these programs. * **************************************************************************/
[ [ [ 1, 79 ] ] ]
ef8e2a4a4d548d93535f362cbad41180e5de9be2
9710e59ed37e5b7a9d05fe99ffcca5f49444f7a3
/src/AbstractPen.cpp
14cfeb4120b4aef541d192e9e103974e3e9adecb
[]
no_license
btuduri/dspaint
218d6de862d9e5c0b062c17d5f75c569e35ffb5e
a1f47537c960d6e93ef8853a14c9ee4b9f267ec5
refs/heads/master
2016-09-06T08:44:20.354217
2009-04-27T20:58:05
2009-04-27T20:58:05
32,271,641
0
0
null
null
null
null
UTF-8
C++
false
false
621
cpp
#include "AbstractPen.h" namespace DSPaint { AbstractPen::AbstractPen() { // black colour m_width = 1; m_colour = PA_RGB(0,0,0); } AbstractPen::~AbstractPen() { } u8 AbstractPen::GetWidth() { return m_width; } void AbstractPen::SetWidth(u8 width) { if (width > 0) m_width = width; } u16 AbstractPen::GetColour() { return m_colour; } void AbstractPen::SetColour(u16 colour) { m_colour = colour; } void AbstractPen::Draw(Canvas canvas, s16 x, s16 y) { } void AbstractPen::Draw(Canvas canvas, s16 x1, s16 y1, s16 x2, s16 y2) { } }
[ "nightstalkerz@08a58f1c-9a32-11dd-9476-71c886a649bc" ]
[ [ [ 1, 44 ] ] ]
52cf2472ccb181c50e6665d486bcb99e15bc94c0
5e6ff9e6e8427078135a7b4d3b194bcbf631e9cd
/EngineSource/dpslim/dpslim/Database/Source/DBSocNetwork.cpp
5dbf7134270c51e756a0f97dc5924d475dc47a63
[]
no_license
karakots/dpresurrection
1a6f3fca00edd24455f1c8ae50764142bb4106e7
46725077006571cec1511f31d314ccd7f5a5eeef
refs/heads/master
2016-09-05T09:26:26.091623
2010-02-01T11:24:41
2010-02-01T11:24:41
32,189,181
0
0
null
null
null
null
UTF-8
C++
false
false
3,018
cpp
#pragma once // ---------------------- // // Created 4/26/2005 // Steve Noble, DecisionPower, Inc. // // ---------------------- #include "DBSocNetwork.h" #include "DBModel.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // IMPLEMENT_DYNAMIC(SocNetworkRecordset, CRecordset) SocNetworkRecordset::SocNetworkRecordset(CDatabase* pdb) : CRecordset(pdb) { //{{AFX_FIELD_INIT(BrandRecordset) from_segment = 0; to_segment = 0; network_param = 0; // this nnumber must needs match how many above m_nFields = 3; //}}AFX_FIELD_INIT // Changing default type ensures that blocking hstmt is used without // the ODBC cursor library. //m_nDefaultType = snapshot; m_nDefaultType = CRecordset::snapshot; // Using bound parameters in place of MFC filter string modification. //m_nParams = 1; } CString SocNetworkRecordset::GetDefaultConnect() { // We don't allow the record set to connect on it's own. Dynamic // creation from the view passes the document's database to // the record set. //return _T("ODBC;DSN=Test"); return _T(""); } CString SocNetworkRecordset::GetDefaultSQL() { CString tmp("SELECT from_id, to_id, network_param FROM segment_network "); tmp += ModelRecordset::ModelQuery; return tmp; } void SocNetworkRecordset::DoFieldExchange(CFieldExchange* pFX) { // Create our own field exchange mechanism. We must do this for two // reasons. First, MFC's class wizard cannot currently determine the data // types of procedure columns. Second, we must create our own parameter // data exchange lines to take advantage of a bound ODBC input parameter. //{{AFX_FIELD_MAP(BrandRecordset) pFX->SetFieldType(CFieldExchange::outputColumn); RFX_Long(pFX, _T("[from_id]"), from_segment); RFX_Long(pFX, _T("[to_id]"), to_segment); RFX_Long(pFX, _T("[network_param]"), network_param); //}}AFX_FIELD_MAP //pFX->SetFieldType(CFieldExchange::param); //RFX_Text(pFX, _T("@CustID"), m_strCustID); } ///////////////////////////////////////////////////////////////////////////// #ifdef _DEBUG void SocNetworkRecordset::AssertValid() const { CRecordset::AssertValid(); } void SocNetworkRecordset::Dump(CDumpContext& dc) const { CRecordset::Dump(dc); } #endif //_DEBUG int SocNetworkRecordset::Open(unsigned int nOpenType, LPCTSTR lpszSql, DWORD dwOptions) { // Override the default behavior of the Open member function. We want to // ensure that the record set executes on the SQL Server default // (blocking) statement type. nOpenType = CRecordset::snapshot; //forwardOnly; dwOptions = CRecordset::none; try { CRecordset::Open(nOpenType, GetDefaultSQL(), dwOptions); } catch (CException* e) { e->Delete(); return FALSE; } return TRUE; }
[ "Isaac.Noble@fd82578e-0ebe-11df-96d9-85c6b80b8d9c" ]
[ [ [ 1, 118 ] ] ]
4243fd852e96e693ba3178c27431ffff28e27beb
6eef3e34d3fe47a10336a53df1a96a591b15cd01
/ASearch/Search/SearchTypes.hpp
6a305d78b86547213dca1ea7d088f07ebbde87aa
[]
no_license
praveenmunagapati/alkaline
25013c233a80b07869e0fdbcf9b8dfa7888cc32e
7cf43b115d3e40ba48854f80aca8d83b67f345ce
refs/heads/master
2021-05-27T16:44:12.356701
2009-10-29T11:23:09
2009-10-29T11:23:09
null
0
0
null
null
null
null
WINDOWS-1252
C++
false
false
3,912
hpp
/* © Vestris Inc., Geneva, Switzerland http://www.vestris.com, 1994-1999 All Rights Reserved ______________________________________________ written by Daniel Doubrovkine - [email protected] */ #ifndef ALKALINE_C_SEARCH_TYPES_HPP #define ALKALINE_C_SEARCH_TYPES_HPP #include <platform/include.hpp> #include <String/String.hpp> #include <Vector/Vector.hpp> #include <Date/Date.hpp> /* search type */ typedef enum CSearchType { st_Exact, // exact, case-insensitive st_InsensExact, // exact, case-sensitive st_Partial, // substring, case-insensitive st_InsensPartial // substring, case-sensitive } CSearchType; /* types of case-sensitive/insensitive search */ typedef enum { sct_CaseAutomatic, sct_CaseSensitive, sct_CaseInsensitive } CSearchCaseType; /* data necessary to perform a search operation and return results */ typedef struct _CSearchData { CSearchCaseType m_SearchCaseType; int m_SearchedWords; CVector<CString> m_Words; // keywords searched CVector<short int> m_ResultsQuality; // quality vector CVector<int> m_Results; // results vector CVector<int> m_ResultsPositions; // original positions (sorted by relevance) short int m_MaxPossibleQuality; short int m_QualityThreshold; } CSearchData; /* results sorting types */ typedef enum { CSTNone, // no sorting CSTDate, // sort by date CSTTitle, // sort by title CSTUrl, // sort by URL CSTSize, // sort by size CSTSizeInverse, // sort by size (inverted) CSTDateInverse // sort by date (inverted) } CSortType; class CAlkalineSession; /* structure passed to the results mapping function for each result shown */ typedef struct _CIndexMapV { CVector<CString> m_HashInfo; // document indexed information [last-modified][content-length][date][title][header][server] CString m_Recent; // recent CString m_Expired; // expired CString m_RecentCount; // recent count CString m_Url; // document url int m_Index; // output relative index CDate m_ModifDateObject; // modified CDate m_DateObject; // created struct tm m_tmDate; // encoded date CString m_DateMap; // map string to use for date bool m_ForceQuote; // force results quoting int m_ResultPosition; // real position (per relevance) CSearchData * m_SearchData; // search data object CAlkalineSession * m_Parent; // parent session } CIndexMapV; /* structure used to specify paths and scope restrictions while constructing search keywords and sorting results */ typedef struct _CSearchOptions { CVector<CString> m_OptionHosts; // host: CVector<CString> m_OptionPaths; // path: CVector<CString> m_OptionUrls; // url: CVector<CString> m_OptionExts; // ext: CVector<CString> m_OptionExtra; // appended by routine CVector<CString> m_OptionMeta; // forced meta tags bool m_DateAfterValid; bool m_DateBeforeValid; struct tm m_DateAfter; // after: struct tm m_DateBefore; // before: bool m_USFormats; // MMDD vs. DDMM dates bool m_OptAnd; // opt:and bool m_OptWhole; // opt:whole bool m_OptCase; // opt:case bool m_OptInsens; // opt:insens } CSearchOptions; #endif
[ [ [ 1, 113 ] ] ]
eefd3eade69a64eb9e0fe2429f34d73ce966f60d
b143d3766a4ff51320c211850bda2b290d0e6d32
/PointSet.h
a2879a87620792595fba9c323088434d36bcf8e7
[]
no_license
jimbok8/MPUReconstruction
676274b046e7d10efc9af20c833a688aeca74462
8cd814a2eadb2a448dec428bc2ac76b5269daf6c
refs/heads/master
2021-05-26T23:03:23.479191
2010-03-17T14:03:53
2010-03-17T14:03:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,031
h
#ifndef POINTSET_H #define POINTSET_H #include <cstdio> #include <cmath> #include <limits> #include <vnl/vnl_math.h> // Dummy class ImplicitOctTree; class PointSet { public: float (*_point)[3]; float (*_normal)[3]; bool *_bound; int _pointN; ImplicitOctTree* _tree; public: PointSet() { _pointN = 0; _point = NULL; _normal = NULL; _bound = NULL; } ~PointSet() { if(_point != NULL) delete[] _point; if(_normal != NULL) delete[] _normal; if(_bound != NULL) delete[] _bound; }; void setPointSize(int N) { _pointN = N; _point = new float[N][3]; _normal = new float[N][3]; //_bound = new bool[N]; //for(int i=0; i<N; i++) //_bound[i] = false; } inline void swapIndex(int i, int j) { float tmp = _point[i][0]; _point[i][0] = _point[j][0]; _point[j][0] = tmp; tmp = _point[i][1]; _point[i][1] = _point[j][1]; _point[j][1] = tmp; tmp = _point[i][2]; _point[i][2] = _point[j][2]; _point[j][2] = tmp; tmp = _normal[i][0]; _normal[i][0] = _normal[j][0]; _normal[j][0] = tmp; tmp = _normal[i][1]; _normal[i][1] = _normal[j][1]; _normal[j][1] = tmp; tmp = _normal[i][2]; _normal[i][2] = _normal[j][2]; _normal[j][2] = tmp; //bool tmpB = _bound[i]; //_bound[i] = _bound[j]; //_bound[j] = tmpB; } void setPoint(int i, float x, float y, float z) { _point[i][0] = x; _point[i][1] = y; _point[i][2] = z; } void setNormal(int i, float x, float y, float z) { _normal[i][0] = x; _normal[i][1] = y; _normal[i][2] = z; } //Index "end" is not taken int account void centroid(float c[3], int start, int end) { c[0] = c[1] = c[2] = 0; for(int i=start; i<end; i++){ c[0] += _point[i][0]; c[1] += _point[i][1]; c[2] += _point[i][2]; } c[0] /= (end-start); c[1] /= (end-start); c[2] /= (end-start); } //Index "end" is not taken int account void averagedNormal(float n[3], int start, int end) { n[0] = n[1] = n[2] = 0; for(int i=start; i<end; i++){ n[0] += _normal[i][0]; n[1] += _normal[i][1]; n[2] += _normal[i][2]; } double len = sqrt(n[0]*n[0] + n[1]*n[1] + n[2]*n[2]); if((float)len != 0) { n[0] = (float)(n[0]/len); n[1] = (float)(n[1]/len); n[2] = (float)(n[2]/len); } } void bound(float min[], float max[]) { min[0] = min[1] = min[2] = std::numeric_limits<float>::infinity(); max[0] = max[1] = max[2] = -std::numeric_limits<float>::infinity(); for(int i=0; i<_pointN; i++) { float *p = _point[i]; if(p[0] < min[0]) min[0] = p[0]; if(p[0] > max[0]) max[0] = p[0]; if(p[1] < min[1]) min[1] = p[1]; if(p[1] > max[1]) max[1] = p[1]; if(p[2] < min[2]) min[2] = p[2]; if(p[2] > max[2]) max[2] = p[2]; } } void bound(float min[], float max[], int start, int end) { min[0] = min[1] = min[2] = std::numeric_limits<float>::infinity(); max[0] = max[1] = max[2] = -std::numeric_limits<float>::infinity(); for(int i=start; i<end; i++){ float *p = _point[i]; if(p[0] < min[0]) min[0] = p[0]; if(p[0] > max[0]) max[0] = p[0]; if(p[1] < min[1]) min[1] = p[1]; if(p[1] > max[1]) max[1] = p[1]; if(p[2] < min[2]) min[2] = p[2]; if(p[2] > max[2]) max[2] = p[2]; } } void shift(float sx, float sy, float sz) { for(int i=0; i<_pointN; i++) { _point[i][0] += sx; _point[i][1] += sy; _point[i][2] += sz; } } void scale(float s) { for(int i=0; i<_pointN; i++) { _point[i][0] *= s; _point[i][1] *= s; _point[i][2] *= s; } } void rotate(float rx, float ry, float rz) { rx = (float)(rx*vnl_math::pi/180.0); ry = (float)(ry*vnl_math::pi/180.0); rz = (float)(rz*vnl_math::pi/180.0); if(rx != 0) { double s = sin(rx); double c = cos(rx); for(int i=0; i<_pointN; i++) { float y = _point[i][1]; float z = _point[i][2]; _point[i][1] = (float)(c*y + s*z); _point[i][2] = (float)(-s*y + c*z); y = _normal[i][1]; z = _normal[i][2]; _normal[i][1] = (float)(c*y + s*z); _normal[i][2] = (float)(-s*y + c*z); } } if(ry != 0) { double s = sin(ry); double c = cos(ry); for(int i=0; i<_pointN; i++) { float z = _point[i][2]; float x = _point[i][0]; _point[i][2] = (float)(c*z + s*x); _point[i][0] = (float)(-s*z + c*x); z = _normal[i][2]; x = _normal[i][0]; _normal[i][2] = (float)(c*z + s*x); _normal[i][0] = (float)(-s*z + c*x); } } if(rz != 0) { double s = sin(rz); double c = cos(rz); for(int i=0; i<_pointN; i++) { float x = _point[i][0]; float y = _point[i][1]; _point[i][0] = (float)(c*x + s*y); _point[i][1] = (float)(-s*x + c*y); x = _normal[i][0]; y = _normal[i][1]; _normal[i][0] = (float)(c*x + s*y); _normal[i][1] = (float)(-s*x + c*y); } } } PointSet* copyPoints() { PointSet* c = new PointSet(); c->setPointSize(_pointN); for(int i=0; i<_pointN; i++) { c->setPoint(i, _point[i][0], _point[i][1], _point[i][2]); c->setNormal(i, _normal[i][0], _normal[i][1], _normal[i][2]); } return c; } }; #endif
[ [ [ 1, 6 ], [ 8, 196 ], [ 200, 272 ] ], [ [ 7, 7 ], [ 197, 199 ] ] ]
503ee0c1f2f40202a293c3f84b23f1351aec1eed
41efaed82e413e06f31b65633ed12adce4b7abc2
/projects/lab6/src/MyController.h
9ce0ab7ee24bf9f72946120840eb69e3973cd578
[]
no_license
ivandro/AVT---project
e0494f2e505f76494feb0272d1f41f5d8f117ac5
ef6fe6ebfe4d01e4eef704fb9f6a919c9cddd97f
refs/heads/master
2016-09-06T03:45:35.997569
2011-10-27T15:00:14
2011-10-27T15:00:14
2,642,435
0
2
null
2016-04-08T14:24:40
2011-10-25T09:47:13
C
UTF-8
C++
false
false
1,329
h
// This file is an example for CGLib. // // CGLib 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. // // CGLib 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 CGLib; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // // Copyright 2007 Carlos Martinho #ifndef MY_CONTROLLER_H #define MY_CONTROLLER_H #include "cg/cg.h" #include "MyLight.h" #include "MyTeapot.h" namespace lab6 { class MyController : public cg::Entity, public cg::IKeyboardEventListener, public cg::IDrawListener { public: MyController(); ~MyController(); void init(); void onKeyPressed(unsigned char key); void onKeyReleased(unsigned char key); void onSpecialKeyPressed(int key); void onSpecialKeyReleased(int key); void drawOverlay(); }; } #endif
[ "Moreira@Moreira-PC.(none)" ]
[ [ [ 1, 44 ] ] ]