| 11 | #include "types.h" |
| 12 | |
| 13 | J2DTextBoxEx::J2DTextBoxEx(J2DPane* parent, JSURandomInputStream* input, u32 flags, J2DMaterial* materials) |
| 14 | { |
| 15 | J2DTextBoxBlock info; |
| 16 | |
| 17 | mAnmVisibility = nullptr; |
| 18 | |
| 19 | int startPos = input->getPosition(); |
| 20 | |
| 21 | J2DScrnBlockHeader header; |
| 22 | input->read(&header, sizeof(J2DScrnBlockHeader)); |
| 23 | mBloBlockType = header.mBloBlockType; |
| 24 | |
| 25 | int panHeaderPos = input->getPosition(); |
| 26 | J2DScrnBlockHeader panHeader; |
| 27 | input->peek(&panHeader, sizeof(J2DScrnBlockHeader)); |
| 28 | makePaneExStream(parent, input); |
| 29 | input->seek(panHeaderPos + panHeader.mBlockLength, SEEK_SET); |
| 30 | |
| 31 | input->read(&info, sizeof(J2DTextBoxBlock)); |
| 32 | mAnimVisibilityIndex = info.mAnimPaneIndex; |
| 33 | mMaterialID = info.mMaterialNum; |
| 34 | mMaterial = nullptr; |
| 35 | |
| 36 | if (mMaterialID != 0xFFFF) { |
| 37 | mMaterial = &materials[mMaterialID]; |
| 38 | materials[mMaterialID].mPane = this; |
| 39 | rewriteAlpha(); |
| 40 | |
| 41 | if (mMaterial) { |
| 42 | if (mMaterial->getTevBlock() != nullptr) { |
| 43 | mFont = static_cast<JUTResFont*>(mMaterial->getTevBlock()->getFont()); |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | mCharSpacing = info.mCharSpacing; |
| 49 | mLineSpacing = info.mLineSpacing; |
| 50 | mFontSize.x = info.mFontSizeX; |
| 51 | mFontSize.y = info.mFontSizeY; |
| 52 | mFlags = (info.mHBind << 2) | info.mVBind; |
| 53 | mCharColor = JUTColor(info.mCharColor); |
| 54 | mGradientColor = JUTColor(info.mGradientColor); |
| 55 | setConnectParent(info.mDoConnectParent); |
| 56 | |
| 57 | u16 strLength = 0; |
| 58 | if (!(flags & 0x2000000)) { |
| 59 | strLength = info.mTextBoxLength; |
| 60 | if ((s16)info.mTextBoxLength == -1) { |
| 61 | strLength = info.mMaxReadLength + 1; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | mStringLength = 0; |
| 66 | mStringPtr = nullptr; |
| 67 | |
| 68 | if (strLength != 0) { |
| 69 | mStringPtr = new char[strLength]; |
| 70 | } |
nothing calls this directly
no test coverage detected