diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 076f9e50a..bff1a36e3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1244,11 +1244,14 @@ endif() if( MSVC ) option( ZDOOM_GENERATE_MAPFILE "Generate .map file for debugging." OFF ) + set( LINKERSTUFF "/MANIFEST:NO /DELAYLOAD:\"fmodex${X64}.dll\"" ) if( ZDOOM_GENERATE_MAPFILE ) - set_target_properties(zdoom PROPERTIES LINK_FLAGS "/MANIFEST:NO /DELAYLOAD:\"fmodex${X64}.dll\" /DELAYLOAD:\"libmpg123-0.dll\" /DELAYLOAD:\"libsndfile-1.dll\" /MAP") - else() - set_target_properties(zdoom PROPERTIES LINK_FLAGS "/MANIFEST:NO /DELAYLOAD:\"fmodex${X64}.dll\" /DELAYLOAD:\"libmpg123-0.dll\" /DELAYLOAD:\"libsndfile-1.dll\"") + set( LINKERSTUFF ${LINKERSTUFF} "/MAP" ) endif() + if( NOT NO_OPENAL ) + set( LINKERSTUFF ${LINKERSTUFF} "/DELAYLOAD:\"libmpg123-0.dll\" /DELAYLOAD:\"libsndfile-1.dll\"" ) + endif() + set_target_properties(zdoom PROPERTIES LINK_FLAGS ${LINKERSTUFF}) add_custom_command(TARGET zdoom POST_BUILD COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\win32\\zdoom.exe.manifest\" -outputresource:\"$\"\;\#1 diff --git a/src/menu/joystickmenu.cpp b/src/menu/joystickmenu.cpp index 676bc1767..90c2b0c4e 100644 --- a/src/menu/joystickmenu.cpp +++ b/src/menu/joystickmenu.cpp @@ -225,7 +225,7 @@ public: void SetSelection(int Selection) { - float f = fabs(SELECTED_JOYSTICK->GetAxisScale(mAxis)); + float f = fabsf(SELECTED_JOYSTICK->GetAxisScale(mAxis)); if (Selection) f*=-1; SELECTED_JOYSTICK->SetAxisScale(mAxis, f); } diff --git a/src/p_user.cpp b/src/p_user.cpp index 9f5a37293..0427bd64f 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2305,7 +2305,7 @@ void P_PlayerThink (player_t *player) { // A negative scale is used to prevent G_AddViewAngle/G_AddViewPitch // from scaling with the FOV scale. - desired *= fabs(player->ReadyWeapon->FOVScale); + desired *= fabsf(player->ReadyWeapon->FOVScale); } if (player->FOV != desired) { diff --git a/src/sound/fmodsound.cpp b/src/sound/fmodsound.cpp index e7a617f5a..1b9dcfda9 100644 --- a/src/sound/fmodsound.cpp +++ b/src/sound/fmodsound.cpp @@ -2311,9 +2311,9 @@ void FMODSoundRenderer::UpdateListener(SoundListener *listener) pos.z = listener->position.Z; float angle = listener->angle; - forward.x = cos(angle); + forward.x = cosf(angle); forward.y = 0; - forward.z = sin(angle); + forward.z = sinf(angle); up.x = 0; up.y = 1; diff --git a/src/sound/music_win_mididevice.cpp b/src/sound/music_win_mididevice.cpp index 151728662..38fa18c59 100644 --- a/src/sound/music_win_mididevice.cpp +++ b/src/sound/music_win_mididevice.cpp @@ -175,7 +175,7 @@ int WinMIDIDevice::GetTechnology() const int WinMIDIDevice::SetTempo(int tempo) { - MIDIPROPTEMPO data = { sizeof(MIDIPROPTEMPO), tempo }; + MIDIPROPTEMPO data = { sizeof(MIDIPROPTEMPO), (DWORD)tempo }; return midiStreamProperty(MidiOut, (LPBYTE)&data, MIDIPROP_SET | MIDIPROP_TEMPO); } @@ -187,7 +187,7 @@ int WinMIDIDevice::SetTempo(int tempo) int WinMIDIDevice::SetTimeDiv(int timediv) { - MIDIPROPTIMEDIV data = { sizeof(MIDIPROPTIMEDIV), timediv }; + MIDIPROPTIMEDIV data = { sizeof(MIDIPROPTIMEDIV), (DWORD)timediv }; return midiStreamProperty(MidiOut, (LPBYTE)&data, MIDIPROP_SET | MIDIPROP_TIMEDIV); } diff --git a/src/tflags.h b/src/tflags.h index 48866c828..81e54e3bb 100644 --- a/src/tflags.h +++ b/src/tflags.h @@ -42,7 +42,7 @@ * T is the enum type of individual flags, * TT is the underlying integer type used (defaults to DWORD) */ -template +template class TFlags { struct ZeroDummy {}; diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index a3e4ac6fa..70a6d96ec 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -5553,7 +5553,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_DropItem) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpeed) { PARAM_ACTION_PROLOGUE; - PARAM_INT(speed); + PARAM_FIXED(speed); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } AActor *ref = COPY_AAPTR(self, ptr); @@ -5573,7 +5573,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetSpeed) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetFloatSpeed) { PARAM_ACTION_PROLOGUE; - PARAM_INT(speed); + PARAM_FIXED(speed); PARAM_INT_OPT(ptr) { ptr = AAPTR_DEFAULT; } AActor *ref = COPY_AAPTR(self, ptr); diff --git a/src/thingdef/thingdef_expression.cpp b/src/thingdef/thingdef_expression.cpp index 19c02837c..53da5d42c 100644 --- a/src/thingdef/thingdef_expression.cpp +++ b/src/thingdef/thingdef_expression.cpp @@ -143,11 +143,13 @@ FxExpression *FxExpression::Resolve(FCompileContext &ctx) FxExpression *FxExpression::ResolveAsBoolean(FCompileContext &ctx) { + ///FIXME: Use an actual boolean type FxExpression *x = Resolve(ctx); if (x != NULL) { switch (x->ValueType.Type) { + case VAL_Int: case VAL_Sound: case VAL_Color: case VAL_Name: @@ -155,6 +157,9 @@ FxExpression *FxExpression::ResolveAsBoolean(FCompileContext &ctx) break; default: + ScriptPosition.Message(MSG_ERROR, "Not an integral type"); + delete this; + return NULL; break; } } @@ -2140,7 +2145,6 @@ FxExpression *FxRandomPick::Resolve(FCompileContext &ctx) ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build) { -#pragma message("FxRandomPick::Emit: Floating point part needs reviewing!") unsigned i; assert(choices.Size() > 0); @@ -2166,6 +2170,14 @@ ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build) // automatically pick it as the destination register for each case. resultreg.Free(build); + // For floating point results, we need to get a new register, since we can't + // reuse the integer one used to store the random result. + if (ValueType == VAL_Float) + { + resultreg = ExpEmit(build, REGT_FLOAT); + resultreg.Free(build); + } + // Allocate space for the jump table. size_t jumptable = build->Emit(OP_JMP, 0); for (i = 1; i < choices.Size(); ++i) @@ -2188,8 +2200,7 @@ ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build) else { double val = static_cast(choices[i])->GetValue().GetFloat(); - build->Emit(OP_PARAM, 0, REGT_FLOAT | REGT_KONST, build->GetConstantFloat(val)); - build->ParamChange(-1); // all params should use the same register here. + build->Emit(OP_LKF, resultreg.RegNum, build->GetConstantFloat(val)); } } else @@ -2200,14 +2211,7 @@ ExpEmit FxRandomPick::Emit(VMFunctionBuilder *build) // was expected. Copy it to the one we wanted. resultreg.Reuse(build); // This is really just for the assert in Reuse() - if (ValueType == VAL_Int) - { - build->Emit(OP_MOVE, resultreg.RegNum, casereg.RegNum, 0); - } - else - { - build->Emit(OP_MOVEF, resultreg.RegNum, casereg.RegNum, 0); - } + build->Emit(ValueType == VAL_Int ? OP_MOVE : OP_MOVEF, resultreg.RegNum, casereg.RegNum, 0); resultreg.Free(build); } // Free this register so the remaining cases can use it. diff --git a/src/timidity/mix.cpp b/src/timidity/mix.cpp index beda91e16..05a3eddd4 100644 --- a/src/timidity/mix.cpp +++ b/src/timidity/mix.cpp @@ -190,7 +190,7 @@ void SF2Envelope::Release(Voice *v) if (stage == SF2_ATTACK) { // The attack stage does not use an attenuation in cB like all the rest. - volume = log10(volume) * -200; + volume = float(log10(volume) * -200); } stage = SF2_RELEASE; bUpdating = true; diff --git a/src/timidity/playmidi.cpp b/src/timidity/playmidi.cpp index 7d8294384..8acdd3487 100644 --- a/src/timidity/playmidi.cpp +++ b/src/timidity/playmidi.cpp @@ -94,7 +94,7 @@ void Renderer::recompute_freq(int v) if (ch->pitchfactor == 0) { /* Damn. Somebody bent the pitch. */ - ch->pitchfactor = pow(2.f, ((abs(pb) * ch->pitchsens) / (8191.f * 1200.f))); + ch->pitchfactor = float(pow(2.f, ((abs(pb) * ch->pitchsens) / (8191.f * 1200.f)))); } if (pb < 0) { diff --git a/src/win32/fb_d3d9.cpp b/src/win32/fb_d3d9.cpp index 4e3a14c18..d0ed84442 100644 --- a/src/win32/fb_d3d9.cpp +++ b/src/win32/fb_d3d9.cpp @@ -1487,10 +1487,10 @@ void D3DFB::DoOffByOneCheck () float texbot = 1.f / float(FBHeight); FBVERTEX verts[4] = { - { -0.5f, -0.5f, 0.5f, 1.f, 0, ~0, 0.f, 0.f }, - { 255.5f, -0.5f, 0.5f, 1.f, 0, ~0, texright, 0.f }, - { 255.5f, 0.5f, 0.5f, 1.f, 0, ~0, texright, texbot }, - { -0.5f, 0.5f, 0.5f, 1.f, 0, ~0, 0.f, texbot } + { -0.5f, -0.5f, 0.5f, 1.f, D3DCOLOR_RGBA(0,0,0,0), D3DCOLOR_RGBA(255,255,255,255), 0.f, 0.f }, + { 255.5f, -0.5f, 0.5f, 1.f, D3DCOLOR_RGBA(0,0,0,0), D3DCOLOR_RGBA(255,255,255,255), texright, 0.f }, + { 255.5f, 0.5f, 0.5f, 1.f, D3DCOLOR_RGBA(0,0,0,0), D3DCOLOR_RGBA(255,255,255,255), texright, texbot }, + { -0.5f, 0.5f, 0.5f, 1.f, D3DCOLOR_RGBA(0,0,0,0), D3DCOLOR_RGBA(255,255,255,255), 0.f, texbot } }; int i, c; diff --git a/src/win32/i_system.cpp b/src/win32/i_system.cpp index 133337af5..a5c2eb84e 100644 --- a/src/win32/i_system.cpp +++ b/src/win32/i_system.cpp @@ -1423,11 +1423,11 @@ static HCURSOR CreateBitmapCursor(int xhot, int yhot, HBITMAP and_mask, HBITMAP { ICONINFO iconinfo = { - FALSE, // fIcon - xhot, // xHotspot - yhot, // yHotspot - and_mask, // hbmMask - color_mask // hbmColor + FALSE, // fIcon + (DWORD)xhot, // xHotspot + (DWORD)yhot, // yHotspot + and_mask, // hbmMask + color_mask // hbmColor }; HCURSOR cursor = CreateIconIndirect(&iconinfo);