void CItem::AdjustByStat() { DWORD dwSWEType, dwSWEValue; double dV1, dV2, dV3; dwSWEType = GetNibble(m_dwAttribute, 5); dwSWEValue = GetNibble(m_dwAttribute, 4); switch (dwSWEType) { case ITEMSTAT_AGILE: m_cSpeed--; if (m_cSpeed < 0) m_cSpeed = 0; break; case ITEMSTAT_LIGHT: dV2 = (double)m_wWeight; dV3 = (double)(dwSWEValue*4); dV1 = (dV3/100.0f)*dV2; m_wWeight -= (int)dV1; if (m_wWeight < 1) m_wWeight = 1; break; case ITEMSTAT_STRONG: case ITEMSTAT_ANCIENT: dV2 = (double)m_wMaxLifeSpan; dV3 = (double)(dwSWEValue*7); dV1 = (dV3/100.0f)*dV2; m_wMaxLifeSpan += (int)dV1; break; } }
bool CVobSubImage::Decode(BYTE* lpData, int packetsize, int datasize, bool fCustomPal, int tridx, RGBQUAD* orgpal /*[16]*/, RGBQUAD* cuspal /*[4]*/, bool fTrim) { GetPacketInfo(lpData, packetsize, datasize); if(!Alloc(rect.Width(), rect.Height())) { return(false); } lpPixels = lpTemp1; nPlane = 0; fAligned = 1; this->fCustomPal = fCustomPal; this->orgpal = orgpal; this->tridx = tridx; this->cuspal = cuspal; CPoint p(rect.left, rect.top); int end0 = nOffset[1]; int end1 = datasize; while((nPlane == 0 && nOffset[0] < end0) || (nPlane == 1 && nOffset[1] < end1)) { DWORD code; if((code = GetNibble(lpData)) >= 0x4 || (code = (code << 4) | GetNibble(lpData)) >= 0x10 || (code = (code << 4) | GetNibble(lpData)) >= 0x40 || (code = (code << 4) | GetNibble(lpData)) >= 0x100) { DrawPixels(p, code >> 2, code & 3); if((p.x += code >> 2) < rect.right) { continue; } } DrawPixels(p, rect.right - p.x, code & 3); if(!fAligned) { GetNibble(lpData); // align to byte } p.x = rect.left; p.y++; nPlane = 1 - nPlane; }
bool SRecordParser::GetByte ( const char **s, unsigned char *b, unsigned lineNum, const char *label ) { unsigned char b1, b2; if ( GetNibble( s, &b1, lineNum, label ) && GetNibble( s, &b2, lineNum, label )) { *b = b1 << 4 | b2; return true; } return false; }
int GetByte ( Parser_t *parser, ///< (mod) Parser object that we're reporting about. const char **s, ///< (mod) Pointer to string. Will be advanced. unsigned char *b , ///< (out) nibble that was parsed. const char *label ///< (in) Error string (used for reporting errors). ) { unsigned char b1, b2; if ( GetNibble( parser, s, &b1, label ) && GetNibble( parser, s, &b2, label )) { *b = b1 << 4 | b2; return TRUE; } return FALSE; } // GetByte
NIBBLETYPE cBlockArea::GetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ) const { return GetNibble(a_BlockX, a_BlockY, a_BlockZ, m_BlockSkyLight); }
NIBBLETYPE cBlockArea::GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ) const { return GetNibble(a_BlockX, a_BlockY, a_BlockZ, m_BlockMetas); }