Skip to content

Commit

Permalink
Split animated faces into different textures
Browse files Browse the repository at this point in the history
  • Loading branch information
isage committed Apr 8, 2019
1 parent 6ac1673 commit e0a1c42
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 21 deletions.
Binary file modified data/Face.pbm
Binary file not shown.
Binary file added data/Face_0.pbm
Binary file not shown.
Binary file added data/Face_1.pbm
Binary file not shown.
Binary file added data/Face_2.pbm
Binary file not shown.
Binary file modified data/sprites.sif
Binary file not shown.
28 changes: 8 additions & 20 deletions src/TextBox/TextBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,8 @@ void TextBox::SetFace(int newface)
// stat("TextBox::SetFace(%d)", newface);
fFace = newface;
fFaceXOffset = -FACE_W;
if (settings->animated_facepics)
{
faceFrame = 0;
faceStep = 1;
}
else
{
faceFrame = 2;
faceStep = 0;
}
faceFrame = 0;
faceStep = 1;
}

void TextBox::ShowCursor(bool enable)
Expand Down Expand Up @@ -273,10 +265,7 @@ void TextBox::TickTextBox()
}
else
{
if (settings->animated_facepics)
faceFrame = 0;
else
faceFrame = 2;
faceFrame = 0;
faceStep = 0;
}
}
Expand Down Expand Up @@ -312,7 +301,11 @@ void TextBox::DrawTextBox()
// draw face
if (fFace != 0)
{
Renderer::getInstance()->sprites.drawSprite((fCoords.x + 14) + fFaceXOffset, fCoords.y + CONTENT_Y - 3, SPR_FACES, fFace + (30*faceFrame));
if (settings->animated_facepics)
Renderer::getInstance()->sprites.drawSprite((fCoords.x + 14) + fFaceXOffset, fCoords.y + CONTENT_Y - 3, SPR_FACES_0 + faceFrame, fFace);
else
Renderer::getInstance()->sprites.drawSprite((fCoords.x + 14) + fFaceXOffset, fCoords.y + CONTENT_Y - 3, SPR_FACES, fFace);

text_x += (FACE_W + 8); // move text over by width of face

// face slide-in animation
Expand Down Expand Up @@ -371,11 +364,6 @@ void TextBox::AddNextChar(void)
}
}
}
else
{
faceStep = 0;
faceFrame = 2;
}

while (!fCharsWaiting.empty())
{
Expand Down
4 changes: 4 additions & 0 deletions src/autogen/sprites.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,3 +491,7 @@
#define SPR_SAVESELECTOR_SIDES 487
#define SPR_SAVESELECTOR_MIDDLE 488
#define SPR_SS_HEALTH_ICON 489

#define SPR_FACES_0 490
#define SPR_FACES_1 491
#define SPR_FACES_2 492
2 changes: 1 addition & 1 deletion src/graphics/Sprites.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#ifndef _SPRITES_H
#define _SPRITES_H

#define MAX_SPRITESHEETS 64
#define MAX_SPRITESHEETS 128
#define MAX_SPRITES 512

#include "../siflib/sif.h"
Expand Down

0 comments on commit e0a1c42

Please sign in to comment.