MCPcopy Create free account
hub / github.com/StrongPC123/Far-Cry-1-Source-Full / DrawTriStrip

Method DrawTriStrip

CrySystem/ScriptObjectSystem.cpp:1518–1586  ·  view source on GitHub ↗

//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

1516/////////////////////////////////////////////////////////////////////////////////
1517/////////////////////////////////////////////////////////////////////////////////
1518int CScriptObjectSystem::DrawTriStrip(IFunctionHandler *pH)
1519{
1520#if !defined(LINUX)
1521#define _MAX_VTXS 10
1522 USER_DATA nTid;
1523 int nCookie=0;
1524 int nMode=0;
1525 float a,r,g,b;
1526 pH->GetParamUDVal(1,nTid,nCookie);
1527 struct _vtx_{
1528 float x,y,z;
1529 unsigned char c[4];
1530 float u,v;
1531 };
1532 pH->GetParam(4,r);
1533 pH->GetParam(5,g);
1534 pH->GetParam(6,b);
1535 pH->GetParam(7,a);
1536 _SmartScriptObject vtxs(m_pScriptSystem,true);
1537 if(((nTid && (nCookie==USER_DATA_TEXTURE))) && pH->GetParam(2,nMode) && pH->GetParam(3,vtxs))
1538 {
1539 _SmartScriptObject vtx(m_pScriptSystem,true);
1540 _vtx_ v[_MAX_VTXS];
1541 int nvtxs=0;
1542 vtxs->BeginIteration();
1543 while(vtxs->MoveNext() && nvtxs<_MAX_VTXS)
1544 {
1545 if(vtxs->GetCurrent(vtx))
1546 {
1547 v[nvtxs].z=0;
1548 v[nvtxs].c[0]=unsigned char(r*0xFF);
1549 v[nvtxs].c[1]=unsigned char(g*0xFF);
1550 v[nvtxs].c[2]=unsigned char(b*0xFF);
1551 v[nvtxs].c[3]=unsigned char(a*0xFF);
1552 vtx->GetValue("x",v[nvtxs].x);
1553 vtx->GetValue("y",v[nvtxs].y);
1554 vtx->GetValue("u",v[nvtxs].u);
1555 vtx->GetValue("v",v[nvtxs].v);
1556 nvtxs++;
1557 }
1558 }
1559 vtxs->EndIteration();
1560 if(nvtxs)
1561 {
1562 CVertexBuffer vb(&v,VERTEX_FORMAT_P3F_COL4UB_TEX2F,nvtxs);
1563 m_pRenderer->Set2DMode(true,800,600);
1564 m_pRenderer->SetTexture(nTid);
1565 unsigned int nState = GS_NODEPTHTEST;
1566 m_pRenderer->SetCullMode(R_CULL_DISABLE);
1567 if (nMode!=0)
1568 {
1569 nState |= sGetBlendState(nMode);
1570 m_pRenderer->SetColorOp(eCO_MODULATE, eCO_MODULATE, DEF_TEXARG0, DEF_TEXARG0);
1571 }
1572 m_pRenderer->SetState(nState);
1573 m_pRenderer->DrawTriStrip(&vb,nvtxs);
1574 if (nMode!=0){
1575 m_pRenderer->SetState(GS_DEPTHWRITE);

Callers 7

RenderTerrainGridMethod · 0.45
DrawTriMethod · 0.45
DrawQuadMethod · 0.45
DrawTexturePolygonMethod · 0.45
DrawHalfCircleGaugeMethod · 0.45
DrawBigDecalOnTerrainMethod · 0.45

Calls 14

sGetBlendStateFunction · 0.85
BeginIterationMethod · 0.80
EndIterationMethod · 0.80
EndFunctionMethod · 0.80
GetParamUDValMethod · 0.45
GetParamMethod · 0.45
MoveNextMethod · 0.45
GetCurrentMethod · 0.45
GetValueMethod · 0.45
Set2DModeMethod · 0.45
SetTextureMethod · 0.45
SetCullModeMethod · 0.45

Tested by

no test coverage detected