From eb81855ac7f6af34cdc11dacea75db4c6c5e2faa Mon Sep 17 00:00:00 2001 From: pelya Date: Mon, 9 Jun 2014 00:30:50 +0300 Subject: [PATCH] OpenTyrian: Reverted C++-isms from code, to match upstream more closely --- .../jni/application/opentyrian/src/animlib.c | 2 +- .../jni/application/opentyrian/src/backgrnd.c | 14 +++++----- .../jni/application/opentyrian/src/destruct.c | 7 ++--- project/jni/application/opentyrian/src/file.c | 2 +- .../application/opentyrian/src/game_menu.c | 11 ++++---- .../jni/application/opentyrian/src/joystick.c | 8 +++--- .../jni/application/opentyrian/src/keyboard.c | 2 +- .../jni/application/opentyrian/src/lds_play.c | 6 ++-- .../jni/application/opentyrian/src/loudness.c | 4 +-- .../jni/application/opentyrian/src/mainint.c | 12 +++----- .../jni/application/opentyrian/src/network.c | 4 +-- .../jni/application/opentyrian/src/nortsong.c | 4 +-- .../jni/application/opentyrian/src/params.c | 8 ++---- .../jni/application/opentyrian/src/pcxload.c | 2 +- .../jni/application/opentyrian/src/picload.c | 2 +- .../jni/application/opentyrian/src/sprite.c | 4 +-- .../jni/application/opentyrian/src/starlib.c | 2 +- .../jni/application/opentyrian/src/tyrian2.c | 27 ++++++++---------- project/jni/application/opentyrian/src/varz.c | 2 +- .../jni/application/opentyrian/src/vga256d.c | 8 +++--- .../application/opentyrian/src/video_scale.c | 28 +++++++++---------- .../opentyrian/src/video_scale_hqNx.c | 12 ++++---- 22 files changed, 80 insertions(+), 91 deletions(-) diff --git a/project/jni/application/opentyrian/src/animlib.c b/project/jni/application/opentyrian/src/animlib.c index 4c83b1744..ba42513f8 100644 --- a/project/jni/application/opentyrian/src/animlib.c +++ b/project/jni/application/opentyrian/src/animlib.c @@ -334,7 +334,7 @@ int JE_playRunSkipDump( Uint8 *incomingBuffer, unsigned int IncomingBufferLength #define ANI_STOP 0x0000 SZ_Init(pBuffer_IN, incomingBuffer, IncomingBufferLength); - SZ_Init(pBuffer_OUT, (Uint8 *)VGAScreen->pixels, VGAScreen->h * VGAScreen->pitch); + SZ_Init(pBuffer_OUT, VGAScreen->pixels, VGAScreen->h * VGAScreen->pitch); /* 320x200 is the only supported format. diff --git a/project/jni/application/opentyrian/src/backgrnd.c b/project/jni/application/opentyrian/src/backgrnd.c index ec1ab7e77..208f2a3ee 100644 --- a/project/jni/application/opentyrian/src/backgrnd.c +++ b/project/jni/application/opentyrian/src/backgrnd.c @@ -44,7 +44,7 @@ JE_byte smoothie_data[9]; /* [1..9] */ void JE_darkenBackground( JE_word neat ) /* wild detail level */ { - Uint8 *s = (Uint8 *)VGAScreen->pixels; /* screen pointer, 8-bit specific */ + Uint8 *s = VGAScreen->pixels; /* screen pointer, 8-bit specific */ int x, y; s += 24; @@ -278,7 +278,7 @@ void JE_filterScreen( JE_shortint col, JE_shortint int_) if (col != -99 && filtrationAvail) { - s = (Uint8 *)VGAScreen->pixels; + s = VGAScreen->pixels; s += 24; col <<= 4; @@ -296,7 +296,7 @@ void JE_filterScreen( JE_shortint col, JE_shortint int_) if (int_ != -99 && explosionTransparent) { - s = (Uint8 *)VGAScreen->pixels; + s = VGAScreen->pixels; s += 24; for (y = 184; y; y--) @@ -417,8 +417,8 @@ void iced_blur_filter( SDL_Surface *dst, SDL_Surface *src ) { assert(src->format->BitsPerPixel == 8 && dst->format->BitsPerPixel == 8); - Uint8 *dst_pixel = (Uint8 *)dst->pixels; - const Uint8 *src_pixel = (Uint8 *)src->pixels; + Uint8 *dst_pixel = dst->pixels; + const Uint8 *src_pixel = src->pixels; for (int y = 0; y < 184; ++y) { @@ -443,8 +443,8 @@ void blur_filter( SDL_Surface *dst, SDL_Surface *src ) { assert(src->format->BitsPerPixel == 8 && dst->format->BitsPerPixel == 8); - Uint8 *dst_pixel = (Uint8 *)dst->pixels; - const Uint8 *src_pixel = (Uint8 *)src->pixels; + Uint8 *dst_pixel = dst->pixels; + const Uint8 *src_pixel = src->pixels; for (int y = 0; y < 184; ++y) { diff --git a/project/jni/application/opentyrian/src/destruct.c b/project/jni/application/opentyrian/src/destruct.c index 7ea2978ee..eb2f71230 100644 --- a/project/jni/application/opentyrian/src/destruct.c +++ b/project/jni/application/opentyrian/src/destruct.c @@ -406,14 +406,13 @@ static struct destruct_explo_s * exploRec; enum de_unit_t string_to_unit_enum(const char * str) { // A config helper function. Probably not useful anywhere else. - //enum de_unit_t i; - int i; + enum de_unit_t i; static const char * unit_names[] = { "UNIT_TANK", "UNIT_NUKE", "UNIT_DIRT", "UNIT_SATELLITE", "UNIT_MAGNET", "UNIT_LASER", "UNIT_JUMPER", "UNIT_HELI" }; for (i = UNIT_FIRST; i < MAX_UNITS; i++) { - if(strcmp(unit_names[i], str) == 0) { return((enum de_unit_t)i); } + if(strcmp(unit_names[i], str) == 0) { return(i); } } return(UNIT_NONE); @@ -599,7 +598,7 @@ void load_destruct_config( void ) { #ifndef ANDROID unsigned int j, k; - int i;//enum de_player_t i; + enum de_player_t i; enum de_unit_t temp; char buffer[40]; const char * key_names[] = { "left", "right", "up", "down", "change", "fire", "cyup", "cydn" }; diff --git a/project/jni/application/opentyrian/src/file.c b/project/jni/application/opentyrian/src/file.c index 7020c048e..cb3fe3f3a 100644 --- a/project/jni/application/opentyrian/src/file.c +++ b/project/jni/application/opentyrian/src/file.c @@ -63,7 +63,7 @@ const char *data_dir( void ) // prepend directory and fopen FILE *dir_fopen( const char *dir, const char *file, const char *mode ) { - char *path = (char *)malloc(strlen(dir) + 1 + strlen(file) + 1); + char *path = malloc(strlen(dir) + 1 + strlen(file) + 1); sprintf(path, "%s/%s", dir, file); FILE *f = fopen(path, mode); diff --git a/project/jni/application/opentyrian/src/game_menu.c b/project/jni/application/opentyrian/src/game_menu.c index 6c6c9ff4e..36619db03 100644 --- a/project/jni/application/opentyrian/src/game_menu.c +++ b/project/jni/application/opentyrian/src/game_menu.c @@ -1940,7 +1940,7 @@ void JE_drawMenuChoices( void ) tempY -= 16; } - str = (char *)malloc(strlen(menuInt[curMenu + 1][x-1])+2); + str = malloc(strlen(menuInt[curMenu + 1][x-1])+2); if (curSel[curMenu] == x) { str[0] = '~'; @@ -2200,7 +2200,7 @@ void JE_scaleBitmap( SDL_Surface *dst_bitmap, const SDL_Surface *src_bitmap, in //Okay, it's time to loop through and add bits of A to a rectangle in B - Uint8 *dst = (Uint8 *)dst_bitmap->pixels; /* 8-bit specific */ + Uint8 *dst = dst_bitmap->pixels; /* 8-bit specific */ const Uint8 *src, *src_w; /* 8-bit specific */ dst += y1 * dst_bitmap->pitch + x1; @@ -2804,7 +2804,7 @@ void JE_menuFunction( JE_byte select ) case 3: case 4: JE_playSampleNum(S_CURSOR); - { + int temp = curSel[curMenu] - 3; do { if (joysticks == 0) @@ -2818,7 +2818,6 @@ void JE_menuFunction( JE_byte select ) inputDevice[temp]++; } } while (inputDevice[temp] == inputDevice[temp == 0 ? 1 : 0]); - } break; case 5: curMenu = 2; @@ -3059,8 +3058,8 @@ void JE_drawShipSpecs( SDL_Surface * screen, SDL_Surface * temp_screen ) * We can't work in place. In fact we'll need to overlay the result * To avoid our temp screen dependence this has been rewritten to * only write one line at a time.*/ - dst = (Uint8 *)screen->pixels; - src = (Uint8 *)temp_screen->pixels; + dst = screen->pixels; + src = temp_screen->pixels; for (int y = 0; y < screen->h; y++) { for (int x = 0; x < screen->pitch; x++) diff --git a/project/jni/application/opentyrian/src/joystick.c b/project/jni/application/opentyrian/src/joystick.c index 37c9f1f9c..bc3671b93 100644 --- a/project/jni/application/opentyrian/src/joystick.c +++ b/project/jni/application/opentyrian/src/joystick.c @@ -272,7 +272,7 @@ void init_joysticks( void ) SDL_JoystickEventState(SDL_IGNORE); joysticks = SDL_NumJoysticks(); - joystick = (Joystick *)malloc(joysticks * sizeof(*joystick)); + joystick = malloc(joysticks * sizeof(*joystick)); for (int j = 0; j < joysticks; j++) { @@ -539,17 +539,17 @@ bool detect_joystick_assignment( int j, Joystick_assignment *assignment ) // get initial joystick state to compare against to see if anything was pressed const int axes = SDL_JoystickNumAxes(joystick[j].handle); - Sint16 *axis = (Sint16 *)malloc(axes * sizeof(*axis)); + Sint16 *axis = malloc(axes * sizeof(*axis)); for (int i = 0; i < axes; i++) axis[i] = SDL_JoystickGetAxis(joystick[j].handle, i); const int buttons = SDL_JoystickNumButtons(joystick[j].handle); - Uint8 *button = (Uint8 *)malloc(buttons * sizeof(*button)); + Uint8 *button = malloc(buttons * sizeof(*button)); for (int i = 0; i < buttons; i++) button[i] = SDL_JoystickGetButton(joystick[j].handle, i); const int hats = SDL_JoystickNumHats(joystick[j].handle); - Uint8 *hat = (Uint8 *)malloc(hats * sizeof(*hat)); + Uint8 *hat = malloc(hats * sizeof(*hat)); for (int i = 0; i < hats; i++) hat[i] = SDL_JoystickGetHat(joystick[j].handle, i); diff --git a/project/jni/application/opentyrian/src/keyboard.c b/project/jni/application/opentyrian/src/keyboard.c index ab8a2670a..13e27d54b 100644 --- a/project/jni/application/opentyrian/src/keyboard.c +++ b/project/jni/application/opentyrian/src/keyboard.c @@ -46,7 +46,7 @@ bool input_grab_enabled = true, #else bool input_grab_enabled = false, #endif - input_grabbed = false; + input_grabbed = false; void flush_events_buffer( void ) diff --git a/project/jni/application/opentyrian/src/lds_play.c b/project/jni/application/opentyrian/src/lds_play.c index 91692e25a..38af271f8 100644 --- a/project/jni/application/opentyrian/src/lds_play.c +++ b/project/jni/application/opentyrian/src/lds_play.c @@ -105,7 +105,7 @@ bool lds_load( FILE *f, unsigned int music_offset, unsigned int music_size ) efread(&numpatch, 2, 1, f); free(soundbank); - soundbank = (SoundBank *)malloc(sizeof(SoundBank) * numpatch); + soundbank = malloc(sizeof(SoundBank) * numpatch); for (unsigned int i = 0; i < numpatch; i++) { @@ -149,7 +149,7 @@ bool lds_load( FILE *f, unsigned int music_offset, unsigned int music_size ) efread(&numposi, 2, 1, f); free(positions); - positions = (Position *)malloc(sizeof(Position) * 9 * numposi); + positions = malloc(sizeof(Position) * 9 * numposi); for (unsigned int i = 0; i < numposi; i++) { @@ -173,7 +173,7 @@ bool lds_load( FILE *f, unsigned int music_offset, unsigned int music_size ) unsigned int remaining = music_size - (ftell(f) - music_offset); free(patterns); - patterns = (Uint16 *)malloc(sizeof(Uint16) * (remaining / 2)); + patterns = malloc(sizeof(Uint16) * (remaining / 2)); for (unsigned int i = 0; i < remaining / 2; i++) efread(&patterns[i], 2, 1, f); diff --git a/project/jni/application/opentyrian/src/loudness.c b/project/jni/application/opentyrian/src/loudness.c index 883a1f63f..bcfcf2bcc 100644 --- a/project/jni/application/opentyrian/src/loudness.c +++ b/project/jni/application/opentyrian/src/loudness.c @@ -200,7 +200,7 @@ void load_music( void ) efread(&song_count, sizeof(song_count), 1, music_file); - song_offset = (Uint32*)malloc((song_count + 1) * sizeof(song_offset)); + song_offset = malloc((song_count + 1) * sizeof(song_offset)); efread(song_offset, 4, song_count, music_file); song_offset[song_count] = ftell_eof(music_file); @@ -271,7 +271,7 @@ void JE_multiSamplePlay(JE_byte *buffer, JE_word size, JE_byte chan, JE_byte vol free(channel_buffer[chan]); channel_len[chan] = size * BYTES_PER_SAMPLE * SAMPLE_SCALING; - channel_buffer[chan] = (OPLSAMPLE*)malloc(channel_len[chan]); + channel_buffer[chan] = malloc(channel_len[chan]); channel_pos[chan] = channel_buffer[chan]; channel_vol[chan] = vol + 1; diff --git a/project/jni/application/opentyrian/src/mainint.c b/project/jni/application/opentyrian/src/mainint.c index 1f9d2670a..197d7a222 100644 --- a/project/jni/application/opentyrian/src/mainint.c +++ b/project/jni/application/opentyrian/src/mainint.c @@ -459,7 +459,6 @@ ulong JE_getCost( JE_byte itemType, JE_word itemNum ) break; case 3: case 4: - { cost = weaponPort[itemNum].cost; const uint port = itemType - 3, @@ -467,7 +466,6 @@ ulong JE_getCost( JE_byte itemType, JE_word itemNum ) downgradeCost = weapon_upgrade_cost(cost, item_power); upgradeCost = weapon_upgrade_cost(cost, item_power + 1); - } break; case 5: cost = shields[itemNum].cost; @@ -591,19 +589,19 @@ void JE_loadScreen( void ) { free(tempstr); } - tempstr = (char *)malloc(7); + tempstr = malloc(7); mal_str = true; strcpy(tempstr, "-----"); /* Unused save slot */ } else { tempstr = saveFiles[x - 1].levelName; - tempstr2 = (char *)malloc(5 + strlen(miscTextB[2-1])); + tempstr2 = malloc(5 + strlen(miscTextB[2-1])); sprintf(tempstr2, "%s %d", miscTextB[2-1], saveFiles[x - 1].episode); JE_textShade(VGAScreen, 250, tempY, tempstr2, 5, (temp2 % 16) - 8, FULL_SHADE); free(tempstr2); } len = strlen(miscTextB[3-1]) + 2 + strlen(tempstr); - tempstr2 = (char *)malloc(len); + tempstr2 = malloc(len); sprintf(tempstr2, "%s %s", miscTextB[3 - 1], tempstr); JE_textShade(VGAScreen, 120, tempY, tempstr2, 5, (temp2 % 16) - 8, FULL_SHADE); free(tempstr2); @@ -717,8 +715,7 @@ JE_longint JE_getValue( JE_byte itemType, JE_word itemNum ) value = ships[itemNum].cost; break; case 3: - case 4: - { + case 4:; const long base_value = weaponPort[itemNum].cost; // if two-player, use first player's front and second player's rear weapon @@ -728,7 +725,6 @@ JE_longint JE_getValue( JE_byte itemType, JE_word itemNum ) value = base_value; for (unsigned int i = 1; i <= item_power; ++i) value += weapon_upgrade_cost(base_value, i); - } break; case 5: value = shields[itemNum].cost; diff --git a/project/jni/application/opentyrian/src/network.c b/project/jni/application/opentyrian/src/network.c index 374377d5a..da72b1d6d 100644 --- a/project/jni/application/opentyrian/src/network.c +++ b/project/jni/application/opentyrian/src/network.c @@ -614,7 +614,7 @@ connect_again: episodes >>= 1; } - network_opponent_name = (char *)malloc(packet_in[0]->len - 12 + 1); + network_opponent_name = malloc(packet_in[0]->len - 12 + 1); strcpy(network_opponent_name, (char *)&packet_in[0]->data[12]); network_update(); @@ -745,7 +745,7 @@ void packet_copy( UDPpacket *dst, UDPpacket *src ) { void *temp = dst->data; memcpy(dst, src, sizeof(*dst)); - dst->data = (Uint8*)temp; + dst->data = temp; memcpy(dst->data, src->data, src->len); } diff --git a/project/jni/application/opentyrian/src/nortsong.c b/project/jni/application/opentyrian/src/nortsong.c index 8a938ad2b..359df6912 100644 --- a/project/jni/application/opentyrian/src/nortsong.c +++ b/project/jni/application/opentyrian/src/nortsong.c @@ -124,7 +124,7 @@ void JE_loadSndFile( const char *effects_sndfile, const char *voices_sndfile ) fseek(fi, sndPos[0][z], SEEK_SET); fxSize[z] = (sndPos[0][z+1] - sndPos[0][z]); /* Store sample sizes */ free(digiFx[z]); - digiFx[z] = (JE_byte*)malloc(fxSize[z]); + digiFx[z] = malloc(fxSize[z]); efread(digiFx[z], 1, fxSize[z], fi); /* JE: Load sample to buffer */ } @@ -151,7 +151,7 @@ void JE_loadSndFile( const char *effects_sndfile, const char *voices_sndfile ) templ = (sndPos[1][y+1] - sndPos[1][y]) - 100; /* SYN: I'm not entirely sure what's going on here. */ if (templ < 1) templ = 1; fxSize[z + y] = templ; /* Store sample sizes */ - digiFx[z + y] = (JE_byte*)malloc(fxSize[z + y]); + digiFx[z + y] = malloc(fxSize[z + y]); efread(digiFx[z + y], 1, fxSize[z + y], fi); /* JE: Load sample to buffer */ } diff --git a/project/jni/application/opentyrian/src/params.c b/project/jni/application/opentyrian/src/params.c index 34e607241..251f48f6e 100644 --- a/project/jni/application/opentyrian/src/params.c +++ b/project/jni/application/opentyrian/src/params.c @@ -120,7 +120,6 @@ void JE_paramCheck( int argc, char *argv[] ) break; case 'n': - { isNetworkGame = true; intptr_t temp = (intptr_t)strchr(option.arg, ':'); @@ -137,19 +136,18 @@ void JE_paramCheck( int argc, char *argv[] ) exit(EXIT_FAILURE); } - network_opponent_host = (char *)malloc(temp + 1); + network_opponent_host = malloc(temp + 1); strnztcpy(network_opponent_host, option.arg, temp); } else { - network_opponent_host = (char *)malloc(strlen(option.arg) + 1); + network_opponent_host = malloc(strlen(option.arg) + 1); strcpy(network_opponent_host, option.arg); } - } break; case 256: // --net-player-name - network_player_name = (char *)malloc(strlen(option.arg) + 1); + network_player_name = malloc(strlen(option.arg) + 1); strcpy(network_player_name, option.arg); break; diff --git a/project/jni/application/opentyrian/src/pcxload.c b/project/jni/application/opentyrian/src/pcxload.c index fc3cdefe8..7d2560839 100644 --- a/project/jni/application/opentyrian/src/pcxload.c +++ b/project/jni/application/opentyrian/src/pcxload.c @@ -24,7 +24,7 @@ void JE_loadPCX( const char *file ) // this is only meant to load tshp2.pcx { - Uint8 *s = (Uint8 *)VGAScreen->pixels; /* 8-bit specific */ + Uint8 *s = VGAScreen->pixels; /* 8-bit specific */ FILE *f = dir_fopen_die(data_dir(), file, "rb"); diff --git a/project/jni/application/opentyrian/src/picload.c b/project/jni/application/opentyrian/src/picload.c index 68241fcce..66243c191 100644 --- a/project/jni/application/opentyrian/src/picload.c +++ b/project/jni/application/opentyrian/src/picload.c @@ -47,7 +47,7 @@ void JE_loadPic(SDL_Surface *screen, JE_byte PCXnumber, JE_boolean storepal ) } unsigned int size = pcxpos[PCXnumber + 1] - pcxpos[PCXnumber]; - Uint8 *buffer = (Uint8 *)malloc(size); + Uint8 *buffer = malloc(size); fseek(f, pcxpos[PCXnumber], SEEK_SET); efread(buffer, sizeof(Uint8), size, f); diff --git a/project/jni/application/opentyrian/src/sprite.c b/project/jni/application/opentyrian/src/sprite.c index 1a0c9f424..08a2f388f 100644 --- a/project/jni/application/opentyrian/src/sprite.c +++ b/project/jni/application/opentyrian/src/sprite.c @@ -59,7 +59,7 @@ void load_sprites( unsigned int table, FILE *f ) efread(&cur_sprite->height, sizeof(Uint16), 1, f); efread(&cur_sprite->size, sizeof(Uint16), 1, f); - cur_sprite->data = (Uint8 *)malloc(cur_sprite->size); + cur_sprite->data = malloc(cur_sprite->size); efread(cur_sprite->data, sizeof(Uint8), cur_sprite->size, f); } @@ -481,7 +481,7 @@ void JE_loadCompShapesB( Sprite2_array *sprite2s, FILE *f ) { free_sprite2s(sprite2s); - sprite2s->data = (Uint8 *)malloc(sizeof(Uint8) * sprite2s->size); + sprite2s->data = malloc(sizeof(Uint8) * sprite2s->size); efread(sprite2s->data, sizeof(Uint8), sprite2s->size, f); } diff --git a/project/jni/application/opentyrian/src/starlib.c b/project/jni/application/opentyrian/src/starlib.c index a6e292198..3ce783610 100644 --- a/project/jni/application/opentyrian/src/starlib.c +++ b/project/jni/application/opentyrian/src/starlib.c @@ -79,7 +79,7 @@ void JE_starlib_main( void ) for(stars = star, i = starlib_MAX_STARS; i > 0; stars++, i--) { /* Make a pointer to the screen... */ - surf = (Uint8 *)VGAScreen->pixels; + surf = VGAScreen->pixels; /* Calculate the offset to where we wish to draw */ off = (stars->lastX)+(stars->lastY)*320; diff --git a/project/jni/application/opentyrian/src/tyrian2.c b/project/jni/application/opentyrian/src/tyrian2.c index 800903970..4021fdd44 100644 --- a/project/jni/application/opentyrian/src/tyrian2.c +++ b/project/jni/application/opentyrian/src/tyrian2.c @@ -82,9 +82,9 @@ void JE_starShowVGA( void ) if (!playerEndLevel && !skipStarShowVGA) { - s = (Uint8 *)VGAScreenSeg->pixels; + s = VGAScreenSeg->pixels; - src = (JE_byte *)game_screen->pixels; + src = game_screen->pixels; src += 24; if (smoothScroll != 0 /*&& thisPlayerNum != 2*/) @@ -380,10 +380,8 @@ enemy_still_exists: } break; case 251:; /* Suck-O-Magnet */ - { const int attractivity = 4 - (abs(player[0].x - tempX) + abs(player[0].y - tempY)) / 100; player[0].x_velocity += (player[0].x > tempX) ? -attractivity : attractivity; - } break; case 253: /* Left ShortRange Magnet */ if (abs(player[0].x + 25 - 14 - tempX) < 24 && abs(player[0].y - tempY) < 28) @@ -2946,8 +2944,8 @@ new_game: { if (!newkey) { - vga = (Uint8 *)VGAScreen->pixels; - vga2 = (Uint8 *)VGAScreen2->pixels; + vga = VGAScreen->pixels; + vga2 = VGAScreen2->pixels; pic = pic_buffer + (199 - z) * 320; setjasondelay(1); /* attempting to emulate JE_waitRetrace();*/ @@ -2997,8 +2995,8 @@ new_game: { if (!newkey) { - vga = (Uint8 *)VGAScreen->pixels; - vga2 = (Uint8 *)VGAScreen2->pixels; + vga = VGAScreen->pixels; + vga2 = VGAScreen2->pixels; pic = pic_buffer; setjasondelay(1); /* attempting to emulate JE_waitRetrace();*/ @@ -3049,8 +3047,8 @@ new_game: { if (!newkey) { - vga = (Uint8 *)VGAScreen->pixels; - vga2 = (Uint8 *)VGAScreen2->pixels; + vga = VGAScreen->pixels; + vga2 = VGAScreen2->pixels; pic = pic_buffer; setjasondelay(1); /* attempting to emulate JE_waitRetrace();*/ @@ -5091,8 +5089,7 @@ void JE_eventSystem( void ) } break; - case 75: - { + case 75:; bool temp_no_clue = false; // TODO: figure out what this is doing for (temp = 0; temp < 100; temp++) @@ -5125,7 +5122,7 @@ void JE_eventSystem( void ) eventLoc += eventRec[eventLoc-1].eventdat4 - 1; } } - } + break; case 76: @@ -5198,8 +5195,8 @@ void JE_whoa( void ) * way to get vgascreen as one of the temp buffers), but it's only called * once so don't worry about it. */ - TempScreen1 = (Uint8 *)game_screen->pixels; - TempScreen2 = (Uint8 *)VGAScreen2->pixels; + TempScreen1 = game_screen->pixels; + TempScreen2 = VGAScreen2->pixels; screenSize = VGAScreenSeg->h * VGAScreenSeg->pitch; topBorder = VGAScreenSeg->pitch * 4; /* Seems an arbitrary number of lines */ diff --git a/project/jni/application/opentyrian/src/varz.c b/project/jni/application/opentyrian/src/varz.c index 44bfd1be8..dc6d4ca2a 100644 --- a/project/jni/application/opentyrian/src/varz.c +++ b/project/jni/application/opentyrian/src/varz.c @@ -402,7 +402,7 @@ JE_word JE_SGr( JE_word ship, Sprite2_array **ptr ) JE_word tempW = extraShips[(ship - 1) * 15]; if (tempW > 7) - *ptr = (Sprite2_array*)extraShapes; + *ptr = extraShapes; return GR[tempW-1]; } diff --git a/project/jni/application/opentyrian/src/vga256d.c b/project/jni/application/opentyrian/src/vga256d.c index 9918ebf05..a145bb4dd 100644 --- a/project/jni/application/opentyrian/src/vga256d.c +++ b/project/jni/application/opentyrian/src/vga256d.c @@ -35,7 +35,7 @@ void JE_pix( SDL_Surface *surface, int x, int y, JE_byte c ) /* Bad things happen if we don't clip */ if (x < surface->pitch && y < surface->h) { - Uint8 *vga = (Uint8 *)surface->pixels; + Uint8 *vga = surface->pixels; vga[y * surface->pitch + x] = c; } } @@ -55,7 +55,7 @@ void JE_rectangle( SDL_Surface *surface, int a, int b, int c, int d, int e ) /* if (a < surface->pitch && b < surface->h && c < surface->pitch && d < surface->h) { - Uint8 *vga = (Uint8 *)surface->pixels; + Uint8 *vga = surface->pixels; int i; /* Top line */ @@ -91,7 +91,7 @@ void JE_barShade( SDL_Surface *surface, int a, int b, int c, int d ) /* x1, y1, if (a < surface->pitch && b < surface->h && c < surface->pitch && d < surface->h) { - Uint8 *vga = (Uint8 *)surface->pixels; + Uint8 *vga = surface->pixels; int i, j, width; width = c - a + 1; @@ -113,7 +113,7 @@ void JE_barBright( SDL_Surface *surface, int a, int b, int c, int d ) /* x1, y1, if (a < surface->pitch && b < surface->h && c < surface->pitch && d < surface->h) { - Uint8 *vga = (Uint8 *)surface->pixels; + Uint8 *vga = surface->pixels; int i, j, width; width = c-a+1; diff --git a/project/jni/application/opentyrian/src/video_scale.c b/project/jni/application/opentyrian/src/video_scale.c index ca1c0fbf2..7ab5879eb 100644 --- a/project/jni/application/opentyrian/src/video_scale.c +++ b/project/jni/application/opentyrian/src/video_scale.c @@ -81,8 +81,8 @@ void set_scaler_by_name( const char *name ) void no_scale( SDL_Surface *src_surface, SDL_Surface *dst_surface ) { - Uint8 *src = (Uint8 *)src_surface->pixels, - *dst = (Uint8 *)dst_surface->pixels; + Uint8 *src = src_surface->pixels, + *dst = dst_surface->pixels; #ifdef VGA_CENTERED size_t blank = (dst_surface->h - src_surface->h) / 2 * dst_surface->pitch; @@ -101,8 +101,8 @@ void no_scale( SDL_Surface *src_surface, SDL_Surface *dst_surface ) void nn_32( SDL_Surface *src_surface, SDL_Surface *dst_surface ) { - Uint8 *src = (Uint8 *)src_surface->pixels, *src_temp, - *dst = (Uint8 *)dst_surface->pixels, *dst_temp; + Uint8 *src = src_surface->pixels, *src_temp, + *dst = dst_surface->pixels, *dst_temp; int src_pitch = src_surface->pitch, dst_pitch = dst_surface->pitch; const int dst_Bpp = 4; // dst_surface->format->BytesPerPixel @@ -150,8 +150,8 @@ void nn_32( SDL_Surface *src_surface, SDL_Surface *dst_surface ) void nn_16( SDL_Surface *src_surface, SDL_Surface *dst_surface ) { - Uint8 *src = (Uint8 *)src_surface->pixels, *src_temp, - *dst = (Uint8 *)dst_surface->pixels, *dst_temp; + Uint8 *src = src_surface->pixels, *src_temp, + *dst = dst_surface->pixels, *dst_temp; int src_pitch = src_surface->pitch, dst_pitch = dst_surface->pitch; const int dst_Bpp = 2; // dst_surface->format->BytesPerPixel @@ -200,8 +200,8 @@ void nn_16( SDL_Surface *src_surface, SDL_Surface *dst_surface ) void scale2x_32( SDL_Surface *src_surface, SDL_Surface *dst_surface ) { - Uint8 *src = (Uint8 *)src_surface->pixels, *src_temp, - *dst = (Uint8 *)dst_surface->pixels, *dst_temp; + Uint8 *src = src_surface->pixels, *src_temp, + *dst = dst_surface->pixels, *dst_temp; int src_pitch = src_surface->pitch, dst_pitch = dst_surface->pitch; const int dst_Bpp = 4; // dst_surface->format->BytesPerPixel @@ -253,8 +253,8 @@ void scale2x_32( SDL_Surface *src_surface, SDL_Surface *dst_surface ) void scale2x_16( SDL_Surface *src_surface, SDL_Surface *dst_surface ) { - Uint8 *src = (Uint8 *)src_surface->pixels, *src_temp, - *dst = (Uint8 *)dst_surface->pixels, *dst_temp; + Uint8 *src = src_surface->pixels, *src_temp, + *dst = dst_surface->pixels, *dst_temp; int src_pitch = src_surface->pitch, dst_pitch = dst_surface->pitch; const int dst_Bpp = 2; // dst_surface->format->BytesPerPixel @@ -307,8 +307,8 @@ void scale2x_16( SDL_Surface *src_surface, SDL_Surface *dst_surface ) void scale3x_32( SDL_Surface *src_surface, SDL_Surface *dst_surface ) { - Uint8 *src = (Uint8 *)src_surface->pixels, *src_temp, - *dst = (Uint8 *)dst_surface->pixels, *dst_temp; + Uint8 *src = src_surface->pixels, *src_temp, + *dst = dst_surface->pixels, *dst_temp; int src_pitch = src_surface->pitch, dst_pitch = dst_surface->pitch; const int dst_Bpp = 4; // dst_surface->format->BytesPerPixel @@ -374,8 +374,8 @@ void scale3x_32( SDL_Surface *src_surface, SDL_Surface *dst_surface ) void scale3x_16( SDL_Surface *src_surface, SDL_Surface *dst_surface ) { - Uint8 *src = (Uint8 *)src_surface->pixels, *src_temp, - *dst = (Uint8 *)dst_surface->pixels, *dst_temp; + Uint8 *src = src_surface->pixels, *src_temp, + *dst = dst_surface->pixels, *dst_temp; int src_pitch = src_surface->pitch, dst_pitch = dst_surface->pitch; const int dst_Bpp = 2; // dst_surface->format->BytesPerPixel diff --git a/project/jni/application/opentyrian/src/video_scale_hqNx.c b/project/jni/application/opentyrian/src/video_scale_hqNx.c index e926a382f..1baab8ed7 100644 --- a/project/jni/application/opentyrian/src/video_scale_hqNx.c +++ b/project/jni/application/opentyrian/src/video_scale_hqNx.c @@ -179,8 +179,8 @@ inline bool diff(unsigned int w1, unsigned int w2) void hq2x_32( SDL_Surface *src_surface, SDL_Surface *dst_surface ) { - Uint8 *src = (Uint8 *)src_surface->pixels, *src_temp, - *dst = (Uint8 *)dst_surface->pixels, *dst_temp; + Uint8 *src = src_surface->pixels, *src_temp, + *dst = dst_surface->pixels, *dst_temp; int src_pitch = src_surface->pitch, dst_pitch = dst_surface->pitch; const int dst_Bpp = 4; // dst_surface->format->BytesPerPixel @@ -2972,8 +2972,8 @@ void hq2x_32( SDL_Surface *src_surface, SDL_Surface *dst_surface ) void hq3x_32( SDL_Surface *src_surface, SDL_Surface *dst_surface ) { - Uint8 *src = (Uint8 *)src_surface->pixels, *src_temp, - *dst = (Uint8 *)dst_surface->pixels, *dst_temp; + Uint8 *src = src_surface->pixels, *src_temp, + *dst = dst_surface->pixels, *dst_temp; int src_pitch = src_surface->pitch, dst_pitch = dst_surface->pitch; const int dst_Bpp = 4; // dst_surface->format->BytesPerPixel @@ -6825,8 +6825,8 @@ void hq3x_32( SDL_Surface *src_surface, SDL_Surface *dst_surface ) void hq4x_32( SDL_Surface *src_surface, SDL_Surface *dst_surface ) { - Uint8 *src = (Uint8 *)src_surface->pixels, *src_temp, - *dst = (Uint8 *)dst_surface->pixels, *dst_temp; + Uint8 *src = src_surface->pixels, *src_temp, + *dst = dst_surface->pixels, *dst_temp; int src_pitch = src_surface->pitch, dst_pitch = dst_surface->pitch; const int dst_Bpp = 4; // dst_surface->format->BytesPerPixel