diff --git a/Q3E/src/main/jni/doom3bfg/doomclassic/doom/f_finale.cpp b/Q3E/src/main/jni/doom3bfg/doomclassic/doom/f_finale.cpp index 79dafc9a7..d68b6f4f6 100644 --- a/Q3E/src/main/jni/doom3bfg/doomclassic/doom/f_finale.cpp +++ b/Q3E/src/main/jni/doom3bfg/doomclassic/doom/f_finale.cpp @@ -719,55 +719,55 @@ F_DrawPatchCol( int x, patch_t* patch, int col ) { // // F_BunnyScroll // -void F_BunnyScroll (void) +void F_BunnyScroll(void) { - int scrolled; - int x; - patch_t* p1; - patch_t* p2; - char name[10]; - int stage; - - p1 = (patch_t*)W_CacheLumpName ("PFUB2", PU_LEVEL_SHARED); - p2 = (patch_t*)W_CacheLumpName ("PFUB1", PU_LEVEL_SHARED); + int scrolled; + int x; + patch_t* p1; + patch_t* p2; + char name[14]; // Увеличен размер массива + int stage; - V_MarkRect (0, 0, SCREENWIDTH, SCREENHEIGHT); - - scrolled = 320 - (::g->finalecount-230)/2; + p1 = (patch_t*)W_CacheLumpName("PFUB2", PU_LEVEL_SHARED); + p2 = (patch_t*)W_CacheLumpName("PFUB1", PU_LEVEL_SHARED); + + V_MarkRect(0, 0, SCREENWIDTH, SCREENHEIGHT); + + scrolled = 320 - (::g->finalecount - 230) / 2; if (scrolled > 320) - scrolled = 320; + scrolled = 320; if (scrolled < 0) - scrolled = 0; - - for ( x=0 ; xfinalecount < 1130) - return; + return; if (::g->finalecount < 1180) { - V_DrawPatch ((ORIGINAL_WIDTH-13*8)/2, - (ORIGINAL_HEIGHT-8*8)/2,0, (patch_t*)W_CacheLumpName ("END0",PU_CACHE_SHARED)); - ::g->laststage = 0; - return; + V_DrawPatch((ORIGINAL_WIDTH - 13 * 8) / 2, + (ORIGINAL_HEIGHT - 8 * 8) / 2, 0, (patch_t*)W_CacheLumpName("END0", PU_CACHE_SHARED)); + ::g->laststage = 0; + return; } - - stage = (::g->finalecount-1180) / 5; + + stage = (::g->finalecount - 1180) / 5; if (stage > 6) - stage = 6; + stage = 6; if (stage > ::g->laststage) { - S_StartSound (NULL, sfx_pistol); - ::g->laststage = stage; + S_StartSound(NULL, sfx_pistol); + ::g->laststage = stage; } - - sprintf (name,"END%i",stage); - V_DrawPatch ((ORIGINAL_WIDTH-13*8)/2, (ORIGINAL_HEIGHT-8*8)/2,0, (patch_t*)W_CacheLumpName (name,PU_CACHE_SHARED)); + + snprintf(name, sizeof(name), "END%i", stage); // Используйте snprintf + V_DrawPatch((ORIGINAL_WIDTH - 13 * 8) / 2, (ORIGINAL_HEIGHT - 8 * 8) / 2, 0, (patch_t*)W_CacheLumpName(name, PU_CACHE_SHARED)); } diff --git a/Q3E/src/main/jni/doom3bfg/doomclassic/doom/hu_stuff.cpp b/Q3E/src/main/jni/doom3bfg/doomclassic/doom/hu_stuff.cpp index b379ef544..0b1f03178 100644 --- a/Q3E/src/main/jni/doom3bfg/doomclassic/doom/hu_stuff.cpp +++ b/Q3E/src/main/jni/doom3bfg/doomclassic/doom/hu_stuff.cpp @@ -316,21 +316,34 @@ char ForeignTranslation(unsigned char ch) void HU_Init(void) { - - int i; - int j; - char buffer[9]; - - shiftxform = english_shiftxform; - - // load the heads-up font - j = HU_FONTSTART; - for (i=0;ihu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC_SHARED); - } - + int i; + int j; + char buffer[17]; // Увеличен размер массива до 17 + + shiftxform = english_shiftxform; + + // load the heads-up font + j = HU_FONTSTART; + for (i = 0; i < HU_FONTSIZE; i++) + { + if (j < 10000) // Проверка, чтобы избежать переполнения + { + snprintf(buffer, sizeof(buffer), "STCFN%04d", j++); // Используйте %04d для дополнения нулями + if (g != NULL) // Проверка на NULL + { + g->hu_font[i] = (patch_t *) W_CacheLumpName(buffer, PU_STATIC_SHARED); + } + else + { + // Обработка ошибки: g не инициализирован + } + } + else + { + // Обработка ошибки: j превышает допустимое значение + break; // Выход из цикла, если j слишком велик + } + } } void HU_Stop(void) diff --git a/cmake_linux_build_doom3bfg.sh b/cmake_linux_build_doom3bfg.sh index 545962cc0..c86eba827 100755 --- a/cmake_linux_build_doom3bfg.sh +++ b/cmake_linux_build_doom3bfg.sh @@ -5,7 +5,7 @@ # Setup build type: Release | Debug -BUILD_TYPE=Release +BUILD_TYPE=ReleaseWithDebInfo TARGET_PATH="`pwd`/Q3E/src/main/jni/doom3bfg/neo"; WORK_DIR=build