[cpp] Formatting.

This commit is contained in:
Mario Zechner 2023-05-02 13:06:10 +02:00
parent 4f01861cac
commit 18eef55eb5
2 changed files with 29 additions and 29 deletions

View File

@ -113,23 +113,23 @@ static int readInt(_dataInput *input) {
} }
static int readVarint(_dataInput *input, int /*bool*/ optimizePositive) { static int readVarint(_dataInput *input, int /*bool*/ optimizePositive) {
unsigned char b = readByte(input); unsigned char b = readByte(input);
int32_t value = b & 0x7F; int32_t value = b & 0x7F;
if (b & 0x80) { if (b & 0x80) {
b = readByte(input); b = readByte(input);
value |= (b & 0x7F) << 7; value |= (b & 0x7F) << 7;
if (b & 0x80) { if (b & 0x80) {
b = readByte(input); b = readByte(input);
value |= (b & 0x7F) << 14; value |= (b & 0x7F) << 14;
if (b & 0x80) { if (b & 0x80) {
b = readByte(input); b = readByte(input);
value |= (b & 0x7F) << 21; value |= (b & 0x7F) << 21;
if (b & 0x80) value |= (readByte(input) & 0x7F) << 28; if (b & 0x80) value |= (readByte(input) & 0x7F) << 28;
} }
} }
} }
if (!optimizePositive) value = (((unsigned int) value >> 1) ^ -(value & 1)); if (!optimizePositive) value = (((unsigned int) value >> 1) ^ -(value & 1));
return value; return value;
} }
float readFloat(_dataInput *input) { float readFloat(_dataInput *input) {
@ -1030,7 +1030,7 @@ spAttachment *spSkeletonBinary_readAttachment(spSkeletonBinary *self, _dataInput
{ {
spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name,
path, sequence); path, sequence);
spRegionAttachment *region = NULL; spRegionAttachment *region = NULL;
if (!attachment) if (!attachment)
return NULL; return NULL;
region = SUB_CAST(spRegionAttachment, attachment); region = SUB_CAST(spRegionAttachment, attachment);
@ -1053,7 +1053,7 @@ spAttachment *spSkeletonBinary_readAttachment(spSkeletonBinary *self, _dataInput
int vertexCount = readVarint(input, 1); int vertexCount = readVarint(input, 1);
spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, 0, spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, 0,
NULL); NULL);
spVertexAttachment *vertexAttachment = NULL; spVertexAttachment *vertexAttachment = NULL;
if (!attachment) if (!attachment)
return NULL; return NULL;
vertexAttachment = SUB_CAST(spVertexAttachment, attachment); vertexAttachment = SUB_CAST(spVertexAttachment, attachment);
@ -1107,7 +1107,7 @@ spAttachment *spSkeletonBinary_readAttachment(spSkeletonBinary *self, _dataInput
{ {
spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, path, sequence); spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, path, sequence);
spMeshAttachment *mesh = NULL; spMeshAttachment *mesh = NULL;
if (!attachment) if (!attachment)
return NULL; return NULL;
mesh = SUB_CAST(spMeshAttachment, attachment); mesh = SUB_CAST(spMeshAttachment, attachment);
@ -1159,7 +1159,7 @@ spAttachment *spSkeletonBinary_readAttachment(spSkeletonBinary *self, _dataInput
{ {
spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, path, sequence); spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, path, sequence);
spMeshAttachment *mesh = NULL; spMeshAttachment *mesh = NULL;
if (!attachment) if (!attachment)
return NULL; return NULL;
mesh = SUB_CAST(spMeshAttachment, attachment); mesh = SUB_CAST(spMeshAttachment, attachment);
@ -1175,13 +1175,13 @@ spAttachment *spSkeletonBinary_readAttachment(spSkeletonBinary *self, _dataInput
case SP_ATTACHMENT_PATH: { case SP_ATTACHMENT_PATH: {
spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, 0, spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, 0,
NULL); NULL);
spPathAttachment *path = NULL; spPathAttachment *path = NULL;
spVertexAttachment *vertexAttachment = NULL; spVertexAttachment *vertexAttachment = NULL;
int vertexCount = 0; int vertexCount = 0;
if (!attachment) if (!attachment)
return NULL; return NULL;
path = SUB_CAST(spPathAttachment, attachment); path = SUB_CAST(spPathAttachment, attachment);
vertexAttachment = SUPER(path); vertexAttachment = SUPER(path);
path->closed = readBoolean(input); path->closed = readBoolean(input);
path->constantSpeed = readBoolean(input); path->constantSpeed = readBoolean(input);
vertexCount = readVarint(input, 1); vertexCount = readVarint(input, 1);
@ -1202,7 +1202,7 @@ spAttachment *spSkeletonBinary_readAttachment(spSkeletonBinary *self, _dataInput
case SP_ATTACHMENT_POINT: { case SP_ATTACHMENT_POINT: {
spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, 0, spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, 0,
NULL); NULL);
spPointAttachment *point = NULL; spPointAttachment *point = NULL;
if (!attachment) if (!attachment)
return NULL; return NULL;
point = SUB_CAST(spPointAttachment, attachment); point = SUB_CAST(spPointAttachment, attachment);
@ -1221,8 +1221,8 @@ spAttachment *spSkeletonBinary_readAttachment(spSkeletonBinary *self, _dataInput
int vertexCount = readVarint(input, 1); int vertexCount = readVarint(input, 1);
spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, 0, spAttachment *attachment = spAttachmentLoader_createAttachment(self->attachmentLoader, skin, type, name, 0,
NULL); NULL);
spClippingAttachment *clip = NULL; spClippingAttachment *clip = NULL;
spVertexAttachment *vertexAttachment = NULL; spVertexAttachment *vertexAttachment = NULL;
if (!attachment) if (!attachment)
return NULL; return NULL;
clip = SUB_CAST(spClippingAttachment, attachment); clip = SUB_CAST(spClippingAttachment, attachment);

View File

@ -101,7 +101,7 @@ void SkeletonDrawable::draw(SDL_Renderer *renderer) {
uvs = &regionAttachment->getUVs(); uvs = &regionAttachment->getUVs();
indices = &quadIndices; indices = &quadIndices;
indicesCount = 6; indicesCount = 6;
texture = (SDL_Texture *)regionAttachment->getRegion()->rendererObject; texture = (SDL_Texture *) regionAttachment->getRegion()->rendererObject;
} else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) { } else if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) {
MeshAttachment *mesh = (MeshAttachment *) attachment; MeshAttachment *mesh = (MeshAttachment *) attachment;