[Scummvm-git-logs] scummvm master -> b1deb8afbae47b7988f3f0369292a059837a2197

bluegr bluegr at gmail.com
Mon Sep 6 22:33:07 UTC 2021


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
b1deb8afba GUI: added float var support to the debugger


Commit: b1deb8afbae47b7988f3f0369292a059837a2197
    https://github.com/scummvm/scummvm/commit/b1deb8afbae47b7988f3f0369292a059837a2197
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-09-07T01:33:04+03:00

Commit Message:
GUI: added float var support to the debugger

Changed paths:
    gui/debugger.cpp
    gui/debugger.h


diff --git a/gui/debugger.cpp b/gui/debugger.cpp
index da8ed5d2af..a71d449827 100644
--- a/gui/debugger.cpp
+++ b/gui/debugger.cpp
@@ -325,6 +325,10 @@ bool Debugger::parseCommand(const char *inputOrig) {
 					*(int32 *)_vars[i].variable = atoi(param[1]);
 					debugPrintf("(int)%s = %d\n", param[0], *(int32 *)_vars[i].variable);
 					break;
+				case DVAR_FLOAT:
+					*(float *)_vars[i].variable = (float)atof(param[1]);
+					debugPrintf("(float)%s = %f\n", param[0], *(float *)_vars[i].variable);
+					break;
 				case DVAR_BOOL:
 					if (Common::parseBool(param[1], *(bool *)_vars[i].variable))
 						debugPrintf("(bool)%s = %s\n", param[0], *(bool *)_vars[i].variable ? "true" : "false");
@@ -362,6 +366,9 @@ bool Debugger::parseCommand(const char *inputOrig) {
 				case DVAR_INT:
 					debugPrintf("(int)%s = %d\n", param[0], *(const int32 *)_vars[i].variable);
 					break;
+				case DVAR_FLOAT:
+					debugPrintf("(float)%s = %f\n", param[0], *(const float *)_vars[i].variable);
+					break;
 				case DVAR_BOOL:
 					debugPrintf("(bool)%s = %s\n", param[0], *(const bool *)_vars[i].variable ? "true" : "false");
 					break;
diff --git a/gui/debugger.h b/gui/debugger.h
index dd69a89492..0ccab88fe4 100644
--- a/gui/debugger.h
+++ b/gui/debugger.h
@@ -92,6 +92,7 @@ protected:
 	enum VarType {
 		DVAR_BYTE,
 		DVAR_INT,
+		DVAR_FLOAT,
 		DVAR_BOOL,
 		DVAR_INTARRAY,
 		DVAR_STRING
@@ -124,6 +125,10 @@ protected:
 		registerVarImpl(varname, variable, DVAR_INT, 0);
 	}
 
+	void registerVar(const Common::String &varname, float *variable) {
+		registerVarImpl(varname, variable, DVAR_FLOAT, 0);
+	}
+
 	void registerVar(const Common::String &varname, bool *variable) {
 		registerVarImpl(varname, variable, DVAR_BOOL, 0);
 	}




More information about the Scummvm-git-logs mailing list