Skip to content

Commit

Permalink
Merge pull request #73 from playmer/playmer/warnings
Browse files Browse the repository at this point in the history
Some warnings clang wouldn't shut up about.
  • Loading branch information
Galladite27 authored Sep 21, 2024
2 parents cd87a5e + 958baf8 commit 0ecc9cc
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 36 deletions.
12 changes: 6 additions & 6 deletions AnimationInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ SDL_Rect AnimationInfo::findOpaquePoint(SDL_Rect *clip)
//find the first opaque-enough pixel position for transbtn
{
int cell_width = image_surface->w/num_of_cells;
SDL_Rect cliprect = {0, 0, cell_width, image_surface->h};
SDL_Rect cliprect = {0, 0, (Uint16)cell_width, (Uint16)image_surface->h};
if (clip) cliprect = *clip;

#ifdef BPP16
Expand Down Expand Up @@ -409,7 +409,7 @@ void AnimationInfo::blendOnSurface( SDL_Surface *dst_surface, int dst_x, int dst
if ( image_surface == NULL ) return;
if ( alpha == 0 ) return;

SDL_Rect dst_rect = {dst_x, dst_y, pos.w, pos.h}, src_rect;
SDL_Rect dst_rect = {(Sint16)dst_x, (Sint16)dst_y, pos.w, pos.h}, src_rect;
if ( doClipping( &dst_rect, &clip, &src_rect ) ) return;

/* ---------------------------------------- */
Expand Down Expand Up @@ -669,7 +669,7 @@ void AnimationInfo::blendText( SDL_Surface *surface, int dst_x, int dst_y,
{
if (image_surface == NULL || surface == NULL) return;

SDL_Rect dst_rect = {dst_x, dst_y, surface->w, surface->h};
SDL_Rect dst_rect = {(Sint16)dst_x, (Sint16)dst_y, (Uint16)surface->w, (Uint16)surface->h};
if (rotate_flag){
dst_rect.w = surface->h;
dst_rect.h = surface->w;
Expand All @@ -688,7 +688,7 @@ void AnimationInfo::blendText( SDL_Surface *surface, int dst_x, int dst_y,

/* ---------------------------------------- */
/* 2nd clipping */
SDL_Rect clip_rect = {0, 0, image_surface->w, image_surface->h};
SDL_Rect clip_rect = {0, 0, (Uint16)image_surface->w, (Uint16)image_surface->h};
if ( doClipping( &dst_rect, &clip_rect, &clipped_rect ) ) return;

src_rect.x += clipped_rect.x;
Expand Down Expand Up @@ -830,10 +830,10 @@ void AnimationInfo::copySurface( SDL_Surface *surface, SDL_Rect *src_rect, SDL_R
{
if (!image_surface || !surface) return;

SDL_Rect _dst_rect = {0, 0, image_surface->w, image_surface->h};
SDL_Rect _dst_rect = {0, 0, (Uint16)image_surface->w, (Uint16)image_surface->h};
if (dst_rect) _dst_rect = *dst_rect;

SDL_Rect _src_rect = {0, 0, surface->w, surface->h};
SDL_Rect _src_rect = {0, 0, (Uint16)surface->w, (Uint16)surface->h};
if (src_rect) _src_rect = *src_rect;

if (_src_rect.x >= surface->w) return;
Expand Down
2 changes: 1 addition & 1 deletion Layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ void OldMovieLayer::om_init()

// Generate scanlines of solid greyscale, used for the glow effect.
GlowSurface = AnimationInfo::allocSurface(width, MAX_GLOW);
for (SDL_Rect r = { 0, 0, width, 1 }; r.y < MAX_GLOW; r.y++) {
for (SDL_Rect r = { 0, 0, (Uint16)width, 1 }; r.y < MAX_GLOW; r.y++) {
const int ry = (r.y * 30 / MAX_GLOW) + 4;
SDL_FillRect(GlowSurface, &r, SDL_MapRGB(GlowSurface->format, ry, ry, ry));
}
Expand Down
3 changes: 1 addition & 2 deletions ONScripterLabel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1302,7 +1302,6 @@ int ONScripterLabel::init()

// ----------------------------------------
// Sound related variables
this->cdaudio_flag = cdaudio_flag;
if ( cdaudio_flag ){
if ( cdrom_drive_number >= 0 && cdrom_drive_number < SDL_CDNumDrives() )
cdrom_info = SDL_CDOpen( cdrom_drive_number );
Expand Down Expand Up @@ -2294,7 +2293,7 @@ void ONScripterLabel::displayTextWindow( SDL_Surface *surface, SDL_Rect &clip )
{
if ( current_font->is_transparent ){

SDL_Rect rect = {0, 0, screen_width, screen_height};
SDL_Rect rect = {0, 0, (Uint16)screen_width, (Uint16)screen_height};
if ( current_font == &sentence_font )
rect = sentence_font_info.pos;

Expand Down
26 changes: 13 additions & 13 deletions ONScripterLabel_command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2054,7 +2054,7 @@ int ONScripterLabel::menu_windowCommand()
#ifndef PSP
if (async_movie) SMPEG_pause( async_movie );
screen_surface = SDL_SetVideoMode( screen_width, screen_height, screen_bpp, DEFAULT_VIDEO_SURFACE_FLAG );
SDL_Rect rect = {0, 0, screen_width, screen_height};
SDL_Rect rect = {0, 0, (Uint16)screen_width, (Uint16)screen_height};
flushDirect( rect, refreshMode() );
if (async_movie){
SMPEG_setdisplay( async_movie, screen_surface, NULL, NULL );
Expand Down Expand Up @@ -2096,7 +2096,7 @@ int ONScripterLabel::menu_fullCommand()
screen_surface = SDL_SetVideoMode( screen_width, screen_height, screen_bpp, DEFAULT_VIDEO_SURFACE_FLAG );
fullscreen_mode = false;
}
SDL_Rect rect = {0, 0, screen_width, screen_height};
SDL_Rect rect = {0, 0, (Uint16)screen_width, (Uint16)screen_height};
flushDirect( rect, refreshMode() );
if (async_movie){
SMPEG_setdisplay( async_movie, screen_surface, NULL, NULL );
Expand Down Expand Up @@ -3639,7 +3639,7 @@ int ONScripterLabel::dvCommand()

int ONScripterLabel::drawtextCommand()
{
SDL_Rect clip = {0, 0, accumulation_surface->w, accumulation_surface->h};
SDL_Rect clip = {0, 0, (Uint16)accumulation_surface->w, (Uint16)accumulation_surface->h};
text_info.blendOnSurface( accumulation_surface, 0, 0, clip );

return RET_CONTINUE;
Expand Down Expand Up @@ -3671,7 +3671,7 @@ int ONScripterLabel::drawsp3Command()
si.inv_mat[1][1] = si.mat[0][0] * 1000 / denom;
}

SDL_Rect clip = {0, 0, screen_surface->w, screen_surface->h};
SDL_Rect clip = {0, 0, (Uint16)screen_surface->w, (Uint16)screen_surface->h};
si.blendOnSurface2( accumulation_surface, x, y, clip, alpha );
si.setCell(old_cell_no);

Expand All @@ -3694,7 +3694,7 @@ int ONScripterLabel::drawsp2Command()
si.calcAffineMatrix();
si.setCell(cell_no);

SDL_Rect clip = {0, 0, screen_surface->w, screen_surface->h};
SDL_Rect clip = {0, 0, (Uint16)screen_surface->w, (Uint16)screen_surface->h};
si.blendOnSurface2( accumulation_surface, si.pos.x, si.pos.y, clip, alpha );

return RET_CONTINUE;
Expand All @@ -3711,7 +3711,7 @@ int ONScripterLabel::drawspCommand()
AnimationInfo &si = sprite_info[sprite_no];
int old_cell_no = si.current_cell;
si.setCell(cell_no);
SDL_Rect clip = {0, 0, accumulation_surface->w, accumulation_surface->h};
SDL_Rect clip = {0, 0, (Uint16)accumulation_surface->w, (Uint16)accumulation_surface->h};
si.blendOnSurface( accumulation_surface, x, y, clip, alpha );
si.setCell(old_cell_no);

Expand All @@ -3738,7 +3738,7 @@ int ONScripterLabel::drawclearCommand()

int ONScripterLabel::drawbgCommand()
{
SDL_Rect clip = {0, 0, accumulation_surface->w, accumulation_surface->h};
SDL_Rect clip = {0, 0, (Uint16)accumulation_surface->w, (Uint16)accumulation_surface->h};
bg_info.blendOnSurface( accumulation_surface, bg_info.pos.x, bg_info.pos.y, clip );

return RET_CONTINUE;
Expand All @@ -3755,7 +3755,7 @@ int ONScripterLabel::drawbg2Command()
bi.rot = script_h.readInt();
bi.calcAffineMatrix();

SDL_Rect clip = {0, 0, screen_surface->w, screen_surface->h};
SDL_Rect clip = {0, 0, (Uint16)screen_surface->w, (Uint16)screen_surface->h};
bi.blendOnSurface2( accumulation_surface, bi.pos.x, bi.pos.y,
clip, 256 );

Expand All @@ -3764,7 +3764,7 @@ int ONScripterLabel::drawbg2Command()

int ONScripterLabel::drawCommand()
{
SDL_Rect rect = {0, 0, screen_width, screen_height};
SDL_Rect rect = {0, 0, (Uint16)screen_width, (Uint16)screen_height};
flushDirect( rect, REFRESH_NONE_MODE );
dirty_rect.clear();

Expand Down Expand Up @@ -4239,7 +4239,7 @@ int ONScripterLabel::btnwaitCommand()
if (txtbtn_show) txtbtn_visible = true;

if (is_exbtn_enabled && exbtn_d_button_link.exbtn_ctl){
SDL_Rect check_src_rect = {0, 0, screen_width, screen_height};
SDL_Rect check_src_rect = {0, 0, (Uint16)screen_width, (Uint16)screen_height};
decodeExbtnControl( exbtn_d_button_link.exbtn_ctl, &check_src_rect );
}

Expand Down Expand Up @@ -4485,8 +4485,8 @@ int ONScripterLabel::bltCommand()

if ( sw == dw && sw > 0 && sh == dh && sh > 0 ){

SDL_Rect src_rect = {sx,sy,sw,sh};
SDL_Rect dst_rect = {dx,dy,dw,dh};
SDL_Rect src_rect = {(Sint16)sx,(Sint16)sy,(Uint16)sw,(Uint16)sh};
SDL_Rect dst_rect = {(Sint16)dx,(Sint16)dy,(Uint16)dw,(Uint16)dh};

SDL_BlitSurface( btndef_info.image_surface, &src_rect, screen_surface, &dst_rect );
SDL_UpdateRect( screen_surface, dst_rect.x, dst_rect.y, dst_rect.w, dst_rect.h );
Expand Down Expand Up @@ -4538,7 +4538,7 @@ int ONScripterLabel::bltCommand()
SDL_UnlockSurface(btndef_info.image_surface);
SDL_UnlockSurface(accumulation_surface);

SDL_Rect dst_rect = {start_x, start_y, end_x-start_x, end_y-start_y};
SDL_Rect dst_rect = {(Sint16)start_x, (Sint16)start_y, (Uint16)(end_x-start_x), (Uint16)(end_y-start_y)};
flushDirect( (SDL_Rect&)dst_rect, REFRESH_NONE_MODE );
}

Expand Down
6 changes: 3 additions & 3 deletions ONScripterLabel_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ bool ONScripterLabel::doEffect( EffectLink *effect, bool clear_dirty_region )
int i, amp;
int width, width2;
int height, height2;
SDL_Rect src_rect={0, 0, screen_width, screen_height};
SDL_Rect dst_rect={0, 0, screen_width, screen_height};
SDL_Rect quake_rect={0, 0, screen_width, screen_height};
SDL_Rect src_rect={0, 0, (Uint16)screen_width, (Uint16)screen_height};
SDL_Rect dst_rect={0, 0, (Uint16)screen_width, (Uint16)screen_height};
SDL_Rect quake_rect={0, 0, (Uint16)screen_width, (Uint16)screen_height};

/* ---------------------------------------- */
/* Execute effect */
Expand Down
4 changes: 2 additions & 2 deletions ONScripterLabel_effect_breakup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ void ONScripterLabel::effectBreakup( char *params, int duration )
bool *msk_buf = breakup_cellforms;

for (int n=0; n<n_cells; ++n) {
SDL_Rect rect = { breakup_cells[n].cell_x * BREAKUP_CELLWIDTH,
breakup_cells[n].cell_y * BREAKUP_CELLWIDTH,
SDL_Rect rect = { (Sint16)(breakup_cells[n].cell_x * BREAKUP_CELLWIDTH),
(Sint16)(breakup_cells[n].cell_y * BREAKUP_CELLWIDTH),
BREAKUP_CELLWIDTH, BREAKUP_CELLWIDTH };
breakup_cells[n].state += frame_diff;
if (breakup_cells[n].state >= (BREAKUP_MOVE_FRAMES + BREAKUP_STILL_STATE)) {
Expand Down
4 changes: 2 additions & 2 deletions ONScripterLabel_effect_cascade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ void ONScripterLabel::effectCascade( char *params, int duration )
};

SDL_Surface *src_surface, *dst_surface;
SDL_Rect src_rect={0, 0, screen_width, screen_height};
SDL_Rect dst_rect={0, 0, screen_width, screen_height};
SDL_Rect src_rect={0, 0, (Uint16)screen_width, (Uint16)screen_height};
SDL_Rect dst_rect={0, 0, (Uint16)screen_width, (Uint16)screen_height};
int mode, width, start, end;

if (params[0] == 'u')
Expand Down
4 changes: 2 additions & 2 deletions ONScripterLabel_effect_trig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ void ONScripterLabel::effectTrvswave( char *params, int duration )
TRVSWAVE_WVLEN_START = 256
};

SDL_Rect src_rect={0, 0, screen_width, 1};
SDL_Rect dst_rect={0, 0, screen_width, 1};
SDL_Rect src_rect={0, 0, (Uint16)screen_width, 1};
SDL_Rect dst_rect={0, 0, (Uint16)screen_width, 1};
int ampl, wvlen;
int y_offset = -screen_height / 2;
int width = 256 * effect_counter / duration;
Expand Down
10 changes: 5 additions & 5 deletions ONScripterLabel_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ void ONScripterLabel::effectBlend( SDL_Surface *mask_surface, int trans_mode,
Uint32 mask_value, SDL_Rect *clip,
SDL_Surface *src1, SDL_Surface *src2, SDL_Surface *dst )
{
SDL_Rect rect = {0, 0, screen_width, screen_height};
SDL_Rect rect = {0, 0, (Uint16)screen_width, (Uint16)screen_height};

if (src1 == NULL)
src1 = effect_src_surface;
Expand Down Expand Up @@ -412,7 +412,7 @@ void ONScripterLabel::alphaBlendText( SDL_Surface *dst_surface, SDL_Rect dst_rec

/* ---------------------------------------- */
/* 2nd clipping */
SDL_Rect clip_rect = {0, 0, dst_surface->w, dst_surface->h};
SDL_Rect clip_rect = {0, 0, (Uint16)dst_surface->w, (Uint16)dst_surface->h};
if ( AnimationInfo::doClipping( &dst_rect, &clip_rect, &clipped_rect ) ) return;

x2 += clipped_rect.x;
Expand Down Expand Up @@ -500,7 +500,7 @@ void ONScripterLabel::refreshSurface( SDL_Surface *surface, SDL_Rect *clip_src,
{
if (refresh_mode == REFRESH_NONE_MODE) return;

SDL_Rect clip = {0, 0, surface->w, surface->h};
SDL_Rect clip = {0, 0, (Uint16)surface->w, (Uint16)surface->h};
if (clip_src) if ( AnimationInfo::doClipping( &clip, clip_src ) ) return;

int i, top;
Expand Down Expand Up @@ -670,8 +670,8 @@ void ONScripterLabel::createBackground()

bg_info.fill(0, 0, 0, 0xff);
if (anim.image_surface){
SDL_Rect src_rect = {0, 0, anim.image_surface->w, anim.image_surface->h};
SDL_Rect dst_rect = {0, 0, screen_width, screen_height};
SDL_Rect src_rect = {0, 0, (Uint16)anim.image_surface->w, (Uint16)anim.image_surface->h};
SDL_Rect dst_rect = {0, 0, (Uint16)screen_width, (Uint16)screen_height};
if (screen_width >= anim.image_surface->w){
dst_rect.x = (screen_width - anim.image_surface->w) / 2;
}
Expand Down

0 comments on commit 0ecc9cc

Please sign in to comment.